0.1.0-2-beta.1.fix.4
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
// file: crates/engines/engine-v1-sdl/src/lib.rs
|
||||
// version: 4
|
||||
// version: 5
|
||||
|
||||
#![warn(missing_docs)]
|
||||
#![deny(unreachable_pub)]
|
||||
@@ -12,5 +12,3 @@ mod unit_tests;
|
||||
|
||||
/// Re-export of the minimal SDL3 runtime used by Desktop POC runners.
|
||||
pub use self::runtime::SdlRuntime;
|
||||
/// Re-export of the platform-native Back request bridge.
|
||||
pub use self::runtime::request_platform_back;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// file: crates/engines/engine-v1-sdl/src/runtime.rs
|
||||
// version: 12
|
||||
// version: 13
|
||||
|
||||
/// Minimal SDL3 runtime used by Desktop and Android POC runners.
|
||||
pub struct SdlRuntime {
|
||||
@@ -9,17 +9,6 @@ pub struct SdlRuntime {
|
||||
frame_duration: std::time::Duration,
|
||||
}
|
||||
|
||||
static PLATFORM_BACK_REQUESTED: std::sync::atomic::AtomicBool = std::sync::atomic::AtomicBool::new(false);
|
||||
|
||||
/// Requests the active SDL runtime to evaluate a platform-native Back action.
|
||||
///
|
||||
/// Platform adapters use this signal when the host operating system does not expose Back
|
||||
/// as a normal SDL keyboard event.
|
||||
pub fn request_platform_back() {
|
||||
PLATFORM_BACK_REQUESTED.store(true, std::sync::atomic::Ordering::Release);
|
||||
return;
|
||||
}
|
||||
|
||||
impl SdlRuntime {
|
||||
/// Creates a minimal SDL3 runtime configuration.
|
||||
#[must_use]
|
||||
@@ -54,12 +43,6 @@ impl SdlRuntime {
|
||||
let mut pointer = engine_v1_common::PointerState::inactive();
|
||||
tracing::info!(title = %self.title, width = self.width, height = self.height, "SDL3 runtime started");
|
||||
'running: loop {
|
||||
if take_platform_back_request() {
|
||||
tracing::info!(source = "platform_back", "SDL3 platform Back requested");
|
||||
if quit_requested(game, engine_v1_common::QuitSource::PlatformBack) {
|
||||
break 'running;
|
||||
}
|
||||
}
|
||||
let mut input = engine_v1_common::InputState::none().with_pointer(pointer);
|
||||
for event in events.poll_iter() {
|
||||
match event {
|
||||
@@ -179,10 +162,6 @@ fn render_scene(canvas: &mut sdl3::render::WindowCanvas, scene: engine_v1_common
|
||||
|
||||
const SWIPE_DIRECTION_THRESHOLD: f32 = 0.04;
|
||||
|
||||
fn take_platform_back_request() -> bool {
|
||||
return PLATFORM_BACK_REQUESTED.swap(false, std::sync::atomic::Ordering::AcqRel);
|
||||
}
|
||||
|
||||
fn quit_requested<G>(game: &mut G, source: engine_v1_common::QuitSource) -> bool
|
||||
where
|
||||
G: engine_v1_common::EngineGame,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// file: crates/engines/engine-v1-sdl/unit_tests/swipe.rs
|
||||
// version: 4
|
||||
// version: 5
|
||||
|
||||
fn pointer(x: f32, y: f32) -> engine_v1_common::PointerState {
|
||||
return engine_v1_common::PointerState::normalized(true, x, y);
|
||||
@@ -48,10 +48,3 @@ fn runtime_respects_game_quit_decision() {
|
||||
assert!(!super::quit_requested(&mut game, engine_v1_common::QuitSource::PlatformBack));
|
||||
assert_eq!(game.requests, 1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn platform_back_bridge_is_consumed_once() {
|
||||
super::request_platform_back();
|
||||
assert!(super::take_platform_back_request());
|
||||
assert!(!super::take_platform_back_request());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user