0.1.0-2-beta.1.fix.4

This commit is contained in:
2026-09-17 17:58:07 +02:00
parent 977b193e00
commit f496ca95d9
19 changed files with 180 additions and 94 deletions

View File

@@ -1,5 +1,5 @@
// file: crates/apps/game-android-entrypoint/src/lib.rs
// version: 3
// version: 4
#![warn(missing_docs)]
#![deny(unreachable_pub)]
@@ -21,13 +21,7 @@ extern "C" fn sdl_main(_argc: core::ffi::c_int, _argv: *mut *mut core::ffi::c_ch
#[unsafe(export_name = "Java_com_sasedev_games_common_NativeBridge_nativeContractVersion")]
extern "C" fn native_contract_version(_environment: *mut core::ffi::c_void, _class: *mut core::ffi::c_void) -> core::ffi::c_int {
return 2;
}
#[unsafe(export_name = "Java_com_sasedev_games_common_NativeBridge_nativeRequestPlatformBack")]
extern "C" fn native_request_platform_back(_environment: *mut core::ffi::c_void, _class: *mut core::ffi::c_void) {
engine_v1_sdl::request_platform_back();
return;
return 3;
}
#[cfg(feature = "reflex")]

View File

@@ -1,7 +1,7 @@
{
"name": "game-reflex-poc-tauri",
"private": true,
"version": "0.1.0-2-beta.1.fix.3",
"version": "0.1.0-2-beta.1.fix.4",
"type": "module",
"scripts": {
"dev": "vite",

View File

@@ -1,7 +1,7 @@
{
"$schema": "https://schema.tauri.app/config/2",
"productName": "Reflex POC Tauri",
"version": "0.1.0-2-beta.1.fix.3",
"version": "0.1.0-2-beta.1.fix.4",
"identifier": "com.sasedev.games.reflex.tauri",
"build": {
"beforeDevCommand": {

View File

@@ -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;

View File

@@ -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,

View File

@@ -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());
}