From e9b84fddb899f053066d6d6801fa8e12d66fd078 Mon Sep 17 00:00:00 2001 From: fhscey Date: Wed, 22 Jan 2025 00:29:19 +0800 Subject: [PATCH] fix: linux build --- phira/src/page/settings.rs | 16 +++++++++++++++- prpr/src/judge.rs | 11 +++++++++-- prpr/src/scene/game.rs | 3 +++ 3 files changed, 27 insertions(+), 3 deletions(-) diff --git a/phira/src/page/settings.rs b/phira/src/page/settings.rs index c42d2f9f..68dd5864 100644 --- a/phira/src/page/settings.rs +++ b/phira/src/page/settings.rs @@ -264,9 +264,9 @@ fn right_rect(w: f32) -> Rect { Rect::new(w - 0.3, (ITEM_HEIGHT - rh) / 2., INTERACT_WIDTH, rh) } +#[cfg(target_os = "windows")] struct GeneralList { icon_lang: SafeTexture, - lang_btn: ChooseButton, windows_fullscreen_btn: DRectButton, windows_multitouch_btn: DRectButton, @@ -280,6 +280,20 @@ struct GeneralList { anys_gateway_btn: DRectButton, } +#[cfg(not(target_os = "windows"))] +struct GeneralList { + icon_lang: SafeTexture, + lang_btn: ChooseButton, + offline_btn: DRectButton, + server_status_btn: DRectButton, + mp_btn: DRectButton, + mp_addr_btn: DRectButton, + lowq_btn: DRectButton, + insecure_btn: DRectButton, + enable_anys_btn: DRectButton, + anys_gateway_btn: DRectButton, +} + impl GeneralList { pub fn new(icon_lang: SafeTexture) -> Self { Self { diff --git a/prpr/src/judge.rs b/prpr/src/judge.rs index c0f7f659..38f500ec 100644 --- a/prpr/src/judge.rs +++ b/prpr/src/judge.rs @@ -274,10 +274,14 @@ pub struct Judge { } static SUBSCRIBER_ID: Lazy = Lazy::new(register_input_subscriber); + +#[cfg(target_os = "windows")] thread_local! { - #[cfg(target_os = "windows")] static TOUCHES: RefCell<(HashMap, i32, u32, Vec)> = RefCell::default(); - #[cfg(not(target_os = "windows"))] +} + +#[cfg(not(target_os = "windows"))] +thread_local! { static TOUCHES: RefCell<(Vec, i32, u32)> = RefCell::default(); } @@ -1016,7 +1020,10 @@ impl Judge { } } +#[cfg(target_os = "windows")] struct Handler(HashMap, i32, u32, Vec); +#[cfg(not(target_os = "windows"))] +struct Handler(Vec, i32, u32); impl Handler { fn finalize(&mut self) { #[cfg(target_os = "windows")] diff --git a/prpr/src/scene/game.rs b/prpr/src/scene/game.rs index f98b72d9..7194dac6 100644 --- a/prpr/src/scene/game.rs +++ b/prpr/src/scene/game.rs @@ -796,6 +796,7 @@ impl Scene for GameScene { let time = tm.now() as f32; let time = match self.state { State::Starting => { + #[cfg(target_os = "windows")] set_multitouch(self.res.config.windows_multitouch_mode, true); if time >= Self::BEFORE_TIME { self.res.alpha = 1.; @@ -838,6 +839,7 @@ impl Scene for GameScene { time } State::Ending => { + #[cfg(target_os = "windows")] set_multitouch(self.res.config.windows_multitouch_mode, false); let t = time - self.res.track_length - WAIT_TIME; if t >= AFTER_TIME + 0.3 { @@ -1104,6 +1106,7 @@ impl Scene for GameScene { fn next_scene(&mut self, tm: &mut TimeManager) -> NextScene { if self.should_exit { + #[cfg(target_os = "windows")] set_multitouch(self.res.config.windows_multitouch_mode, false); if tm.paused() { tm.resume();