diff --git a/CMakeLists.txt b/CMakeLists.txt index 61f73b9..5709c6a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -18,17 +18,17 @@ set(LUNARIUM_SRC "src/main.cpp" "src/core/core.cpp" "src/core/state.cpp" -"src/core/Version.cpp" +"src/core/version.cpp" "src/utils/types.cpp" -"src/utils/Logger.cpp" -"src/utils/HighResTimer.cpp" +"src/utils/logger.cpp" +"src/utils/highResTimer.cpp" "src/utils/helpers.cpp" -"src/utils/OpRes.cpp" -"src/utils/Args.cpp" -"src/utils/BinaryFileBuffer.cpp" -"src/utils/FrameCounter.cpp" +"src/utils/opRes.cpp" +"src/utils/args.cpp" +"src/utils/binaryFileBuffer.cpp" +"src/utils/frameCounter.cpp" "src/graphics/window.cpp" -"src/graphics/oglgraphics.cpp" +"src/graphics/glGraphics.cpp" "src/graphics/glShader.cpp" "src/graphics/image.cpp" ) @@ -108,5 +108,5 @@ target_link_directories(${PROJECT_NAME} if(WIN32) target_link_libraries(${PROJECT_NAME} opengl32.lib glfw glad glm dearimgui lua_static pugixml) elseif(UNIX) - target_link_libraries(${PROJECT_NAME} GL glfw glad glm dearimgui lua_static pugixml) + target_link_libraries(${PROJECT_NAME} X11 GL glfw glad glm dearimgui lua_static pugixml) endif() diff --git a/src/core/core.cpp b/src/core/core.cpp index 67308d4..92f5115 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp @@ -7,11 +7,11 @@ ******************************************************************************/ #include "core.h" -#include "Version.h" +#include "version.h" // Sub Systems #include -#include +#include namespace lunarium { @@ -36,7 +36,6 @@ namespace lunarium { if (!mpInstance) return; - Logger::Log(LogCategory::CORE, LogLevel::INFO, "Lunarium is shutting down!"); @@ -50,10 +49,10 @@ namespace lunarium delete mpInstance->mpArgs; mpInstance->mpArgs = nullptr; + mpInstance->mbIsInit = false; delete mpInstance; mpInstance = nullptr; - mpInstance->mbIsInit = false; } void Core::Initialize(int argc, char** argv) @@ -133,6 +132,9 @@ namespace lunarium return; } + // DEBUG + mpGraphics->SetClearColor(Color(0.0f, 0.0f, 0.0f, 1.0f)); + mbIsInit = true; } diff --git a/src/core/core.h b/src/core/core.h index a2b3a32..df12fcc 100644 --- a/src/core/core.h +++ b/src/core/core.h @@ -10,9 +10,9 @@ #define CORE_H_ #include "state.h" -#include +#include #include -#include +#include namespace lunarium { diff --git a/src/core/state.cpp b/src/core/state.cpp index 633bccf..47e5809 100644 --- a/src/core/state.cpp +++ b/src/core/state.cpp @@ -143,7 +143,7 @@ namespace lunarium display.append_attribute("IsFullScreen").set_value(Display.IsFullScreen); display.append_attribute("VSyncEnabled").set_value(Display.VSyncEnabled); - char* names[] = { "opengl", "vulkan", "unknown" }; + const char* names[] = { "opengl", "vulkan", "unknown" }; display.append_attribute("RenderFramework").set_value(names[Display.RenderFramework]); pugi::xml_node fsr = display.append_child("FullScreenResolution"); diff --git a/src/core/state.h b/src/core/state.h index a61f44c..f3ae931 100644 --- a/src/core/state.h +++ b/src/core/state.h @@ -10,7 +10,7 @@ #define STATE_H_ #include -#include +#include namespace lunarium { diff --git a/src/core/Version.cpp b/src/core/version.cpp similarity index 98% rename from src/core/Version.cpp rename to src/core/version.cpp index 1391b91..ea1a270 100644 --- a/src/core/Version.cpp +++ b/src/core/version.cpp @@ -9,7 +9,7 @@ * ******************************************************************************/ -#include "Version.h" +#include "version.h" #include #include diff --git a/src/core/Version.h b/src/core/version.h similarity index 93% rename from src/core/Version.h rename to src/core/version.h index e11a821..fa00066 100644 --- a/src/core/Version.h +++ b/src/core/version.h @@ -14,7 +14,7 @@ #include -#include +#include namespace lunarium { diff --git a/src/graphics/DefaultShaders.h b/src/graphics/defaultShaders.h similarity index 100% rename from src/graphics/DefaultShaders.h rename to src/graphics/defaultShaders.h diff --git a/src/graphics/OGLGraphics.cpp b/src/graphics/glGraphics.cpp similarity index 99% rename from src/graphics/OGLGraphics.cpp rename to src/graphics/glGraphics.cpp index c1c4c40..ccf3fab 100644 --- a/src/graphics/OGLGraphics.cpp +++ b/src/graphics/glGraphics.cpp @@ -6,8 +6,8 @@ * Description - An openGL implementation of the engine Graphics interface. ******************************************************************************/ -#include "OGLGraphics.h" -#include "DefaultShaders.h" +#include "glGraphics.h" +#include "defaultShaders.h" #include "window.h" #include "image.h" #include diff --git a/src/graphics/OGLGraphics.h b/src/graphics/glGraphics.h similarity index 94% rename from src/graphics/OGLGraphics.h rename to src/graphics/glGraphics.h index a5832ff..c155d77 100644 --- a/src/graphics/OGLGraphics.h +++ b/src/graphics/glGraphics.h @@ -1,5 +1,5 @@ /****************************************************************************** -* File - OGLGraphics.h +* File - glGraphics.h * Author - Joey Pollack * Date - 2021/08/30 (y/m/d) * Mod Date - 2021/09/02 (y/m/d) @@ -9,7 +9,7 @@ #ifndef OGLGRAPHICS_H_ #define OGLGRAPHICS_H_ -#include "IGraphics.h" +#include "igraphics.h" #include #include "glShader.h" #include @@ -85,7 +85,7 @@ namespace lunarium private: // Debug Message System - friend void __stdcall MessageCallback(GLenum source, GLenum type, GLuint id, + friend void GLAPIENTRY MessageCallback(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar* message, const void* userParam); static std::map mDebugMsgTypes; static std::map mDebugMsgSources; diff --git a/src/graphics/IGraphics.h b/src/graphics/igraphics.h similarity index 100% rename from src/graphics/IGraphics.h rename to src/graphics/igraphics.h diff --git a/src/graphics/Image.cpp b/src/graphics/image.cpp similarity index 97% rename from src/graphics/Image.cpp rename to src/graphics/image.cpp index baef763..4efafc3 100644 --- a/src/graphics/Image.cpp +++ b/src/graphics/image.cpp @@ -7,7 +7,7 @@ * Use the Graphics class to create instances of Image. ******************************************************************************/ -#include "Image.h" +#include "image.h" namespace lunarium { diff --git a/src/graphics/Image.h b/src/graphics/image.h similarity index 100% rename from src/graphics/Image.h rename to src/graphics/image.h diff --git a/src/graphics/Shaders/DefaultImage.frag b/src/graphics/shaders/DefaultImage.frag similarity index 100% rename from src/graphics/Shaders/DefaultImage.frag rename to src/graphics/shaders/DefaultImage.frag diff --git a/src/graphics/Shaders/DefaultImage.vert b/src/graphics/shaders/DefaultImage.vert similarity index 100% rename from src/graphics/Shaders/DefaultImage.vert rename to src/graphics/shaders/DefaultImage.vert diff --git a/src/graphics/window.cpp b/src/graphics/window.cpp index 735f618..6388a86 100644 --- a/src/graphics/window.cpp +++ b/src/graphics/window.cpp @@ -10,8 +10,8 @@ #include "window.h" #include -#include -#include +#include +#include #include namespace lunarium diff --git a/src/main.cpp b/src/main.cpp index 393fe49..f72c8b7 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -29,16 +29,17 @@ int main(int argc, char** argv) if (!core.IsInit()) { - std::cout << "\nFailed to initialize the engine core."; + std::cout << "\nFailed to initialize the engine core.\n"; return 1; } - std::cout << "\nEngine core successfully initialized!"; + std::cout << "\nEngine core successfully initialized!\n"; core.RunGameLoop(); core.Shutdown(); lunarium::Logger::GetInstance()->FreeAllListeners(); lunarium::Logger::FreeInstance(); + std::cout << "\n"; return 0; } \ No newline at end of file diff --git a/src/test_main.cpp b/src/test_main.cpp index b609b6d..686bc06 100644 --- a/src/test_main.cpp +++ b/src/test_main.cpp @@ -6,10 +6,10 @@ #include #include #include -#include "utils/Logger.h" -#include "utils/OpRes.h" +#include "utils/logger.h" +#include "utilsoOpRes.h" #include "core/state.h" -#include "core/Version.h" +#include "core/version.h" #include "utils/args.h" extern "C" diff --git a/src/utils/args.cpp b/src/utils/args.cpp index 2e70afd..9398c84 100644 --- a/src/utils/args.cpp +++ b/src/utils/args.cpp @@ -6,7 +6,7 @@ * Description - Processes command line arguments. ******************************************************************************/ -#include "Args.h" +#include "args.h" #include namespace lunarium diff --git a/src/utils/BinaryFileBuffer.cpp b/src/utils/binaryFileBuffer.cpp similarity index 95% rename from src/utils/BinaryFileBuffer.cpp rename to src/utils/binaryFileBuffer.cpp index 4001fdd..3192815 100644 --- a/src/utils/BinaryFileBuffer.cpp +++ b/src/utils/binaryFileBuffer.cpp @@ -8,8 +8,9 @@ * large files chunk by chunk. ******************************************************************************/ -#include "BinaryFileBuffer.h" +#include "binaryFileBuffer.h" #include +#include namespace lunarium { @@ -88,7 +89,7 @@ namespace lunarium if (!mbIsLoaded || mReadPos >= mFileSize) return false; - memcpy_s(buffer, numBytes, &mpData[mReadPos], numBytes); + memcpy(buffer, &mpData[mReadPos], numBytes); mReadPos += numBytes; return true; diff --git a/src/utils/BinaryFileBuffer.h b/src/utils/binaryFileBuffer.h similarity index 100% rename from src/utils/BinaryFileBuffer.h rename to src/utils/binaryFileBuffer.h diff --git a/src/utils/FrameCounter.cpp b/src/utils/frameCounter.cpp similarity index 97% rename from src/utils/FrameCounter.cpp rename to src/utils/frameCounter.cpp index 67bc19a..9630456 100644 --- a/src/utils/FrameCounter.cpp +++ b/src/utils/frameCounter.cpp @@ -6,7 +6,8 @@ * Description - Tracks frame statistics ******************************************************************************/ -#include "FrameCounter.h" +#include "frameCounter.h" +#include namespace lunarium { diff --git a/src/utils/FrameCounter.h b/src/utils/frameCounter.h similarity index 100% rename from src/utils/FrameCounter.h rename to src/utils/frameCounter.h diff --git a/src/utils/helpers.cpp b/src/utils/helpers.cpp index 0fd6af1..f6a81a2 100644 --- a/src/utils/helpers.cpp +++ b/src/utils/helpers.cpp @@ -8,6 +8,7 @@ #include "helpers.h" #include +#include #ifdef WIN32 #include diff --git a/src/utils/HighResTimer.cpp b/src/utils/highResTimer.cpp similarity index 97% rename from src/utils/HighResTimer.cpp rename to src/utils/highResTimer.cpp index 5899d36..960d1d0 100644 --- a/src/utils/HighResTimer.cpp +++ b/src/utils/highResTimer.cpp @@ -8,7 +8,7 @@ * does not include windows.h in the header. ******************************************************************************/ -#include "HighResTimer.h" +#include "highResTimer.h" using std::chrono::high_resolution_clock; using std::chrono::duration; diff --git a/src/utils/HighResTimer.h b/src/utils/highResTimer.h similarity index 100% rename from src/utils/HighResTimer.h rename to src/utils/highResTimer.h diff --git a/src/utils/Logger.cpp b/src/utils/logger.cpp similarity index 99% rename from src/utils/Logger.cpp rename to src/utils/logger.cpp index cf77034..cf70e42 100644 --- a/src/utils/Logger.cpp +++ b/src/utils/logger.cpp @@ -7,7 +7,7 @@ * list of built-in and user-defined listerers. ******************************************************************************/ -#include "Logger.h" +#include "logger.h" #include #include #include @@ -130,7 +130,7 @@ namespace lunarium return false; std::cout << std::endl << Logger::TimeStamp() << Logger::GetCategoryName(message.LogCategory) - << Logger::GetLevelName(message.LogLevel) << message.Message; + << Logger::GetLevelName(message.LogLevel) << message.Message << std::flush; return true; } diff --git a/src/utils/Logger.h b/src/utils/logger.h similarity index 99% rename from src/utils/Logger.h rename to src/utils/logger.h index 08ac48c..1a3beda 100644 --- a/src/utils/Logger.h +++ b/src/utils/logger.h @@ -19,7 +19,7 @@ // TODO: Remove the dependence on HighResTimer.h // OR re-write HighResTimer with modern timer code -#include "HighResTimer.h" +#include "highResTimer.h" // Conflict with a region flag in wingdi.h #undef ERROR diff --git a/src/utils/OpRes.cpp b/src/utils/opRes.cpp similarity index 97% rename from src/utils/OpRes.cpp rename to src/utils/opRes.cpp index ffba023..8833731 100644 --- a/src/utils/OpRes.cpp +++ b/src/utils/opRes.cpp @@ -7,7 +7,7 @@ * ******************************************************************************/ -#include "OpRes.h" +#include "opRes.h" namespace lunarium { diff --git a/src/utils/OpRes.h b/src/utils/opRes.h similarity index 100% rename from src/utils/OpRes.h rename to src/utils/opRes.h