|
|
|
|
@ -10,14 +10,14 @@
|
|
|
|
|
#include "version.h"
|
|
|
|
|
|
|
|
|
|
// Sub Systems
|
|
|
|
|
#include "window.h"
|
|
|
|
|
#include <window/window.h>
|
|
|
|
|
#include <graphics/opengl/glGraphics.h>
|
|
|
|
|
|
|
|
|
|
namespace lunarium
|
|
|
|
|
{
|
|
|
|
|
Core* Core::mpInstance = nullptr;
|
|
|
|
|
Core::Core()
|
|
|
|
|
: mbIsInit(false), mpArgs(nullptr), mpWindow(nullptr), mpGraphics(nullptr)
|
|
|
|
|
: mbIsInit(false), mpArgs(nullptr), mpWindow(nullptr), mpGraphics(nullptr), mpInput(nullptr)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
@ -40,6 +40,10 @@ namespace lunarium
|
|
|
|
|
Logger::Log(LogCategory::CORE, LogLevel::INFO, "Lunarium is shutting down!");
|
|
|
|
|
|
|
|
|
|
// Shutdown subsystems
|
|
|
|
|
mpInstance->mpInput->Shutdown();
|
|
|
|
|
delete mpInstance->mpInput;
|
|
|
|
|
mpInstance->mpInput = nullptr;
|
|
|
|
|
|
|
|
|
|
mpInstance->mpGraphics->Shutdown();
|
|
|
|
|
delete mpInstance->mpGraphics;
|
|
|
|
|
mpInstance->mpGraphics = nullptr;
|
|
|
|
|
@ -134,8 +138,11 @@ namespace lunarium
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// DEBUG
|
|
|
|
|
mpGraphics->SetClearColor(Color(0.0f, 0.0f, 0.0f, 1.0f));
|
|
|
|
|
mpGraphics->SetClearColor(Color(0.5f, 0.5f, 0.75f, 1.0f));
|
|
|
|
|
|
|
|
|
|
// INPUT
|
|
|
|
|
mpInput = new InputManager;
|
|
|
|
|
mpInput->Initialize(mpWindow);
|
|
|
|
|
|
|
|
|
|
mbIsInit = true;
|
|
|
|
|
}
|
|
|
|
|
@ -166,21 +173,22 @@ namespace lunarium
|
|
|
|
|
|
|
|
|
|
// Poll input
|
|
|
|
|
Window::PollEvents();
|
|
|
|
|
mKeyEvents = mpInput->PollKeys();
|
|
|
|
|
|
|
|
|
|
// HACK: Temporary solution to close the program
|
|
|
|
|
if (glfwGetKey(mpWindow->GetWindow(), GLFW_KEY_ESCAPE) == GLFW_PRESS)
|
|
|
|
|
if (mpInput->IsKeyDown(KeyCode::ESCAPE))
|
|
|
|
|
{
|
|
|
|
|
mpWindow->SetShouldCloseFlag(true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// DEBUG: Graphics testing
|
|
|
|
|
static int width = 500;
|
|
|
|
|
if (glfwGetKey(mpWindow->GetWindow(), GLFW_KEY_LEFT) == GLFW_PRESS)
|
|
|
|
|
if (mpInput->IsKeyDown(KeyCode::LEFT))
|
|
|
|
|
{
|
|
|
|
|
width -= 10;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (glfwGetKey(mpWindow->GetWindow(), GLFW_KEY_RIGHT) == GLFW_PRESS)
|
|
|
|
|
if (mpInput->IsKeyDown(KeyCode::RIGHT))
|
|
|
|
|
{
|
|
|
|
|
width += 10;
|
|
|
|
|
}
|
|
|
|
|
|