fix warnings

This commit is contained in:
veclav talica 2024-10-08 10:30:11 +03:00
parent 7c0107704d
commit 9b5c043d85
2 changed files with 12 additions and 6 deletions

View File

@ -11,6 +11,7 @@
#include <stb_ds.h>
#include <toml.h>
/* TODO: should not be used here directly */
#ifdef EMSCRIPTEN
#include <GLES2/gl2.h>
#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);

View File

@ -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.");