0.1.0-0-pre.8

This commit is contained in:
2026-09-16 09:39:53 +02:00
parent 431665992c
commit 00808ea5a6
21 changed files with 410 additions and 30 deletions

View File

@@ -1,5 +1,5 @@
// file: crates/engines/engine-v1-sdl/src/runtime.rs
// version: 4
// version: 5
/// Minimal SDL3 runtime used by Desktop POC runners.
pub struct SdlRuntime {
@@ -39,9 +39,10 @@ impl SdlRuntime {
std::result::Result::Err(error) => return std::result::Result::Err(error.to_string()),
};
let mut runner = engine_v1_common::FixedStepRunner::new(self.frame_duration);
let mut pointer = engine_v1_common::PointerState::inactive();
tracing::info!(title = %self.title, width = self.width, height = self.height, "SDL3 runtime started");
'running: loop {
let mut input = engine_v1_common::InputState::none();
let mut input = engine_v1_common::InputState::none().with_pointer(pointer);
for event in events.poll_iter() {
match event {
sdl3::event::Event::Quit { .. } => break 'running,
@@ -49,9 +50,20 @@ impl SdlRuntime {
sdl3::event::Event::KeyDown { keycode: Some(sdl3::keyboard::Keycode::Space), .. } => {
input = input.with_action(engine_v1_common::GameAction::Primary, true);
},
sdl3::event::Event::FingerDown { x, y, .. } | sdl3::event::Event::FingerMotion { x, y, .. } => {
pointer = engine_v1_common::PointerState::normalized(true, x, y);
input = input.with_pointer(pointer).with_action(engine_v1_common::GameAction::Primary, true);
},
sdl3::event::Event::FingerUp { x, y, .. } | sdl3::event::Event::FingerCanceled { x, y, .. } => {
pointer = engine_v1_common::PointerState::normalized(false, x, y);
input = input.with_pointer(pointer);
},
_ => {},
}
}
if pointer.active() {
input = input.with_pointer(pointer).with_action(engine_v1_common::GameAction::Primary, true);
}
runner.tick(game, input);
canvas.set_draw_color(sdl3::pixels::Color::RGB(18, 18, 24));
canvas.clear();