0.1.0-0-pre.5
This commit is contained in:
@@ -1,31 +1,14 @@
|
||||
// file: crates/apps/game-snake-poc-desktop/src/main.rs
|
||||
// version: 3
|
||||
|
||||
#![warn(missing_docs)]
|
||||
#![deny(unreachable_pub)]
|
||||
#![forbid(unsafe_code)]
|
||||
use engine_v1_sdl::SdlRuntime;
|
||||
use game_snake_poc::SnakeGame;
|
||||
|
||||
//! Desktop development runner for the Snake POC game library.
|
||||
//!
|
||||
//! This binary exercises the platform-independent fixed-step loop. SDL3 windowing and physical input mapping are introduced in the next dedicated delta.
|
||||
fn main() -> Result<(), String> {
|
||||
let _guard = game_logging_lib::init_default_tracing("games::runner").map_err(|error| error.to_string())?;
|
||||
tracing::info!(game = "snake", "desktop SDL3 runner started");
|
||||
|
||||
fn main() {
|
||||
let _logging_guard = match game_logging_lib::init_console_tracing() {
|
||||
std::result::Result::Ok(guard) => guard,
|
||||
std::result::Result::Err(error) => {
|
||||
eprintln!("failed to initialize tracing: {error}");
|
||||
return;
|
||||
},
|
||||
};
|
||||
tracing::info!(target: "games::runner", game = "snake", "desktop POC runner started");
|
||||
let _monetization = engine_v1_platform_api::MonetizationCapabilities::disabled();
|
||||
let input = engine_v1_common::InputState::none().with_action(engine_v1_common::GameAction::Primary, true);
|
||||
let mut runner = engine_v1_common::FixedStepRunner::new(std::time::Duration::from_millis(16));
|
||||
let mut state = game_snake_poc::SnakeState::new();
|
||||
for _ in 0..3 {
|
||||
runner.tick(&mut state, input);
|
||||
}
|
||||
tracing::info!(target: "games::runner", game = "snake", frames = runner.next_frame_index(), "desktop POC runner completed");
|
||||
println!("Snake POC desktop runner: length={} frames={}", state.length(), runner.next_frame_index());
|
||||
return;
|
||||
let runtime = SdlRuntime::new("Snake POC", 720, 1280, 16);
|
||||
let mut game = SnakeGame::default();
|
||||
return runtime.run(&mut game);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user