aboutsummaryrefslogtreecommitdiff
path: root/teensy/teensy_context.c
diff options
context:
space:
mode:
authoriamcheeseman <[email protected]>2026-05-27 16:34:31 -0400
committeriamcheeseman <[email protected]>2026-05-27 16:34:31 -0400
commita875e0155ec7757c7b487bee0b4a8fbfa8574888 (patch)
treee35b5384478371a8708e6adeeb4f49201b618364 /teensy/teensy_context.c
parent9d997b496f9d475c6e08e33f9aa2555612c8f87b (diff)
build for w*ndows
Diffstat (limited to 'teensy/teensy_context.c')
-rw-r--r--teensy/teensy_context.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/teensy/teensy_context.c b/teensy/teensy_context.c
index ad7c79e..2eb1df3 100644
--- a/teensy/teensy_context.c
+++ b/teensy/teensy_context.c
@@ -2,7 +2,11 @@
#include <math.h>
#include <stdarg.h>
+#ifdef _WIN32
+#include <windows.h>
+#else
#include <time.h>
+#endif
#include "teensy_platform.h"
#include "teensy_renderer.h"
@@ -81,7 +85,7 @@ int ty_tick(void)
double current_time = ty_get_time();
double time_since_tic = current_time - ctx.prev_tic_ts;
- int tics = time_since_tic / ctx.ticrate;
+ int tics = (int)(time_since_tic / ctx.ticrate);
if (tics > 0) {
update_buttons();
ctx.prev_tic_ts = current_time;
@@ -95,10 +99,14 @@ void ty_sleep(uint64_t ms)
{
assert(is_init());
+#ifdef _WIN32
+ Sleep((DWORD)ms);
+#else
struct timespec ts;
ts.tv_sec = ms / 1000;
ts.tv_nsec = (ms % 1000) * 1000000;
nanosleep(&ts, NULL);
+#endif
}
char *ty_format_args(const char *fmt, va_list list)