Rework logger

This commit is contained in:
Antoine Pilote
2023-07-21 22:25:17 -04:00
parent 46a531fd7d
commit e4119c0d15
26 changed files with 127 additions and 97 deletions

View File

@@ -163,7 +163,7 @@ int main(int argc, char* argv[])
}
catch (std::exception exception)
{
Logger::Log("Error loading project: " + projectPath, CRITICAL);
Logger::Log("Error loading project: " + projectPath, "editor", CRITICAL);
Logger::Log(exception.what());
}
}

View File

@@ -45,7 +45,7 @@ namespace Nuake
Ref<Project> project = Project::New();
if (!project->Deserialize(FileSystem::ReadFile(projectPath, true)))
{
Logger::Log("Error loading project: " + projectPath, CRITICAL);
Logger::Log("Error loading project: " + projectPath, "editor", CRITICAL);
return;
}

View File

@@ -77,9 +77,8 @@ namespace Nuake {
ImVec2 LastSize = ImVec2();
void EditorInterface::DrawViewport()
{
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(0, 0));
std::string name = ICON_FA_GAMEPAD + std::string(" Scene");
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(4, 4));
std::string name = ICON_FA_GAMEPAD + std::string(" Scene");
if (ImGui::Begin(name.c_str()))
{
ImGui::PopStyleVar();
@@ -94,7 +93,7 @@ namespace Nuake {
float half = windowWidth / 2.0;
float needed = half - used;
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(0, 0));
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(2, 2));
if (ImGui::Button(ICON_FA_PLAY, ImVec2(30, 30)) || (Input::IsKeyPressed(GLFW_KEY_F5) && !Engine::IsPlayMode()))
{
SceneSnapshot = Engine::GetCurrentScene()->Copy();
@@ -159,8 +158,10 @@ namespace Nuake {
Ref<Texture> texture = framebuffer->GetTexture();
ImVec2 imagePos = ImGui::GetCursorPos();
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(0, 0));
m_ViewportPos = { imagePos.x, imagePos.y };
ImGui::Image((void*)texture->GetID(), regionAvail, ImVec2(0, 1), ImVec2(1, 0));
ImGui::PopStyleVar();
const Vector2& mousePos = Input::GetMousePosition();
const ImVec2& windowPos = ImGui::GetWindowPos() + ImVec2(0, 30.0);
@@ -1118,6 +1119,7 @@ namespace Nuake {
bool LogErrors = true;
bool LogWarnings = true;
bool LogDebug = true;
bool AutoScroll = true;
void EditorInterface::DrawLogger()
{
if (ImGui::Begin("Logger"))
@@ -1127,21 +1129,20 @@ namespace Nuake {
ImGui::Checkbox("Warning", &LogWarnings);
ImGui::SameLine();
ImGui::Checkbox("Debug", &LogDebug);
ImGui::SameLine();
ImGui::Checkbox("Autoscroll", &AutoScroll);
//ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(0, 0));
//if (ImGui::BeginChild("Log window", ImGui::GetContentRegionAvail(), false))
//{
//ImGui::PopStyleVar();
ImGuiTableFlags flags = ImGuiTableFlags_ScrollY | ImGuiTableFlags_RowBg | ImGuiTableFlags_BordersOuter | ImGuiTableFlags_BordersV | ImGuiTableFlags_Resizable | ImGuiTableFlags_Reorderable | ImGuiTableFlags_Hideable;
ImGuiTableFlags flags = ImGuiTableFlags_ScrollY | ImGuiTableFlags_RowBg | ImGuiTableFlags_Hideable;
if (ImGui::BeginTable("LogTable", 3, flags))
{
ImGui::TableSetupScrollFreeze(0, 1);
ImGui::TableSetupColumn("Severity", 0, 0.15f);
ImGui::TableSetupColumn("Time", 0.15f);
ImGui::TableSetupColumn("Message", 0.7f);
ImGui::TableHeadersRow();
ImGui::TableSetupColumn("Severity", ImGuiTableColumnFlags_WidthFixed, 64.0f);
ImGui::TableSetupColumn("Time", ImGuiTableColumnFlags_WidthFixed, 64.0f);
ImGui::TableSetupColumn("Message", ImGuiTableColumnFlags_WidthStretch, 1.0f);
ImGui::TableNextColumn();
ImGui::PushStyleVar(ImGuiStyleVar_CellPadding, ImVec2(4, 4));
for (auto& l : Logger::GetLogs())
{
if (l.type == LOG_TYPE::VERBOSE && !LogDebug)
@@ -1153,31 +1154,46 @@ namespace Nuake {
std::string severityText = "";
if (l.type == LOG_TYPE::VERBOSE)
severityText = "Verbose";
severityText = "verbose";
else if (l.type == LOG_TYPE::WARNING)
severityText = "Warning";
severityText = "warning";
else
severityText = "Critical";
severityText = "critical";
ImVec4 colorGreen = ImVec4(0.59, 0.76, 0.47, 1.0);
ImGui::PushStyleColor(ImGuiCol_Text, colorGreen);
ImGui::TableSetBgColor(ImGuiTableBgTarget_CellBg, ImGui::GetColorU32(ImVec4(0.59, 0.76, 0.47, 0.2)), -1);
const std::string timeString = " [" + l.time + "]";
ImGui::Text(timeString.c_str());
ImGui::PopStyleColor();
ImGui::Text(severityText.c_str());
ImGui::TableNextColumn();
ImGui::Text(l.time.c_str());
ImVec4 colorBlue = ImVec4(98 / 255.0, 174 / 255.0, 239 / 255.0, 1.);
ImGui::PushStyleColor(ImGuiCol_Text, colorBlue);
ImGui::TableSetBgColor(ImGuiTableBgTarget_CellBg, ImGui::GetColorU32(ImVec4(98 / 255.0, 174 / 255.0, 239 / 255.0, 0.2)), -1);
ImGui::Text(l.logger.c_str());
ImGui::PopStyleColor();
ImGui::TableNextColumn();
ImVec4 color = ImVec4(1, 1, 1, 1.0);
ImGui::PushStyleColor(ImGuiCol_Text, color);
ImGui::TableSetBgColor(ImGuiTableBgTarget_CellBg, ImGui::GetColorU32(ImVec4(1, 1, 1, 0.0)), -1);
ImGui::TextWrapped(l.message.c_str());
ImGui::PopStyleColor();
ImGui::TableNextColumn();
}
if (ImGui::GetScrollY() >= ImGui::GetScrollMaxY())
ImGui::SetScrollHereY(1.0f);
ImGui::PopStyleVar();
if (AutoScroll)
{
ImGui::SetScrollY(ImGui::GetScrollMaxY());
}
ImGui::EndTable();
}
//ImGui::EndChild();
//}
}
ImGui::End();
}
@@ -1308,7 +1324,7 @@ namespace Nuake {
Ref<Project> project = Project::New();
if (!project->Deserialize(FileSystem::ReadFile(projectPath, true)))
{
Logger::Log("Error loading project: " + projectPath, CRITICAL);
Logger::Log("Error loading project: " + projectPath, "editor", CRITICAL);
return;
}
@@ -1328,7 +1344,7 @@ namespace Nuake {
Ref<Scene> scene = Scene::New();
if (!scene->Deserialize(FileSystem::ReadFile(projectPath, true)))
{
Logger::Log("Error failed loading scene: " + projectPath, CRITICAL);
Logger::Log("Error failed loading scene: " + projectPath, "editor", CRITICAL);
return;
}

View File

@@ -197,7 +197,7 @@ namespace Nuake
{
if(FileSystem::RemoveFile(file->GetAbsolutePath()) != 0)
{
Logger::Log("Failed to remove file: " + file->GetRelativePath(), CRITICAL);
Logger::Log("Failed to remove file: " + file->GetRelativePath(), "editor", CRITICAL);
}
RefreshFileBrowser();
}
@@ -289,7 +289,7 @@ namespace Nuake
}
else
{
Logger::Log("[FileSystem] Cannot create script files that starts with a number.", CRITICAL);
Logger::Log("[FileSystem] Cannot create script files that starts with a number.", "editor", CRITICAL);
}
}
}
@@ -437,6 +437,8 @@ namespace Nuake
ImGui::EndChild();
ImGui::PopStyleVar();
ImGui::PopStyleVar();
ImGui::PopStyleColor();
@@ -444,7 +446,7 @@ namespace Nuake
if (ImGui::Button((std::string(ICON_FA_FOLDER_OPEN)).c_str(), buttonSize))
{
OS::ShowInFileExplorer(m_CurrentDirectory->fullPath);
OS::OpenIn(m_CurrentDirectory->fullPath);
}
ImGui::SameLine();

View File

@@ -269,7 +269,7 @@ namespace Nuake
}
catch (std::exception exception)
{
Logger::Log("Error loading project: " + projectPath, CRITICAL);
Logger::Log("Error loading project: " + projectPath, "editor", CRITICAL);
Logger::Log(exception.what());
}

View File

@@ -28,26 +28,15 @@ namespace Nuake
void Engine::Init()
{
Logger::Log("Nuake initializing");
AudioManager::Get().Initialize();
Logger::Log("Audio engine initialized");
AudioManager::Get().PlayTTS("Nuake Engine debug");
PhysicsManager::Get().Init();
Logger::Log("Physics initialized");
// Creates the window
s_CurrentWindow = Window::Get();
Logger::Log("Window initialized");
Input::Init();
Renderer2D::Init();
Logger::Log("2D renderer initialized");
Logger::Log("Engine initialized successfully!");
Logger::Log("Engine initialized");
}
void Engine::Tick()
@@ -56,7 +45,7 @@ namespace Nuake
s_TimeStep = s_Time - s_LastFrameTime;
s_LastFrameTime = s_Time;
s_TimeStep = std::min((float)s_TimeStep, 0.5f);
//s_TimeStep = std::min((float)s_TimeStep, 0f);
// Dont update if no scene is loaded.
if (s_CurrentWindow->GetScene())
@@ -90,7 +79,7 @@ namespace Nuake
// Dont trigger init if already in player mode.
if (IsPlayMode())
{
Logger::Log("Cannot enter play mode if is already in play mode.", WARNING);
Logger::Log("Cannot enter play mode if is already in play mode.", "engine", WARNING);
return;
}
@@ -100,7 +89,7 @@ namespace Nuake
}
else
{
Logger::Log("Cannot enter play mode. Scene OnInit failed", CRITICAL);
Logger::Log("Cannot enter play mode. Scene OnInit failed", "engine", CRITICAL);
GetCurrentScene()->OnExit();
}
}

