Initial Gitea Commit
This commit is contained in:
75
main.cpp
Normal file
75
main.cpp
Normal file
@@ -0,0 +1,75 @@
|
||||
|
||||
#include "Logger.h"
|
||||
#include "VulkanInstanceManager.h"
|
||||
#include "GlfwWindowManager.h"
|
||||
|
||||
struct AppConfig
|
||||
{
|
||||
std::string Title = "Learning Vulkan";
|
||||
uint32_t Width = 800;
|
||||
uint32_t Height = 600;
|
||||
bool bResizable = false;
|
||||
bool bFullscreen = false;
|
||||
bool bValidationEnabled = true;
|
||||
bool bVerboseLogging = false;
|
||||
};
|
||||
|
||||
class HelloTriangleApplication
|
||||
{
|
||||
public:
|
||||
void Run()
|
||||
{
|
||||
InitGlfw();
|
||||
InitVulkan();
|
||||
MainLoop();
|
||||
Cleanup();
|
||||
}
|
||||
|
||||
private:
|
||||
VulkanInstanceManager VkInstanceManager;
|
||||
GlfwWindowManager GlfwWindowManager;
|
||||
AppConfig Settings = {};
|
||||
|
||||
void InitVulkan()
|
||||
{
|
||||
FVulkanConfig Config = { Settings.bValidationEnabled, Settings.bVerboseLogging };
|
||||
VkInstanceManager.Initialize(Config);
|
||||
}
|
||||
|
||||
void InitGlfw()
|
||||
{
|
||||
FWindowConfig Config = { Settings.Title, Settings.Width, Settings.Height, Settings.bResizable, Settings.bFullscreen };
|
||||
GlfwWindowManager.Initialize(Config);
|
||||
}
|
||||
|
||||
void MainLoop()
|
||||
{
|
||||
while (!GlfwWindowManager.ShouldClose())
|
||||
{
|
||||
GlfwWindowManager.PollEvents();
|
||||
}
|
||||
}
|
||||
|
||||
void Cleanup()
|
||||
{
|
||||
// VkInstanceManager.Cleanup();
|
||||
// GlfwWindowManager.Cleanup();
|
||||
}
|
||||
};
|
||||
|
||||
int main()
|
||||
{
|
||||
HelloTriangleApplication app;
|
||||
|
||||
try
|
||||
{
|
||||
app.Run();
|
||||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
Log::Error(e.what());
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
Reference in New Issue
Block a user