DEVELOPMENT ENVIRONMENT

~liljamo/deck-builder

dba81d38792caad88bb3daae4e2e7a9c50e31dcd — Jonni Liljamo 1 year, 9 months ago 24224ca
Move Cfg things to a new mod
3 files changed, 41 insertions(+), 31 deletions(-)

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

use bevy::prelude::*;

/// Various settings that can be changed from the... Settings.
#[derive(Resource, Debug, Component, PartialEq, Clone)]
pub struct CfgSettings {
    /// Master Volume
    pub volume_master: u32,
    /// Fulsscreen
    pub fullscreen: bool,
    /// Resolution
    pub resolution: (f32, f32),
}

/// User details and status
#[derive(Resource, Debug, Component, PartialEq, Clone)]
pub struct CfgUser {
    /// User logged in status
    pub logged_in: bool,
    /// User Token
    pub user_token: String,
}

/// Settings that the user has no access to, or can only access through developer settings
#[derive(Resource, Debug, Component, PartialEq, Clone)]
pub struct CfgHidden {
    /// API Server
    pub api_server: String,
}

M sdbclient/src/main.rs => sdbclient/src/main.rs +4 -30
@@ 14,6 14,7 @@ use bevy::{
use bevy_egui::EguiPlugin;
use bevy_inspector_egui::WorldInspectorPlugin;

mod cfg;
mod menu;
mod plugins;
mod util;


@@ 26,33 27,6 @@ pub enum GameState {
    Game,
}

/// Various settings that can be changed from the... Settings.
#[derive(Resource, Debug, Component, PartialEq, Clone)]
pub struct CfgSettings {
    /// Master Volume
    pub volume_master: u32,
    /// Fulsscreen
    pub fullscreen: bool,
    /// Resolution
    pub resolution: (f32, f32),
}

/// User details and status
#[derive(Resource, Debug, Component, PartialEq, Clone)]
pub struct CfgUser {
    /// User logged in status
    pub logged_in: bool,
    /// User Token
    pub user_token: String,
}

/// Settings that the user has no access to, or can only access through developer settings
#[derive(Resource, Debug, Component, PartialEq, Clone)]
pub struct CfgHidden {
    /// API Server
    pub api_server: String,
}

// Input structs
/// Login inputs
#[derive(Resource, Debug, Component, PartialEq, Eq, Clone)]


@@ 95,16 69,16 @@ fn main() {
    app.add_plugin(EguiPlugin);
    app.add_plugin(WorldInspectorPlugin::new());

    app.insert_resource(CfgSettings {
    app.insert_resource(cfg::CfgSettings {
        volume_master: 7,
        fullscreen: false,
        resolution: (1280., 720.),
    })
    .insert_resource(CfgUser {
    .insert_resource(cfg::CfgUser {
        logged_in: false,
        user_token: "".to_string(),
    })
    .insert_resource(CfgHidden {
    .insert_resource(cfg::CfgHidden {
        api_server: "http://localhost:8080".to_string(),
    })
    .insert_resource(InputsUserLogin("".to_string(), "".to_string()))

M sdbclient/src/menu/mod.rs => sdbclient/src/menu/mod.rs +1 -1
@@ 8,7 8,7 @@

use bevy::{app::AppExit, prelude::*};

use crate::CfgUser;
use crate::cfg::CfgUser;

use super::{despawn_screen, GameState};