merge from develop

This commit is contained in:
arthur.jamet
2021-06-16 17:37:23 +02:00
19 changed files with 151 additions and 35 deletions
+50 -14
View File
@@ -64,8 +64,6 @@ namespace BBM
LobbySystem::switchToGame(wal);
})
.addComponent<TagComponent<"PlayButton">>();
auto &back = scene->addEntity("back to menu")
.addComponent<PositionComponent>(10, 1080 - 85, 0)
.addComponent<Drawable2DComponent, RAY::Texture>("assets/buttons/button_back.png")
@@ -105,7 +103,7 @@ namespace BBM
texture->use("assets/buttons/button_htp_hovered.png");
});
auto &lavaOption = scene->addEntity("lava option text")
.addComponent<PositionComponent>(1920 / 6, 2 * 1080 / 3, 0)
.addComponent<PositionComponent>(1920 / 6, 1.85 * 1080 / 3, 0)
.addComponent<Drawable2DComponent, RAY2D::Text>("Lava: Off", 70, RAY::Vector2(), BLACK)
.addComponent<OnClickComponent>([](WAL::Entity &entity, WAL::Wal &wal)
{
@@ -120,38 +118,74 @@ namespace BBM
}
})
.addComponent<OnIdleComponent>([](WAL::Entity &entity, WAL::Wal &)
{
entity.getComponent<Drawable2DComponent>().drawable->setColor(BLACK);
})
{
entity.getComponent<Drawable2DComponent>().drawable->setColor(BLACK);
})
.addComponent<OnHoverComponent>([](WAL::Entity &entity, WAL::Wal &)
{
entity.getComponent<Drawable2DComponent>().drawable->setColor(ORANGE);
});
auto &heightOption = scene->addEntity("Height option text")
.addComponent<PositionComponent>(1920 / 1.75, 2 * 1080 / 3, 0)
.addComponent<PositionComponent>(1920 / 6, 2.1 * 1080 / 3, 0)
.addComponent<Drawable2DComponent, RAY2D::Text>("2nd Level: Off", 70, RAY::Vector2(), BLACK)
.addComponent<OnClickComponent>([](WAL::Entity &entity, WAL::Wal &wal)
{
RAY2D::Text *text = dynamic_cast<RAY2D::Text *>(entity.getComponent<Drawable2DComponent>().drawable.get());
auto *text = dynamic_cast<RAY2D::Text *>(entity.getComponent<Drawable2DComponent>().drawable.get());
if (text->getString().find("Off") != std::string::npos) {
text->setText("2nd Level: On");
//do
Runner::hasHeights = true;
} else {
text->setText("2nd Level: Off");
//do
Runner::hasHeights = false;
}
})
.addComponent<OnIdleComponent>([](WAL::Entity &entity, WAL::Wal &)
{
{
entity.getComponent<Drawable2DComponent>().drawable->setColor(BLACK);
})
})
.addComponent<OnHoverComponent>([](WAL::Entity &entity, WAL::Wal &)
{
entity.getComponent<Drawable2DComponent>().drawable->setColor(ORANGE);
});
auto &aiMore = scene->addEntity("AI+")
.addComponent<PositionComponent>(1920 / 1.75, 1.85 * 1080 / 3, 0)
.addComponent<Drawable2DComponent, RAY::Texture>("assets/buttons/cpu_add.png")
.addComponent<OnClickComponent>([](WAL::Entity &entity, WAL::Wal &wal)
{
wal.getSystem<LobbySystem>().addAI();
})
.addComponent<OnIdleComponent>([](WAL::Entity &entity, WAL::Wal &)
{
auto *texture = dynamic_cast<RAY::Texture *>(entity.getComponent<Drawable2DComponent>().drawable.get());
texture->use("assets/buttons/cpu_add.png");
})
.addComponent<OnHoverComponent>([](WAL::Entity &entity, WAL::Wal &)
{
auto *texture = dynamic_cast<RAY::Texture *>(entity.getComponent<Drawable2DComponent>().drawable.get());
texture->use("assets/buttons/cpu_add_hovered.png");
});
auto &aiLess = scene->addEntity("AI-")
.addComponent<PositionComponent>(1920 / 1.75, 2.10 * 1080 / 3, 0)
.addComponent<Drawable2DComponent, RAY::Texture>("assets/buttons/cpu_remove.png")
.addComponent<OnClickComponent>([](WAL::Entity &entity, WAL::Wal &wal)
{
wal.getSystem<LobbySystem>().removeAI();
})
.addComponent<OnIdleComponent>([](WAL::Entity &entity, WAL::Wal &)
{
auto *texture = dynamic_cast<RAY::Texture *>(entity.getComponent<Drawable2DComponent>().drawable.get());
texture->use("assets/buttons/cpu_remove.png");
})
.addComponent<OnHoverComponent>([](WAL::Entity &entity, WAL::Wal &)
{
auto *texture = dynamic_cast<RAY::Texture *>(entity.getComponent<Drawable2DComponent>().drawable.get());
texture->use("assets/buttons/cpu_remove_hovered.png");
});
for (int i = 0; i < 4; i++) {
auto &playerTile = scene->addEntity("player tile")
.addComponent<PositionComponent>(224 * (i + 1) + 200 * i, 1080 / 3, 0)
@@ -170,8 +204,10 @@ namespace BBM
play.getComponent<OnClickComponent>().setButtonLinks(&lavaOption, &back, &back, &howToPlay);
howToPlay.getComponent<OnClickComponent>().setButtonLinks(&play, nullptr, &play);
back.getComponent<OnClickComponent>().setButtonLinks(&play, nullptr, nullptr, &play);
lavaOption.getComponent<OnClickComponent>().setButtonLinks(nullptr, &play, nullptr, &heightOption);
heightOption.getComponent<OnClickComponent>().setButtonLinks(nullptr, &play, &lavaOption, nullptr);
lavaOption.getComponent<OnClickComponent>().setButtonLinks(nullptr, &heightOption, nullptr, &aiMore);
heightOption.getComponent<OnClickComponent>().setButtonLinks(&lavaOption, &play, nullptr, &aiLess);
aiMore.getComponent<OnClickComponent>().setButtonLinks(nullptr, &aiLess, &lavaOption, nullptr);
aiLess.getComponent<OnClickComponent>().setButtonLinks(&aiMore, &play, &heightOption, nullptr);
return scene;
}
}