diff --git a/CMakeLists.txt b/CMakeLists.txt index a48dd4ca..81c10361 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -46,6 +46,8 @@ if(EMSCRIPTEN) set(ENABLE_TEST_COVERAGE OFF) endif() +include(cmake/subdirlist.cmake) + include(external/external.cmake) add_subdirectory(modules) diff --git a/cmake/subdirlist.cmake b/cmake/subdirlist.cmake new file mode 100644 index 00000000..d8782bfb --- /dev/null +++ b/cmake/subdirlist.cmake @@ -0,0 +1,14 @@ +macro(SUBDIRLIST result curdir) + file( + GLOB children CONFIGURE_DEPENDS + RELATIVE ${curdir} + ${curdir}/* + ) + set(dirlist "") + foreach(child ${children}) + if(IS_DIRECTORY ${curdir}/${child}) + list(APPEND dirlist ${child}) + endif() + endforeach() + set(${result} ${dirlist}) +endmacro() diff --git a/core/WebRequest.cpp b/core/WebRequest.cpp index 1121a23c..1754e49d 100644 --- a/core/WebRequest.cpp +++ b/core/WebRequest.cpp @@ -1,11 +1,11 @@ -//#include "WebRequest.h" -//#ifndef __EMSCRIPTEN__ -//# include "cpr/cpr.h" -//#endif +// #include "WebRequest.h" +// #ifndef __EMSCRIPTEN__ +// # include "cpr/cpr.h" +// #endif // //// ref.: see https://github.com/libcpr/cpr/blob/master/test/post_tests.cpp // WebRequest::WebRequest(std::string uri, WebRequestVerb verb = WebRequestVerb::GET, std::map headers = {}) { -//#ifndef __EMSCRIPTEN__ +// #ifndef __EMSCRIPTEN__ // cpr::Payload payload{}; // cpr::Session session; // cpr::Header header; @@ -16,5 +16,5 @@ // if (verb == WebRequestVerb::GET) { // r = session.Get(); // } -//#endif +// #endif // } diff --git a/core/WebRequest.h b/core/WebRequest.h index 0ba9b130..dcf2e3d7 100644 --- a/core/WebRequest.h +++ b/core/WebRequest.h @@ -1,52 +1,52 @@ -//#ifndef MOBAGEN_WEBREQUEST_H -//#define MOBAGEN_WEBREQUEST_H +// #ifndef MOBAGEN_WEBREQUEST_H +// #define MOBAGEN_WEBREQUEST_H // -//#include -//#include -//#include +// #include +// #include +// #include // -// enum class WebRequestVerb { GET, POST, PUT }; +// enum class WebRequestVerb { GET, POST, PUT }; // -// enum class ErrorCode { -// OK = 0, -// CONNECTION_FAILURE, -// EMPTY_RESPONSE, -// HOST_RESOLUTION_FAILURE, -// INTERNAL_ERROR, -// INVALID_URL_FORMAT, -// NETWORK_RECEIVE_ERROR, -// NETWORK_SEND_FAILURE, -// OPERATION_TIMEDOUT, -// PROXY_RESOLUTION_FAILURE, -// SSL_CONNECT_ERROR, -// SSL_LOCAL_CERTIFICATE_ERROR, -// SSL_REMOTE_CERTIFICATE_ERROR, -// SSL_CACERT_ERROR, -// GENERIC_SSL_ERROR, -// UNSUPPORTED_PROTOCOL, -// REQUEST_CANCELLED, -// TOO_MANY_REDIRECTS, -// UNKNOWN_ERROR = 1000, -//}; +// enum class ErrorCode { +// OK = 0, +// CONNECTION_FAILURE, +// EMPTY_RESPONSE, +// HOST_RESOLUTION_FAILURE, +// INTERNAL_ERROR, +// INVALID_URL_FORMAT, +// NETWORK_RECEIVE_ERROR, +// NETWORK_SEND_FAILURE, +// OPERATION_TIMEDOUT, +// PROXY_RESOLUTION_FAILURE, +// SSL_CONNECT_ERROR, +// SSL_LOCAL_CERTIFICATE_ERROR, +// SSL_REMOTE_CERTIFICATE_ERROR, +// SSL_CACERT_ERROR, +// GENERIC_SSL_ERROR, +// UNSUPPORTED_PROTOCOL, +// REQUEST_CANCELLED, +// TOO_MANY_REDIRECTS, +// UNKNOWN_ERROR = 1000, +// }; // -// struct WebResponse { -// public: -// uint32_t status_code; -// std::string text; -// std::map header; -// std::string url; -// // todo: cookies -// ErrorCode errorCode; -// std::string ErrorMessage; -// std::string raw_header{}; -// std::string status_line{}; -// std::string reason{}; -// // todo: uploaded_bytes{}; -// // todo: downloaded_bytes{}; -//}; +// struct WebResponse { +// public: +// uint32_t status_code; +// std::string text; +// std::map header; +// std::string url; +// // todo: cookies +// ErrorCode errorCode; +// std::string ErrorMessage; +// std::string raw_header{}; +// std::string status_line{}; +// std::string reason{}; +// // todo: uploaded_bytes{}; +// // todo: downloaded_bytes{}; +// }; // -// struct WebRequest { -// WebRequest(std::string uri, WebRequestVerb verb, std::map headers); -//}; +// struct WebRequest { +// WebRequest(std::string uri, WebRequestVerb verb, std::map headers); +// }; // -//#endif // MOBAGEN_WEBREQUEST_H +// #endif // MOBAGEN_WEBREQUEST_H diff --git a/core/datastructures/Tree.h b/core/datastructures/Tree.h index 3318e7d6..ac7d60ab 100644 --- a/core/datastructures/Tree.h +++ b/core/datastructures/Tree.h @@ -4,46 +4,46 @@ #include // binary tree -template struct BinaryTree { - struct Node { - T value; - Node* left = nullptr; - Node* right = nullptr; - explicit Node(T value) : value(value) {} - Node(T value, Node* left, Node* right) : value(value), left(left), right(right) {} - - ~Node() { - if (left) delete left; - if (right) delete right; - } - }; - - Node* root = nullptr; - - void Add(T value) { - if (!root) { - root = new Node(value); - return; - } - Node* current = root; - while (true) { - if (value < current->value) { - if (current->left != nullptr) { - current = current->left; - } else { - current->left = new Node(value); - break; - } - } else { - if (current->right != nullptr) { - current = current->right; - } else { - current->right = new Node(value); - break; - } - } - } - } -}; +// template struct BinaryTree { +// struct Node { +// T value; +// Node* left = nullptr; +// Node* right = nullptr; +// explicit Node(T value) : value(value) {} +// Node(T value, Node* left, Node* right) : value(value), left(left), right(right) {} +// +// ~Node() { +// if (left) delete left; +// if (right) delete right; +// } +// }; +// +// Node* root = nullptr; +// +// void Add(T value) { +// if (!root) { +// root = new Node(value); +// return; +// } +// Node* current = root; +// while (true) { +// if (value < current->value) { +// if (current->left != nullptr) { +// current = current->left; +// } else { +// current->left = new Node(value); +// break; +// } +// } else { +// if (current->right != nullptr) { +// current = current->right; +// } else { +// current->right = new Node(value); +// break; +// } +// } +// } +// } +//}; #endif // MOBAGEN_TREE_H diff --git a/core/datastructures/Vector.cpp b/core/datastructures/Vector.cpp new file mode 100644 index 00000000..c8b1ec53 --- /dev/null +++ b/core/datastructures/Vector.cpp @@ -0,0 +1,5 @@ +// +// Created by Alexandre Tolstenko Nogueira on 2023.10.25. +// + +#include "Vector.h" diff --git a/core/datastructures/Vector.h b/core/datastructures/Vector.h new file mode 100644 index 00000000..cce8b5aa --- /dev/null +++ b/core/datastructures/Vector.h @@ -0,0 +1,37 @@ +#ifndef MOBAGEN_VECTOR_H +#define MOBAGEN_VECTOR_H +/*** + * + * @brief This is just me trying to improve my skills dont use this as a vector replacement + * + * @tparam T data type to hold inside the container + */ +template struct Vector { +private: + T* buffer; + // Constructors + // default (1) + // vector(); + // explicit vector (const allocator_type& alloc); + + // fill (2) + // explicit vector (size_type n, const allocator_type& alloc = allocator_type()); + // vector (size_type n, const value_type& val, const allocator_type& alloc = allocator_type()); + + // range (3) + // template vector (InputIterator first, InputIterator last, const allocator_type& alloc = allocator_type()); + + // copy (4) + // vector (const vector& x);vector (const vector& x, const allocator_type& alloc); + + // move (5) + // vector (vector&& x); + // vector (vector&& x, const allocator_type& alloc); + + // initializer list (6) + // vector (initializer_list il, const allocator_type& alloc = allocator_type()); + + ~Vector(); +}; + +#endif // MOBAGEN_VECTOR_H diff --git a/core/datastructures/concepts.h b/core/datastructures/concepts.h index 5942b405..43e54cb4 100644 --- a/core/datastructures/concepts.h +++ b/core/datastructures/concepts.h @@ -6,18 +6,21 @@ #include template -concept Hashable = requires(T a) { +concept HashableConcept = requires(T a) { { std::hash{}(a) } -> std::convertible_to; }; template -concept Integral = std::is_integral::value; +concept IntegralConcept = std::integral; template -concept Float = std::is_floating_point::value; +concept FloatConcept = std::floating_point; template -concept Sortable = requires(T a, T b) { +concept NumberConcept = std::integral || std::floating_point; + +template +concept SortableConcept = requires(T a, T b) { { a < b } -> std::convertible_to; }; diff --git a/core/engine/Engine.cpp b/core/engine/Engine.cpp index 3cdec0a5..ca9de3a0 100644 --- a/core/engine/Engine.cpp +++ b/core/engine/Engine.cpp @@ -115,7 +115,7 @@ void Engine::Tick() { toDestroy.clear(); } - ImGui_ImplSDLRenderer2_RenderDrawData(ImGui::GetDrawData(),window->sdlRenderer); + ImGui_ImplSDLRenderer2_RenderDrawData(ImGui::GetDrawData(), window->sdlRenderer); SDL_RenderPresent(window->sdlRenderer); } diff --git a/core/scene/Object.h b/core/scene/Object.h index a20fea06..0fcd42d5 100644 --- a/core/scene/Object.h +++ b/core/scene/Object.h @@ -35,7 +35,7 @@ class Object { static void DontDestroyOnLoad(const Object& object){}; public: - std::string ToString(){return _name;}; + std::string ToString() { return _name; }; }; #endif // MOBAGEN_ENGINE_OBJECT_H_ diff --git a/core/scene/ScriptableObject.h b/core/scene/ScriptableObject.h index c7f19088..1d2315d0 100644 --- a/core/scene/ScriptableObject.h +++ b/core/scene/ScriptableObject.h @@ -21,7 +21,8 @@ class ScriptableObject : public Object { // methods template - requires std::is_base_of::value static T* CreateInstance(Engine* engine) { // todo: remove dependency of engine + requires std::is_base_of::value + static T* CreateInstance(Engine* engine) { // todo: remove dependency of engine return new T(engine); } }; diff --git a/core/script/Script.h b/core/script/Script.h index 2707aaa4..c68c610b 100644 --- a/core/script/Script.h +++ b/core/script/Script.h @@ -1,10 +1,10 @@ -//#ifndef MOBAGEN_SCRIPT_H -//#define MOBAGEN_SCRIPT_H +// #ifndef MOBAGEN_SCRIPT_H +// #define MOBAGEN_SCRIPT_H // -//#include +// #include // -// class Script { +// class Script { // -//}; +// }; // -//#endif // MOBAGEN_SCRIPT_H +// #endif // MOBAGEN_SCRIPT_H diff --git a/core/script/ScriptManager.cpp b/core/script/ScriptManager.cpp index 0ad88fc1..ad334406 100644 --- a/core/script/ScriptManager.cpp +++ b/core/script/ScriptManager.cpp @@ -1,6 +1,6 @@ -//#include "ScriptManager.h" -//#include "quickjspp.hpp" +// #include "ScriptManager.h" +// #include "quickjspp.hpp" // -// void ScriptManager::Initialize() { +// void ScriptManager::Initialize() { // -//} +// } diff --git a/core/script/ScriptManager.h b/core/script/ScriptManager.h index f881b826..a007794c 100644 --- a/core/script/ScriptManager.h +++ b/core/script/ScriptManager.h @@ -1,7 +1,7 @@ -//#ifndef MOBAGEN_SCRIPTMANAGER_H -//#define MOBAGEN_SCRIPTMANAGER_H +// #ifndef MOBAGEN_SCRIPTMANAGER_H +// #define MOBAGEN_SCRIPTMANAGER_H // -//#include "quickjspp.hpp" +// #include "quickjspp.hpp" // //// todo: generate bindings for quickjs. see https://github.com/ftk/quickjspp/tree/master/binding-generator // @@ -25,4 +25,4 @@ // ScriptManager() = default; // }; // -//#endif // MOBAGEN_SCRIPTMANAGER_H +// #endif // MOBAGEN_SCRIPTMANAGER_H diff --git a/documentation/Architecture.md b/documentation/Architecture.md index cc89b44e..7730070d 100644 --- a/documentation/Architecture.md +++ b/documentation/Architecture.md @@ -6,16 +6,16 @@ https://playground.diagram.codes/d/system-layers ``` -V[core,engine,editor] with label "Architecture" +V[Interfaces,glue,engine,editor] with label "Architecture" -core=H["Math","Containers &\nData Converters","Log",platform] with label "Core" +glue=H["Math","Containers &\nData Converters","Log",platform] with label "Glue" platform=H[mobile,desktop,web] with label "Platform Specific" mobile=H["android","ios"] with label "Mobile" desktop=H["win","osx","linux"] with label "Desktop" web=H["wasm"] with label "WEB" -engine=H[orchestrator,rendering,physics,resource,animation,networking,gameplay] with label "Engine Modules" +engine=H[orchestrator,rendering,physics,resource,animation,networking,gameplay] with label "Modules" rendering=V["GUI","Rendering","Shaders","Scripting","Materials"] with label "Graphics" physics=V["Particles","Collision","RigidBody","Constraints"] with label "Physics" diff --git a/editor/Editor.cpp b/editor/Editor.cpp index 7a99bd7c..5883b3cc 100644 --- a/editor/Editor.cpp +++ b/editor/Editor.cpp @@ -1,54 +1,54 @@ -//#include "Editor.h" -//#include "imgui.h" -//#include "Engine.h" +// #include "Editor.h" +// #include "imgui.h" +// #include "Engine.h" // -// void Editor::OnGui(ImGuiContext *context) { -// ImGui::SetCurrentContext(context); -// if (ImGui::BeginMainMenuBar()) -// { -// if (ImGui::BeginMenu("File")) -// { -// ImGui::MenuItem("New Scene"); -// ImGui::MenuItem("Open Scene"); -// ImGui::MenuItem("Open Recent"); -// ImGui::Separator(); -// ImGui::MenuItem("Save"); -// ImGui::MenuItem("Save As..."); -// ImGui::MenuItem("Save As Scene Template..."); -// ImGui::Separator(); -// ImGui::MenuItem("New Project..."); -// ImGui::MenuItem("Open Project..."); -// ImGui::MenuItem("Save Project"); -// ImGui::Separator(); -// ImGui::MenuItem("Build Settings"); -// ImGui::Separator(); -// if(ImGui::MenuItem("Exit")) -// engine->Exit(); +// void Editor::OnGui(ImGuiContext *context) { +// ImGui::SetCurrentContext(context); +// if (ImGui::BeginMainMenuBar()) +// { +// if (ImGui::BeginMenu("File")) +// { +// ImGui::MenuItem("New Scene"); +// ImGui::MenuItem("Open Scene"); +// ImGui::MenuItem("Open Recent"); +// ImGui::Separator(); +// ImGui::MenuItem("Save"); +// ImGui::MenuItem("Save As..."); +// ImGui::MenuItem("Save As Scene Template..."); +// ImGui::Separator(); +// ImGui::MenuItem("New Project..."); +// ImGui::MenuItem("Open Project..."); +// ImGui::MenuItem("Save Project"); +// ImGui::Separator(); +// ImGui::MenuItem("Build Settings"); +// ImGui::Separator(); +// if(ImGui::MenuItem("Exit")) +// engine->Exit(); // -// ImGui::EndMenu(); -// } -// if(ImGui::BeginMenu("Edit")) { -// ImGui::EndMenu(); -// } -// if(ImGui::BeginMenu("Assets")) { -// ImGui::EndMenu(); -// } -// if(ImGui::BeginMenu("GameObject")) { -// ImGui::EndMenu(); -// } -// if(ImGui::BeginMenu("Component")) { -// ImGui::EndMenu(); -// } -// if(ImGui::BeginMenu("Window")) { -// ImGui::EndMenu(); -// } -// if(ImGui::BeginMenu("Help")) { -// ImGui::EndMenu(); -// } -// ImGui::Separator(); -// ImGui::Text("%.3fms (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate); -// ImGui::EndMenuBar(); -// } -//} +// ImGui::EndMenu(); +// } +// if(ImGui::BeginMenu("Edit")) { +// ImGui::EndMenu(); +// } +// if(ImGui::BeginMenu("Assets")) { +// ImGui::EndMenu(); +// } +// if(ImGui::BeginMenu("GameObject")) { +// ImGui::EndMenu(); +// } +// if(ImGui::BeginMenu("Component")) { +// ImGui::EndMenu(); +// } +// if(ImGui::BeginMenu("Window")) { +// ImGui::EndMenu(); +// } +// if(ImGui::BeginMenu("Help")) { +// ImGui::EndMenu(); +// } +// ImGui::Separator(); +// ImGui::Text("%.3fms (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate); +// ImGui::EndMenuBar(); +// } +// } // -// Editor::Editor(Engine *pEngine) : GameObject(pEngine) {} \ No newline at end of file +// Editor::Editor(Engine *pEngine) : GameObject(pEngine) {} \ No newline at end of file diff --git a/editor/Editor.h b/editor/Editor.h index bdf7f9c0..3c9881c5 100644 --- a/editor/Editor.h +++ b/editor/Editor.h @@ -1,11 +1,11 @@ -//#ifndef EDITOR_H -//#define EDITOR_H +// #ifndef EDITOR_H +// #define EDITOR_H // -//#include "GameObject.h" +// #include "GameObject.h" // -// class Editor: GameObject { -// public: -// explicit Editor(Engine *pEngine); -// void OnGui(ImGuiContext *context) override; -//}; -//#endif \ No newline at end of file +// class Editor: GameObject { +// public: +// explicit Editor(Engine *pEngine); +// void OnGui(ImGuiContext *context) override; +// }; +// #endif \ No newline at end of file diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index c05ab69a..2f0e9570 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -1,18 +1,3 @@ -macro(SUBDIRLIST result curdir) - file( - GLOB children CONFIGURE_DEPENDS - RELATIVE ${curdir} - ${curdir}/* - ) - set(dirlist "") - foreach(child ${children}) - if(IS_DIRECTORY ${curdir}/${child}) - list(APPEND dirlist ${child}) - endif() - endforeach() - set(${result} ${dirlist}) -endmacro() - subdirlist(SUBDIRS ${CMAKE_CURRENT_SOURCE_DIR}) foreach(subdir ${SUBDIRS}) diff --git a/examples/catchthecat/Agent.cpp b/examples/catchthecat/Agent.cpp index 14bc0920..abf34dd2 100644 --- a/examples/catchthecat/Agent.cpp +++ b/examples/catchthecat/Agent.cpp @@ -4,30 +4,31 @@ #include #include "World.h" using namespace std; -std::vector Agent::generatePath(World* w){ - unordered_map cameFrom; // to build the flowfield and build the path - queue frontier; // to store next ones to visit - unordered_set frontierSet; // OPTIMIZATION to check faster if a point is in the queue - unordered_map visited; // use .at() to get data, if the element dont exist [] will give you wrong results +std::vector Agent::generatePath(World* w) { + unordered_map cameFrom; // to build the flowfield and build the path + queue frontier; // to store next ones to visit + unordered_set frontierSet; // OPTIMIZATION to check faster if a point is in the queue + unordered_map visited; // use .at() to get data, if the element dont exist [] will give you wrong results // bootstrap state auto catPos = w->getCat(); frontier.push(catPos); frontierSet.insert(catPos); - Point2D borderExit = Point2D::INFINITE; // if at the end of the loop we dont find a border, we have to return random points + Point2D borderExit = Point2D::INFINITE; // if at the end of the loop we dont find a border, we have to return random points - while (!frontier.empty()){ + while (!frontier.empty()) { // get the current from frontier // remove the current from frontierset // mark current as visited // getVisitableNeightbors(world, current) returns a vector of neighbors that are not visited, not cat, not block, not in the queue // iterate over the neighs: - // for every neighbor set the cameFrom - // enqueue the neighbors to frontier and frontierset + // for every neighbor set the cameFrom + // enqueue the neighbors to frontier and frontierset // do this up to find a visitable border and break the loop } // if the border is not infinity, build the path from border to the cat using the camefrom map // if there isnt a reachable border, just return empty vector // if your vector is filled from the border to the cat, the first element is the catcher move, and the last element is the cat move + return vector(); } diff --git a/examples/catchthecat/World.cpp b/examples/catchthecat/World.cpp index c00e8a66..11d5f5c6 100644 --- a/examples/catchthecat/World.cpp +++ b/examples/catchthecat/World.cpp @@ -163,8 +163,7 @@ void World::OnGui(ImGuiContext* context) { ImGui::SetNextWindowPos(pos, ImGuiCond_Always, ImVec2(0.5f, 0.5f)); ImGuiWindowFlags flags = ImGuiWindowFlags_NoMove | ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoSavedSettings; ImGui::Begin("Game Over", nullptr, flags); - if (ImGui::Button("OK", ImVec2(200, 0))) - clearWorld(); + if (ImGui::Button("OK", ImVec2(200, 0))) clearWorld(); ImGui::End(); } } diff --git a/examples/life/rules/HexagonGameOfLife.cpp b/examples/life/rules/HexagonGameOfLife.cpp index 8f1ffcb4..5eeb3397 100644 --- a/examples/life/rules/HexagonGameOfLife.cpp +++ b/examples/life/rules/HexagonGameOfLife.cpp @@ -3,49 +3,5 @@ // #include "HexagonGameOfLife.h" -#include -void HexagonGameOfLife::Step(World& world) { - for (int y = 0; y < world.SideSize(); ++y) { - for (int x = 0; x < world.SideSize(); ++x) - { - int neighbors = CountNeighbors(world,Point2D(x,y)); - if (neighbors==2)//(neighbors==2&&world.Get(Point2D(x,y)))|| - { - world.SetNext(Point2D(x,y), true); - } - else - { - world.SetNext(Point2D(x,y), false); - } - } - } - - world.SwapBuffers(); -} -int HexagonGameOfLife::CountNeighbors(World& world, Point2D point) { - int count; -//assume 1,1 - bool shift =point.y%2!=0; - if (shift){//assume 1,1 - count= world.Get(point.Up())+//1,0 - world.Get(point.Right().Up())+//2,0 - world.Get(point.Right())+//2,1 - world.Get(point.Right().Down())+//2,2 - world.Get(point.Down())+//1,2 - world.Get(point.Left());//0,1 - - - } - else{//assume 2,2 - count = world.Get(point.Up().Left())+//1,1 - world.Get(point.Up())+//2,1 - world.Get(point.Right())+//3,2 - world.Get(point.Down())+//2,3 - world.Get(point.Down().Left())+//1,3 - world.Get(point.Left());//1,2 - } - - return count; - - -} +void HexagonGameOfLife::Step(World& world) {} +int HexagonGameOfLife::CountNeighbors(World& world, Point2D point) { return 0; } diff --git a/examples/life/rules/JohnConway.cpp b/examples/life/rules/JohnConway.cpp index 00f75e1f..eb59e8d3 100644 --- a/examples/life/rules/JohnConway.cpp +++ b/examples/life/rules/JohnConway.cpp @@ -2,9 +2,10 @@ // Reference: https://playgameoflife.com/info void JohnConway::Step(World& world) { - + // todo: implement } int JohnConway::CountNeighbors(World& world, Point2D point) { - + // todo: implement + return 0; } diff --git a/examples/maze/World.h b/examples/maze/World.h index 2c00da3b..f0e12f7e 100644 --- a/examples/maze/World.h +++ b/examples/maze/World.h @@ -20,7 +20,7 @@ class World : GameObject { int64_t moveDuration = 0; int64_t totalTime = 0; - // .= + // ._ // | // even indexes are top elements; // odd indexes are left elements; diff --git a/examples/maze/generators/HuntAndKillExample.cpp b/examples/maze/generators/HuntAndKillExample.cpp index 2ff78623..da8ca88e 100644 --- a/examples/maze/generators/HuntAndKillExample.cpp +++ b/examples/maze/generators/HuntAndKillExample.cpp @@ -3,7 +3,8 @@ #include "Random.h" #include bool HuntAndKillExample::Step(World* w) { - + // todo: code this + return false; } void HuntAndKillExample::Clear(World* world) { visited.clear(); @@ -30,6 +31,8 @@ std::vector HuntAndKillExample::getVisitables(World* w, const Point2D& auto sideOver2 = w->GetSize() / 2; std::vector visitables; + // todo: code this + return visitables; } std::vector HuntAndKillExample::getVisitedNeighbors(World* w, const Point2D& p) { @@ -37,5 +40,7 @@ std::vector HuntAndKillExample::getVisitedNeighbors(World* w, const Poi auto sideOver2 = w->GetSize() / 2; std::vector neighbors; + // todo: code this + return neighbors; } diff --git a/examples/maze/generators/PrimExample.cpp b/examples/maze/generators/PrimExample.cpp index ee0f0c9b..dfe45090 100644 --- a/examples/maze/generators/PrimExample.cpp +++ b/examples/maze/generators/PrimExample.cpp @@ -5,6 +5,8 @@ bool PrimExample::Step(World* w) { int sideOver2 = w->GetSize() / 2; + // todo: code this + return true; } void PrimExample::Clear(World* world) { @@ -17,7 +19,7 @@ std::vector PrimExample::getVisitables(World* w, const Point2D& p) { std::vector visitables; auto clearColor = Color::DarkGray; - + // todo: code this return visitables; } @@ -27,5 +29,7 @@ std::vector PrimExample::getVisitedNeighbors(World* w, const Point2D& p auto sideOver2 = w->GetSize() / 2; std::vector neighbors; + // todo: code this + return neighbors; } diff --git a/examples/maze/generators/RecursiveBacktrackerExample.cpp b/examples/maze/generators/RecursiveBacktrackerExample.cpp index 70cfcedb..778dae13 100644 --- a/examples/maze/generators/RecursiveBacktrackerExample.cpp +++ b/examples/maze/generators/RecursiveBacktrackerExample.cpp @@ -3,7 +3,8 @@ #include "RecursiveBacktrackerExample.h" #include bool RecursiveBacktrackerExample::Step(World* w) { - + // todo: implement this + return false; } void RecursiveBacktrackerExample::Clear(World* world) { @@ -31,5 +32,7 @@ std::vector RecursiveBacktrackerExample::getVisitables(World* w, const auto sideOver2 = w->GetSize() / 2; std::vector visitables; + // todo: implement this + return visitables; } diff --git a/examples/scenario/generators/ParticleGenerator.h b/examples/scenario/generators/ParticleGenerator.h index 4a3820f7..41cacc0c 100644 --- a/examples/scenario/generators/ParticleGenerator.h +++ b/examples/scenario/generators/ParticleGenerator.h @@ -1,5 +1,6 @@ #ifndef MOBAGEN_PARTICLEGENERATOR_H #define MOBAGEN_PARTICLEGENERATOR_H +#define GLM_ENABLE_EXPERIMENTAL // to use glm::normal // reference: https://github.com/weigert/SimpleErosion #include "../GeneratorBase.h" diff --git a/modules/CMakeLists.txt b/modules/CMakeLists.txt index ab9d7ca8..2f0e9570 100644 --- a/modules/CMakeLists.txt +++ b/modules/CMakeLists.txt @@ -1,20 +1,5 @@ -macro(SUBDIRLIST result curdir) - file( - GLOB children CONFIGURE_DEPENDS - RELATIVE ${curdir} - ${curdir}/* - ) - set(dirlist "") - foreach(child ${children}) - if(IS_DIRECTORY ${curdir}/${child}) - list(APPEND dirlist ${child}) - endif() - endforeach() - set(${result} ${dirlist}) -endmacro() - subdirlist(SUBDIRS ${CMAKE_CURRENT_SOURCE_DIR}) foreach(subdir ${SUBDIRS}) - add_subdirectory(${subdir}) + add_subdirectory(${subdir}) endforeach() diff --git a/modules/time/CMakeLists.txt b/modules/time/CMakeLists.txt index aa67dafd..dd97732a 100644 --- a/modules/time/CMakeLists.txt +++ b/modules/time/CMakeLists.txt @@ -1,21 +1,21 @@ -#set(BUILD_SHARED_LIBS FALSE) +# set(BUILD_SHARED_LIBS FALSE) # todo: isolate interfaces in a folder so you can use other time implementations file( - GLOB_RECURSE TIME_INC CONFIGURE_DEPENDS - RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} - *.h *.hpp + GLOB_RECURSE TIME_INC CONFIGURE_DEPENDS + RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} + *.h *.hpp ) file( - GLOB_RECURSE TIME_SRC CONFIGURE_DEPENDS - RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} - *.c *.cpp + GLOB_RECURSE TIME_SRC CONFIGURE_DEPENDS + RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} + *.c *.cpp ) set(TIME_INC_DIR - ${CMAKE_CURRENT_SOURCE_DIR} - CACHE PATH "TIME INCLUDE SOURCE PATH" + ${CMAKE_CURRENT_SOURCE_DIR} + CACHE PATH "TIME INCLUDE SOURCE PATH" ) add_library(time STATIC ${TIME_SRC} ${TIME_INC}) diff --git a/modules/time/Time.cpp b/modules/time/Time.cpp index 7ead2241..dc3a1850 100644 --- a/modules/time/Time.cpp +++ b/modules/time/Time.cpp @@ -9,4 +9,4 @@ namespace MoBaGEn::TimeManager { Duration Time::GetElapsedTime() { return Now() - m_startTime; } TimePoint Time::Now() { return std::chrono::high_resolution_clock::now(); } -} \ No newline at end of file +} // namespace MoBaGEn::TimeManager \ No newline at end of file diff --git a/modules/time/Time.h b/modules/time/Time.h index 563ed15b..215ee9c6 100644 --- a/modules/time/Time.h +++ b/modules/time/Time.h @@ -11,9 +11,9 @@ namespace MoBaGEn::TimeManager { class Time { public: /** - * @brief Get the current wall time - * - * @return TimePoint + * @brief Get the current wall time + * + * @return TimePoint */ static TimePoint Now(); @@ -22,11 +22,11 @@ namespace MoBaGEn::TimeManager { public: /** - * @brief Get the Elapsed Time since the start of the program - * - * @return Duration + * @brief Get the Elapsed Time since the start of the program + * + * @return Duration */ static Duration GetElapsedTime(); }; -} +} // namespace MoBaGEn::TimeManager #endif // MOBAGEN_TIME_H diff --git a/modules/time/TimeDefs.h b/modules/time/TimeDefs.h index 5c2f8336..3498b414 100644 --- a/modules/time/TimeDefs.h +++ b/modules/time/TimeDefs.h @@ -9,16 +9,16 @@ namespace MoBaGEn::TimeManager { /** - * @brief TimePoint is a type alias for std::chrono::time_point - * @description rename std::chrono::time_point to TimePoint + * @brief TimePoint is a type alias for std::chrono::time_point + * @description rename std::chrono::time_point to TimePoint */ using TimePoint = std::chrono::time_point; /** - * @brief Duration is a type alias for std::chrono::duration - * @description rename std::chrono::duration to Duration + * @brief Duration is a type alias for std::chrono::duration + * @description rename std::chrono::duration to Duration */ using Duration = std::chrono::duration; -} +} // namespace MoBaGEn::TimeManager #endif // MOBAGEN_TIMEDEFS_H diff --git a/test/GameObjects.tests.cpp b/test/GameObjects.tests.cpp index 451f18bc..bccbe44d 100644 --- a/test/GameObjects.tests.cpp +++ b/test/GameObjects.tests.cpp @@ -1,8 +1,8 @@ -//#define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN +// #define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN // -//#include -//#include "engine/Engine.h" -//#include "scene/GameObject.h" +// #include +// #include "engine/Engine.h" +// #include "scene/GameObject.h" // ////TEST_CASE("Test GameObjects") { //// auto engine = new Engine(); diff --git a/test/NullRenderer.tests.cpp b/test/NullRenderer.tests.cpp index d2bd35ad..e77ebca3 100644 --- a/test/NullRenderer.tests.cpp +++ b/test/NullRenderer.tests.cpp @@ -1,22 +1,22 @@ -//#define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN +// #define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN // -//#include -//#include "engine/Engine.h" -//#include "scene/GameObject.h" +// #include +// #include "engine/Engine.h" +// #include "scene/GameObject.h" // -// class Quitter : public GameObject { -// public: -// explicit Quitter(Engine* pEngine) : GameObject(pEngine){}; -// void Update(float time) override { engine->Exit(); } -//}; +// class Quitter : public GameObject { +// public: +// explicit Quitter(Engine* pEngine) : GameObject(pEngine){}; +// void Update(float time) override { engine->Exit(); } +// }; // -// TEST_CASE("Engine should run without Renderering") { -// auto* engine = new Engine(); -// if (engine->Start("Test engine")) { -// new Quitter(engine); -// engine->Run(); -// } -// engine->Exit(); -// delete engine; -// engine = nullptr; -//} \ No newline at end of file +// TEST_CASE("Engine should run without Renderering") { +// auto* engine = new Engine(); +// if (engine->Start("Test engine")) { +// new Quitter(engine); +// engine->Run(); +// } +// engine->Exit(); +// delete engine; +// engine = nullptr; +// } \ No newline at end of file diff --git a/test/Test.cpp b/test/Test.cpp index af264c20..c9754669 100644 --- a/test/Test.cpp +++ b/test/Test.cpp @@ -3,7 +3,7 @@ #include #include "engine/Engine.h" #include "scene/GameObject.h" -//#include "cpr/cpr.h" +// #include "cpr/cpr.h" class Quitter : public GameObject { public: