turtlegame/src/main.rs

47 lines
777 B
Rust
Raw Normal View History

2024-07-06 11:33:58 +00:00
mod activities;
2024-07-05 21:10:25 +00:00
mod game;
2024-07-06 11:33:58 +00:00
use activities::Activity;
2024-07-05 21:10:25 +00:00
use comfy::*;
const GAME_NAME: &str = "Powercreep";
#[derive(Debug)]
2024-07-06 11:33:58 +00:00
struct State {
activity: Activity
}
impl Default for State {
fn default() -> Self {
Self {
activity: Activity::House
}
}
}
2024-07-05 21:10:25 +00:00
impl GameLoop for State {
fn new(_c: &mut EngineState) -> Self {
2024-07-06 11:33:58 +00:00
Self::default()
2024-07-05 21:10:25 +00:00
}
fn update(&mut self, engine: &mut EngineContext) {
game::update(self, engine);
game::draw(self, engine);
}
}
fn config(config: GameConfig) -> GameConfig {
config
}
async fn run() {
init_game_config(GAME_NAME.to_string(), env!("CARGO_PKG_VERSION"), config);
let mut engine = EngineState::new();
let game = State::new(&mut engine);
run_comfy_main_async(game, engine).await;
}
2024-07-05 17:01:09 +00:00
fn main() {
2024-07-05 21:10:25 +00:00
pollster::block_on(run());
}