From e298ce03eb784c5f0908417b427e6f51b0405bb5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Le=20Bihan?= Date: Tue, 1 Jun 2021 15:52:47 +0200 Subject: [PATCH 01/14] starting to implement a AnimationComponent.cpp/.hpp --- CMakeLists.txt | 2 ++ .../Animation/AnimationComponent.cpp | 16 ++++++++++ .../Animation/AnimationComponent.hpp | 31 +++++++++++++++++++ 3 files changed, 49 insertions(+) create mode 100644 sources/Component/Animation/AnimationComponent.cpp create mode 100644 sources/Component/Animation/AnimationComponent.hpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 763064ac..81b3c154 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -54,6 +54,8 @@ set(SOURCES sources/Component/Renderer/CameraComponent.hpp sources/System/Renderer/Render2DScreenSystem.cpp sources/System/Renderer/Render2DScreenSystem.hpp + sources/Component/Animation/AnimationComponent.cpp + sources/Component/Animation/AnimationComponent.hpp ) add_executable(bomberman diff --git a/sources/Component/Animation/AnimationComponent.cpp b/sources/Component/Animation/AnimationComponent.cpp new file mode 100644 index 00000000..d1f8210b --- /dev/null +++ b/sources/Component/Animation/AnimationComponent.cpp @@ -0,0 +1,16 @@ +// +// Created by cbihan on 01/06/2021. +// + +#include "AnimationComponent.hpp" +#include "Entity/Entity.hpp" + +namespace BBM +{ + AnimationComponent::AnimationComponent(WAL::Entity &entity, RAY::ModelAnimation &modelAnimation) + : WAL::Component(entity), + _modelAnimation(modelAnimation) + { + + } +} \ No newline at end of file diff --git a/sources/Component/Animation/AnimationComponent.hpp b/sources/Component/Animation/AnimationComponent.hpp new file mode 100644 index 00000000..36946c16 --- /dev/null +++ b/sources/Component/Animation/AnimationComponent.hpp @@ -0,0 +1,31 @@ +// +// Created by cbihan on 01/06/2021. +// + +#pragma once + +#include +#include "Component/Component.hpp" +#include "Entity/Entity.hpp" +#include "Model/Model.hpp" + +namespace BBM +{ + + class AnimationComponent : public WAL::Component + { + private: + //! @brief To get the animation data + RAY::ModelAnimation &_modelAnimation; + public: + //! @brief ctor entity and the path of the animation file + explicit AnimationComponent(WAL::Entity &entity, RAY::ModelAnimation &modelAnimation); + //! @brief copy ctor + AnimationComponent(const AnimationComponent &) = default; + //! @brief dtor + ~AnimationComponent() override = default; + //! @brief assignment operator + AnimationComponent &operator=(const AnimationComponent &) = delete; + }; + +} From b4d783d6c21788a9469e13331138488aada318e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Le=20Bihan?= Date: Tue, 1 Jun 2021 17:26:01 +0200 Subject: [PATCH 02/14] adding AnimationsSystem.cpp --- CMakeLists.txt | 9 ++-- .../Animation/AnimationComponent.cpp | 16 ------- .../Animation/AnimationComponent.hpp | 31 ------------ .../Animation/AnimationsComponent.cpp | 43 +++++++++++++++++ .../Animation/AnimationsComponent.hpp | 47 +++++++++++++++++++ sources/System/Animation/AnimationsSystem.cpp | 27 +++++++++++ sources/System/Animation/AnimationsSystem.hpp | 25 ++++++++++ .../Controllable/ControllableSystem.cpp | 2 - .../Controllable/ControllableSystem.hpp | 2 +- 9 files changed, 149 insertions(+), 53 deletions(-) delete mode 100644 sources/Component/Animation/AnimationComponent.cpp delete mode 100644 sources/Component/Animation/AnimationComponent.hpp create mode 100644 sources/Component/Animation/AnimationsComponent.cpp create mode 100644 sources/Component/Animation/AnimationsComponent.hpp create mode 100644 sources/System/Animation/AnimationsSystem.cpp create mode 100644 sources/System/Animation/AnimationsSystem.hpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 81b3c154..b17dc1aa 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -54,13 +54,16 @@ set(SOURCES sources/Component/Renderer/CameraComponent.hpp sources/System/Renderer/Render2DScreenSystem.cpp sources/System/Renderer/Render2DScreenSystem.hpp - sources/Component/Animation/AnimationComponent.cpp - sources/Component/Animation/AnimationComponent.hpp + sources/Component/Animation/AnimationsComponent.cpp + sources/Component/Animation/AnimationsComponent.hpp + sources/System/Animation/AnimationsSystem.cpp + sources/System/Animation/AnimationsSystem.hpp ) add_executable(bomberman sources/main.cpp - ${SOURCES}) + ${SOURCES} + ) target_include_directories(bomberman PUBLIC sources) target_link_libraries(bomberman PUBLIC wal ray) diff --git a/sources/Component/Animation/AnimationComponent.cpp b/sources/Component/Animation/AnimationComponent.cpp deleted file mode 100644 index d1f8210b..00000000 --- a/sources/Component/Animation/AnimationComponent.cpp +++ /dev/null @@ -1,16 +0,0 @@ -// -// Created by cbihan on 01/06/2021. -// - -#include "AnimationComponent.hpp" -#include "Entity/Entity.hpp" - -namespace BBM -{ - AnimationComponent::AnimationComponent(WAL::Entity &entity, RAY::ModelAnimation &modelAnimation) - : WAL::Component(entity), - _modelAnimation(modelAnimation) - { - - } -} \ No newline at end of file diff --git a/sources/Component/Animation/AnimationComponent.hpp b/sources/Component/Animation/AnimationComponent.hpp deleted file mode 100644 index 36946c16..00000000 --- a/sources/Component/Animation/AnimationComponent.hpp +++ /dev/null @@ -1,31 +0,0 @@ -// -// Created by cbihan on 01/06/2021. -// - -#pragma once - -#include -#include "Component/Component.hpp" -#include "Entity/Entity.hpp" -#include "Model/Model.hpp" - -namespace BBM -{ - - class AnimationComponent : public WAL::Component - { - private: - //! @brief To get the animation data - RAY::ModelAnimation &_modelAnimation; - public: - //! @brief ctor entity and the path of the animation file - explicit AnimationComponent(WAL::Entity &entity, RAY::ModelAnimation &modelAnimation); - //! @brief copy ctor - AnimationComponent(const AnimationComponent &) = default; - //! @brief dtor - ~AnimationComponent() override = default; - //! @brief assignment operator - AnimationComponent &operator=(const AnimationComponent &) = delete; - }; - -} diff --git a/sources/Component/Animation/AnimationsComponent.cpp b/sources/Component/Animation/AnimationsComponent.cpp new file mode 100644 index 00000000..d32c6818 --- /dev/null +++ b/sources/Component/Animation/AnimationsComponent.cpp @@ -0,0 +1,43 @@ +// +// Created by cbihan on 01/06/2021. +// + +#include "AnimationsComponent.hpp" +#include "Entity/Entity.hpp" +#include "Model/ModelAnimations.hpp" + +namespace BBM +{ + AnimationsComponent::AnimationsComponent(WAL::Entity &entity, RAY::ModelAnimations &modelAnimation) + : WAL::Component(entity), + _modelAnimation(modelAnimation), + _animFrameCounter(0) + { + } + + WAL::Component *AnimationsComponent::clone(WAL::Entity &entity) const + { + return new AnimationsComponent(entity, this->_modelAnimation); + } + + size_t AnimationsComponent::getAnimFrameCounter() const + { + return this->_animFrameCounter; + } + + RAY::ModelAnimation AnimationsComponent::getCurrentModelAnim() const + { + return this->_modelAnimation[static_cast(this->_animFrameCounter)]; + } + + void AnimationsComponent::setAnimFrameCounter(size_t animFrameCounter) + { + this->_animFrameCounter = animFrameCounter; + this->_animFrameCounter %= this->_modelAnimation.getAnimationsCount(); + } + + void AnimationsComponent::resetAnimFrameCounter() + { + this->_animFrameCounter = 0; + } +} \ No newline at end of file diff --git a/sources/Component/Animation/AnimationsComponent.hpp b/sources/Component/Animation/AnimationsComponent.hpp new file mode 100644 index 00000000..a3d741a9 --- /dev/null +++ b/sources/Component/Animation/AnimationsComponent.hpp @@ -0,0 +1,47 @@ +// +// Created by cbihan on 01/06/2021. +// + +#pragma once + +#include +#include +#include +#include + +namespace BBM +{ + class AnimationsComponent : public WAL::Component + { + private: + //! @brief To get the animation data + RAY::ModelAnimations &_modelAnimation; + //! @brief the frame animation counter + size_t _animFrameCounter; + public: + //! @inherit + WAL::Component *clone(WAL::Entity &entity) const override; + + //! @brief get animation frame counter + size_t getAnimFrameCounter() const; + + //! @brief get the current + RAY::ModelAnimation getCurrentModelAnim() const; + + //! @brief + void setAnimFrameCounter(size_t animFrameCounter); + + //! @brief Set the internal anim counter to 0 + void resetAnimFrameCounter(); + + //! @brief ctor entity and the path of the animation file + explicit AnimationsComponent(WAL::Entity &entity, RAY::ModelAnimations &modelAnimation); + //! @brief copy ctor + AnimationsComponent(const AnimationsComponent &) = default; + //! @brief dtor + ~AnimationsComponent() override = default; + //! @brief assignment operator + AnimationsComponent &operator=(const AnimationsComponent &) = delete; + }; + +} diff --git a/sources/System/Animation/AnimationsSystem.cpp b/sources/System/Animation/AnimationsSystem.cpp new file mode 100644 index 00000000..42425acf --- /dev/null +++ b/sources/System/Animation/AnimationsSystem.cpp @@ -0,0 +1,27 @@ +// +// Created by cbihan on 01/06/2021. +// + +#include "AnimationsSystem.hpp" +#include "Component/Animation/AnimationsComponent.hpp" +#include "Model/Model.hpp" +#include "Component/Renderer/Drawable3DComponent.hpp" + +namespace BBM +{ + + AnimationsSystem::AnimationsSystem() + : WAL::System({typeid(AnimationsComponent), + typeid(Drawable3DComponent)}) + { + } + + void AnimationsSystem::onFixedUpdate(WAL::Entity &entity) + { + auto &model = entity.getComponent>(); + auto &anim = entity.getComponent(); + + model.member.setAnimation(anim.getCurrentModelAnim()); + anim.setAnimFrameCounter(anim.getAnimFrameCounter() + 1); + } +} \ No newline at end of file diff --git a/sources/System/Animation/AnimationsSystem.hpp b/sources/System/Animation/AnimationsSystem.hpp new file mode 100644 index 00000000..eb508b3e --- /dev/null +++ b/sources/System/Animation/AnimationsSystem.hpp @@ -0,0 +1,25 @@ +// +// Created by cbihan on 01/06/2021. +// + +#pragma once + +#include + +namespace BBM +{ + class AnimationsSystem : public WAL::System + { + //! @inherit + void onFixedUpdate(WAL::Entity &entity) override; + + //! @brief A default constructor + AnimationsSystem(); + //! @brief A Controllable system is copy constructable + AnimationsSystem(const AnimationsSystem &) = default; + //! @brief A default destructor + ~AnimationsSystem() override = default; + //! @brief A Controllable system is assignable. + AnimationsSystem &operator=(const AnimationsSystem &) = default; + }; +} \ No newline at end of file diff --git a/sources/System/Controllable/ControllableSystem.cpp b/sources/System/Controllable/ControllableSystem.cpp index 0a9c789c..41c54895 100644 --- a/sources/System/Controllable/ControllableSystem.cpp +++ b/sources/System/Controllable/ControllableSystem.cpp @@ -10,8 +10,6 @@ namespace BBM { - float ControllableSystem::speed = .25f; - ControllableSystem::ControllableSystem() : WAL::System({ typeid(ControllableComponent), diff --git a/sources/System/Controllable/ControllableSystem.hpp b/sources/System/Controllable/ControllableSystem.hpp index fac4db08..ec6eef9d 100644 --- a/sources/System/Controllable/ControllableSystem.hpp +++ b/sources/System/Controllable/ControllableSystem.hpp @@ -14,7 +14,7 @@ namespace BBM { public: //! @brief The speed applied to every controllable entities. - static float speed; + static constexpr const float speed = .25f; //! @inherit void onFixedUpdate(WAL::Entity &entity) override; From d986a24c47025bc4de9127aadd9ebe15c74fe920 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Le=20Bihan?= Date: Wed, 2 Jun 2021 15:08:46 +0200 Subject: [PATCH 03/14] animation component should theoretically work --- lib/Ray/sources/Model/ModelAnimations.cpp | 2 +- .../Animation/AnimationsComponent.cpp | 37 +++++++++++++------ .../Animation/AnimationsComponent.hpp | 23 ++++++++---- sources/System/Animation/AnimationsSystem.cpp | 2 +- 4 files changed, 44 insertions(+), 20 deletions(-) diff --git a/lib/Ray/sources/Model/ModelAnimations.cpp b/lib/Ray/sources/Model/ModelAnimations.cpp index 224b9979..2b7328f4 100644 --- a/lib/Ray/sources/Model/ModelAnimations.cpp +++ b/lib/Ray/sources/Model/ModelAnimations.cpp @@ -13,7 +13,7 @@ RAY::ModelAnimations::ModelAnimations(const std::string &filePath): ::ModelAnimation *ptr = this->_animationsPtr.get(); for (int i = 0; i < this->_animationCount; i++) - this->_animations.push_back(RAY::ModelAnimation(ptr[i])); + this->_animations.emplace_back(RAY::ModelAnimation(ptr[i])); } RAY::ModelAnimations::~ModelAnimations() diff --git a/sources/Component/Animation/AnimationsComponent.cpp b/sources/Component/Animation/AnimationsComponent.cpp index d32c6818..ce29964d 100644 --- a/sources/Component/Animation/AnimationsComponent.cpp +++ b/sources/Component/Animation/AnimationsComponent.cpp @@ -8,36 +8,51 @@ namespace BBM { - AnimationsComponent::AnimationsComponent(WAL::Entity &entity, RAY::ModelAnimations &modelAnimation) + AnimationsComponent::AnimationsComponent(WAL::Entity &entity, RAY::ModelAnimations &modelAnimation, int animIndex) : WAL::Component(entity), _modelAnimation(modelAnimation), - _animFrameCounter(0) + _currentAnimIndex(animIndex) { + this->_modelAnimation[this->_currentAnimIndex].setFrameCounter(0); } WAL::Component *AnimationsComponent::clone(WAL::Entity &entity) const { - return new AnimationsComponent(entity, this->_modelAnimation); + return new AnimationsComponent(entity, this->_modelAnimation, this->_currentAnimIndex); } - size_t AnimationsComponent::getAnimFrameCounter() const + size_t AnimationsComponent::getCurrentAnimFrameCounter() const { - return this->_animFrameCounter; + return this->_modelAnimation[this->_currentAnimIndex].getFrameCounter(); } RAY::ModelAnimation AnimationsComponent::getCurrentModelAnim() const { - return this->_modelAnimation[static_cast(this->_animFrameCounter)]; + return this->_modelAnimation[this->_currentAnimIndex]; } - void AnimationsComponent::setAnimFrameCounter(size_t animFrameCounter) + void AnimationsComponent::setCurrentAnimFrameCounter(size_t animFrameCounter) { - this->_animFrameCounter = animFrameCounter; - this->_animFrameCounter %= this->_modelAnimation.getAnimationsCount(); + this->_modelAnimation[this->_currentAnimIndex].setFrameCounter(animFrameCounter); } - void AnimationsComponent::resetAnimFrameCounter() + void AnimationsComponent::resetCurrentAnimFrameCounter() { - this->_animFrameCounter = 0; + this->_modelAnimation[this->_currentAnimIndex].setFrameCounter(0); + } + + size_t AnimationsComponent::getCurrentAnimIndex() const + { + return this->_currentAnimIndex; + } + + void AnimationsComponent::setAnimIndex(int animIndex) + { + this->_currentAnimIndex = animIndex % static_cast(this->_modelAnimation.getAnimationsCount()); + } + + void AnimationsComponent::incCurrentAnimFrameCounter() + { + this->_modelAnimation[this->_currentAnimIndex].incrementFrameCounter(); } } \ No newline at end of file diff --git a/sources/Component/Animation/AnimationsComponent.hpp b/sources/Component/Animation/AnimationsComponent.hpp index a3d741a9..239c9470 100644 --- a/sources/Component/Animation/AnimationsComponent.hpp +++ b/sources/Component/Animation/AnimationsComponent.hpp @@ -16,26 +16,35 @@ namespace BBM private: //! @brief To get the animation data RAY::ModelAnimations &_modelAnimation; - //! @brief the frame animation counter - size_t _animFrameCounter; + //! @brief The index of the + int _currentAnimIndex; public: //! @inherit WAL::Component *clone(WAL::Entity &entity) const override; + //! @brief get the current animation index + size_t getCurrentAnimIndex() const; + + //! @brief Set the animation index to use + void setAnimIndex(int animIndex); + //! @brief get animation frame counter - size_t getAnimFrameCounter() const; + size_t getCurrentAnimFrameCounter() const; //! @brief get the current RAY::ModelAnimation getCurrentModelAnim() const; - //! @brief - void setAnimFrameCounter(size_t animFrameCounter); + //! @brief set the anim frame counter + void setCurrentAnimFrameCounter(size_t animFrameCounter); //! @brief Set the internal anim counter to 0 - void resetAnimFrameCounter(); + void resetCurrentAnimFrameCounter(); + + //! @brief Increment the internal anim counter + void incCurrentAnimFrameCounter(); //! @brief ctor entity and the path of the animation file - explicit AnimationsComponent(WAL::Entity &entity, RAY::ModelAnimations &modelAnimation); + explicit AnimationsComponent(WAL::Entity &entity, RAY::ModelAnimations &modelAnimation, int animIndex); //! @brief copy ctor AnimationsComponent(const AnimationsComponent &) = default; //! @brief dtor diff --git a/sources/System/Animation/AnimationsSystem.cpp b/sources/System/Animation/AnimationsSystem.cpp index 42425acf..f9f7c9ef 100644 --- a/sources/System/Animation/AnimationsSystem.cpp +++ b/sources/System/Animation/AnimationsSystem.cpp @@ -22,6 +22,6 @@ namespace BBM auto &anim = entity.getComponent(); model.member.setAnimation(anim.getCurrentModelAnim()); - anim.setAnimFrameCounter(anim.getAnimFrameCounter() + 1); + anim.setCurrentAnimFrameCounter(anim.getCurrentAnimFrameCounter() + 1); } } \ No newline at end of file From f245fe727b0d6619c639a2b1697dafe5ed8b0b52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Le=20Bihan?= Date: Wed, 2 Jun 2021 15:58:37 +0200 Subject: [PATCH 04/14] Animation is working segfault on unload --- lib/Ray/sources/Model/ModelAnimations.cpp | 15 +++++++++++++-- lib/Ray/sources/Model/ModelAnimations.hpp | 12 ++++++++++++ .../Component/Animation/AnimationsComponent.cpp | 12 +++++++----- .../Component/Animation/AnimationsComponent.hpp | 6 +++--- sources/Runner/Runner.cpp | 5 +++++ sources/System/Animation/AnimationsSystem.cpp | 9 ++++++--- sources/System/Animation/AnimationsSystem.hpp | 3 ++- 7 files changed, 48 insertions(+), 14 deletions(-) diff --git a/lib/Ray/sources/Model/ModelAnimations.cpp b/lib/Ray/sources/Model/ModelAnimations.cpp index 7ab39f41..5d5d297f 100644 --- a/lib/Ray/sources/Model/ModelAnimations.cpp +++ b/lib/Ray/sources/Model/ModelAnimations.cpp @@ -10,7 +10,8 @@ RAY::Cache<::ModelAnimation> RAY::ModelAnimations::_animationsCache(LoadModelAnimations, UnloadModelAnimations); RAY::ModelAnimations::ModelAnimations(const std::string &filePath): - _animationsPtr(_animationsCache.fetch(filePath, &this->_animationCount)) + _animationsPtr(_animationsCache.fetch(filePath, &this->_animationCount)), + _filePath(filePath) { ::ModelAnimation *ptr = this->_animationsPtr.get(); @@ -20,7 +21,7 @@ RAY::ModelAnimations::ModelAnimations(const std::string &filePath): RAY::ModelAnimation &RAY::ModelAnimations::operator[](int index) { - return this->_animations[index]; + return this->_animations.at(index); } size_t RAY::ModelAnimations::getAnimationsCount() const @@ -28,3 +29,13 @@ size_t RAY::ModelAnimations::getAnimationsCount() const return this->_animationCount; } +std::string RAY::ModelAnimations::getFilePath() const +{ + return this->_filePath; +} + +const RAY::ModelAnimation &RAY::ModelAnimations::at(int index) const +{ + return this->_animations.at(index); +} + diff --git a/lib/Ray/sources/Model/ModelAnimations.hpp b/lib/Ray/sources/Model/ModelAnimations.hpp index ba46a0e4..9188955a 100644 --- a/lib/Ray/sources/Model/ModelAnimations.hpp +++ b/lib/Ray/sources/Model/ModelAnimations.hpp @@ -27,15 +27,24 @@ namespace RAY { //! @brief Default constructor ~ModelAnimations() = default; + //! @brief Default move ctor + ModelAnimations(ModelAnimations &&) = default; + //! @brief Only single entity can hold these animations pointers ModelAnimations &operator=(const ModelAnimations &) = delete; //! @brief Castin Object to raw model animation pointer ModelAnimation &operator[](int index); + //! @brief Same usage as the operator[] but const + const ModelAnimation &at(int index) const; + //! @return the number of loaded animations size_t getAnimationsCount() const; + //! @brief Get the creation file + std::string getFilePath() const; + private: //! @brief Holds the pointer returned by the loading function std::shared_ptr<::ModelAnimation> _animationsPtr; @@ -46,6 +55,9 @@ namespace RAY { //! @brief the number of loaded animations int _animationCount; + //! @brief The file where the animations were loaded (used to create a copy of this class) + const std::string _filePath; + static Cache<::ModelAnimation> _animationsCache; }; } diff --git a/sources/Component/Animation/AnimationsComponent.cpp b/sources/Component/Animation/AnimationsComponent.cpp index ce29964d..843dcbcc 100644 --- a/sources/Component/Animation/AnimationsComponent.cpp +++ b/sources/Component/Animation/AnimationsComponent.cpp @@ -8,9 +8,9 @@ namespace BBM { - AnimationsComponent::AnimationsComponent(WAL::Entity &entity, RAY::ModelAnimations &modelAnimation, int animIndex) + AnimationsComponent::AnimationsComponent(WAL::Entity &entity, RAY::ModelAnimations modelAnimation, int animIndex) : WAL::Component(entity), - _modelAnimation(modelAnimation), + _modelAnimation(std::move(modelAnimation)), _currentAnimIndex(animIndex) { this->_modelAnimation[this->_currentAnimIndex].setFrameCounter(0); @@ -18,15 +18,17 @@ namespace BBM WAL::Component *AnimationsComponent::clone(WAL::Entity &entity) const { - return new AnimationsComponent(entity, this->_modelAnimation, this->_currentAnimIndex); + return new AnimationsComponent(entity, + RAY::ModelAnimations(this->_modelAnimation.getFilePath()), + this->_currentAnimIndex); } size_t AnimationsComponent::getCurrentAnimFrameCounter() const { - return this->_modelAnimation[this->_currentAnimIndex].getFrameCounter(); + return this->_modelAnimation.at(this->_currentAnimIndex).getFrameCounter(); } - RAY::ModelAnimation AnimationsComponent::getCurrentModelAnim() const + RAY::ModelAnimation AnimationsComponent::getCurrentModelAnim() { return this->_modelAnimation[this->_currentAnimIndex]; } diff --git a/sources/Component/Animation/AnimationsComponent.hpp b/sources/Component/Animation/AnimationsComponent.hpp index 239c9470..ffaf0599 100644 --- a/sources/Component/Animation/AnimationsComponent.hpp +++ b/sources/Component/Animation/AnimationsComponent.hpp @@ -15,7 +15,7 @@ namespace BBM { private: //! @brief To get the animation data - RAY::ModelAnimations &_modelAnimation; + RAY::ModelAnimations _modelAnimation; //! @brief The index of the int _currentAnimIndex; public: @@ -32,7 +32,7 @@ namespace BBM size_t getCurrentAnimFrameCounter() const; //! @brief get the current - RAY::ModelAnimation getCurrentModelAnim() const; + RAY::ModelAnimation getCurrentModelAnim(); //! @brief set the anim frame counter void setCurrentAnimFrameCounter(size_t animFrameCounter); @@ -44,7 +44,7 @@ namespace BBM void incCurrentAnimFrameCounter(); //! @brief ctor entity and the path of the animation file - explicit AnimationsComponent(WAL::Entity &entity, RAY::ModelAnimations &modelAnimation, int animIndex); + explicit AnimationsComponent(WAL::Entity &entity, RAY::ModelAnimations modelAnimation, int animIndex); //! @brief copy ctor AnimationsComponent(const AnimationsComponent &) = default; //! @brief dtor diff --git a/sources/Runner/Runner.cpp b/sources/Runner/Runner.cpp index d2a1adc9..6ca30a27 100644 --- a/sources/Runner/Runner.cpp +++ b/sources/Runner/Runner.cpp @@ -22,6 +22,9 @@ #include "Component/Renderer/CameraComponent.hpp" #include "Runner.hpp" #include "Models/GameState.hpp" +#include +#include "Component/Animation/AnimationsComponent.hpp" +#include "System/Animation/AnimationsSystem.hpp" #include "Map/Map.hpp" namespace RAY2D = RAY::Drawables::Drawables2D; @@ -53,6 +56,7 @@ namespace BBM RAY::Window &window = RAY::Window::getInstance(600, 400, "Bomberman", FLAG_WINDOW_RESIZABLE); wal.addSystem>(); + wal.addSystem(); wal.addSystem(window) .addSystem>(); @@ -73,6 +77,7 @@ namespace BBM .addComponent>("assets/player/player.iqm", std::make_pair(MAP_DIFFUSE, "assets/player/blue.png")) .addComponent() .addComponent() + .addComponent(RAY::ModelAnimations("assets/player/player.iqm"), 3) .addComponent(); scene->addEntity("camera") .addComponent(8, 20, 7) diff --git a/sources/System/Animation/AnimationsSystem.cpp b/sources/System/Animation/AnimationsSystem.cpp index f9f7c9ef..66d1253e 100644 --- a/sources/System/Animation/AnimationsSystem.cpp +++ b/sources/System/Animation/AnimationsSystem.cpp @@ -2,6 +2,7 @@ // Created by cbihan on 01/06/2021. // +#include #include "AnimationsSystem.hpp" #include "Component/Animation/AnimationsComponent.hpp" #include "Model/Model.hpp" @@ -11,12 +12,14 @@ namespace BBM { AnimationsSystem::AnimationsSystem() - : WAL::System({typeid(AnimationsComponent), - typeid(Drawable3DComponent)}) + : WAL::System({ + typeid(Drawable3DComponent), + typeid(AnimationsComponent) + }) { } - void AnimationsSystem::onFixedUpdate(WAL::Entity &entity) + void AnimationsSystem::onUpdate(WAL::Entity &entity, std::chrono::nanoseconds) { auto &model = entity.getComponent>(); auto &anim = entity.getComponent(); diff --git a/sources/System/Animation/AnimationsSystem.hpp b/sources/System/Animation/AnimationsSystem.hpp index eb508b3e..fb08b2ef 100644 --- a/sources/System/Animation/AnimationsSystem.hpp +++ b/sources/System/Animation/AnimationsSystem.hpp @@ -10,8 +10,9 @@ namespace BBM { class AnimationsSystem : public WAL::System { + public: //! @inherit - void onFixedUpdate(WAL::Entity &entity) override; + void onUpdate(WAL::Entity &entity, std::chrono::nanoseconds) override; //! @brief A default constructor AnimationsSystem(); From b3eae9ebdfe024548a4683b38ba4ecd869338854 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Le=20Bihan?= Date: Wed, 2 Jun 2021 16:11:14 +0200 Subject: [PATCH 05/14] adding the possibility to pause/resume an animation --- .../Component/Animation/AnimationsComponent.cpp | 15 +++++++++++++-- .../Component/Animation/AnimationsComponent.hpp | 10 +++++++++- sources/System/Animation/AnimationsSystem.cpp | 2 ++ 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/sources/Component/Animation/AnimationsComponent.cpp b/sources/Component/Animation/AnimationsComponent.cpp index 843dcbcc..72be399f 100644 --- a/sources/Component/Animation/AnimationsComponent.cpp +++ b/sources/Component/Animation/AnimationsComponent.cpp @@ -8,10 +8,11 @@ namespace BBM { - AnimationsComponent::AnimationsComponent(WAL::Entity &entity, RAY::ModelAnimations modelAnimation, int animIndex) + AnimationsComponent::AnimationsComponent(WAL::Entity &entity, RAY::ModelAnimations modelAnimation, int animIndex, bool play) : WAL::Component(entity), _modelAnimation(std::move(modelAnimation)), - _currentAnimIndex(animIndex) + _currentAnimIndex(animIndex), + _animDisabled(play) { this->_modelAnimation[this->_currentAnimIndex].setFrameCounter(0); } @@ -57,4 +58,14 @@ namespace BBM { this->_modelAnimation[this->_currentAnimIndex].incrementFrameCounter(); } + + void AnimationsComponent::setAnimDisabled(bool disable) + { + this->_animDisabled = disable; + } + + bool AnimationsComponent::isAnimDisabled() const + { + return this->_animDisabled; + } } \ No newline at end of file diff --git a/sources/Component/Animation/AnimationsComponent.hpp b/sources/Component/Animation/AnimationsComponent.hpp index ffaf0599..62e2e13b 100644 --- a/sources/Component/Animation/AnimationsComponent.hpp +++ b/sources/Component/Animation/AnimationsComponent.hpp @@ -18,6 +18,8 @@ namespace BBM RAY::ModelAnimations _modelAnimation; //! @brief The index of the int _currentAnimIndex; + //! @brief Bool allowing to play pause an animation + bool _animDisabled; public: //! @inherit WAL::Component *clone(WAL::Entity &entity) const override; @@ -43,8 +45,14 @@ namespace BBM //! @brief Increment the internal anim counter void incCurrentAnimFrameCounter(); + //! @brief Allow to play pause animations + void setAnimDisabled(bool disable); + + //! @brief To know if the animation will be updated or not + bool isAnimDisabled() const; + //! @brief ctor entity and the path of the animation file - explicit AnimationsComponent(WAL::Entity &entity, RAY::ModelAnimations modelAnimation, int animIndex); + explicit AnimationsComponent(WAL::Entity &entity, RAY::ModelAnimations modelAnimation, int animIndex, bool play = true); //! @brief copy ctor AnimationsComponent(const AnimationsComponent &) = default; //! @brief dtor diff --git a/sources/System/Animation/AnimationsSystem.cpp b/sources/System/Animation/AnimationsSystem.cpp index 66d1253e..7e54adbd 100644 --- a/sources/System/Animation/AnimationsSystem.cpp +++ b/sources/System/Animation/AnimationsSystem.cpp @@ -24,6 +24,8 @@ namespace BBM auto &model = entity.getComponent>(); auto &anim = entity.getComponent(); + if (anim.isDisabled()) + return; model.member.setAnimation(anim.getCurrentModelAnim()); anim.setCurrentAnimFrameCounter(anim.getCurrentAnimFrameCounter() + 1); } From 37fb527d5bcf5cecf718f250ff17d3e90d15c32c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Le=20Bihan?= Date: Wed, 2 Jun 2021 16:30:16 +0200 Subject: [PATCH 06/14] little fix --- sources/Component/Animation/AnimationsComponent.hpp | 1 - sources/System/Animation/AnimationsSystem.cpp | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/sources/Component/Animation/AnimationsComponent.hpp b/sources/Component/Animation/AnimationsComponent.hpp index 62e2e13b..463f241f 100644 --- a/sources/Component/Animation/AnimationsComponent.hpp +++ b/sources/Component/Animation/AnimationsComponent.hpp @@ -60,5 +60,4 @@ namespace BBM //! @brief assignment operator AnimationsComponent &operator=(const AnimationsComponent &) = delete; }; - } diff --git a/sources/System/Animation/AnimationsSystem.cpp b/sources/System/Animation/AnimationsSystem.cpp index 7e54adbd..fb9f79e0 100644 --- a/sources/System/Animation/AnimationsSystem.cpp +++ b/sources/System/Animation/AnimationsSystem.cpp @@ -27,6 +27,6 @@ namespace BBM if (anim.isDisabled()) return; model.member.setAnimation(anim.getCurrentModelAnim()); - anim.setCurrentAnimFrameCounter(anim.getCurrentAnimFrameCounter() + 1); + anim.incCurrentAnimFrameCounter(); } } \ No newline at end of file From f3d9effb838255e213d986daed69a87c94eb5a61 Mon Sep 17 00:00:00 2001 From: "arthur.jamet" Date: Wed, 2 Jun 2021 16:47:05 +0200 Subject: [PATCH 07/14] fix double free for model animation unloading --- lib/Ray/sources/Utils/Cache.hpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/Ray/sources/Utils/Cache.hpp b/lib/Ray/sources/Utils/Cache.hpp index f30fa3ff..a1eef87a 100644 --- a/lib/Ray/sources/Utils/Cache.hpp +++ b/lib/Ray/sources/Utils/Cache.hpp @@ -60,11 +60,13 @@ namespace RAY { {}; std::shared_ptr<::ModelAnimation> fetch(const std::string &path, int *counter) { + ::ModelAnimation *animations = this->_dataLoader(path.c_str(), counter); + unsigned int animCount = *counter; + if (this->_cache.find(path) == this->_cache.end()) this->_cache.emplace(path, std::shared_ptr<::ModelAnimation>( - this->_dataLoader(path.c_str(), counter), [this, counter](::ModelAnimation *p) { - this->_dataUnloader(p, *counter); - delete p; + animations, [this, animCount](::ModelAnimation *p) { + this->_dataUnloader(p, animCount); })); return _cache[path]; }; From 3790b2a8cdd03d99f41f55a408e09fe174c4a2a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Le=20Bihan?= Date: Wed, 2 Jun 2021 18:14:44 +0200 Subject: [PATCH 08/14] first pr fixes from reviews --- CMakeLists.txt | 4 +++- lib/Ray/sources/Model/ModelAnimations.cpp | 2 +- lib/Ray/sources/Utils/Cache.hpp | 14 ++++++++------ .../Component/Animation/AnimationsComponent.cpp | 4 ++-- sources/Runner/Runner.cpp | 10 +++++----- sources/System/Animation/AnimationsSystem.cpp | 2 +- 6 files changed, 20 insertions(+), 16 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 99872204..589b5630 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -80,7 +80,9 @@ add_executable(unit_tests EXCLUDE_FROM_ALL tests/MainTest.cpp tests/EngineTests.cpp tests/CallbackTest.cpp - tests/MoveTests.cpp) + tests/MoveTests.cpp + tests/CollisionTest.cpp + ) target_include_directories(unit_tests PUBLIC sources) target_link_libraries(unit_tests PUBLIC wal ray) diff --git a/lib/Ray/sources/Model/ModelAnimations.cpp b/lib/Ray/sources/Model/ModelAnimations.cpp index 5d5d297f..b70abf56 100644 --- a/lib/Ray/sources/Model/ModelAnimations.cpp +++ b/lib/Ray/sources/Model/ModelAnimations.cpp @@ -16,7 +16,7 @@ RAY::ModelAnimations::ModelAnimations(const std::string &filePath): ::ModelAnimation *ptr = this->_animationsPtr.get(); for (int i = 0; i < this->_animationCount; i++) - this->_animations.emplace_back(RAY::ModelAnimation(ptr[i])); + this->_animations.emplace_back(ptr[i]); } RAY::ModelAnimation &RAY::ModelAnimations::operator[](int index) diff --git a/lib/Ray/sources/Utils/Cache.hpp b/lib/Ray/sources/Utils/Cache.hpp index a1eef87a..7f041853 100644 --- a/lib/Ray/sources/Utils/Cache.hpp +++ b/lib/Ray/sources/Utils/Cache.hpp @@ -60,15 +60,17 @@ namespace RAY { {}; std::shared_ptr<::ModelAnimation> fetch(const std::string &path, int *counter) { + if (this->_cache.find(path) != this->_cache.end()) + return this->_cache[path]; + ::ModelAnimation *animations = this->_dataLoader(path.c_str(), counter); unsigned int animCount = *counter; - if (this->_cache.find(path) == this->_cache.end()) - this->_cache.emplace(path, std::shared_ptr<::ModelAnimation>( - animations, [this, animCount](::ModelAnimation *p) { - this->_dataUnloader(p, animCount); - })); - return _cache[path]; + this->_cache.emplace(path, std::shared_ptr<::ModelAnimation>( + animations, [this, animCount](::ModelAnimation *p) { + this->_dataUnloader(p, animCount); + })); + return this->_cache[path]; }; private: //! @brief function to call to load data diff --git a/sources/Component/Animation/AnimationsComponent.cpp b/sources/Component/Animation/AnimationsComponent.cpp index 72be399f..4461cc8e 100644 --- a/sources/Component/Animation/AnimationsComponent.cpp +++ b/sources/Component/Animation/AnimationsComponent.cpp @@ -20,8 +20,8 @@ namespace BBM WAL::Component *AnimationsComponent::clone(WAL::Entity &entity) const { return new AnimationsComponent(entity, - RAY::ModelAnimations(this->_modelAnimation.getFilePath()), - this->_currentAnimIndex); + RAY::ModelAnimations(this->_modelAnimation.getFilePath()), + this->_currentAnimIndex); } size_t AnimationsComponent::getCurrentAnimFrameCounter() const diff --git a/sources/Runner/Runner.cpp b/sources/Runner/Runner.cpp index 8b9f70e7..00218852 100644 --- a/sources/Runner/Runner.cpp +++ b/sources/Runner/Runner.cpp @@ -60,8 +60,8 @@ namespace BBM RAY::Window &window = RAY::Window::getInstance(600, 400, "Bomberman", FLAG_WINDOW_RESIZABLE); wal.addSystem>(); - wal.addSystem(); wal.addSystem>(); + wal.addSystem(); wal.addSystem(window) .addSystem>(); @@ -76,12 +76,12 @@ namespace BBM .addComponent>("assets/player/player.iqm", std::make_pair(MAP_DIFFUSE, "assets/player/blue.png")) .addComponent() .addComponent() - .addComponent(RAY::ModelAnimations("assets/player/player.iqm"), 3) + .addComponent(RAY::ModelAnimations("assets/player/player.iqm"), 1) .addComponent(2) .addComponent(); scene->addEntity("cube") - .addComponent(-5, 0, -5) - .addComponent>(Vector3f(-5, 0, -5), Vector3f(3, 3, 3), RED) + .addComponent(5, 0, 5) + .addComponent>(Vector3f(5, 0, 5), Vector3f(3, 3, 3), RED) .addComponent() .addComponent() .addComponent([](WAL::Entity &, const WAL::Entity &){}, @@ -96,7 +96,7 @@ namespace BBM .addComponent(8, 20, 7) .addComponent(Vector3f(8, 0, 8)); std::srand(std::time(NULL)); - MapGenerator::loadMap(16, 16, MapGenerator::createMap(16, 16), scene); + //MapGenerator::loadMap(16, 16, MapGenerator::createMap(16, 16), scene); return scene; } diff --git a/sources/System/Animation/AnimationsSystem.cpp b/sources/System/Animation/AnimationsSystem.cpp index fb9f79e0..3400cf10 100644 --- a/sources/System/Animation/AnimationsSystem.cpp +++ b/sources/System/Animation/AnimationsSystem.cpp @@ -13,7 +13,7 @@ namespace BBM AnimationsSystem::AnimationsSystem() : WAL::System({ - typeid(Drawable3DComponent), + typeid(Drawable3DComponent), typeid(AnimationsComponent) }) { From 883022d255c2673323273f654a6d38b9f4d7f16c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Le=20Bihan?= Date: Wed, 2 Jun 2021 18:17:32 +0200 Subject: [PATCH 09/14] reenable map drawing --- sources/Runner/Runner.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sources/Runner/Runner.cpp b/sources/Runner/Runner.cpp index 00218852..8b1f36fd 100644 --- a/sources/Runner/Runner.cpp +++ b/sources/Runner/Runner.cpp @@ -80,8 +80,8 @@ namespace BBM .addComponent(2) .addComponent(); scene->addEntity("cube") - .addComponent(5, 0, 5) - .addComponent>(Vector3f(5, 0, 5), Vector3f(3, 3, 3), RED) + .addComponent(-5, 0, -5) + .addComponent>(Vector3f(-5, 0, -5), Vector3f(3, 3, 3), RED) .addComponent() .addComponent() .addComponent([](WAL::Entity &, const WAL::Entity &){}, @@ -96,7 +96,7 @@ namespace BBM .addComponent(8, 20, 7) .addComponent(Vector3f(8, 0, 8)); std::srand(std::time(NULL)); - //MapGenerator::loadMap(16, 16, MapGenerator::createMap(16, 16), scene); + MapGenerator::loadMap(16, 16, MapGenerator::createMap(16, 16), scene); return scene; } From 4ea98204a22a3524d870407b8ff690fddd6b6241 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Le=20Bihan?= Date: Wed, 2 Jun 2021 18:32:58 +0200 Subject: [PATCH 10/14] indents fixes --- CMakeLists.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 589b5630..fd2543bf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -58,8 +58,8 @@ set(SOURCES sources/System/Renderer/Render2DScreenSystem.hpp sources/Component/Animation/AnimationsComponent.cpp sources/Component/Animation/AnimationsComponent.hpp - sources/System/Animation/AnimationsSystem.cpp - sources/System/Animation/AnimationsSystem.hpp + sources/System/Animation/AnimationsSystem.cpp + sources/System/Animation/AnimationsSystem.hpp sources/Component/Collision/CollisionComponent.cpp sources/Component/Collision/CollisionComponent.hpp sources/System/Collision/CollisionSystem.hpp @@ -81,7 +81,7 @@ add_executable(unit_tests EXCLUDE_FROM_ALL tests/EngineTests.cpp tests/CallbackTest.cpp tests/MoveTests.cpp - tests/CollisionTest.cpp + tests/CollisionTest.cpp ) target_include_directories(unit_tests PUBLIC sources) target_link_libraries(unit_tests PUBLIC wal ray) From 066e77c47b9469206b265bf0d29be68881a96051 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Le=20Bihan?= Date: Wed, 2 Jun 2021 18:42:21 +0200 Subject: [PATCH 11/14] hope you're HaPpY --- lib/Ray/sources/Model/ModelAnimations.cpp | 9 +++++++++ lib/Ray/sources/Model/ModelAnimations.hpp | 8 +++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/lib/Ray/sources/Model/ModelAnimations.cpp b/lib/Ray/sources/Model/ModelAnimations.cpp index b70abf56..1b5f9cc4 100644 --- a/lib/Ray/sources/Model/ModelAnimations.cpp +++ b/lib/Ray/sources/Model/ModelAnimations.cpp @@ -39,3 +39,12 @@ const RAY::ModelAnimation &RAY::ModelAnimations::at(int index) const return this->_animations.at(index); } +const RAY::ModelAnimation &RAY::ModelAnimations::operator[](int index) const +{ + return this->_animations[index]; +} + +RAY::ModelAnimation &RAY::ModelAnimations::at(int index) +{ + return this->_animations.at(index); +} diff --git a/lib/Ray/sources/Model/ModelAnimations.hpp b/lib/Ray/sources/Model/ModelAnimations.hpp index 9188955a..83978b82 100644 --- a/lib/Ray/sources/Model/ModelAnimations.hpp +++ b/lib/Ray/sources/Model/ModelAnimations.hpp @@ -36,9 +36,15 @@ namespace RAY { //! @brief Castin Object to raw model animation pointer ModelAnimation &operator[](int index); - //! @brief Same usage as the operator[] but const + //! @brief std [] const + const ModelAnimation &operator[](int index) const; + + //! @brief std at const const ModelAnimation &at(int index) const; + //! @brief std at + ModelAnimation &at(int index); + //! @return the number of loaded animations size_t getAnimationsCount() const; From d29b0dc4edcfafbc62cecaa56e7e3688585cec9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Le=20Bihan?= Date: Wed, 2 Jun 2021 18:44:31 +0200 Subject: [PATCH 12/14] pain --- lib/Ray/sources/Model/ModelAnimations.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Ray/sources/Model/ModelAnimations.cpp b/lib/Ray/sources/Model/ModelAnimations.cpp index 1b5f9cc4..6d41832d 100644 --- a/lib/Ray/sources/Model/ModelAnimations.cpp +++ b/lib/Ray/sources/Model/ModelAnimations.cpp @@ -21,7 +21,7 @@ RAY::ModelAnimations::ModelAnimations(const std::string &filePath): RAY::ModelAnimation &RAY::ModelAnimations::operator[](int index) { - return this->_animations.at(index); + return this->_animations[index]; } size_t RAY::ModelAnimations::getAnimationsCount() const From 72d66bc9702ba2d0a932df4c5dbee33b3dfdc626 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Le=20Bihan?= Date: Thu, 3 Jun 2021 09:13:58 +0200 Subject: [PATCH 13/14] setting copy ctor of ModelAnimations.hpp to default --- lib/Ray/sources/Model/ModelAnimations.hpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/lib/Ray/sources/Model/ModelAnimations.hpp b/lib/Ray/sources/Model/ModelAnimations.hpp index 83978b82..2b99e1d7 100644 --- a/lib/Ray/sources/Model/ModelAnimations.hpp +++ b/lib/Ray/sources/Model/ModelAnimations.hpp @@ -21,17 +21,14 @@ namespace RAY { //! @param filePath Path to the file containing animations ModelAnimations(const std::string &filePath); - //! @brief Only single entity can hold these animations pointers - ModelAnimations(const ModelAnimations &) = delete; + //! @brief default copy ctor + ModelAnimations(const ModelAnimations &) = default; //! @brief Default constructor ~ModelAnimations() = default; - //! @brief Default move ctor - ModelAnimations(ModelAnimations &&) = default; - - //! @brief Only single entity can hold these animations pointers - ModelAnimations &operator=(const ModelAnimations &) = delete; + //! @brief Default assignment operator + ModelAnimations &operator=(const ModelAnimations &) = default; //! @brief Castin Object to raw model animation pointer ModelAnimation &operator[](int index); From edd92efdbe2f45dc6d0f97243ced001a39b6c8bb Mon Sep 17 00:00:00 2001 From: Arthi-chaud <60505370+Arthi-chaud@users.noreply.github.com> Date: Thu, 3 Jun 2021 10:59:31 +0200 Subject: [PATCH 14/14] Update readme's build instruction --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 18e93e7a..0d19b943 100644 --- a/README.md +++ b/README.md @@ -40,12 +40,13 @@ mkdir build cd build cmake .. cmake --build . +cd - ``` Enjoy ! ```bash -./bomberman +./build/bomberman ```