DEVELOPMENT ENVIRONMENT

~liljamo/deck-builder

6022bb94cd385eb2782bd6f63cf636ebab246fb9 — Jonni Liljamo 1 year, 10 months ago 0162b4c
feat(sdbclient): simple runtime data handling
M sdbclient/src/main.rs => sdbclient/src/main.rs +5 -0
@@ 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();
}


A sdbclient/src/runtime/game/mod.rs => sdbclient/src/runtime/game/mod.rs +19 -0
@@ 0,0 1,19 @@
/*
 * This file is part of sdbclient
 * Copyright (C) 2023 Jonni Liljamo <jonni@liljamo.com>
 *
 * 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 {}
    }
}

A sdbclient/src/runtime/menu/mod.rs => sdbclient/src/runtime/menu/mod.rs +24 -0
@@ 0,0 1,24 @@
/*
 * This file is part of sdbclient
 * Copyright (C) 2023 Jonni Liljamo <jonni@liljamo.com>
 *
 * 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(""),
        }
    }
}

A sdbclient/src/runtime/mod.rs => sdbclient/src/runtime/mod.rs +10 -0
@@ 0,0 1,10 @@
/*
 * This file is part of sdbclient
 * Copyright (C) 2023 Jonni Liljamo <jonni@liljamo.com>
 *
 * Licensed under GPL-3.0-only.
 * See LICENSE for licensing information.
 */

pub(crate) mod game;
pub(crate) mod menu;