mirror of
https://github.com/Noratrieb/game-wip-dontplay.git
synced 2026-01-16 20:35:02 +01:00
more
This commit is contained in:
parent
a55aedca0c
commit
39dde35229
2 changed files with 33 additions and 42 deletions
39
src/app.rs
39
src/app.rs
|
|
@ -1,39 +0,0 @@
|
||||||
use crate::{
|
|
||||||
command::CmdVec,
|
|
||||||
debug::{self, DebugState},
|
|
||||||
game::GameState,
|
|
||||||
res::Res,
|
|
||||||
};
|
|
||||||
use egui_sfml::SfEgui;
|
|
||||||
/// Application level state (includes game and ui state, etc.)
|
|
||||||
pub(crate) struct App {
|
|
||||||
pub(crate) game: GameState,
|
|
||||||
pub(crate) res: Res,
|
|
||||||
pub(crate) sf_egui: SfEgui,
|
|
||||||
pub(crate) debug: DebugState,
|
|
||||||
/// Integer scale for rendering the game
|
|
||||||
pub(crate) scale: u8,
|
|
||||||
pub(crate) cmdvec: CmdVec,
|
|
||||||
}
|
|
||||||
impl App {
|
|
||||||
pub(crate) fn new() -> anyhow::Result<Self> {
|
|
||||||
loop {}
|
|
||||||
}
|
|
||||||
pub(crate) fn do_game_loop(&mut self) {
|
|
||||||
self.do_rendering();
|
|
||||||
}
|
|
||||||
fn do_rendering(&mut self) {
|
|
||||||
self.sf_egui
|
|
||||||
.do_frame(|ctx| {
|
|
||||||
debug::do_debug_ui(
|
|
||||||
ctx,
|
|
||||||
&mut self.debug,
|
|
||||||
&mut self.game,
|
|
||||||
&mut self.res,
|
|
||||||
&mut self.scale,
|
|
||||||
&mut self.cmdvec,
|
|
||||||
);
|
|
||||||
})
|
|
||||||
.unwrap();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
36
src/main.rs
36
src/main.rs
|
|
@ -1,4 +1,9 @@
|
||||||
mod app;
|
use command::CmdVec;
|
||||||
|
use debug::DebugState;
|
||||||
|
use egui_sfml::SfEgui;
|
||||||
|
use game::GameState;
|
||||||
|
use res::Res;
|
||||||
|
|
||||||
mod command;
|
mod command;
|
||||||
mod debug;
|
mod debug;
|
||||||
mod game;
|
mod game;
|
||||||
|
|
@ -8,9 +13,34 @@ mod res;
|
||||||
mod texture_atlas;
|
mod texture_atlas;
|
||||||
mod tiles;
|
mod tiles;
|
||||||
mod world;
|
mod world;
|
||||||
use app::App;
|
|
||||||
|
pub(crate) struct App {
|
||||||
|
pub(crate) game: GameState,
|
||||||
|
pub(crate) res: Res,
|
||||||
|
pub(crate) sf_egui: SfEgui,
|
||||||
|
pub(crate) debug: DebugState,
|
||||||
|
/// Integer scale for rendering the game
|
||||||
|
pub(crate) scale: u8,
|
||||||
|
pub(crate) cmdvec: CmdVec,
|
||||||
|
}
|
||||||
|
impl App {
|
||||||
|
pub(crate) fn new() -> anyhow::Result<Self> {
|
||||||
|
loop {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let mut app = App::new().unwrap();
|
let mut app = App::new().unwrap();
|
||||||
app.do_game_loop();
|
app.sf_egui
|
||||||
|
.do_frame(|ctx| {
|
||||||
|
debug::do_debug_ui(
|
||||||
|
ctx,
|
||||||
|
&mut app.debug,
|
||||||
|
&mut app.game,
|
||||||
|
&mut app.res,
|
||||||
|
&mut app.scale,
|
||||||
|
&mut app.cmdvec,
|
||||||
|
);
|
||||||
|
})
|
||||||
|
.unwrap();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue