Skip to content

Commit ea7f19f

Browse files
committed
Fix windows build
1 parent 5af32e3 commit ea7f19f

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

src/main_rgfw.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,24 @@
2626
#include "RGFW.h"
2727
typedef struct { i32 x, y, w, h; } RGFW_rect;
2828

29+
#ifdef _WIN32
30+
void RGFW_sleep(u64 ms) {
31+
Sleep((u32)ms);
32+
}
33+
34+
u64 RGFW_getTimerFreq(void) {
35+
static u64 frequency = 0;
36+
if (frequency == 0) QueryPerformanceFrequency((LARGE_INTEGER*)&frequency);
37+
38+
return frequency;
39+
}
40+
41+
u64 RGFW_getTimerValue(void) {
42+
u64 value;
43+
QueryPerformanceCounter((LARGE_INTEGER*)&value);
44+
return value;
45+
}
46+
#else
2947
// TODO: make RGFW_getTimerFreq, RGFW_getTimerValue, RGFW_sleep compile on the rest of the platforms (Windows, MacOS)
3048
void RGFW_sleep(u64 ms) {
3149
struct timespec time;
@@ -44,6 +62,8 @@ u64 RGFW_getTimerValue(void) {
4462
return (u64)ts.tv_sec * RGFW_getTimerFreq() + (u64)ts.tv_nsec;
4563
}
4664

65+
#endif // _WIN32
66+
4767
#define RGL_LOAD_IMPLEMENTATION
4868
#include "rglLoad.h"
4969

0 commit comments

Comments
 (0)