From 9b5c043d85d2ae8c9f68118c121628b88af90567 Mon Sep 17 00:00:00 2001 From: veclavtalica Date: Tue, 8 Oct 2024 10:30:11 +0300 Subject: [PATCH] fix warnings --- src/twn_loop.c | 8 +++++++- src/twn_textures.c | 10 +++++----- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/twn_loop.c b/src/twn_loop.c index ab8336b..28b2820 100644 --- a/src/twn_loop.c +++ b/src/twn_loop.c @@ -11,6 +11,7 @@ #include #include +/* TODO: should not be used here directly */ #ifdef EMSCRIPTEN #include #else @@ -22,6 +23,8 @@ static int event_callback(void *userdata, SDL_Event *event) { + (void)userdata; + switch (event->type) { case SDL_WINDOWEVENT: if (event->window.windowID != ctx.window_id) @@ -43,6 +46,9 @@ static int event_callback(void *userdata, SDL_Event *event) { default: break; } + + /* ignored */ + return 0; } @@ -489,7 +495,7 @@ static bool initialize(void) { /* might need this to have multiple windows */ ctx.window_id = SDL_GetWindowID(ctx.window); - glViewport(0, 0, ctx.base_render_width, ctx.base_render_height); + glViewport(0, 0, (GLsizei)ctx.base_render_width, (GLsizei)ctx.base_render_height); /* TODO: */ // SDL_GetRendererOutputSize(ctx.renderer, &ctx.window_w, &ctx.window_h); diff --git a/src/twn_textures.c b/src/twn_textures.c index 03c289d..d3fa9e7 100644 --- a/src/twn_textures.c +++ b/src/twn_textures.c @@ -343,7 +343,7 @@ static TextureKey textures_load(TextureCache *cache, const char *path) { }; /* it's a "loner texture," it doesn't fit in an atlas so it's not in one */ - if (surface->w >= ctx.texture_atlas_size || surface->h >= ctx.texture_atlas_size) { + if (surface->w >= (int)ctx.texture_atlas_size || surface->h >= (int)ctx.texture_atlas_size) { if (ctx.game.debug) { if (surface->w > 2048 || surface->h > 2048) log_warn("Unportable texture dimensions for %s, use 2048x2048 at max", path); @@ -370,10 +370,10 @@ void textures_update_atlas(TextureCache *cache) { /* this function makes a lot more sense if you read stb_rect_pack.h */ stbrp_context pack_ctx; /* target info */ stbrp_init_target(&pack_ctx, - ctx.texture_atlas_size, - ctx.texture_atlas_size, + (int)ctx.texture_atlas_size, + (int)ctx.texture_atlas_size, cache->node_buffer, - ctx.texture_atlas_size); + (int)ctx.texture_atlas_size); stbrp_rect *rects = create_rects_from_cache(cache); @@ -495,7 +495,7 @@ Rect textures_get_dims(const TextureCache *cache, TextureKey key) { if (cache->hash[key.id].value.loner_texture != 0) return cache->hash[key.id].value.srcrect; else - return (Rect){ .w = ctx.texture_atlas_size, .h = ctx.texture_atlas_size }; + return (Rect){ .w = (float)ctx.texture_atlas_size, .h = (float)ctx.texture_atlas_size }; } else { CRY("Texture lookup failed.", "Tried to get texture that isn't loaded.");