Making menues selectable by keyboard or controller

This commit is contained in:
Zoe Roux
2021-06-10 18:05:56 +02:00
parent d328a976ed
commit e38c2e56fe
5 changed files with 53 additions and 70 deletions

View File

@@ -14,41 +14,26 @@ namespace BBM
class MenuControllableSystem : public WAL::System<ControllableComponent>
{
private:
//! @brief reference to wal
WAL::Wal &wal;
//! @brief index of the current button selected
WAL::Entity *currentButton;
//! @brief move vector
Vector2f move;
//! @brief Select action
bool select = false;
//! @brief Cancel action
bool cancel = false;
WAL::Entity *_currentButton;
//! @brief update current button reference
//! @param selected lets know if te new selected button is 'pressed'
void updateCurrentButton(bool selected);
void _updateCurrentButton(bool selected, Vector2f move);
//! @brief time (in mili second) since last check
//! @brief time (in millisecond) since last check
std::chrono::time_point<std::chrono::steady_clock> _now;
public:
//! @inherit
void onSelfUpdate(void) override;
//! @inherit
void onFixedUpdate(WAL::ViewEntity<ControllableComponent> &entities) override;
//! @brief A default constructor
MenuControllableSystem(WAL::Wal &wal);
explicit MenuControllableSystem(WAL::Wal &wal);
//! @brief A MenuControllable system is not copy constructable
MenuControllableSystem(const MenuControllableSystem &) = delete;
//! @brief A default destructor
~MenuControllableSystem() override = default;
//! @brief A MenuControllable system is assignable.
MenuControllableSystem &operator=(const MenuControllableSystem &) = default;
//! @brief A MenuControllable system is not assignable.
MenuControllableSystem &operator=(const MenuControllableSystem &) = delete;
};
}