aboutsummaryrefslogtreecommitdiff
path: root/teensy/teensy_context.c
diff options
context:
space:
mode:
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)