// // Created by sebastian on 02.08.26. // #ifndef COLORRACE_PIECEPRESENTER_H #define COLORRACE_PIECEPRESENTER_H #include #include #include "BoardLayout.h" #include "LudoGameState.h" #include "core/animation/events/AnimationMarkerEvent.h" #include "core/audio/SoundSource.h" #include "core/events/EventBus.h" #include "ecs/EntityRegistry.h" #include "loader/assets/AssetManager.h" #include "loader/models/Model.h" namespace ludo { class PiecePresenter { public: PiecePresenter(engine::EventBus& animationEventbus, engine::EntityRegistry& registry, std::unordered_map> pieceModels, std::unordered_map> pieceSounds, std::shared_ptr boardModel) : m_registry(registry), m_pieceModels(std::move(pieceModels)), m_pieceSounds(std::move(pieceSounds)), m_layout(std::move(boardModel)), m_animationEventBus(animationEventbus) {} void spawnPieces(const ludo::LudoGameState& state); void onPieceMoved(const ludo::PieceMovedEvent& event, const ludo::LudoGameState& state); [[nodiscard]] const std::vector& getPieceEntities() const { return m_pieceEntities; } [[nodiscard]] std::optional getPieceIndex(std::optional::value_type entity); private: engine::EntityRegistry& m_registry; std::unordered_map> m_pieceModels; std::unordered_map> m_pieceSounds; BoardLayout m_layout; std::vector m_pieceEntities; engine::EventBus& m_animationEventBus; }; } #endif //COLORRACE_PIECEPRESENTER_H