fix warnings
This commit is contained in:
parent
7c0107704d
commit
9b5c043d85
@ -11,6 +11,7 @@
|
|||||||
#include <stb_ds.h>
|
#include <stb_ds.h>
|
||||||
#include <toml.h>
|
#include <toml.h>
|
||||||
|
|
||||||
|
/* TODO: should not be used here directly */
|
||||||
#ifdef EMSCRIPTEN
|
#ifdef EMSCRIPTEN
|
||||||
#include <GLES2/gl2.h>
|
#include <GLES2/gl2.h>
|
||||||
#else
|
#else
|
||||||
@ -22,6 +23,8 @@
|
|||||||
|
|
||||||
|
|
||||||
static int event_callback(void *userdata, SDL_Event *event) {
|
static int event_callback(void *userdata, SDL_Event *event) {
|
||||||
|
(void)userdata;
|
||||||
|
|
||||||
switch (event->type) {
|
switch (event->type) {
|
||||||
case SDL_WINDOWEVENT:
|
case SDL_WINDOWEVENT:
|
||||||
if (event->window.windowID != ctx.window_id)
|
if (event->window.windowID != ctx.window_id)
|
||||||
@ -43,6 +46,9 @@ static int event_callback(void *userdata, SDL_Event *event) {
|
|||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ignored */
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -489,7 +495,7 @@ static bool initialize(void) {
|
|||||||
/* might need this to have multiple windows */
|
/* might need this to have multiple windows */
|
||||||
ctx.window_id = SDL_GetWindowID(ctx.window);
|
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: */
|
/* TODO: */
|
||||||
// SDL_GetRendererOutputSize(ctx.renderer, &ctx.window_w, &ctx.window_h);
|
// SDL_GetRendererOutputSize(ctx.renderer, &ctx.window_w, &ctx.window_h);
|
||||||
|
@ -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 */
|
/* 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 (ctx.game.debug) {
|
||||||
if (surface->w > 2048 || surface->h > 2048)
|
if (surface->w > 2048 || surface->h > 2048)
|
||||||
log_warn("Unportable texture dimensions for %s, use 2048x2048 at max", path);
|
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 */
|
/* this function makes a lot more sense if you read stb_rect_pack.h */
|
||||||
stbrp_context pack_ctx; /* target info */
|
stbrp_context pack_ctx; /* target info */
|
||||||
stbrp_init_target(&pack_ctx,
|
stbrp_init_target(&pack_ctx,
|
||||||
ctx.texture_atlas_size,
|
(int)ctx.texture_atlas_size,
|
||||||
ctx.texture_atlas_size,
|
(int)ctx.texture_atlas_size,
|
||||||
cache->node_buffer,
|
cache->node_buffer,
|
||||||
ctx.texture_atlas_size);
|
(int)ctx.texture_atlas_size);
|
||||||
|
|
||||||
stbrp_rect *rects = create_rects_from_cache(cache);
|
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)
|
if (cache->hash[key.id].value.loner_texture != 0)
|
||||||
return cache->hash[key.id].value.srcrect;
|
return cache->hash[key.id].value.srcrect;
|
||||||
else
|
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 {
|
} else {
|
||||||
CRY("Texture lookup failed.",
|
CRY("Texture lookup failed.",
|
||||||
"Tried to get texture that isn't loaded.");
|
"Tried to get texture that isn't loaded.");
|
||||||
|
Loading…
Reference in New Issue
Block a user