Вынес движок рендера в отдельный модуль ввиде статической библиотеки

This commit is contained in:
Jiga228
2025-10-25 20:33:21 +07:00
parent e52df7ef12
commit 29f700d3a5
17 changed files with 217 additions and 118 deletions
+17
View File
@@ -0,0 +1,17 @@
find_package(Vulkan REQUIRED)
file(GLOB_RECURSE SRC "*.cpp" "*.c" "*.hpp" "*.h")
add_library(RenderEngineSDK ${SRC})
target_include_directories(RenderEngineSDK PUBLIC
${PROJECT_SOURCE_DIR}/glfw/Include
${PROJECT_SOURCE_DIR}/Delegate
${PROJECT_SOURCE_DIR}/Core
)
target_link_libraries(RenderEngineSDK PUBLIC
FastRTTI
glfw
Vulkan::Vulkan
)
+24
View File
@@ -0,0 +1,24 @@
#include "RenderEngineBase.hpp"
#include <stdexcept>
RenderEngineBase::RenderEngineBase()
{
if (!glfwInit())
throw std::runtime_error("Fail init glfw");
glfwWindowHint(GLFW_RESIZABLE, GLFW_FALSE);
glfwWindowHint(GLFW_CLIENT_API, GLFW_NO_API);
window_ = glfwCreateWindow(800, 600, "UwU Engine", nullptr, nullptr);
if (window_ == nullptr)
throw std::runtime_error("Fail create window");
}
RenderEngineBase::~RenderEngineBase()
{
if (window_ != nullptr)
glfwDestroyWindow(window_);
glfwTerminate();
}
+25
View File
@@ -0,0 +1,25 @@
#pragma once
#define GLFW_INCLUDE_VULKAN
#include <GLFW/glfw3.h>
class CoreInstance;
class RenderEngineBase
{
GLFWwindow* window_ = nullptr;
public:
explicit RenderEngineBase();
virtual ~RenderEngineBase();
virtual void start() = 0;
virtual void stop_render() const = 0;
GLFWwindow* get_window() const { return window_; }
};
#define RENDER_ENGINE_FACTORY_GENERATE(Class) \
RenderEngineBase* RenderEngineFactory(CoreInstance& core) {\
return new Class(core); \
}