diff --git a/sources/Component/Lobby/ResumeLobbyComponent.cpp b/sources/Component/Lobby/ResumeLobbyComponent.cpp index 780b3db1..5a1bbf24 100644 --- a/sources/Component/Lobby/ResumeLobbyComponent.cpp +++ b/sources/Component/Lobby/ResumeLobbyComponent.cpp @@ -6,16 +6,16 @@ namespace BBM { - ResumeLobbyComponent::ResumeLobbyComponent(WAL::Entity &entity, int playerNumber, WAL::Entity &button, WAL::Entity &tile, int color) + ResumeLobbyComponent::ResumeLobbyComponent(WAL::Entity &entity, int playerNumber, WAL::Entity &button, WAL::Entity &tile, int pColor) : WAL::Component(entity), playerID(playerNumber), readyButton(button), coloredTile(tile), - color(color) + playerColor(pColor) {} WAL::Component *ResumeLobbyComponent::clone(WAL::Entity &entity) const { - return new ResumeLobbyComponent(entity, this->playerID, this->readyButton, this->coloredTile, this->color); + return new ResumeLobbyComponent(entity, this->playerID, this->readyButton, this->coloredTile, this->playerColor); } } \ No newline at end of file diff --git a/sources/Component/Lobby/ResumeLobbyComponent.hpp b/sources/Component/Lobby/ResumeLobbyComponent.hpp index 68d3b432..8656a472 100644 --- a/sources/Component/Lobby/ResumeLobbyComponent.hpp +++ b/sources/Component/Lobby/ResumeLobbyComponent.hpp @@ -20,7 +20,7 @@ namespace BBM //! @brief The ID of the lobby player (from 0 to 3) int playerID; //! @brief The color of the player (as an index) - int color; + int playerColor; //! @brief Is this player ready bool ready = false; //! @brief The entity containing the ready display. @@ -33,7 +33,7 @@ namespace BBM Component *clone(WAL::Entity &entity) const override; //! @brief Create a new lobby component. - explicit ResumeLobbyComponent(WAL::Entity &entity, int playerNumber, WAL::Entity &button, WAL::Entity &tile, int color); + explicit ResumeLobbyComponent(WAL::Entity &entity, int playerNumber, WAL::Entity &button, WAL::Entity &tile, int pColor); //! @brief A lobby component is copyable. ResumeLobbyComponent(const ResumeLobbyComponent &) = default; //! @brief A default destructor diff --git a/sources/Runner/ResumeLobbyScene.cpp b/sources/Runner/ResumeLobbyScene.cpp index b67013e6..c839e459 100644 --- a/sources/Runner/ResumeLobbyScene.cpp +++ b/sources/Runner/ResumeLobbyScene.cpp @@ -87,29 +87,10 @@ namespace BBM texture->use("assets/buttons/button_back_hovered.png"); }); - auto &howToPlay = scene->addEntity("to to play") - .addComponent(1920 - 10 - 75, 1080 - 85, 0) - .addComponent("assets/buttons/button_htp.png") - .addComponent([](WAL::Entity &entity, WAL::Wal &) - { - gameState.nextScene = BBM::GameState::SceneID::HowToPlayScene; - }) - .addComponent([](WAL::Entity &entity, WAL::Wal &) - { - RAY::Texture *texture = dynamic_cast(entity.getComponent().drawable.get()); - - texture->use("assets/buttons/button_htp.png"); - }) - .addComponent([](WAL::Entity &entity, WAL::Wal &) - { - RAY::Texture *texture = dynamic_cast(entity.getComponent().drawable.get()); - - texture->use("assets/buttons/button_htp_hovered.png"); - }); scene->addEntity("camera") .addComponent(8, 20, 7) .addComponent(Vector3f(8, 0, 8)); - play.getComponent().setButtonLinks(nullptr, &back, &back, nullptr); + play.getComponent().setButtonLinks(nullptr, &back, &back); back.getComponent().setButtonLinks(&play, nullptr, nullptr, &play); return scene; } diff --git a/sources/System/Lobby/ResumeLobbySystem.cpp b/sources/System/Lobby/ResumeLobbySystem.cpp index 19e9269e..6c0f4a74 100644 --- a/sources/System/Lobby/ResumeLobbySystem.cpp +++ b/sources/System/Lobby/ResumeLobbySystem.cpp @@ -150,12 +150,12 @@ namespace BBM speed->speed = ParserYAML::playersInfos[countPlayer].speed; } addController(player, lobby.layout); - std::string texturePath = "assets/player/ui/" + _colors[lobby.color] + ".png"; + std::string texturePath = "assets/player/ui/" + _colors[lobby.playerColor] + ".png"; int x = (countPlayer % 2 == 0) ? 1920 - 10 - 320 : 10; int y = (countPlayer % 3 != 0) ? 1080 - 10 - 248 : 10; scene->addEntity("player color tile") .addComponent(x, y - 2, 0) - .addComponent(x, y, 320, 248, _rayColors[lobby.color]); + .addComponent(x, y, 320, 248, _rayColors[lobby.playerColor]); scene->addEntity("player ui tile") .addComponent(x, y, 0) .addComponent(texturePath); @@ -189,14 +189,14 @@ namespace BBM .addComponent(x + 220, y + 122, 0) .addComponent("", 20, x, y, WHITE) .addComponent([&player](Drawable2DComponent &drawble) { - auto *speed = player.tryGetComponent(); + auto speedComponent = player.tryGetComponent(); - if (!speed) + if (!speedComponent) return; RAY2D::Text *text = dynamic_cast(drawble.drawable.get()); if (!text) return; - text->setText(std::to_string(static_cast(speed->speed * 100))); + text->setText(std::to_string(static_cast(speedComponent->speed * 100))); }); scene->addEntity("player hide wall") .addComponent(x + 220, y + 161, 0) diff --git a/tests/MoveTests.cpp b/tests/MoveTests.cpp index 75ff2bbd..413332b8 100644 --- a/tests/MoveTests.cpp +++ b/tests/MoveTests.cpp @@ -12,6 +12,7 @@ #include "System/Movable/MovableSystem.hpp" #include #include +#include using namespace WAL; using namespace BBM; @@ -24,6 +25,7 @@ TEST_CASE("Move test", "[Component][System]") wal.getScene()->addEntity("player") .addComponent() .addComponent() + .addComponent() .addComponent(); Entity &entity = wal.getScene()->getEntities().front();