Initial Commit
This commit is contained in:
38
src/Game/Splash.cpp
Normal file
38
src/Game/Splash.cpp
Normal file
@@ -0,0 +1,38 @@
|
||||
#include "Game/Scene/Splash.h"
|
||||
#include "Engine/Globals.h"
|
||||
#include "Game/Scene/DemoGameScene.h"
|
||||
|
||||
void DemoGameSplash::Init() {
|
||||
RedactedSoftware = new JGL::Texture("assets/sprites/Re3D.png");
|
||||
}
|
||||
|
||||
void DemoGameSplash::Update() {
|
||||
angle += (elapsed * 4) * Globals::DeltaTime();
|
||||
elapsed += Globals::DeltaTime();
|
||||
|
||||
// Pretend we're actually loading something idk.
|
||||
if (elapsed >= 2.75) {
|
||||
auto* dgs = new DemoGameScene();
|
||||
Globals::ChangeScene(dgs);
|
||||
}
|
||||
}
|
||||
|
||||
void DemoGameSplash::Render() {
|
||||
auto text_length = JGL::Fonts::Jupiteroid.MeasureString("Loading ....", 24);
|
||||
std::string text = "Loading";
|
||||
int dots = static_cast<int>(floor(elapsed / 0.35)) % 4;
|
||||
for (int i = 0; i < dots; ++i)
|
||||
text += ".";
|
||||
|
||||
J2D::Begin(nullptr, true);
|
||||
J2D::DrawSprite(RedactedSoftware, {Globals::Window->GetSize().x - RedactedSoftware->GetDimensions().x, Globals::Window->GetSize().y - RedactedSoftware->GetDimensions().y}, angle, {0.5, 0.5});
|
||||
J2D::DrawString(Colors::Whites::Ivory, text, (Globals::Window->GetSize().x - text_length.x) - RedactedSoftware->GetDimensions().x , Globals::Window->GetSize().y - text_length.y * 1.125, 1, 24);
|
||||
J2D::End();
|
||||
}
|
||||
|
||||
|
||||
DemoGameSplash::~DemoGameSplash() {
|
||||
delete RedactedSoftware;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user