diff --git a/CMakeLists.txt b/CMakeLists.txt index 94c6d3e6..c948f529 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -36,12 +36,14 @@ set(SOURCES sources/System/Movable/MovableSystem.cpp sources/System/Movable/MovableSystem.hpp sources/Models/Vector3.hpp -) + sources/Component/GridCentered/GridCenteredComponent.cpp + sources/Component/GridCentered/GridCenteredComponent.hpp + sources/System/GridCentered/GridCenteredSystem.cpp sources/System/GridCentered/GridCenteredSystem.hpp) add_executable(bomberman sources/main.cpp ${SOURCES} - sources/Component/Controllable/ControllableComponent.cpp) +) target_include_directories(bomberman PUBLIC sources) target_link_libraries(bomberman PUBLIC wal ray) diff --git a/sources/Component/GridCentered/GridCenteredComponent.cpp b/sources/Component/GridCentered/GridCenteredComponent.cpp new file mode 100644 index 00000000..d4b333b4 --- /dev/null +++ b/sources/Component/GridCentered/GridCenteredComponent.cpp @@ -0,0 +1,17 @@ +// +// Created by Zoe Roux on 5/24/21. +// + +#include "GridCenteredComponent.hpp" + +namespace BBM +{ + GridCenteredComponent::GridCenteredComponent(WAL::Entity &entity) + : WAL::Component(entity) + {} + + WAL::Component *GridCenteredComponent::clone(WAL::Entity &entity) const + { + return new GridCenteredComponent(entity); + } +} \ No newline at end of file diff --git a/sources/Component/GridCentered/GridCenteredComponent.hpp b/sources/Component/GridCentered/GridCenteredComponent.hpp new file mode 100644 index 00000000..d4de0eed --- /dev/null +++ b/sources/Component/GridCentered/GridCenteredComponent.hpp @@ -0,0 +1,33 @@ +// +// Created by Zoe Roux on 5/24/21. +// + +#pragma once + +#include + +namespace BBM +{ + //! @brief A component to slowly center entities to the middle of their current block. + //! This allow flexibility in their movement will preventing them from getting stuck at every corner. + class GridCenteredComponent : public WAL::Component + { + public: + //! @brief The force factor applied at each frame. + float force = 1; + + //! @inherit + Component *clone(WAL::Entity &entity) const override; + + //! @brief Create a new, default GridCenteredComponent. + //! @param entity The entity attached to this component. + explicit GridCenteredComponent(WAL::Entity &entity); + //! @brief A GridCenteredComponent is copy constructable + //! @param other The other GridCenteredComponent to copy. + GridCenteredComponent(const GridCenteredComponent &other) = default; + //! @brief A default destructor + ~GridCenteredComponent() override = default; + //! @brief A GridCenteredComponent is not assignable + GridCenteredComponent &operator=(const GridCenteredComponent &) = delete; + }; +} diff --git a/sources/System/GridCentered/GridCenteredSystem.cpp b/sources/System/GridCentered/GridCenteredSystem.cpp new file mode 100644 index 00000000..133c2160 --- /dev/null +++ b/sources/System/GridCentered/GridCenteredSystem.cpp @@ -0,0 +1,5 @@ +// +// Created by Zoe Roux on 5/24/21. +// + +#include "GridCenteredSystem.hpp" diff --git a/sources/System/GridCentered/GridCenteredSystem.hpp b/sources/System/GridCentered/GridCenteredSystem.hpp new file mode 100644 index 00000000..0c33bc92 --- /dev/null +++ b/sources/System/GridCentered/GridCenteredSystem.hpp @@ -0,0 +1,15 @@ +// +// Created by Zoe Roux on 5/24/21. +// + +#pragma once + +#include + +namespace BBM +{ + class GridCenteredSystem : public WAL::System + { + + }; +}