From 11792958f2f1fb34824fe2bb5a7fb5e95e876a41 Mon Sep 17 00:00:00 2001 From: "arthur.jamet" Date: Fri, 18 Jun 2021 08:42:02 +0200 Subject: [PATCH] add epitech logo in splash screen --- .../IntroAnimationComponent.hpp | 3 +- sources/Runner/SplashScreenScene.cpp | 3 -- .../IntroAnimation/IntroAnimationSystem.cpp | 33 ++++++++++++++++--- 3 files changed, 30 insertions(+), 9 deletions(-) diff --git a/sources/Component/IntroAnimation/IntroAnimationComponent.hpp b/sources/Component/IntroAnimation/IntroAnimationComponent.hpp index 0def3a25..d33e1730 100644 --- a/sources/Component/IntroAnimation/IntroAnimationComponent.hpp +++ b/sources/Component/IntroAnimation/IntroAnimationComponent.hpp @@ -12,6 +12,7 @@ namespace BBM unsigned int frameCounter = 0; enum animationSteps { + epitechLogo, boxBlinking, topLeftgrowing, bottomRightGrowing, @@ -20,7 +21,7 @@ namespace BBM prompt, }; - enum animationSteps currentStep = boxBlinking; + enum animationSteps currentStep = epitechLogo; //! @inherit Component *clone(WAL::Entity &entity) const override; diff --git a/sources/Runner/SplashScreenScene.cpp b/sources/Runner/SplashScreenScene.cpp index 3d0cc1ae..55b54acb 100644 --- a/sources/Runner/SplashScreenScene.cpp +++ b/sources/Runner/SplashScreenScene.cpp @@ -25,9 +25,6 @@ namespace BBM auto &background = scene->addEntity("background") .addComponent(0, 0, 0) .addComponent(RAY::Vector2(), RAY::Vector2(1920, 1080)); - auto &text = scene->addEntity("powered by text") - .addComponent(1920 / 2 - 200, 1080 / 2 - 180, 0) - .addComponent("powered by", 30, RAY::Vector2(), BLACK); auto &skipText = scene->addEntity("Press space to skip") .addComponent(1920 - 250, 1080 - 30, 0) .addComponent("Press space to skip", 20, RAY::Vector2(), BLACK) diff --git a/sources/System/IntroAnimation/IntroAnimationSystem.cpp b/sources/System/IntroAnimation/IntroAnimationSystem.cpp index 9e14eb1b..71055dd4 100644 --- a/sources/System/IntroAnimation/IntroAnimationSystem.cpp +++ b/sources/System/IntroAnimation/IntroAnimationSystem.cpp @@ -9,6 +9,7 @@ #include #include "Runner/Runner.hpp" #include "Component/Music/MusicComponent.hpp" +#include "Drawables/Texture.hpp" namespace RAY2D = RAY::Drawables::Drawables2D; @@ -25,25 +26,47 @@ namespace BBM auto scene = wal.getScene(); RAY2D::Rectangle *rectangle = nullptr; RAY2D::Text *text = nullptr; + static auto &powered_text = scene->addEntity("powered by text") + .addComponent(1920 / 2 - 200, 1080 / 2 - 180, 0) + .addComponent("powered by", 30, RAY::Vector2(), WHITE); static auto &rayText = scene->addEntity("raylibtext Rectangle") .addComponent(1920 / 2 - 44, 1080 / 2 + 48, 0) - .addComponent("", 50, RAY::Vector2(), BLACK); + .addComponent("", 50, RAY::Vector2(), WHITE); static auto &bottomRectangle = scene->addEntity("bottom Rectangle") .addComponent(1920 / 2 - 128, 1080 / 2 - 128, 0) - .addComponent(logoPos, RAY::Vector2(16, 16), BLACK); + .addComponent(logoPos, RAY::Vector2(16, 16), WHITE); static auto &leftRectangle = scene->addEntity("left Rectangle") .addComponent(1920 / 2 - 128, 1080 / 2 - 128, 0) - .addComponent(logoPos, RAY::Vector2(16, 16), BLACK); + .addComponent(logoPos, RAY::Vector2(16, 16), WHITE); static auto &rightRectangle = scene->addEntity("right Rectangle") .addComponent(1920 / 2 - 128, 1080 / 2 - 128, 0) - .addComponent(logoPos, RAY::Vector2(16, 16), BLACK); + .addComponent(logoPos, RAY::Vector2(16, 16), WHITE); static auto &topRectangle = scene->addEntity("top Rectangle") .addComponent(1920 / 2 - 128, 1080 / 2 - 128, 0) - .addComponent(logoPos, RAY::Vector2(16, 16), BLACK); + .addComponent(logoPos, RAY::Vector2(16, 16), WHITE); + static auto &epitechLogo = scene->addEntity("epitech logo") + .addComponent(1920 / 2 - 150, 1080 / 2 - 61, 0) + .addComponent("assets/epitech.png"); static short letterCounter = 0; switch (component.currentStep) { + case IntroAnimationComponent::animationSteps::epitechLogo: + if (component.frameCounter == 30) { + epitechLogo.getComponent().position = Vector3f(1920, 1080, 0); + } + if (component.frameCounter == 40) + powered_text.getComponent().drawable->setColor(BLACK); + if (component.frameCounter == 50) { + rayText.getComponent().drawable->setColor(BLACK); + bottomRectangle.getComponent().drawable->setColor(BLACK); + leftRectangle.getComponent().drawable->setColor(BLACK); + rightRectangle.getComponent().drawable->setColor(BLACK); + topRectangle.getComponent().drawable->setColor(BLACK); + component.currentStep = IntroAnimationComponent::animationSteps::topLeftgrowing; + component.frameCounter = 0; + } + break; case IntroAnimationComponent::animationSteps::boxBlinking: if ((component.frameCounter / 15) % 2) topRectangle.getComponent().drawable->setColor(BLACK);