Better scene management.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
#include "Engine/Animation.h"
|
||||
#include "Engine/Entity/Animation.h"
|
||||
#include "jlog/Logger.hpp"
|
||||
|
||||
float Animation::GetMsBetweenFrames() const {
|
||||
|
@@ -1,4 +1,4 @@
|
||||
#include "Engine/Level/Scene.h"
|
||||
#include <Engine/Level/Scene.h>
|
||||
|
||||
bool Scene::EntityListContains(const Entity* entity) const {
|
||||
for (auto* e : EntityList)
|
||||
@@ -47,6 +47,18 @@ Scene::~Scene() {
|
||||
|
||||
for (auto* e : EntityList)
|
||||
delete e;
|
||||
|
||||
delete HeadsUpDisplay;
|
||||
}
|
||||
|
||||
void Scene::Unload() {
|
||||
for (auto* f : FixedList)
|
||||
delete f;
|
||||
|
||||
for (auto* e : EntityList)
|
||||
delete e;
|
||||
|
||||
delete HeadsUpDisplay;
|
||||
}
|
||||
|
||||
void Scene::AppendEntity(Entity* entity) {
|
||||
@@ -84,3 +96,7 @@ void Scene::RemoveFixed(Fixed* fixed) {
|
||||
FixedList.erase(it);
|
||||
}
|
||||
|
||||
std::string Scene::GetName() const {
|
||||
return name;
|
||||
}
|
||||
|
||||
|
@@ -1,11 +1,10 @@
|
||||
#include <Game/Scene/DemoGameScene.h>
|
||||
#include <Game/Scene/ControllableBox.h>
|
||||
#include <Game/Entity/DemoGameHud.h>
|
||||
#include <Game/Entity/Box.h>
|
||||
|
||||
void DemoGameScene::Init() {
|
||||
void ControllableBox::Init() {
|
||||
auto* hud = new DemoGameHud();
|
||||
auto* b = new Box({0, 0});
|
||||
|
||||
HeadsUpDisplay = hud;
|
||||
AppendEntity(b);
|
||||
}
|
@@ -1,23 +1,20 @@
|
||||
#include "Game/Scene/Splash.h"
|
||||
#include "Engine/Globals.h"
|
||||
#include "Game/Scene/DemoGameScene.h"
|
||||
#include <Game/Scene/Loading.h>
|
||||
#include <Engine/Globals.h>
|
||||
|
||||
void DemoGameSplash::Init() {
|
||||
void LoadingScreen::Init() {
|
||||
RedactedSoftware = new JGL::Texture("assets/sprites/Re3D.png");
|
||||
}
|
||||
|
||||
void DemoGameSplash::Update() {
|
||||
void LoadingScreen::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);
|
||||
}
|
||||
if (elapsed >= 2.75)
|
||||
Globals::ChangeScene("Scene0");
|
||||
}
|
||||
|
||||
void DemoGameSplash::Render() {
|
||||
void LoadingScreen::Render() {
|
||||
auto text_length = JGL::Fonts::Jupiteroid.MeasureString("Loading ....", 24);
|
||||
std::string text = "Loading";
|
||||
int dots = static_cast<int>(floor(elapsed / 0.35)) % 4;
|
||||
@@ -31,7 +28,7 @@ void DemoGameSplash::Render() {
|
||||
}
|
||||
|
||||
|
||||
DemoGameSplash::~DemoGameSplash() {
|
||||
LoadingScreen::~LoadingScreen() {
|
||||
delete RedactedSoftware;
|
||||
}
|
||||
|
Reference in New Issue
Block a user