From a875e0155ec7757c7b487bee0b4a8fbfa8574888 Mon Sep 17 00:00:00 2001 From: iamcheeseman Date: Wed, 27 May 2026 16:34:31 -0400 Subject: build for w*ndows --- .gitignore | 4 ++++ bootlickerbuild.bat | 6 ++++++ platform/gl/gl.c | 2 +- teensy/teensy_context.c | 10 +++++++++- teensy/teensy_renderer.c | 8 ++++---- teensy/teensy_ui.c | 20 ++++++++++---------- 6 files changed, 34 insertions(+), 16 deletions(-) create mode 100644 bootlickerbuild.bat diff --git a/.gitignore b/.gitignore index 21d0083..ad204a7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,9 @@ *.[ao] *.so +*.lib +*.dll +*.obj +*.exe *~ config.mk demonchime diff --git a/bootlickerbuild.bat b/bootlickerbuild.bat new file mode 100644 index 0000000..0dd35b3 --- /dev/null +++ b/bootlickerbuild.bat @@ -0,0 +1,6 @@ +@set TY_INCLUDE=/I editor /I teensy /I platform\gl /I platform\gl\glad /I teensy\platform\gl\glad /I dc +@set TY_COMPILE=cl /nologo /std:c11 /O2 /W3 %TY_INCLUDE% + +@rem you are out of your MIND if you think I'm doing anything more than making +@rem sure it works. +%TY_COMPILE% /Fe:demonchime.exe dc\*.c teensy\*.c platform\gl\*.c platform\gl\glad\*.c editor\*.c .\glfw3dll.lib diff --git a/platform/gl/gl.c b/platform/gl/gl.c index 15bfe00..3f15160 100644 --- a/platform/gl/gl.c +++ b/platform/gl/gl.c @@ -238,7 +238,7 @@ ty_Vec2i ty_platform_get_mouse(void) double scalex = win_width / ctx.hints.scr_width; double scaley = win_height / ctx.hints.scr_height; - return ty_vec2i(x / scalex, y / scaley); + return ty_vec2i((int)(x / scalex), (int)(y / scaley)); } bool ty_platform_is_button_down(ty_Button btn) 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 #include +#ifdef _WIN32 +#include +#else #include +#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) diff --git a/teensy/teensy_renderer.c b/teensy/teensy_renderer.c index 564718a..863fa25 100644 --- a/teensy/teensy_renderer.c +++ b/teensy/teensy_renderer.c @@ -227,8 +227,8 @@ void ty_draw_image_rot( double s = sin(-rot); double c = cos(-rot); - int blit_width = ceil(img.width * fabs(c) + img.height * fabs(s)); - int blit_height = ceil(img.width * fabs(s) + img.height * fabs(c)); + int blit_width = (int)ceil(img.width * fabs(c) + img.height * fabs(s)); + int blit_height = (int)ceil(img.width * fabs(s) + img.height * fabs(c)); int startx = -blit_width / 2; int starty = -blit_height / 2; @@ -237,8 +237,8 @@ void ty_draw_image_rot( for (int img_y = starty; img_y < endy; img_y++) { for (int img_x = startx; img_x < endx; img_x++) { - int dx = floor(img_x * c - img_y * s - offset.x); - int dy = floor(img_x * s + img_y * c - offset.y); + int dx = (int)floor(img_x * c - img_y * s - offset.x); + int dy = (int)floor(img_x * s + img_y * c - offset.y); if (dx < 0 || dx >= img.width || dy < 0 || dy >= img.height) continue; diff --git a/teensy/teensy_ui.c b/teensy/teensy_ui.c index f518431..4dd9d5d 100644 --- a/teensy/teensy_ui.c +++ b/teensy/teensy_ui.c @@ -162,10 +162,10 @@ int get_column_width(const Layout *l) { float width = l->column_widths[l->idx]; if (width < 0) - return width + l->width - l->x + 1; + return (int)(width + l->width - l->x + 1); if (width < 1) - return (l->width - tyui.style.padding * 2) * width; - return width; + return (int)((l->width - tyui.style.padding * 2) * width); + return (int)width; } static @@ -175,7 +175,7 @@ ty_Recti next_rect(int height) l->max_height = ty_max(l->max_height, height); - float width = get_column_width(l); + float width = (float)get_column_width(l); int x = 0; int y = 0; @@ -190,11 +190,11 @@ ty_Recti next_rect(int height) width = ty_max(width, 0); height = ty_max(height, 0); - l->x += width + tyui.style.padding; + l->x += (int)width + tyui.style.padding; advance_layout(); - return ty_recti(x, y, width, height); + return ty_recti(x, y, (int)width, height); } static @@ -518,7 +518,7 @@ void tyui_slider_ex( if (clicked) { ty_Vec2i mp = ty_mouse_pos(); - float x = mp.x - rect.x; + float x = (float)(mp.x - rect.x); float p = x / (rect.w - 1); *value_ptr = ty_clamp(p * (max - min) + min, min, max); } @@ -538,7 +538,7 @@ void tyui_slider_ex( { value = ty_clamp(value, min, max); float p = (value - min) / max; - int x = (rect.w - grabber_size) * p + rect.x; + int x = (int)((rect.w - grabber_size) * p + rect.x); ty_Recti grabber_rect = ty_recti( x, rect.y, @@ -583,14 +583,14 @@ void tyui_text_input(tyui_Text_Input *input) ty_Recti text_rect = ty_recti_shrink(rect, tyui.style.control_padding); int text_width = ty_font_width(tyui.font, input->chars); - text_rect.w = fmin(text_rect.w, text_width); + text_rect.w = (int)fmin(text_rect.w, text_width); text_cmd( input->chars, text_rect, focused ? TYUI_ALIGN_RIGHT : TYUI_ALIGN_LEFT ); if (focused && (int)(ty_get_time() * 2) % 2 == 0) { - text_rect.x += fmin(text_width, text_rect.w - 1); + text_rect.x += (int)fmin(text_width, text_rect.w - 1); text_rect.w = 1; rect_cmd(text_rect, tyui.style.fg_normal); } -- cgit v1.3-2-g0d8e