migrate to comfy

This commit is contained in:
luckyturtledev 2024-07-05 23:10:25 +02:00
parent 96e3f6982e
commit e83ec5ce20
4 changed files with 1223 additions and 1925 deletions

3092
Cargo.lock generated

File diff suppressed because it is too large Load diff

View file

@ -1,5 +1,5 @@
[package]
name = "turtlegame"
name = "powercreep"
version = "0.1.0"
publish = false
edition = "2021"
@ -8,9 +8,6 @@ description = "turtlegame - the game from the turtleteam :)"
[workspace]
resolver = "2"
# Enable a small amount of optimization in debug mode
[profile.dev]
# opt-level = 1
# Enable high optimizations for dependencies (incl. Bevy), but not for our code:
@ -18,4 +15,6 @@ resolver = "2"
opt-level = 3
[dependencies]
bevy = "0.14.0"
comfy = { version = "0.4.0", features = ["wayland"] }
log = "0.4.22"
my-env-logger-style = "0.2.0"

9
src/game.rs Normal file
View file

@ -0,0 +1,9 @@
use comfy::*;
use crate::State;
pub fn update(_state: &mut State, _engine: &mut EngineContext) {}
pub fn draw(_state: &State, _engine: &EngineContext) {
draw_circle(vec2(0.0, 0.0), 0.5, RED, 0);
}

View file

@ -1,7 +1,35 @@
use bevy::prelude::*;
mod game;
use comfy::*;
const GAME_NAME: &str = "Powercreep";
#[derive(Debug)]
struct State {}
impl GameLoop for State {
fn new(_c: &mut EngineState) -> Self {
State {}
}
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;
}
fn main() {
App::new()
.add_plugins(DefaultPlugins)
.run();
//my_env_logger_style::just_log();
pollster::block_on(run());
}