27 lines
626 B
C++
27 lines
626 B
C++
#include "RenderEngineBase.hpp"
|
|
|
|
#include <stdexcept>
|
|
|
|
#include "Core/CoreInstance.hpp"
|
|
|
|
RenderEngineBase::RenderEngineBase(CoreInstance& core)
|
|
{
|
|
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, core.getGameName().c_str(), nullptr, nullptr);
|
|
if (window_ == nullptr)
|
|
throw std::runtime_error("Fail create window");
|
|
}
|
|
|
|
RenderEngineBase::~RenderEngineBase()
|
|
{
|
|
if (window_ != nullptr)
|
|
glfwDestroyWindow(window_);
|
|
|
|
glfwTerminate();
|
|
}
|