Load Overlay

This commit is contained in:
2024-01-03 17:23:23 -06:00
parent f2183b3a99
commit c142f3b0d6
7 changed files with 82 additions and 10 deletions

View File

@@ -2,6 +2,7 @@
#include "include/font_writer.hpp"
#include "include/menu.hpp"
#include "include/paco.hpp"
#include "Overlay/Overlays.hpp"
#include <FontWriter/fonts.hpp>
#include <FontWriter/font_writer.hpp>
#include <PSX/Periphery/periphery.hpp>
@@ -9,6 +10,24 @@
using namespace JabyEngine;
struct StateChange {
void (*asset_load)();
void (*main)();
static constexpr StateChange empty() {
return StateChange{.asset_load = nullptr, .main = nullptr};
}
void clear() {
this->asset_load = nullptr;
this->main = nullptr;
}
bool contains_state() const {
return this->main;
}
};
static const Menu::SimpleMenu::Entry MenuEntries[] = {
{"Menu 1"},
{"Menu 2"},
@@ -21,14 +40,15 @@ static const Menu::SimpleMenu::Entry MenuEntries[] = {
// Do we want Paco to be HERE?!
static object::Paco paco;
static Menu::SimpleMenu menu;
static bool enter_loading = false;
static StateChange state_changer;
static void setup() {
Assets::Main::load();
FontWriter::setup();
paco.setup();
menu.setup([](uint32_t selection) {
enter_loading = true;
state_changer.asset_load = Assets::Overlay::load_gpu_test;
state_changer.main = GPUTest::main;
},MenuEntries);
}
@@ -72,14 +92,19 @@ namespace LoadingScene {
}
static void run() {
enter_loading = false;
update();
GPU::swap_buffers_vsync(1);
render();
GPU::swap_buffers_vsync(1);
printf("End of execution!\n");
while(true);
state_changer.asset_load();
state_changer.main();
printf("Done in state!\n");
while(true);
state_changer.clear();
}
}
@@ -87,7 +112,7 @@ void main() {
setup();
while(true) {
if(enter_loading) {
if(state_changer.contains_state()) {
LoadingScene::run();
}