diff --git a/CMakeLists.txt b/CMakeLists.txt index 0202af2..f5a0049 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -120,7 +120,7 @@ add_subdirectory(external/freetype) add_subdirectory(external/box2d) # add run mode tester -add_subdirectory(src/run_modes/tester) +add_subdirectory(src/run_modes/testbed) # add run mode editor add_subdirectory(src/run_modes/editor) @@ -155,7 +155,7 @@ target_link_directories(${PROJECT_NAME} PRIVATE external/box2d/bin ) -target_link_libraries(${PROJECT_NAME} box2d glfw glad glm gui dearimgui utils assets lua_static pugixml freetype tester game) +target_link_libraries(${PROJECT_NAME} box2d glfw glad glm gui dearimgui utils assets lua_static pugixml freetype testbed game) if (NOT NO_EDITOR) target_link_libraries(${PROJECT_NAME} editor) diff --git a/docs/3rd_party_libs.md b/docs/3rd_party_libs.md new file mode 100644 index 0000000..34f6038 --- /dev/null +++ b/docs/3rd_party_libs.md @@ -0,0 +1,36 @@ +## List of 3rd party tools and libraries + + +- GLFW + - [Git Repo](https://github.com/glfw/glfw) + - License: [zlib/libpng](https://www.glfw.org/license.html) +- Glad2 + - [Git Repo](https://github.com/Dav1dde/glad/tree/glad2) + - License: [MIT](https://github.com/Dav1dde/glad/blob/glad2/LICENSE) +- GLM + - [Git Repo](https://github.com/g-truc/glm) + - License: [The Happy Bunny License or MIT](https://github.com/g-truc/glm/blob/master/copying.txt) +- Wren + - [Git Repo](https://github.com/wren-lang/wren) + - License: [MIT](https://github.com/wren-lang/wren/blob/main/LICENSE) +- Dear ImGui + - [Git Repo](https://github.com/ocornut/imgui/tree/docking) + - License: [MIT](https://github.com/ocornut/imgui/blob/docking/LICENSE.txt) +- stb_image headers + - [Git Repo](https://github.com/nothings/stb) + - License: [MIT OR Public Domain](https://github.com/nothings/stb/blob/master/LICENSE) +- OpenAL Soft + - [Git Repo](https://github.com/kcat/openal-soft) + - License: [GPL v2](https://github.com/kcat/openal-soft/blob/master/COPYING) +- FreeType + - [Git Repo](https://gitlab.freedesktop.org/freetype/freetype) + - License: [FreeType License OR GPL 2 (or later)](https://gitlab.freedesktop.org/freetype/freetype/-/blob/master/LICENSE.TXT) +- Box2D + - [Git Repo](https://github.com/erincatto/box2d) + - License: [MIT](https://github.com/Dav1dde/glad/blob/glad2/LICENSE) +- json + - [Git Repo](https://github.com/nlohmann/json) + - License: [MIT](https://github.com/nlohmann/json/blob/develop/LICENSE.MIT) +- nativefiledialog-extended + - [Git Repo](https://github.com/btzy/nativefiledialog-extended) + - License: [ZLIB](https://github.com/btzy/nativefiledialog-extended/blob/master/LICENSE) \ No newline at end of file diff --git a/docs/binary_file_formats.txt b/docs/design/binary_file_formats.txt similarity index 100% rename from docs/binary_file_formats.txt rename to docs/design/binary_file_formats.txt diff --git a/docs/project_structure.txt b/docs/design/project_structure.txt similarity index 100% rename from docs/project_structure.txt rename to docs/design/project_structure.txt diff --git a/docs/Bugs.todo b/docs/tasks/Bugs.todo similarity index 100% rename from docs/Bugs.todo rename to docs/tasks/Bugs.todo diff --git a/docs/core.todo b/docs/tasks/core.todo similarity index 96% rename from docs/core.todo rename to docs/tasks/core.todo index 745f0be..336e95a 100644 --- a/docs/core.todo +++ b/docs/tasks/core.todo @@ -4,15 +4,18 @@ Build System: ✔ Modify .sh scripts to recognize the noeditor flag @done (1/25/2022, 3:59:23 PM) Core: + ☐ Replace XML with JSON (https://github.com/nlohmann/json) @high ☐ Move internal libs back into the core and refactor @high ☐ Replace the File Browser (imgui) class with the NFD library (https://github.com/btzy/nativefiledialog-extended) @high - ☐ For scripting switch to Wren instead of LUA @high + ☐ For scripting switch to Wren instead of LUA (https://github.com/wren-lang/wren) @high + ☐ Remove SOL ☐ Add log settings to the state file ✔ Add run modes (Editor, Game, Test) to state file @done (9/15/2021, 7:27:03 PM) ✔ Add run mode interface class @done (9/15/2021, 8:22:35 PM) ✔ Read the window size and position on shutdown and write these to the state file @done (2/8/2022, 4:39:37 PM) Graphics: + ☐ Implement batch rendering ✔ Decide on a font/text rendering system @done (9/7/2021, 1:39:53 PM) ✔ Add FreeType to the project @done (9/7/2021, 2:23:13 PM) ✔ Add a new class for font loading/management and text rendering @done (9/7/2021, 3:57:08 PM) diff --git a/docs/editor.todo b/docs/tasks/editor.todo similarity index 95% rename from docs/editor.todo rename to docs/tasks/editor.todo index 8a53481..b65d700 100644 --- a/docs/editor.todo +++ b/docs/tasks/editor.todo @@ -46,6 +46,8 @@ Editor: ☐ Allow Tile Maps to be named Tile Map Canvas: + ☐ Implement a proper camera system and do not use panel scrolling @high + Implement drawing tiles: ✔ Connect Selected Tile Set to the Canvas @done (3/11/2022, 6:11:07 PM) ✔ Handle mouse clicking in update @done (3/11/2022, 6:11:09 PM) diff --git a/docs/game.todo b/docs/tasks/game.todo similarity index 100% rename from docs/game.todo rename to docs/tasks/game.todo diff --git a/scripts/build.bat b/scripts/build.bat index 7c5c5a7..eb35bab 100644 --- a/scripts/build.bat +++ b/scripts/build.bat @@ -1,7 +1,12 @@ @echo off +SETLOCAL ENABLEDELAYEDEXPANSION REM This script expects to be run from the parent directory REM ex. scripts/build.bat +REM Sets the escape char. see for info: +REM https://stackoverflow.com/questions/55891318/how-to-echo-with-different-colors-in-the-windows-command-line-inside-a-for-loop +for /F %%a in ('echo prompt $E ^| cmd') do set "ESC=%%a" + IF not exist build/ ( echo This script needs to be run from the directory above build/ goto END @@ -18,15 +23,33 @@ If "%~2" == "g" set "DELGUI=1" IF defined RELEASE ( cmake --build build/ --target ALL_BUILD --config Release + +SET BUILD_ERRORLEVEL=!ERRORLEVEL! +IF NOT "!BUILD_ERRORLEVEL!"=="0" ( + echo %ESC%[91mBUILD FAILED!%ESC%[0m %BUILD_ERRORLEVEL% + EXIT /B !BUILD_ERRORLEVEL! +) + xcopy /y test_data\engine_state.xml build\Release\ ) ELSE ( cmake --build build/ --target ALL_BUILD --config Debug + +SET BUILD_ERRORLEVEL=!ERRORLEVEL! +IF NOT "!BUILD_ERRORLEVEL!"=="0" ( + echo %ESC%[91mBUILD FAILED!%ESC%[0m %BUILD_ERRORLEVEL% + EXIT /B !BUILD_ERRORLEVEL! +) + xcopy /y test_data\engine_state.xml build\Debug\ + ) +echo %ESC%[92mBUILD SUCCEEDED!%ESC%[0m + IF defined DELGUI ( del /s /q build\Debug\imgui.ini del /s /q build\Release\imgui.ini ) -:END \ No newline at end of file +:END +ENDLOCAL \ No newline at end of file diff --git a/src/core/core.cpp b/src/core/core.cpp index 59901a8..f1ebc07 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp @@ -15,7 +15,7 @@ #include // Run modes -#include +#include #include // Sub Systems @@ -232,7 +232,7 @@ namespace lunarium Logger::Log(LogCategory::CORE, LogLevel::INFO, "Running in mode: %s", types[mState.Mode]); if (RunMode::MODE_TEST == mState.Mode) { - mpRunMode = new Tester; + mpRunMode = new TestBed; } else if (RunMode::MODE_EDITOR == mState.Mode) diff --git a/src/core/core.h b/src/core/core.h index c0e0637..b23c26f 100644 --- a/src/core/core.h +++ b/src/core/core.h @@ -21,7 +21,7 @@ namespace lunarium { class Image; - class Tester; + class TestBed; class GUI; class IGraphics; class Window; @@ -93,7 +93,7 @@ namespace lunarium Core& operator=(const Core&) = delete; private: // RUN MODES - Tester* mpTester; + TestBed* mpTester; }; } diff --git a/src/run_modes/tester/CMakeLists.txt b/src/run_modes/testbed/CMakeLists.txt similarity index 55% rename from src/run_modes/tester/CMakeLists.txt rename to src/run_modes/testbed/CMakeLists.txt index f74c09e..fc98d19 100644 --- a/src/run_modes/tester/CMakeLists.txt +++ b/src/run_modes/testbed/CMakeLists.txt @@ -1,6 +1,8 @@ -add_library(tester tester.cpp scenes/baseScene.cpp scenes/simpleRenderScene.cpp scenes/physicsScene.cpp) -target_include_directories(tester + +add_library(testbed testbed.cpp scenes/baseScene.cpp scenes/simpleRenderScene.cpp scenes/physicsScene.cpp) + +target_include_directories(testbed PUBLIC "${PROJECT_BINARY_DIR}" PUBLIC ../../ PUBLIC ../../internal_libs @@ -10,4 +12,4 @@ target_include_directories(tester PUBLIC ../../../external/box2d/include ) -target_link_libraries(tester box2d utils dearimgui) \ No newline at end of file +target_link_libraries(testbed box2d utils dearimgui) \ No newline at end of file diff --git a/src/run_modes/tester/scenes/baseScene.cpp b/src/run_modes/testbed/scenes/baseScene.cpp similarity index 100% rename from src/run_modes/tester/scenes/baseScene.cpp rename to src/run_modes/testbed/scenes/baseScene.cpp diff --git a/src/run_modes/tester/scenes/baseScene.h b/src/run_modes/testbed/scenes/baseScene.h similarity index 100% rename from src/run_modes/tester/scenes/baseScene.h rename to src/run_modes/testbed/scenes/baseScene.h diff --git a/src/run_modes/tester/scenes/physicsScene.cpp b/src/run_modes/testbed/scenes/physicsScene.cpp similarity index 100% rename from src/run_modes/tester/scenes/physicsScene.cpp rename to src/run_modes/testbed/scenes/physicsScene.cpp diff --git a/src/run_modes/tester/scenes/physicsScene.h b/src/run_modes/testbed/scenes/physicsScene.h similarity index 100% rename from src/run_modes/tester/scenes/physicsScene.h rename to src/run_modes/testbed/scenes/physicsScene.h diff --git a/src/run_modes/tester/scenes/simpleRenderScene.cpp b/src/run_modes/testbed/scenes/simpleRenderScene.cpp similarity index 100% rename from src/run_modes/tester/scenes/simpleRenderScene.cpp rename to src/run_modes/testbed/scenes/simpleRenderScene.cpp diff --git a/src/run_modes/tester/scenes/simpleRenderScene.h b/src/run_modes/testbed/scenes/simpleRenderScene.h similarity index 100% rename from src/run_modes/tester/scenes/simpleRenderScene.h rename to src/run_modes/testbed/scenes/simpleRenderScene.h diff --git a/src/run_modes/tester/tester.cpp b/src/run_modes/testbed/testbed.cpp similarity index 88% rename from src/run_modes/tester/tester.cpp rename to src/run_modes/testbed/testbed.cpp index eeb2d09..e949e43 100644 --- a/src/run_modes/tester/tester.cpp +++ b/src/run_modes/testbed/testbed.cpp @@ -1,12 +1,12 @@ /****************************************************************************** -* File - tester.cpp +* File - testbed.cpp * Author - Joey Pollack * Date - 2021/09/15 (y/m/d) * Mod Date - 2021/09/15 (y/m/d) * Description - Run a series of tests to verify engine functionality ******************************************************************************/ -#include "tester.h" +#include "testbed.h" #include "scenes/simpleRenderScene.h" #include "scenes/physicsScene.h" @@ -17,13 +17,13 @@ namespace lunarium { - Tester::Tester() + TestBed::TestBed() : mpScene(nullptr) { } - OpRes Tester::Initialize() + OpRes TestBed::Initialize() { // return OpRes::Fail("Tester::Initialize not implemented"); @@ -43,14 +43,14 @@ namespace lunarium return OpRes::OK(); } - void Tester::Shutdown() + void TestBed::Shutdown() { delete mpScene; mpScene = nullptr; } - void Tester::OnTick(double delta) + void TestBed::OnTick(double delta) { if (Core::Input().IsKeyDown(KeyCode::NUM_1)) { @@ -80,13 +80,13 @@ namespace lunarium mpScene->OnTick(delta); } - void Tester::OnRender(IGraphics* g) + void TestBed::OnRender(IGraphics* g) { mpScene->OnRender(g); } - void Tester::OnKeyPress(InputManager::KeyPress kp) + void TestBed::OnKeyPress(InputManager::KeyPress kp) { Logger::Log(mLogCat, LogLevel::INFO_VERBOSE, "Key Press Event: %s", kp.Key.Name.c_str()); } diff --git a/src/run_modes/tester/tester.h b/src/run_modes/testbed/testbed.h similarity index 81% rename from src/run_modes/tester/tester.h rename to src/run_modes/testbed/testbed.h index ad8fba2..61065ef 100644 --- a/src/run_modes/tester/tester.h +++ b/src/run_modes/testbed/testbed.h @@ -1,5 +1,5 @@ /****************************************************************************** -* File - tester.h +* File - testbed.h * Author - Joey Pollack * Date - 2021/09/15 (y/m/d) * Mod Date - 2021/09/15 (y/m/d) @@ -17,10 +17,10 @@ namespace lunarium { class Image; - class Tester : public iRunMode + class TestBed : public iRunMode { public: - Tester(); + TestBed(); OpRes Initialize(); void Shutdown(); void OnTick(double delta); @@ -31,8 +31,8 @@ namespace lunarium private: - Tester(const Tester&) = delete; - const Tester& operator=(const Tester&) = delete; + TestBed(const TestBed&) = delete; + const TestBed& operator=(const TestBed&) = delete; private: // Data uint32_t mLogCat;