View File

@@ -9,7 +9,7 @@ namespace Nuake
{
std::vector<LogEntry> Logger::m_Logs = std::vector<LogEntry>();
void Logger::Log(const std::string& log, LOG_TYPE type)
void Logger::Log(const std::string& log, const std::string& logger ,LOG_TYPE type)
{
char buff[100];
time_t now = time(0);
@@ -20,10 +20,24 @@ namespace Nuake
LogEntry newLog = {
type,
buff,
log
log,
logger
};
std::string msg = "[" + std::string(buff) + "]" + std::string(" - ") + log;
switch (type)
{
case WARNING:
// TODO: Add color
break;
case CRITICAL:
break;
case VERBOSE:
break;
}
std::string msg = "[" + std::string(buff) + "] " + logger + " - " + log;
std::cout << msg << std::endl;
if (m_Logs.size() >= MAX_LOG)

View File

@@ -16,6 +16,7 @@ namespace Nuake
LOG_TYPE type;
std::string time;
std::string message;
std::string logger;
};
class Logger
@@ -25,7 +26,7 @@ namespace Nuake
static std::vector<LogEntry> m_Logs;
public:
static void Log(const std::string& log, LOG_TYPE type = VERBOSE);
static void Log(const std::string& log, const std::string& logger = "main", LOG_TYPE type = VERBOSE);
static std::vector<LogEntry> GetLogs();
};
}

