enable vsync by default for sdl3 backend, cleanup headers
This commit is contained in:
parent
9d183341ae
commit
865a2b4518
3 changed files with 9 additions and 6 deletions
|
|
@ -2,20 +2,16 @@
|
|||
#define PXL8_COPYRIGHT "Copyright (c) 2024-2025 pxl8.org"
|
||||
#define PXL8_VERSION "0.1.0"
|
||||
|
||||
#include <pthread.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <linenoise.h>
|
||||
|
||||
#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"
|
||||
|
||||
|
|
|
|||
|
|
@ -1,10 +1,13 @@
|
|||
#include <ctype.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#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';
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue