From 85019a08c195ac31e548b0549053fbc9f71b427f Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Sun, 3 Mar 2019 18:06:40 +0100 Subject: [PATCH] added detecting use of touch device for user input on current platform --- src/events.c | 2 ++ src/init.c | 2 ++ src/libgame/system.c | 6 ++++++ src/libgame/system.h | 7 +++++++ 4 files changed, 17 insertions(+) diff --git a/src/events.c b/src/events.c index 8279f70f..b94e57c5 100644 --- a/src/events.c +++ b/src/events.c @@ -1016,6 +1016,8 @@ void HandleFingerEvent(FingerEvent *event) event->pressure); #endif + runtime.uses_touch_device = TRUE; + if (game_status != GAME_MODE_PLAYING) return; diff --git a/src/init.c b/src/init.c index 3f060862..683bacdb 100644 --- a/src/init.c +++ b/src/init.c @@ -6061,6 +6061,8 @@ void OpenAll(void) InitNetworkSettings(); + InitRuntimeInfo(); + if (network.serveronly) { #if defined(PLATFORM_UNIX) diff --git a/src/libgame/system.c b/src/libgame/system.c index de973c73..488e838e 100644 --- a/src/libgame/system.c +++ b/src/libgame/system.c @@ -30,6 +30,7 @@ struct ProgramInfo program; struct NetworkInfo network; +struct RuntimeInfo runtime; struct OptionInfo options; struct VideoSystemInfo video; struct AudioSystemInfo audio; @@ -114,6 +115,11 @@ void InitNetworkInfo(boolean enabled, boolean connected, boolean serveronly, network.server_port = server_port; } +void InitRuntimeInfo() +{ + runtime.uses_touch_device = FALSE; +} + void InitScoresInfo(void) { char *global_scores_dir = getPath2(getCommonDataDir(), SCORES_DIRECTORY); diff --git a/src/libgame/system.h b/src/libgame/system.h index afb90b7a..50dc5736 100644 --- a/src/libgame/system.h +++ b/src/libgame/system.h @@ -942,6 +942,11 @@ struct NetworkInfo }; +struct RuntimeInfo +{ + boolean uses_touch_device; +}; + struct OptionInfo { char *server_host; @@ -1688,6 +1693,7 @@ struct LevelStats extern struct ProgramInfo program; extern struct NetworkInfo network; +extern struct RuntimeInfo runtime; extern struct OptionInfo options; extern struct VideoSystemInfo video; extern struct AudioSystemInfo audio; @@ -1726,6 +1732,7 @@ extern int FrameCounter; void InitProgramInfo(char *, char *, char *, char *, char *, char *, char *, char *, int); void InitNetworkInfo(boolean, boolean, boolean, char *, int); +void InitRuntimeInfo(void); void InitScoresInfo(void); void SetWindowTitle(void); -- 2.34.1