View File

@@ -50,10 +50,8 @@ namespace Nuake
void PhysicsManager::Init()
{
Logger::Log("Initializing Jolt physics.");
JPH::RegisterDefaultAllocator();
Logger::Log("Creating factory & registering types.");
JPH::Factory::sInstance = new JPH::Factory();
JPH::RegisterTypes();

View File

@@ -157,12 +157,11 @@ namespace Nuake
m_Material = CreateRef<Material>();
m_Material->Deserialize(j["Material"].dump());
std::vector<uint32_t> indices;
m_Indices.reserve(j["Indices"].size());
for (auto& i : j["Indices"])
{
indices.push_back(i);
m_Indices.push_back(i);
}
m_Indices = indices;
std::vector<Vertex> vertices;
for (auto& v : j["Vertices"])

View File

@@ -22,7 +22,7 @@ namespace Nuake
{
if (!s.second->Rebuild())
{
Logger::Log("Failed to rebuild shader: " + s.first, Nuake::CRITICAL);
Logger::Log("Failed to rebuild shader: " + s.first, "shader", Nuake::CRITICAL);
}
}
}

View File

@@ -57,9 +57,6 @@ namespace Nuake
std::string matName;
if (!j.contains("name"))
{
std::string msg = "Error: Cannot load material file: " + materialPath +
" - Material file must have a name. \n";
printf(msg.c_str());
return nullptr;
}
else

