Compare commits
No commits in common. "0f3639e4013e4269d45f4e7a88e2d44484f043a4" and "ae336e3bbaae9e5428eafc08bfdf7493f2220229" have entirely different histories.
0f3639e401
...
ae336e3bba
27 changed files with 52 additions and 71 deletions
|
@ -1,3 +1,3 @@
|
||||||
add_library_module(lt_debug instrumentor.cpp)
|
add_library_module(lt_debug)
|
||||||
target_link_libraries(lt_debug PUBLIC logger)
|
target_link_libraries(lt_debug INTERFACE logger)
|
||||||
target_precompile_headers(lt_debug PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src/pch.hpp)
|
target_precompile_headers(lt_debug INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/src/pch.hpp)
|
||||||
|
|
|
@ -12,25 +12,13 @@ struct FailedAssertion: std::exception
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define lt_assert(x, ...) \
|
||||||
template<typename Expression_T, typename... Args>
|
{ \
|
||||||
constexpr void ensure(Expression_T &&expression, std::format_string<Args...> fmt, Args &&...args)
|
if (!(x)) \
|
||||||
{
|
{ \
|
||||||
if (!static_cast<bool>(expression))
|
log_crt(__VA_ARGS__); \
|
||||||
{
|
throw ::lt::FailedAssertion(__FILE__, __LINE__); \
|
||||||
Logger::log(LogLvl::critical, fmt, std::forward<Args>(args)...);
|
} \
|
||||||
throw ::lt::FailedAssertion(__FILE__, __LINE__);
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
template<typename Expression_T>
|
|
||||||
constexpr void ensure(Expression_T &&expression, const char *message)
|
|
||||||
{
|
|
||||||
if (!static_cast<bool>(expression))
|
|
||||||
{
|
|
||||||
Logger::log(LogLvl::critical, message);
|
|
||||||
throw ::lt::FailedAssertion(__FILE__, __LINE__);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace lt
|
} // namespace lt
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
#include <debug/instrumentor.hpp>
|
#include <debug/instrumentor.hpp>
|
||||||
#include <logger/logger.hpp>
|
|
||||||
|
|
||||||
namespace lt {
|
namespace lt {
|
||||||
|
|
||||||
|
|
|
@ -90,7 +90,7 @@ auto Scene::get_entity_by_tag(const std::string &tag) -> Entity
|
||||||
return entity;
|
return entity;
|
||||||
}
|
}
|
||||||
|
|
||||||
ensure(false, "Scene::get_entity_by_tag: failed to find entity by tag: {}", tag);
|
lt_assert(false, "Scene::get_entity_by_tag: failed to find entity by tag: {}", tag);
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,8 +12,8 @@ try
|
||||||
|
|
||||||
application = lt::create_application();
|
application = lt::create_application();
|
||||||
|
|
||||||
lt::ensure(application, "Failed to create application");
|
lt_assert(application, "Failed to create application");
|
||||||
lt::ensure(application->sanity_check(), "Failed to verify the sanity of the application");
|
lt_assert(application->sanity_check(), "Failed to verify the sanity of the application");
|
||||||
|
|
||||||
application->game_loop();
|
application->game_loop();
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@ Application *Application::s_instance = nullptr;
|
||||||
|
|
||||||
Application::Application(): m_window(nullptr)
|
Application::Application(): m_window(nullptr)
|
||||||
{
|
{
|
||||||
ensure(!s_instance, "Application constructed twice");
|
lt_assert(!s_instance, "Application constructed twice");
|
||||||
s_instance = this;
|
s_instance = this;
|
||||||
|
|
||||||
m_window = Window::create([this](auto &&PH1) { on_event(std::forward<decltype(PH1)>(PH1)); });
|
m_window = Window::create([this](auto &&PH1) { on_event(std::forward<decltype(PH1)>(PH1)); });
|
||||||
|
@ -62,7 +62,7 @@ Application::Application(): m_window(nullptr)
|
||||||
"TEXTURE_SHADER"),
|
"TEXTURE_SHADER"),
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
ensure(m_graphics_context, "lWindow::lWindow: failed to create 'GraphicsContext'");
|
lt_assert(m_graphics_context, "lWindow::lWindow: failed to create 'GraphicsContext'");
|
||||||
|
|
||||||
m_user_interface = UserInterface::create(
|
m_user_interface = UserInterface::create(
|
||||||
(GLFWwindow *)m_window->get_handle(),
|
(GLFWwindow *)m_window->get_handle(),
|
||||||
|
@ -173,13 +173,13 @@ void Application::on_event(const Event &event)
|
||||||
[[nodiscard]] auto Application::sanity_check() const -> bool
|
[[nodiscard]] auto Application::sanity_check() const -> bool
|
||||||
{
|
{
|
||||||
log_inf("Checking application sanity...");
|
log_inf("Checking application sanity...");
|
||||||
ensure(s_instance, "Application not constructed!?");
|
lt_assert(s_instance, "Application not constructed!?");
|
||||||
ensure(m_window, "Window is not initialized");
|
lt_assert(m_window, "Window is not initialized");
|
||||||
ensure(m_user_interface, "User interface is not initialized");
|
lt_assert(m_user_interface, "User interface is not initialized");
|
||||||
ensure(m_graphics_context, "Graphics context is not initialized");
|
lt_assert(m_graphics_context, "Graphics context is not initialized");
|
||||||
ensure(m_renderer, "Renderer is not initialized");
|
lt_assert(m_renderer, "Renderer is not initialized");
|
||||||
ensure(m_layer_stack, "Layer_stack is not initialized");
|
lt_assert(m_layer_stack, "Layer_stack is not initialized");
|
||||||
ensure(!m_layer_stack->is_empty(), "Layer_stack is empty");
|
lt_assert(!m_layer_stack->is_empty(), "Layer_stack is empty");
|
||||||
|
|
||||||
log_inf("Logging application state...");
|
log_inf("Logging application state...");
|
||||||
this->log_debug_data();
|
this->log_debug_data();
|
||||||
|
|
|
@ -40,7 +40,7 @@ auto Layer::on_event(const Event &event) -> bool
|
||||||
case EventType::WindowGainFocus:
|
case EventType::WindowGainFocus:
|
||||||
return on_window_gain_focus(dynamic_cast<const WindowGainFocusEvent &>(event));
|
return on_window_gain_focus(dynamic_cast<const WindowGainFocusEvent &>(event));
|
||||||
|
|
||||||
default: ensure(false, "Invalid event: {}", event.get_info_lt_log());
|
default: lt_assert(false, "Invalid event: {}", event.get_info_lt_log());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -53,12 +53,6 @@ public:
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void static log(LogLvl lvl, const char *message)
|
|
||||||
{
|
|
||||||
instance().spd_logger->log((spdlog::level::level_enum)lvl, message);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Logger();
|
Logger();
|
||||||
|
|
||||||
|
|
|
@ -46,7 +46,7 @@ EditorLayer::EditorLayer(const std::string &name)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
auto serializer = SceneSerializer { m_scene };
|
auto serializer = SceneSerializer { m_scene };
|
||||||
ensure(serializer.deserialize(m_scene_dir), "Failed to de-serialize: {}", m_scene_dir);
|
lt_assert(serializer.deserialize(m_scene_dir), "Failed to de-serialize: {}", m_scene_dir);
|
||||||
|
|
||||||
// m_camera_entity = m_scene->GetEntityByTag("Game Camera");
|
// m_camera_entity = m_scene->GetEntityByTag("Game Camera");
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,7 @@ auto Blender::create(const Ref<SharedContext> & /*sharedContext*/) -> Scope<Blen
|
||||||
);)
|
);)
|
||||||
|
|
||||||
default
|
default
|
||||||
: ensure(
|
: lt_assert(
|
||||||
false,
|
false,
|
||||||
"Invalid/unsupported 'GraphicsAPI' {}",
|
"Invalid/unsupported 'GraphicsAPI' {}",
|
||||||
static_cast<uint32_t>(GraphicsContext::get_graphics_api())
|
static_cast<uint32_t>(GraphicsContext::get_graphics_api())
|
||||||
|
|
|
@ -30,7 +30,7 @@ auto ConstantBuffer::create(
|
||||||
);)
|
);)
|
||||||
|
|
||||||
default
|
default
|
||||||
: ensure(
|
: lt_assert(
|
||||||
false,
|
false,
|
||||||
"Invalid/unsupported 'GraphicsAPI' {}",
|
"Invalid/unsupported 'GraphicsAPI' {}",
|
||||||
static_cast<uint32_t>(GraphicsContext::get_graphics_api())
|
static_cast<uint32_t>(GraphicsContext::get_graphics_api())
|
||||||
|
@ -59,7 +59,7 @@ auto VertexBuffer::create(
|
||||||
);)
|
);)
|
||||||
|
|
||||||
default
|
default
|
||||||
: ensure(
|
: lt_assert(
|
||||||
false,
|
false,
|
||||||
"Invalid/unsupported 'GraphicsAPI' {}",
|
"Invalid/unsupported 'GraphicsAPI' {}",
|
||||||
static_cast<uint32_t>(GraphicsContext::get_graphics_api())
|
static_cast<uint32_t>(GraphicsContext::get_graphics_api())
|
||||||
|
@ -86,7 +86,7 @@ auto IndexBuffer::create(
|
||||||
);)
|
);)
|
||||||
|
|
||||||
default
|
default
|
||||||
: ensure(
|
: lt_assert(
|
||||||
false,
|
false,
|
||||||
"Invalid/unsupported 'GraphicsAPI' {}",
|
"Invalid/unsupported 'GraphicsAPI' {}",
|
||||||
static_cast<uint32_t>(GraphicsContext::get_graphics_api())
|
static_cast<uint32_t>(GraphicsContext::get_graphics_api())
|
||||||
|
|
|
@ -48,8 +48,8 @@ dxShader::dxShader(
|
||||||
);
|
);
|
||||||
|
|
||||||
// check
|
// check
|
||||||
ensure(!vsErr.Get(), "Vertex shader compile error: {}", (char *)vsErr->GetBufferPointer());
|
lt_assert(!vsErr.Get(), "Vertex shader compile error: {}", (char *)vsErr->GetBufferPointer());
|
||||||
ensure(!psErr.Get(), "Pixels shader compile error: {}", (char *)psErr->GetBufferPointer());
|
lt_assert(!psErr.Get(), "Pixels shader compile error: {}", (char *)psErr->GetBufferPointer());
|
||||||
|
|
||||||
// create shaders
|
// create shaders
|
||||||
auto hr = HRESULT {};
|
auto hr = HRESULT {};
|
||||||
|
|
|
@ -28,7 +28,7 @@ dxVertexLayout::dxVertexLayout(
|
||||||
}
|
}
|
||||||
|
|
||||||
auto dxpShader = std::dynamic_pointer_cast<dxShader>(shader);
|
auto dxpShader = std::dynamic_pointer_cast<dxShader>(shader);
|
||||||
ensure(dxpShader, "Failed to cast 'Shader' to 'dxShader'");
|
lt_assert(dxpShader, "Failed to cast 'Shader' to 'dxShader'");
|
||||||
|
|
||||||
// create input layout (vertex layout)
|
// create input layout (vertex layout)
|
||||||
auto hr = HRESULT {};
|
auto hr = HRESULT {};
|
||||||
|
@ -88,7 +88,7 @@ auto dxVertexLayout::get_dxgi_format(VertexElementType type) -> DXGI_FORMAT
|
||||||
case lt::VertexElementType::Float3: return DXGI_FORMAT_R32G32B32_FLOAT;
|
case lt::VertexElementType::Float3: return DXGI_FORMAT_R32G32B32_FLOAT;
|
||||||
case lt::VertexElementType::Float4: return DXGI_FORMAT_R32G32B32A32_FLOAT;
|
case lt::VertexElementType::Float4: return DXGI_FORMAT_R32G32B32A32_FLOAT;
|
||||||
|
|
||||||
default: ensure(false, "Invalid 'VertexElementType'"); return DXGI_FORMAT_UNKNOWN;
|
default: lt_assert(false, "Invalid 'VertexElementType'"); return DXGI_FORMAT_UNKNOWN;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@ auto Framebuffer::create(
|
||||||
););
|
););
|
||||||
|
|
||||||
default:
|
default:
|
||||||
ensure(
|
lt_assert(
|
||||||
false,
|
false,
|
||||||
"Invalid/unsupported 'GraphicsAPI' {}",
|
"Invalid/unsupported 'GraphicsAPI' {}",
|
||||||
static_cast<uint32_t>(GraphicsContext::get_graphics_api())
|
static_cast<uint32_t>(GraphicsContext::get_graphics_api())
|
||||||
|
|
|
@ -85,7 +85,7 @@ void glFramebuffer::resize(const glm::uvec2 &size)
|
||||||
// m_specification.width, m_specification.height); glFramebufferTexture2D(GL_FRAMEBUFFER,
|
// m_specification.width, m_specification.height); glFramebufferTexture2D(GL_FRAMEBUFFER,
|
||||||
// GL_DEPTH_STENCIL_ATTACHMENT, GL_TEXTURE_2D, m_depth_stencil_attachment_id, 0);
|
// GL_DEPTH_STENCIL_ATTACHMENT, GL_TEXTURE_2D, m_depth_stencil_attachment_id, 0);
|
||||||
|
|
||||||
ensure(
|
lt_assert(
|
||||||
(glCheckFramebufferStatus(GL_FRAMEBUFFER) == GL_FRAMEBUFFER_COMPLETE),
|
(glCheckFramebufferStatus(GL_FRAMEBUFFER) == GL_FRAMEBUFFER_COMPLETE),
|
||||||
"Framebuffer is incomplete"
|
"Framebuffer is incomplete"
|
||||||
);
|
);
|
||||||
|
|
|
@ -16,7 +16,7 @@ glGraphicsContext::glGraphicsContext(GLFWwindow *windowHandle): m_window_handle(
|
||||||
{
|
{
|
||||||
m_graphics_api = GraphicsAPI::OpenGL;
|
m_graphics_api = GraphicsAPI::OpenGL;
|
||||||
glfwMakeContextCurrent(windowHandle);
|
glfwMakeContextCurrent(windowHandle);
|
||||||
ensure(gladLoadGL(glfwGetProcAddress), "Failed to initialize opengl (glad)");
|
lt_assert(gladLoadGL(glfwGetProcAddress), "Failed to initialize opengl (glad)");
|
||||||
|
|
||||||
set_debug_message_callback();
|
set_debug_message_callback();
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,7 +58,7 @@ auto glTexture::get_texture() -> void *
|
||||||
case 3u: return GL_RGB;
|
case 3u: return GL_RGB;
|
||||||
case 2u: return GL_RG;
|
case 2u: return GL_RG;
|
||||||
case 1u: return GL_RED;
|
case 1u: return GL_RED;
|
||||||
default: ensure(false, "Invalid number of components: {}", num_components);
|
default: lt_assert(false, "Invalid number of components: {}", num_components);
|
||||||
}
|
}
|
||||||
|
|
||||||
return {};
|
return {};
|
||||||
|
@ -73,7 +73,7 @@ auto glTexture::get_texture() -> void *
|
||||||
case 3u: return GL_RGB8;
|
case 3u: return GL_RGB8;
|
||||||
case 2u: return GL_RG8;
|
case 2u: return GL_RG8;
|
||||||
case 1u: return GL_R8;
|
case 1u: return GL_R8;
|
||||||
default: ensure(false, "Invalid number of components: {}", num_components);
|
default: lt_assert(false, "Invalid number of components: {}", num_components);
|
||||||
}
|
}
|
||||||
|
|
||||||
return {};
|
return {};
|
||||||
|
|
|
@ -12,11 +12,11 @@ glVertexLayout::glVertexLayout(
|
||||||
: m_array_id(NULL)
|
: m_array_id(NULL)
|
||||||
{
|
{
|
||||||
// check
|
// check
|
||||||
ensure(
|
lt_assert(
|
||||||
std::dynamic_pointer_cast<glVertexBuffer>(buffer),
|
std::dynamic_pointer_cast<glVertexBuffer>(buffer),
|
||||||
"Failed to cast 'VertexBuffer' to 'glVertexBuffer'"
|
"Failed to cast 'VertexBuffer' to 'glVertexBuffer'"
|
||||||
);
|
);
|
||||||
ensure(!elements.empty(), "'elements' is empty");
|
lt_assert(!elements.empty(), "'elements' is empty");
|
||||||
|
|
||||||
// local
|
// local
|
||||||
auto elementsDesc = std::vector<glVertexElementDesc> {};
|
auto elementsDesc = std::vector<glVertexElementDesc> {};
|
||||||
|
@ -140,7 +140,7 @@ auto glVertexLayout::get_element_desc(VertexElementType type, unsigned int offse
|
||||||
case VertexElementType::Float4:
|
case VertexElementType::Float4:
|
||||||
return { .type = GL_FLOAT, .count = 4u, .typeSize = sizeof(GLfloat), .offset = offset };
|
return { .type = GL_FLOAT, .count = 4u, .typeSize = sizeof(GLfloat), .offset = offset };
|
||||||
|
|
||||||
default: ensure(false, "Invalid 'VertexElementType'"); return {};
|
default: lt_assert(false, "Invalid 'VertexElementType'"); return {};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,7 @@ auto GraphicsContext::create(GraphicsAPI api, GLFWwindow *window_handle) -> Scop
|
||||||
break;)
|
break;)
|
||||||
|
|
||||||
default
|
default
|
||||||
: ensure(
|
: lt_assert(
|
||||||
false,
|
false,
|
||||||
"Invalid/unsupported 'GraphicsAPI' {}",
|
"Invalid/unsupported 'GraphicsAPI' {}",
|
||||||
// TODO(Light): Stringifier::graphics_api_to_string(api),
|
// TODO(Light): Stringifier::graphics_api_to_string(api),
|
||||||
|
|
|
@ -24,7 +24,7 @@ auto RenderCommand::create(GLFWwindow *windowHandle, const Ref<SharedContext> &
|
||||||
);)
|
);)
|
||||||
|
|
||||||
default
|
default
|
||||||
: ensure(
|
: lt_assert(
|
||||||
false,
|
false,
|
||||||
"Invalid/unsupported 'GraphicsAPI' {}",
|
"Invalid/unsupported 'GraphicsAPI' {}",
|
||||||
static_cast<uint32_t>(GraphicsContext::get_graphics_api())
|
static_cast<uint32_t>(GraphicsContext::get_graphics_api())
|
||||||
|
|
|
@ -43,7 +43,7 @@ Renderer::Renderer(
|
||||||
, m_target_framebuffer(nullptr)
|
, m_target_framebuffer(nullptr)
|
||||||
|
|
||||||
{
|
{
|
||||||
ensure(!s_context, "An instance of 'renderer' already exists, do not construct this class!");
|
lt_assert(!s_context, "An instance of 'renderer' already exists, do not construct this class!");
|
||||||
s_context = this;
|
s_context = this;
|
||||||
|
|
||||||
m_view_projection_buffer = ConstantBuffer::create(
|
m_view_projection_buffer = ConstantBuffer::create(
|
||||||
|
@ -151,7 +151,7 @@ void Renderer::draw_quad_impl(const glm::mat4 &transform, const glm::vec4 &tint)
|
||||||
|
|
||||||
void Renderer::draw_quad_impl(const glm::mat4 &transform, const Ref<Texture> &texture)
|
void Renderer::draw_quad_impl(const glm::mat4 &transform, const Ref<Texture> &texture)
|
||||||
{
|
{
|
||||||
ensure(texture, "Texture passed to renderer::draw_quad_impl");
|
lt_assert(texture, "Texture passed to renderer::draw_quad_impl");
|
||||||
|
|
||||||
texture->bind();
|
texture->bind();
|
||||||
auto map = std::span<TextureRendererProgram::TextureVertexData> {
|
auto map = std::span<TextureRendererProgram::TextureVertexData> {
|
||||||
|
@ -189,7 +189,7 @@ void Renderer::draw_quad_impl(
|
||||||
const Ref<Texture> &texture
|
const Ref<Texture> &texture
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
ensure(texture, "Texture passed to renderer::draw_quad_impl");
|
lt_assert(texture, "Texture passed to renderer::draw_quad_impl");
|
||||||
|
|
||||||
texture->bind();
|
texture->bind();
|
||||||
auto map = std::span<TintedTextureRendererProgram::TintedTextureVertexData> {
|
auto map = std::span<TintedTextureRendererProgram::TintedTextureVertexData> {
|
||||||
|
|
|
@ -33,7 +33,7 @@ namespace lt {
|
||||||
););
|
););
|
||||||
|
|
||||||
default:
|
default:
|
||||||
ensure(
|
lt_assert(
|
||||||
false,
|
false,
|
||||||
"Invalid/unsupported 'GraphicsAPI' {}",
|
"Invalid/unsupported 'GraphicsAPI' {}",
|
||||||
static_cast<uint32_t>(GraphicsContext::get_graphics_api())
|
static_cast<uint32_t>(GraphicsContext::get_graphics_api())
|
||||||
|
|
|
@ -31,7 +31,7 @@ namespace lt {
|
||||||
);)
|
);)
|
||||||
|
|
||||||
default
|
default
|
||||||
: ensure(
|
: lt_assert(
|
||||||
false,
|
false,
|
||||||
"Invalid/unsupported 'GraphicsAPI' {}",
|
"Invalid/unsupported 'GraphicsAPI' {}",
|
||||||
static_cast<uint32_t>(GraphicsContext::get_graphics_api())
|
static_cast<uint32_t>(GraphicsContext::get_graphics_api())
|
||||||
|
|
|
@ -30,7 +30,7 @@ auto VertexLayout::create(
|
||||||
);)
|
);)
|
||||||
|
|
||||||
default
|
default
|
||||||
: ensure(
|
: lt_assert(
|
||||||
false,
|
false,
|
||||||
"Invalid/unsupported 'GraphicsAPI' {}",
|
"Invalid/unsupported 'GraphicsAPI' {}",
|
||||||
static_cast<uint32_t>(GraphicsContext::get_graphics_api())
|
static_cast<uint32_t>(GraphicsContext::get_graphics_api())
|
||||||
|
|
|
@ -37,7 +37,7 @@ auto UserInterface::create(GLFWwindow *windowHandle, Ref<SharedContext> sharedCo
|
||||||
case GraphicsAPI::DirectX: lt_win(scopeUserInterface = create_scope<dxUserInterface>();) break;
|
case GraphicsAPI::DirectX: lt_win(scopeUserInterface = create_scope<dxUserInterface>();) break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
ensure(
|
lt_assert(
|
||||||
false,
|
false,
|
||||||
"UserInterface::create: invalid/unsupported 'GraphicsAPI' {}",
|
"UserInterface::create: invalid/unsupported 'GraphicsAPI' {}",
|
||||||
static_cast<uint32_t>(GraphicsContext::get_graphics_api())
|
static_cast<uint32_t>(GraphicsContext::get_graphics_api())
|
||||||
|
@ -58,7 +58,7 @@ UserInterface::UserInterface()
|
||||||
)
|
)
|
||||||
// NOLINTEND
|
// NOLINTEND
|
||||||
{
|
{
|
||||||
ensure(
|
lt_assert(
|
||||||
!s_context,
|
!s_context,
|
||||||
"UserInterface::UserInterface: an instance of 'UserInterface' already exists, do not "
|
"UserInterface::UserInterface: an instance of 'UserInterface' already exists, do not "
|
||||||
"construct this class!"
|
"construct this class!"
|
||||||
|
|
|
@ -21,7 +21,7 @@ lWindow::lWindow(std::function<void(Event &)> callback)
|
||||||
: m_event_callback(std::move(std::move(callback)))
|
: m_event_callback(std::move(std::move(callback)))
|
||||||
{
|
{
|
||||||
// init glfw
|
// init glfw
|
||||||
ensure(glfwInit(), "lWindow::lWindow: failed to initialize 'glfw'");
|
lt_assert(glfwInit(), "lWindow::lWindow: failed to initialize 'glfw'");
|
||||||
|
|
||||||
// create window
|
// create window
|
||||||
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 4);
|
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 4);
|
||||||
|
@ -30,7 +30,7 @@ lWindow::lWindow(std::function<void(Event &)> callback)
|
||||||
glfwWindowHint(GLFW_VISIBLE, GLFW_FALSE);
|
glfwWindowHint(GLFW_VISIBLE, GLFW_FALSE);
|
||||||
|
|
||||||
m_handle = glfwCreateWindow(1u, 1u, "", nullptr, nullptr);
|
m_handle = glfwCreateWindow(1u, 1u, "", nullptr, nullptr);
|
||||||
ensure(m_handle, "lWindow::lWindow: failed to create 'GLFWwindow'");
|
lt_assert(m_handle, "lWindow::lWindow: failed to create 'GLFWwindow'");
|
||||||
|
|
||||||
glfwSetWindowUserPointer(m_handle, &m_event_callback);
|
glfwSetWindowUserPointer(m_handle, &m_event_callback);
|
||||||
bind_glfw_events();
|
bind_glfw_events();
|
||||||
|
|
Loading…
Add table
Reference in a new issue