diff --git a/src/pxl8.c b/src/pxl8.c index 34a76e9..face084 100644 --- a/src/pxl8.c +++ b/src/pxl8.c @@ -2,20 +2,16 @@ #define PXL8_COPYRIGHT "Copyright (c) 2024-2025 pxl8.org" #define PXL8_VERSION "0.1.0" -#include #include #include #include #include -#include - #include "pxl8_cart.h" #include "pxl8_game.h" #include "pxl8_hal.h" #include "pxl8_macros.h" #include "pxl8_script.h" -#include "pxl8_sdl3.h" #include "pxl8_types.h" #include "pxl8_ui.h" diff --git a/src/pxl8_io.c b/src/pxl8_io.c index f9a4b5b..b32441f 100644 --- a/src/pxl8_io.c +++ b/src/pxl8_io.c @@ -1,10 +1,13 @@ -#include #include #include #include "pxl8_io.h" #include "pxl8_types.h" +static inline char pxl8_to_lower(char c) { + return (c >= 'A' && c <= 'Z') ? c + 32 : c; +} + pxl8_result pxl8_io_read_file(const char* path, char** content, size_t* size) { if (!path || !content || !size) return PXL8_ERROR_NULL_POINTER; @@ -121,7 +124,7 @@ static i32 pxl8_key_code(const char* key_name) { char lower_name[64]; size_t i; for (i = 0; i < sizeof(lower_name) - 1 && key_name[i]; i++) { - lower_name[i] = (char)tolower((unsigned char)key_name[i]); + lower_name[i] = pxl8_to_lower(key_name[i]); } lower_name[i] = '\0'; diff --git a/src/pxl8_sdl3.c b/src/pxl8_sdl3.c index 1cd6179..83d464f 100644 --- a/src/pxl8_sdl3.c +++ b/src/pxl8_sdl3.c @@ -57,6 +57,10 @@ static void* sdl3_create(pxl8_color_mode mode, pxl8_resolution resolution, return NULL; } + if (!SDL_SetRenderVSync(ctx->renderer, 1)) { + pxl8_error("Failed to enable vsync: %s", SDL_GetError()); + } + SDL_SetRenderLogicalPresentation(ctx->renderer, fb_w, fb_h, SDL_LOGICAL_PRESENTATION_INTEGER_SCALE);