View File

@@ -31,9 +31,14 @@ namespace Nuake
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, m_Width, m_Height, 0, GL_RGBA, GL_UNSIGNED_BYTE, m_LocalBuffer);
glGenerateMipmap(GL_TEXTURE_2D);
if (m_LocalBuffer)
{
stbi_image_free(m_LocalBuffer);
}
else
std::cout << "Error: failed to load texture: " << path << std::endl;
{
const std::string& msg = "Failed to load texture: " + path;
Logger::Log(msg, "texture", WARNING);
}
}
Texture::Texture(glm::vec2 size, GLenum format, GLenum format2, GLenum format3, void* data)
@@ -83,9 +88,14 @@ namespace Nuake
glGenerateMipmap(GL_TEXTURE_2D);
if (m_LocalBuffer)
{
stbi_image_free(m_LocalBuffer);
}
else
std::cout << "Error: failed to load texture buffer " << std::endl;
{
const std::string msg = "failed to load texture buffer";
Logger::Log(msg, "texture", WARNING);
}
}
Texture::Texture(glm::vec2 size, msdfgen::BitmapConstRef<unsigned char, 4>& bitmap, bool t)

View File

@@ -3,8 +3,9 @@
namespace Nuake
{
struct Vertex
class Vertex
{
public:
Vector3 position;
Vector2 uv;
Vector3 normal;

View File

@@ -34,7 +34,7 @@ namespace Nuake
{
std::string assimpErrorMsg = std::string(import.GetErrorString());
std::string logMsg = "[Failed to load model] - " + assimpErrorMsg;
Logger::Log(logMsg, WARNING);
Logger::Log(logMsg, "model", WARNING);
return model;
}
@@ -219,7 +219,7 @@ namespace Nuake
if (!FileSystem::FileExists(texturePath, true))
{
std::string textureNotFoundmsg = "Texture file couldn't be found: " + texturePath;
Logger::Log(textureNotFoundmsg, Nuake::LOG_TYPE::WARNING);
Logger::Log(textureNotFoundmsg, "model", Nuake::LOG_TYPE::WARNING);
texturePath = "resources/Textures/default/Default.png";
}

View File

@@ -142,11 +142,11 @@ namespace Nuake
std::string sceneContent = FileSystem::ReadFile(scenePath, false);
if (!DefaultScene->Deserialize(sceneContent))
{
Logger::Log("Error loading scene: " + scenePath, CRITICAL);
Logger::Log("Error loading scene: " + scenePath, "project", CRITICAL);
}
DefaultScene->Path = scenePath;
Logger::Log("Successfully loaded scene: " + scenePath);
Logger::Log("Loaded scene: " + scenePath);
return true; // Success
}

View File

@@ -25,14 +25,14 @@ namespace Nuake
const std::string MATERIAL_EXT = ".material";
if (!FileSystem::FileExists(path))
{
Logger::Log(FILE_NOT_FOUND + path, LOG_TYPE::WARNING);
Logger::Log(FILE_NOT_FOUND + path, "resource", LOG_TYPE::WARNING);
return nullptr;
}
if (!String::EndsWith(path, MATERIAL_EXT))
{
std::string message = WRONG_EXTENSION + MATERIAL_EXT + " actual: " + path;
Logger::Log(message, LOG_TYPE::WARNING);
Logger::Log(message, "resource", LOG_TYPE::WARNING);
}
std::string content = FileSystem::ReadFile(path);

View File

@@ -201,7 +201,7 @@ namespace Nuake {
{
if (name.empty())
{
Logger::Log("[Scene] Failed to create entity. Entity name cannot be empty.");
Logger::Log("Failed to create entity. Entity name cannot be empty.");
return Entity();
}
@@ -213,7 +213,7 @@ namespace Nuake {
else
{
// Try to generate a unique name
for (uint32_t i = 1; i < 2048; i++)
for (uint32_t i = 1; i < 4096; i++)
{
const std::string& entityEnumName = name + std::to_string(i);
const auto& entityId = GetEntity(entityEnumName).GetHandle();
@@ -226,7 +226,7 @@ namespace Nuake {
if (entityName.empty()) // We ran out of names!!!
{
Logger::Log("[Scene] Failed to create entity. Limit reached with name: " + name, CRITICAL);
Logger::Log("Failed to create entity. Limit reached with name: " + name, "scene", CRITICAL);
return Entity();
}
}
@@ -242,7 +242,7 @@ namespace Nuake {
nameComponent.Name = entityName;
nameComponent.ID = id;
Logger::Log("[Scene] Entity created with name: " + nameComponent.Name, LOG_TYPE::VERBOSE);
Logger::Log("Entity created with name: " + nameComponent.Name, "scene", LOG_TYPE::VERBOSE);
return entity;
}

View File

@@ -197,7 +197,7 @@ namespace Nuake
Entity entity { e, m_Scene };
if (!entity.HasComponent<ModelComponent>())
{
Logger::Log("Cannot use mesh collider without model component", WARNING);
Logger::Log("Cannot use mesh collider without model component", "physics", WARNING);
}
auto meshColliderComponent = meshColliderView.get<MeshColliderComponent>(e);
@@ -209,7 +209,7 @@ namespace Nuake
const std::vector<Ref<Mesh>>& submeshes = modelComponent.ModelResource->GetMeshes();
if (subMeshId >= submeshes.size())
{
Logger::Log("Cannot create mesh collider, invalid submesh ID", WARNING);
Logger::Log("Cannot create mesh collider, invalid submesh ID", "physics", WARNING);
}
Ref<Mesh> mesh = submeshes[subMeshId];
@@ -274,7 +274,7 @@ namespace Nuake
{
if (!ent.HasComponent<ModelComponent>())
{
Logger::Log("Cannot use mesh collider without model component", WARNING);
Logger::Log("Cannot use mesh collider without model component", "physics", WARNING);
}
const auto& modelComponent = ent.GetComponent<ModelComponent>();
const auto& component = ent.GetComponent<MeshColliderComponent>();
@@ -285,7 +285,7 @@ namespace Nuake
const std::vector<Ref<Mesh>>& submeshes = modelComponent.ModelResource->GetMeshes();
if (subMeshId >= submeshes.size())
{
Logger::Log("Cannot create mesh collider, invalid submesh ID", WARNING);
Logger::Log("Cannot create mesh collider, invalid submesh ID", "physics", WARNING);
}
Ref<Mesh> mesh = submeshes[subMeshId];
auto shape = CreateRef<Physics::MeshShape>(mesh);

View File

@@ -83,7 +83,7 @@ namespace Nuake {
const std::string& prefabPath = wrenGetSlotString(vm, 1);
if (prefabPath.empty())
{
Logger::Log("[Scripting] Cannot add prefab with an empty path.", CRITICAL);
Logger::Log("Cannot add prefab with an empty path.", "script", CRITICAL);
wrenSetSlotDouble(vm, 0, -1); // -1 is an empty entity.
return;
}
@@ -91,14 +91,14 @@ namespace Nuake {
const std::string& prefabName = wrenGetSlotString(vm, 1);
if (prefabName.empty())
{
Logger::Log("[Scripting] Cannot add prefab with an empty name.", CRITICAL);
Logger::Log("Cannot add prefab with an empty name.", "script", CRITICAL);
wrenSetSlotDouble(vm, 0, -1); // -1 is an empty entity.
return;
}
if (!FileSystem::FileExists(prefabPath))
{
Logger::Log("[Scripting] Cannot add prefab. File not found: " + prefabPath, CRITICAL);
Logger::Log("Cannot add prefab. File not found: " + prefabPath, "script", CRITICAL);
return;
}

View File

@@ -25,23 +25,23 @@ namespace Nuake {
case WREN_ERROR_COMPILE:
{
std::string t = std::string(module) + " line " + std::to_string(line) + ": " + msg;
Logger::Log(t, CRITICAL);
Logger::Log(t, "script", CRITICAL);
Engine::ExitPlayMode();
} break;
case WREN_ERROR_STACK_TRACE:
{
std::string t = "Stack trace: " + std::string(module) + " line " + std::to_string(line) + ": " + msg;
Logger::Log(t, CRITICAL);
Logger::Log(t, "script", CRITICAL);
} break;
case WREN_ERROR_RUNTIME:
{
std::string t = "Script Runtime Error: " + std::string(msg);
Logger::Log(t, WARNING);
Logger::Log(t, "script", WARNING);
} break;
default:
{
std::string t = "Script Runtime Error: " + std::string(msg);
Logger::Log(t, CRITICAL);
Logger::Log(t, "script", CRITICAL);
}
break;
}

View File

@@ -91,7 +91,7 @@ namespace Nuake
// Load file
if (!font->load(path.c_str()))
Logger::Log("Failed to load font", CRITICAL);
Logger::Log("Failed to load font", "font", CRITICAL);
// Load charset ASCII
std::vector<msdf_atlas::GlyphGeometry> glyphs;
@@ -107,7 +107,7 @@ namespace Nuake
fonts.push_back(fontGeometry);
if (glyphs.empty())
Logger::Log("No glyphs loaded.", CRITICAL);
Logger::Log("No glyphs loaded.", "font", CRITICAL);
// Create atlas params
msdf_atlas::TightAtlasPacker::DimensionsConstraint atlasSizeConstraint = msdf_atlas::TightAtlasPacker::DimensionsConstraint::MULTIPLE_OF_FOUR_SQUARE;
@@ -124,7 +124,7 @@ namespace Nuake
{
if (remaining < 0)
{
Logger::Log("Failed to pack atlas.", CRITICAL);
Logger::Log("Failed to pack atlas.", "font", CRITICAL);
}
else
{

View File

@@ -16,7 +16,7 @@ namespace Nuake {
if (newFont)
return newFont;
Logger::Log("Error: failed to load font " + font, CRITICAL);
Logger::Log("Error: failed to load font " + font, "font", CRITICAL);
return nullptr;
}
}

View File

@@ -12,7 +12,7 @@ namespace Nuake
std::string name = doc.first_child().name();
if (name != "Canvas")
{
Logger::Log("InterfaceParser error: First child should be a canvas - " + path, CRITICAL);
Logger::Log("InterfaceParser error: First child should be a canvas - " + path, "ui", CRITICAL);
return nullptr;
}

View File

@@ -19,7 +19,7 @@ namespace Nuake {
if (!Root)
{
Logger::Log("Failed to generate interface structure", CRITICAL);
Logger::Log("Failed to generate interface structure", "ui", CRITICAL);
}
yoga_config = YGConfigNew();
@@ -40,7 +40,7 @@ namespace Nuake {
Root = InterfaceParser::Parse(FileSystem::Root + this->m_Path);
if (!Root)
{
Logger::Log("Failed to generate interface structure", CRITICAL);
Logger::Log("Failed to generate interface structure", "ui", CRITICAL);
}
yoga_config = YGConfigNew();

View File

@@ -53,30 +53,33 @@ namespace Nuake
{
if (!glfwInit())
{
Logger::Log("glfw initialization failed.", CRITICAL);
Logger::Log("GLFW initialization failed", "window", CRITICAL);
return -1;
}
m_Window = glfwCreateWindow(m_Width, m_Height, m_Title.c_str(), NULL, NULL);
if (!m_Window)
{
Logger::Log("Window creation failed.", CRITICAL);
Logger::Log("Window creation failed", "window", CRITICAL);
return -1;
}
SetWindowIcon("resources/Images/nuake-logo.png");
glfwMakeContextCurrent(m_Window);
SetVSync(0);
//SetVSync(true)
Logger::Log((char*)glGetString(GL_VERSION));
Logger::Log("Driver detected " + std::string(((char*)glGetString(GL_VERSION))), "renderer");
if (glewInit() != GLEW_OK)
{
Logger::Log("GLEW initialization failed!", CRITICAL);
Logger::Log("GLEW initialization failed!", "window", CRITICAL);
return -1;
}
if (glfwRawMouseMotionSupported())
glfwSetInputMode(m_Window, GLFW_RAW_MOUSE_MOTION, GLFW_TRUE);
// TODO: Move this to renderer init. The window shouldnt have to do gl calls.
glfwWindowHint(GLFW_SAMPLES, 4);
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);