From 6022bb94cd385eb2782bd6f63cf636ebab246fb9 Mon Sep 17 00:00:00 2001 From: Jonni Liljamo Date: Mon, 6 Feb 2023 12:28:35 +0200 Subject: [PATCH] feat(sdbclient): simple runtime data handling --- sdbclient/src/main.rs | 5 +++++ sdbclient/src/runtime/game/mod.rs | 19 +++++++++++++++++++ sdbclient/src/runtime/menu/mod.rs | 24 ++++++++++++++++++++++++ sdbclient/src/runtime/mod.rs | 10 ++++++++++ 4 files changed, 58 insertions(+) create mode 100644 sdbclient/src/runtime/game/mod.rs create mode 100644 sdbclient/src/runtime/menu/mod.rs create mode 100644 sdbclient/src/runtime/mod.rs diff --git a/sdbclient/src/main.rs b/sdbclient/src/main.rs index 2b6f692..a5a5e43 100644 --- a/sdbclient/src/main.rs +++ b/sdbclient/src/main.rs @@ -25,6 +25,7 @@ mod cfg; mod constants; //mod lua; mod plugins; +mod runtime; mod util; /// Used to control the state of the game @@ -99,6 +100,10 @@ fn main() { .add_plugin(plugins::phases::loading::LoadingPlugin) .add_plugin(plugins::menu::MenuPlugin); + // Lastly, add in runtime data structs + app.insert_resource(runtime::menu::RTDMenu::default()) + .insert_resource(runtime::game::RTDGame::default()); + app.run(); } diff --git a/sdbclient/src/runtime/game/mod.rs b/sdbclient/src/runtime/game/mod.rs new file mode 100644 index 0000000..cdafbd3 --- /dev/null +++ b/sdbclient/src/runtime/game/mod.rs @@ -0,0 +1,19 @@ +/* + * This file is part of sdbclient + * Copyright (C) 2023 Jonni Liljamo + * + * Licensed under GPL-3.0-only. + * See LICENSE for licensing information. + */ + +use bevy::prelude::Resource; + +/// Runtime data for use when in game +#[derive(Resource)] +pub(crate) struct RTDGame {} + +impl Default for RTDGame { + fn default() -> Self { + Self {} + } +} diff --git a/sdbclient/src/runtime/menu/mod.rs b/sdbclient/src/runtime/menu/mod.rs new file mode 100644 index 0000000..1e91088 --- /dev/null +++ b/sdbclient/src/runtime/menu/mod.rs @@ -0,0 +1,24 @@ +/* + * This file is part of sdbclient + * Copyright (C) 2023 Jonni Liljamo + * + * Licensed under GPL-3.0-only. + * See LICENSE for licensing information. + */ + +use bevy::prelude::Resource; + +/// Runtime data for use in the menu +#[derive(Resource)] +pub(crate) struct RTDMenu { + /// Current game ID, for showing lobby data etc + pub cur_game_id: String, +} + +impl Default for RTDMenu { + fn default() -> Self { + Self { + cur_game_id: String::from(""), + } + } +} diff --git a/sdbclient/src/runtime/mod.rs b/sdbclient/src/runtime/mod.rs new file mode 100644 index 0000000..c47b2ed --- /dev/null +++ b/sdbclient/src/runtime/mod.rs @@ -0,0 +1,10 @@ +/* + * This file is part of sdbclient + * Copyright (C) 2023 Jonni Liljamo + * + * Licensed under GPL-3.0-only. + * See LICENSE for licensing information. + */ + +pub(crate) mod game; +pub(crate) mod menu; -- 2.44.1