Skip to content

Commit

Permalink
fix: linux build
Browse files Browse the repository at this point in the history
  • Loading branch information
fhscey committed Jan 21, 2025
1 parent b011b55 commit e9b84fd
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 3 deletions.
16 changes: 15 additions & 1 deletion phira/src/page/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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 {
Expand Down
11 changes: 9 additions & 2 deletions prpr/src/judge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -274,10 +274,14 @@ pub struct Judge {
}

static SUBSCRIBER_ID: Lazy<usize> = Lazy::new(register_input_subscriber);

#[cfg(target_os = "windows")]
thread_local! {
#[cfg(target_os = "windows")]
static TOUCHES: RefCell<(HashMap<u64, Touch>, i32, u32, Vec<Touch>)> = RefCell::default();
#[cfg(not(target_os = "windows"))]
}

#[cfg(not(target_os = "windows"))]
thread_local! {
static TOUCHES: RefCell<(Vec<Touch>, i32, u32)> = RefCell::default();
}

Expand Down Expand Up @@ -1016,7 +1020,10 @@ impl Judge {
}
}

#[cfg(target_os = "windows")]
struct Handler(HashMap<u64, Touch>, i32, u32, Vec<Touch>);
#[cfg(not(target_os = "windows"))]
struct Handler(Vec<Touch>, i32, u32);
impl Handler {
fn finalize(&mut self) {
#[cfg(target_os = "windows")]
Expand Down
3 changes: 3 additions & 0 deletions prpr/src/scene/game.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.;
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit e9b84fd

Please sign in to comment.