Skip to content
Snippets Groups Projects
Commit 1a434565 authored by Deucе's avatar Deucе :ok_hand_tone4:
Browse files

Use xp_timer() instead of msclock()

I'm not really happy about rounding floats in time-critical bits,
but there you go.
parent 75756ade
Branches
Tags
1 merge request!463MRC mods by Codefenix (2024-10-20)
Pipeline #2713 failed
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
* Note: If this box doesn't appear square, then you need to fix your tabs. * * Note: If this box doesn't appear square, then you need to fix your tabs. *
****************************************************************************/ ****************************************************************************/
#include <math.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
...@@ -41,7 +42,7 @@ ...@@ -41,7 +42,7 @@
#include "ciolib.h" #include "ciolib.h"
#define MSEC_CLOCK() (msclock()*MSCLOCKS_PER_SEC/1000) #define MSEC_CLOCK() llroundl(xp_timer()*1000)
enum { enum {
MOUSE_NOSTATE MOUSE_NOSTATE
...@@ -62,7 +63,7 @@ struct in_mouse_event { ...@@ -62,7 +63,7 @@ struct in_mouse_event {
int y; int y;
int x_res; int x_res;
int y_res; int y_res;
clock_t ts; long long ts;
void *nextevent; void *nextevent;
}; };
...@@ -91,7 +92,7 @@ struct mouse_state { ...@@ -91,7 +92,7 @@ struct mouse_state {
int button_y[5]; int button_y[5];
int button_x_res[5]; /* Start X/Y position of the current state */ int button_x_res[5]; /* Start X/Y position of the current state */
int button_y_res[5]; int button_y_res[5];
clock_t timeout[5]; /* Button event timeouts (timespecs ie: time of expiry) */ long long timeout[5]; /* Button event timeouts (timespecs ie: time of expiry) */
int curx; /* Current X position */ int curx; /* Current X position */
int cury; /* Current Y position */ int cury; /* Current Y position */
int curx_res; /* Current X position */ int curx_res; /* Current X position */
...@@ -265,7 +266,7 @@ void ciolib_mouse_thread(void *data) ...@@ -265,7 +266,7 @@ void ciolib_mouse_thread(void *data)
int timeout_button=0; int timeout_button=0;
int but; int but;
int delay; int delay;
clock_t ttime=0; long long ttime=0;
SetThreadName("Mouse"); SetThreadName("Mouse");
init_mouse(); init_mouse();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment