Brought over the storyboard thing from my other game for the intro sequence.

This commit is contained in:
Zed A. Shaw 2026-04-03 00:05:37 -04:00
parent 279faf6dd5
commit 0df63ea074
10 changed files with 204 additions and 3 deletions

View file

@ -31,6 +31,7 @@ namespace gui {
void FSM::event(Event ev, std::any data) {
switch($state) {
FSM_STATE(State, START, ev);
FSM_STATE(State, INTRO, ev);
FSM_STATE(State, START_SCENE, ev);
FSM_STATE(State, DEATH_SCENE, ev);
FSM_STATE(State, WIN_SCENE, ev);
@ -58,9 +59,23 @@ namespace gui {
$debug_ui.init(cell);
$status_ui.init();
run_systems();
$story = std::make_shared<storyboard::UI>("intro_story");
$story->init();
state(State::INTRO);
}
show_scene("STARTING");
state(State::START_SCENE);
void FSM::INTRO(Event ev) {
dbc::check($story != nullptr, "you forgot the stroy");
if($story->playing()) {
if(ev == game::Event::MOUSE_CLICK) {
$story->reset();
}
} else {
$story = nullptr;
show_scene("STARTING");
state(State::START_SCENE);
}
}
void FSM::START_SCENE(Event ev) {
@ -407,6 +422,8 @@ namespace gui {
void FSM::draw_gui() {
if($cur_scene != nullptr) {
$cur_scene->render($window);
} else if($story != nullptr) {
$story->render($window);
} else {
$main_ui.render();
$status_ui.render($window);
@ -422,6 +439,8 @@ namespace gui {
void FSM::update() {
if($cur_scene != nullptr) {
$cur_scene->update();
} else if($story != nullptr) {
$story->update();
}
}