create score component

This commit is contained in:
arthur.jamet
2021-06-15 09:45:57 +02:00
parent d164e3d407
commit 41d8369ba5
3 changed files with 47 additions and 0 deletions
+2
View File
@@ -130,6 +130,8 @@ set(SOURCES
sources/Runner/PauseMenuScene.cpp
sources/Runner/SettingsMenuScene.cpp
sources/Runner/CreditScene.cpp
sources/Component/Score/ScoreComponent.cpp
sources/Component/Score/ScoreComponent.hpp
)
add_executable(bomberman
sources/main.cpp
@@ -0,0 +1,16 @@
#include "ScoreComponent.hpp"
namespace BBM
{
ScoreComponent::ScoreComponent(WAL::Entity &entity)
: Component(entity),
position()
{}
WAL::Component *ScoreComponent::clone(WAL::Entity &entity) const
{
return new ScoreComponent(entity);
}
} // namespace WAL
@@ -0,0 +1,29 @@
#pragma once
#include "Component/Component.hpp"
namespace BBM
{
//! @brief A basic position component
class ScoreComponent : public WAL::Component
{
public:
//! @brief score of player (4 is the looser, 1 is the winner)
enum Score {FIRST = 1, SECOND = 2, THIRD = 3, FOURTH = 4, PLAYING = -1};
//! @brief the score of the player
enum Score position;
//! @inherit
WAL::Component *clone(WAL::Entity &entity) const override;
//! @brief Create a new ScoreComponent linked to a specific entity
explicit ScoreComponent(WAL::Entity &entity);
//! @brief A position component is copy constructable
ScoreComponent(const ScoreComponent &) = default;
//! @brief A default destructor
~ScoreComponent() override = default;
//! @brief A position component is not assignable
ScoreComponent &operator=(const ScoreComponent &) = delete;
};
} // namespace WAL