diff --git a/CMakeLists.txt b/CMakeLists.txt index d7e36036..2ba47cf3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,6 +3,9 @@ project(bomberman) set(CMAKE_CXX_STANDARD 20) +set(CMAKE_C_FLAGS -O2) +set(CMAKE_CXX_FLAGS -O2) + include_directories(lib/Ray/sources) include_directories(lib/wal/sources) include_directories(lib/LuaGate/sources) diff --git a/sources/Component/Animation/AnimationsComponent.cpp b/sources/Component/Animation/AnimationsComponent.cpp index 26367a0b..e53cc259 100644 --- a/sources/Component/Animation/AnimationsComponent.cpp +++ b/sources/Component/Animation/AnimationsComponent.cpp @@ -29,7 +29,7 @@ namespace BBM return this->_modelAnimation.at(this->_currentAnimIndex).getFrameCounter(); } - RAY::ModelAnimation AnimationsComponent::getCurrentModelAnim() + RAY::ModelAnimation &AnimationsComponent::getCurrentModelAnim() { return this->_modelAnimation[this->_currentAnimIndex]; } diff --git a/sources/Component/Animation/AnimationsComponent.hpp b/sources/Component/Animation/AnimationsComponent.hpp index 36f22a6a..a1daa591 100644 --- a/sources/Component/Animation/AnimationsComponent.hpp +++ b/sources/Component/Animation/AnimationsComponent.hpp @@ -34,7 +34,7 @@ namespace BBM size_t getCurrentAnimFrameCounter() const; //! @brief get the current - RAY::ModelAnimation getCurrentModelAnim(); + RAY::ModelAnimation &getCurrentModelAnim(); //! @brief set the anim frame counter void setCurrentAnimFrameCounter(size_t animFrameCounter); diff --git a/sources/Runner/Runner.cpp b/sources/Runner/Runner.cpp index 98507d1f..b56b94fc 100644 --- a/sources/Runner/Runner.cpp +++ b/sources/Runner/Runner.cpp @@ -106,7 +106,7 @@ namespace BBM .addSystem() .addSystem() .addSystem() - .addSystem() +// .addSystem() .addSystem() .addSystem(); } diff --git a/sources/System/Animation/AnimationsSystem.cpp b/sources/System/Animation/AnimationsSystem.cpp index 5aaa4597..65bd7e0b 100644 --- a/sources/System/Animation/AnimationsSystem.cpp +++ b/sources/System/Animation/AnimationsSystem.cpp @@ -15,10 +15,15 @@ namespace BBM : System(wal) {} - void AnimationsSystem::onUpdate(WAL::ViewEntity &entity, std::chrono::nanoseconds) + void AnimationsSystem::onFixedUpdate(WAL::ViewEntity &entity) { auto &model = entity.get(); auto &anim = entity.get(); + static int count = 0; + + count++; + if (count % 2) + return; if (anim.isDisabled()) return; @@ -26,6 +31,7 @@ namespace BBM if (modelPtr) { modelPtr->setAnimation(anim.getCurrentModelAnim()); anim.incCurrentAnimFrameCounter(); + anim.incCurrentAnimFrameCounter(); } } } \ No newline at end of file diff --git a/sources/System/Animation/AnimationsSystem.hpp b/sources/System/Animation/AnimationsSystem.hpp index 6ace28d8..bf71460e 100644 --- a/sources/System/Animation/AnimationsSystem.hpp +++ b/sources/System/Animation/AnimationsSystem.hpp @@ -14,7 +14,7 @@ namespace BBM { public: //! @inherit - void onUpdate(WAL::ViewEntity &entity, std::chrono::nanoseconds) override; + void onFixedUpdate(WAL::ViewEntity &entity) override; //! @brief A default constructor explicit AnimationsSystem(WAL::Wal &wal);