diff --git a/sources/Component/Renderer/Drawable2DComponent.hpp b/sources/Component/Renderer/Drawable2DComponent.hpp index f57e9863..c6f86044 100644 --- a/sources/Component/Renderer/Drawable2DComponent.hpp +++ b/sources/Component/Renderer/Drawable2DComponent.hpp @@ -27,6 +27,14 @@ namespace BBM drawBefore3D(drawBefore3D) {} + //! ctor + template + explicit Drawable2DComponent(WAL::Entity &entity, WAL::TypeHolder, Params &&...params) + : WAL::Component(entity), + drawable(new T(std::forward(params)...)), + drawBefore3D(false) + {} + //! ctor template explicit Drawable2DComponent(WAL::Entity &entity, WAL::TypeHolder, bool drawBefore3D, Params &&...params) diff --git a/sources/Runner/CreditScene.cpp b/sources/Runner/CreditScene.cpp index 6ed28187..fa77c9ff 100644 --- a/sources/Runner/CreditScene.cpp +++ b/sources/Runner/CreditScene.cpp @@ -26,7 +26,7 @@ namespace BBM addMenuControl(*scene); scene->addEntity("background") .addComponent() - .addComponent(false, "assets/plain_menu_background.png"); + .addComponent("assets/plain_menu_background.png"); scene->addEntity("Control entity") .addComponent("assets/musics/music_title.ogg") @@ -34,22 +34,22 @@ namespace BBM auto &raylibLogo = scene->addEntity("raylib logo") .addComponent(1920 / 3.5, 1080 / 1.75, 0) - .addComponent(false, "assets/raylib.png"); + .addComponent("assets/raylib.png"); auto &raylibText = scene->addEntity("raylib text") .addComponent(1920 / 4, 1080 / 2, 0) - .addComponent(false, "Powered by:", 35, RAY::Vector2(), BLACK); + .addComponent("Powered by:", 35, RAY::Vector2(), BLACK); auto &otherRepoText = scene->addEntity("other repo text") .addComponent(1920 / 4, 1080 / 4, 0) - .addComponent(false, "Many Thanks to:", 35, RAY::Vector2(), BLACK); + .addComponent("Many Thanks to:", 35, RAY::Vector2(), BLACK); auto &BriansRepo = scene->addEntity("thx brian") .addComponent(1920 / 3.5, 1080 / 3.25, 0) - .addComponent(false, "Brian Guitteny (and his team)\nAssets used by their permission", 35, RAY::Vector2(), BLACK); + .addComponent("Brian Guitteny (and his team)\nAssets used by their permission", 35, RAY::Vector2(), BLACK); auto &team = scene->addEntity("team") .addComponent(1920 / 1.5, 1080 / 3.5, 0) - .addComponent(false, "Team:\n Zoe Roux\n Clément Le Bihan\n Arthur Jamet\n Louis Auzuret\n Benjamin Henry\n Tom Augier", 35, RAY::Vector2(), BLACK); + .addComponent("Team:\n Zoe Roux\n Clément Le Bihan\n Arthur Jamet\n Louis Auzuret\n Benjamin Henry\n Tom Augier", 35, RAY::Vector2(), BLACK); auto &back = scene->addEntity("back to menu") .addComponent(10, 1080 - 85, 0) - .addComponent(false, "assets/buttons/button_back.png") + .addComponent("assets/buttons/button_back.png") .addComponent([](WAL::Entity &entity, WAL::Wal &) { gameState.nextScene = BBM::GameState::SceneID::MainMenuScene; diff --git a/sources/Runner/LobbyScene.cpp b/sources/Runner/LobbyScene.cpp index 51d52f43..49f0e948 100644 --- a/sources/Runner/LobbyScene.cpp +++ b/sources/Runner/LobbyScene.cpp @@ -39,13 +39,13 @@ namespace BBM .addComponent(sounds); scene->addEntity("background") .addComponent() - .addComponent(false, "assets/plain_menu_background.png"); + .addComponent("assets/plain_menu_background.png"); scene->addEntity("lobby text") .addComponent(1920 / 2.75, 100, 0) - .addComponent(false, "Get Ready", 120, RAY::Vector2(), ORANGE); + .addComponent("Get Ready", 120, RAY::Vector2(), ORANGE); auto &play = scene->addEntity("play button") .addComponent(1920 / 2.5, 1080 - 180, 0) - .addComponent(false, "assets/buttons/button_new_game.png") + .addComponent("assets/buttons/button_new_game.png") .addComponent([](WAL::Entity &entity, WAL::Wal &wal) { auto *texture = dynamic_cast(entity.getComponent().drawable.get()); @@ -68,7 +68,7 @@ namespace BBM auto &back = scene->addEntity("back to menu") .addComponent(10, 1080 - 85, 0) - .addComponent(false, "assets/buttons/button_back.png") + .addComponent("assets/buttons/button_back.png") .addComponent([](WAL::Entity &entity, WAL::Wal &wal) { gameState.nextScene = BBM::GameState::SceneID::MainMenuScene; @@ -88,7 +88,7 @@ namespace BBM }); auto &lavaOption = scene->addEntity("lava option text") .addComponent(1920 / 6, 1.85 * 1080 / 3, 0) - .addComponent(false, "Lava: Off", 70, RAY::Vector2(), BLACK) + .addComponent("Lava: Off", 70, RAY::Vector2(), BLACK) .addComponent([](WAL::Entity &entity, WAL::Wal &wal) { auto *text = dynamic_cast(entity.getComponent().drawable.get()); @@ -112,7 +112,7 @@ namespace BBM auto &heightOption = scene->addEntity("Height option text") .addComponent(1920 / 6, 2.1 * 1080 / 3, 0) - .addComponent(false, "2nd Level: Off", 70, RAY::Vector2(), BLACK) + .addComponent("2nd Level: Off", 70, RAY::Vector2(), BLACK) .addComponent([](WAL::Entity &entity, WAL::Wal &wal) { auto *text = dynamic_cast(entity.getComponent().drawable.get()); @@ -136,7 +136,7 @@ namespace BBM auto &aiMore = scene->addEntity("AI+") .addComponent(1920 / 1.75, 1.85 * 1080 / 3, 0) - .addComponent(false, "assets/buttons/cpu_add.png") + .addComponent("assets/buttons/cpu_add.png") .addComponent([](WAL::Entity &entity, WAL::Wal &wal) { wal.getSystem().addAI(); @@ -176,11 +176,11 @@ namespace BBM .addComponent(false, RAY::Vector2(224 * (i + 1) + 200 * i, 1080 / 3), RAY::Vector2(200, 200), RAY::Color(0, 0, 0, 0)); auto &player = scene->addEntity("player") .addComponent(224 * (i + 1) + 200 * i, 1080 / 3, 0) - .addComponent(false, "assets/player/icons/none.png"); + .addComponent("assets/player/icons/none.png"); auto &ready = scene->addEntity("ready") .addComponent(224 * (i + 1) + 200 * i, 1080 / 3, 0) - // todo check why it does this | hacky way to fix ready texture - .addComponent(false, ""); + // todo check why it does this | hacky way to fix ready texture + .addComponent(""); player.addComponent(i, ready, playerTile); } scene->addEntity("camera") diff --git a/sources/Runner/MainMenuScene.cpp b/sources/Runner/MainMenuScene.cpp index 81a3cf99..13104829 100644 --- a/sources/Runner/MainMenuScene.cpp +++ b/sources/Runner/MainMenuScene.cpp @@ -29,13 +29,13 @@ namespace BBM .addComponent(sounds); scene->addEntity("background") .addComponent() - .addComponent(false, "assets/plain_menu_background.png"); + .addComponent("assets/plain_menu_background.png"); scene->addEntity("logo") .addComponent(1920 / 3, 180, 0) - .addComponent(false, "assets/logo_small.png"); + .addComponent("assets/logo_small.png"); auto &play = scene->addEntity("play button") .addComponent(1920 / 2.5, 1080 - 540, 0) - .addComponent(false, "assets/buttons/button_new_game.png") + .addComponent("assets/buttons/button_new_game.png") .addComponent([](WAL::Entity &entity, WAL::Wal &) { RAY::Texture *texture = dynamic_cast(entity.getComponent().drawable.get()); @@ -54,7 +54,7 @@ namespace BBM }); auto &settings = scene->addEntity("settings button") .addComponent(1920 / 2.5, 1080 - 360, 0) - .addComponent(false, "assets/buttons/button_settings.png") + .addComponent("assets/buttons/button_settings.png") .addComponent([](WAL::Entity &entity, WAL::Wal &) { RAY::Texture *texture = dynamic_cast(entity.getComponent().drawable.get()); @@ -92,7 +92,7 @@ namespace BBM }); auto &credits = scene->addEntity("credit button") .addComponent(1920 - 100, 1080 - 30, 0) - .addComponent(false, "Credits", 20, RAY::Vector2(), BLACK) + .addComponent("Credits", 20, RAY::Vector2(), BLACK) .addComponent([](WAL::Entity &entity, WAL::Wal &) { RAY2D::Text *text = dynamic_cast(entity.getComponent().drawable.get()); diff --git a/sources/Runner/PauseMenuScene.cpp b/sources/Runner/PauseMenuScene.cpp index 16506775..cf7d66c6 100644 --- a/sources/Runner/PauseMenuScene.cpp +++ b/sources/Runner/PauseMenuScene.cpp @@ -29,13 +29,13 @@ namespace BBM .addComponent(sounds); scene->addEntity("background") .addComponent() - .addComponent(false, "assets/plain_menu_background.png"); + .addComponent("assets/plain_menu_background.png"); scene->addEntity("pause text") .addComponent(1920 / 2.5, 180, 0) - .addComponent(false, "PAUSE", 120, RAY::Vector2(), ORANGE); + .addComponent("PAUSE", 120, RAY::Vector2(), ORANGE); auto &play = scene->addEntity("play button") .addComponent(1920 / 6.5, 1080 - 360, 0) - .addComponent(false, "assets/buttons/button_back.png") + .addComponent("assets/buttons/button_back.png") .addComponent([](WAL::Entity &entity, WAL::Wal &) { RAY::Texture *texture = dynamic_cast(entity.getComponent().drawable.get()); @@ -54,7 +54,7 @@ namespace BBM }); auto &settings = scene->addEntity("settings button") .addComponent(1920 / 2.5, 1080 - 360, 0) - .addComponent(false, "assets/buttons/button_settings.png") + .addComponent("assets/buttons/button_settings.png") .addComponent([](WAL::Entity &entity, WAL::Wal &) { RAY::Texture *texture = dynamic_cast(entity.getComponent().drawable.get()); @@ -73,7 +73,7 @@ namespace BBM }); auto &exit = scene->addEntity("exit button") .addComponent(1920 / 1.5, 1080 - 360, 0) - .addComponent(false, "assets/buttons/button_exit.png") + .addComponent("assets/buttons/button_exit.png") .addComponent([](WAL::Entity &entity, WAL::Wal &) { RAY::Texture *texture = dynamic_cast(entity.getComponent().drawable.get()); diff --git a/sources/Runner/ScoreScene.cpp b/sources/Runner/ScoreScene.cpp index f7463bf1..76a3008f 100644 --- a/sources/Runner/ScoreScene.cpp +++ b/sources/Runner/ScoreScene.cpp @@ -51,30 +51,30 @@ namespace BBM .addComponent(sounds); scene->addEntity("background") .addComponent() - .addComponent(false, "assets/plain_menu_background.png"); + .addComponent("assets/plain_menu_background.png"); scene->addEntity("scene title text") .addComponent(1920 / 3.25, 100, 0) - .addComponent(false, "GAME OVER", 120, RAY::Vector2(), ORANGE); + .addComponent("GAME OVER", 120, RAY::Vector2(), ORANGE); scene->addEntity("scene title text") .addComponent(1920 / 2.37, 250, 0) - .addComponent(false, "CONGRATS", 50, RAY::Vector2(), ORANGE); + .addComponent("CONGRATS", 50, RAY::Vector2(), ORANGE); for (int i = 0; i < players.size(); i++) { auto &playerTile = scene->addEntity("player tile") .addComponent(224 * (i + 1) + 200 * i, 1080 / 2.5, 0) - .addComponent(false, RAY::Vector2(224 * (i + 1) + 200 * i, 1080 / 3), + .addComponent(RAY::Vector2(224 * (i + 1) + 200 * i, 1080 / 3), RAY::Vector2(200, 200), tilesColor[i]); auto &playerRank = scene->addEntity("player rank name") .addComponent(224 * (i + 1) + 200 * i, 1080 / 2.75, 0) - .addComponent(false, rankName[i], 30, + .addComponent(rankName[i], 30, RAY::Vector2(224 * (i + 1) + 200 * i, 1080 / 3), tilesColor[i]); auto &player = scene->addEntity("player") .addComponent(224 * (i + 1) + 200 * i, 1080 / 2.5, 0) - .addComponent(false, playersIconPath[i]); + .addComponent(playersIconPath[i]); } scene->addEntity("back to main menu") .addComponent(10, 1080 - 85, 0) - .addComponent(false, "assets/buttons/button_back.png") + .addComponent("assets/buttons/button_back.png") .addComponent([](WAL::Entity &entity, WAL::Wal &) { gameState.nextScene = BBM::GameState::SceneID::MainMenuScene; }) diff --git a/sources/Runner/SettingsMenuScene.cpp b/sources/Runner/SettingsMenuScene.cpp index 9dfcafb1..8883bbeb 100644 --- a/sources/Runner/SettingsMenuScene.cpp +++ b/sources/Runner/SettingsMenuScene.cpp @@ -30,13 +30,13 @@ namespace BBM .addComponent(sounds); scene->addEntity("background") .addComponent() - .addComponent(false, "assets/plain_menu_background.png"); + .addComponent("assets/plain_menu_background.png"); scene->addEntity("logo") .addComponent(1920 / 3, 180, 0) - .addComponent(false, "assets/logo_small.png"); + .addComponent("assets/logo_small.png"); auto &music = scene->addEntity("music text") .addComponent(1920 / 2.5, 1080 - 540, 0) - .addComponent(false, "Music Volume", 70, RAY::Vector2(), BLACK) + .addComponent("Music Volume", 70, RAY::Vector2(), BLACK) .addComponent() .addComponent([](WAL::Entity &entity, WAL::Wal &) { @@ -49,7 +49,7 @@ namespace BBM auto &musicUp = scene->addEntity("music up button") .addComponent(1920 / 1.5, 1080 - 540, 0) - .addComponent(false, "assets/buttons/button_plus.png") + .addComponent("assets/buttons/button_plus.png") .addComponent("assets/musics/music_title.ogg") .addComponent([](WAL::Entity &entity, WAL::Wal &) { @@ -72,7 +72,7 @@ namespace BBM auto &musicDown = scene->addEntity("music down button") .addComponent(1920 / 3, 1080 - 540, 0) - .addComponent(false, "assets/buttons/button_minus.png") + .addComponent("assets/buttons/button_minus.png") .addComponent("assets/musics/music_title.ogg") .addComponent([](WAL::Entity &entity, WAL::Wal &) { @@ -95,7 +95,7 @@ namespace BBM auto &sound = scene->addEntity("sound text") .addComponent(1920 / 2.5, 1080 - 360, 0) - .addComponent(false, "Sound Volume", 70, RAY::Vector2(), BLACK) + .addComponent("Sound Volume", 70, RAY::Vector2(), BLACK) .addComponent() .addComponent([](WAL::Entity &entity, WAL::Wal &) { @@ -108,7 +108,7 @@ namespace BBM auto &soundUp = scene->addEntity("sound up button") .addComponent(1920 / 1.5, 1080 - 360, 0) - .addComponent(false, "assets/buttons/button_plus.png") + .addComponent("assets/buttons/button_plus.png") .addComponent(sounds) .addComponent([](WAL::Entity &entity, WAL::Wal &) { @@ -131,7 +131,7 @@ namespace BBM auto &soundDown = scene->addEntity("sound down button") .addComponent(1920 / 3, 1080 - 360, 0) - .addComponent(false, "assets/buttons/button_minus.png") + .addComponent("assets/buttons/button_minus.png") .addComponent(sounds) .addComponent([](WAL::Entity &entity, WAL::Wal &) { @@ -154,7 +154,7 @@ namespace BBM auto &debug = scene->addEntity("debug text") .addComponent(1920 / 2.5, 1080 - 180, 0) - .addComponent(false, "Debug Mode: Off", 70, RAY::Vector2(), BLACK) + .addComponent("Debug Mode: Off", 70, RAY::Vector2(), BLACK) .addComponent([](WAL::Entity &entity, WAL::Wal &wal) { RAY2D::Text *text = dynamic_cast(entity.getComponent().drawable.get()); @@ -177,7 +177,7 @@ namespace BBM }); auto &back = scene->addEntity("back to menu") .addComponent(10, 1080 - 85, 0) - .addComponent(false, "assets/buttons/button_back.png") + .addComponent("assets/buttons/button_back.png") .addComponent([](WAL::Entity &entity, WAL::Wal &) { gameState.nextScene = BBM::GameState::SceneID::MainMenuScene; diff --git a/sources/Runner/SplashScreenScene.cpp b/sources/Runner/SplashScreenScene.cpp index 15700ba3..a22d20da 100644 --- a/sources/Runner/SplashScreenScene.cpp +++ b/sources/Runner/SplashScreenScene.cpp @@ -24,13 +24,13 @@ namespace BBM .addComponent(); auto &background = scene->addEntity("background") .addComponent(0, 0, 0) - .addComponent(false, RAY::Vector2(), RAY::Vector2(1920, 1080)); + .addComponent(RAY::Vector2(), RAY::Vector2(1920, 1080)); auto &text = scene->addEntity("powered by text") .addComponent(1920 / 2 - 200, 1080 / 2 - 180, 0) - .addComponent(false, "powered by", 30, RAY::Vector2(), BLACK); + .addComponent("powered by", 30, RAY::Vector2(), BLACK); auto &skipText = scene->addEntity("Press space to skip") .addComponent(1920 - 250, 1080 - 30, 0) - .addComponent(false, "Press space to skip", 20, RAY::Vector2(), BLACK); + .addComponent("Press space to skip", 20, RAY::Vector2(), BLACK); return scene; } } \ No newline at end of file diff --git a/sources/Runner/TitleScreenScene.cpp b/sources/Runner/TitleScreenScene.cpp index 3336d986..729434f3 100644 --- a/sources/Runner/TitleScreenScene.cpp +++ b/sources/Runner/TitleScreenScene.cpp @@ -28,13 +28,13 @@ namespace BBM .addComponent("assets/musics/music_title.ogg"); scene->addEntity("background") .addComponent() - .addComponent(false, "assets/plain_menu_background.png"); + .addComponent("assets/plain_menu_background.png"); scene->addEntity("logo") .addComponent(320, 180, 0) - .addComponent(false, "assets/logo_big.png"); + .addComponent("assets/logo_big.png"); scene->addEntity("text_prompt") .addComponent(1920 / 2.5, 1080 - 130, 0) - .addComponent(false, "Press space", 70, RAY::Vector2(), BLACK) + .addComponent("Press space", 70, RAY::Vector2(), BLACK) .addComponent() .addComponent() .addComponent([](WAL::Entity &entity, WAL::Wal &)