Make it possible to specify the story to play.

This commit is contained in:
Zed A. Shaw 2025-11-12 11:48:24 -05:00
parent c486db5a57
commit 5e9dad51b0
3 changed files with 5 additions and 7 deletions

View file

@ -9,19 +9,17 @@
#include <sstream> #include <sstream>
namespace storyboard { namespace storyboard {
UI::UI() : UI::UI(const std::string& story_name) :
$view_texture({SCREEN_WIDTH, SCREEN_HEIGHT}), $view_texture({SCREEN_WIDTH, SCREEN_HEIGHT}),
$view_sprite($view_texture.getTexture()), $view_sprite($view_texture.getTexture()),
$audio(sound::get_sound_pair("ambient_1").sound) $audio(sound::get_sound_pair("ambient_1").sound)
{ {
$view_sprite.setPosition({0, 0}); $view_sprite.setPosition({0, 0});
$camera.style("pan"); auto config = settings::get("stories");
$story = components::convert<components::Storyboard>(config[story_name]);
} }
void UI::init() { void UI::init() {
auto config = settings::get("stories");
$story = components::convert<components::Storyboard>(config["rat_king"]);
$ui.position(0,0, SCREEN_WIDTH, SCREEN_HEIGHT); $ui.position(0,0, SCREEN_WIDTH, SCREEN_HEIGHT);
$ui.set<guecs::Background>($ui.MAIN, {$ui.$parser, guecs::THEME.TRANSPARENT}); $ui.set<guecs::Background>($ui.MAIN, {$ui.$parser, guecs::THEME.TRANSPARENT});

View file

@ -18,7 +18,7 @@ namespace storyboard {
components::Storyboard $story; components::Storyboard $story;
std::string $layout; std::string $layout;
UI(); UI(const std::string& story_name);
void init(); void init();
void render(sf::RenderWindow &window); void render(sf::RenderWindow &window);

View file

@ -26,7 +26,7 @@ int main(int, char*[]) {
gui::routing::Router router; gui::routing::Router router;
storyboard::UI main; storyboard::UI main("rat_king");
main.init(); main.init();
while(true) { while(true) {