0.3.1-0-pre.2
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
// file: crates/apps/game-snake-poc-wasm/src/runtime.rs
|
||||
// version: 2
|
||||
// version: 3
|
||||
|
||||
const FIXED_STEP_MILLIS: u64 = 16;
|
||||
|
||||
@@ -31,8 +31,16 @@ impl SnakeWasmGame {
|
||||
};
|
||||
}
|
||||
|
||||
/// Updates browser-observed device and input dimensions while preserving Web/WASM/Browser provenance.
|
||||
pub fn configure_runtime_provenance(&mut self, device_class: &str, input_profile: &str) -> bool {
|
||||
/// Updates host-observed runtime provenance while preserving WebAssembly execution.
|
||||
pub fn configure_runtime_provenance(&mut self, platform_family: &str, runtime_host: &str, device_class: &str, input_profile: &str) -> bool {
|
||||
let platform_family = match parse_platform_family(platform_family) {
|
||||
Some(value) => value,
|
||||
None => return false,
|
||||
};
|
||||
let runtime_host = match parse_runtime_host(runtime_host) {
|
||||
Some(value) => value,
|
||||
None => return false,
|
||||
};
|
||||
let device_class = match parse_device_class(device_class) {
|
||||
Some(value) => value,
|
||||
None => return false,
|
||||
@@ -45,8 +53,8 @@ impl SnakeWasmGame {
|
||||
device_class,
|
||||
engine_v1_platform_api::ExecutionModel::Wasm,
|
||||
input_profile,
|
||||
engine_v1_platform_api::PlatformFamily::Web,
|
||||
engine_v1_platform_api::RuntimeHost::Browser,
|
||||
platform_family,
|
||||
runtime_host,
|
||||
);
|
||||
return true;
|
||||
}
|
||||
@@ -236,6 +244,24 @@ impl SnakeWasmGame {
|
||||
}
|
||||
}
|
||||
|
||||
fn parse_platform_family(label: &str) -> Option<engine_v1_platform_api::PlatformFamily> {
|
||||
return match label {
|
||||
"android" => Some(engine_v1_platform_api::PlatformFamily::Android),
|
||||
"desktop" => Some(engine_v1_platform_api::PlatformFamily::Desktop),
|
||||
"web" => Some(engine_v1_platform_api::PlatformFamily::Web),
|
||||
_ => None,
|
||||
};
|
||||
}
|
||||
|
||||
fn parse_runtime_host(label: &str) -> Option<engine_v1_platform_api::RuntimeHost> {
|
||||
return match label {
|
||||
"browser" => Some(engine_v1_platform_api::RuntimeHost::Browser),
|
||||
"native" => Some(engine_v1_platform_api::RuntimeHost::Native),
|
||||
"tauri-webview" => Some(engine_v1_platform_api::RuntimeHost::TauriWebView),
|
||||
_ => None,
|
||||
};
|
||||
}
|
||||
|
||||
fn parse_device_class(label: &str) -> Option<engine_v1_platform_api::DeviceClass> {
|
||||
return match label {
|
||||
"desktop" => Some(engine_v1_platform_api::DeviceClass::Desktop),
|
||||
|
||||
Reference in New Issue
Block a user