effort to have no warnings once again
This commit is contained in:
@ -39,7 +39,7 @@ static void load_game_object(void) {
|
||||
goto ERR_OPENING_SO;
|
||||
}
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wpedantic"
|
||||
|
||||
game_tick_callback = (void (*)(void))dlsym(new_handle, "game_tick");
|
||||
@ -83,6 +83,7 @@ static void watcher_callback(XWATCHER_FILE_EVENT event,
|
||||
(void)data;
|
||||
|
||||
switch(event) {
|
||||
case XWATCHER_FILE_CREATED:
|
||||
case XWATCHER_FILE_MODIFIED:
|
||||
SDL_LockMutex(lock);
|
||||
last_tick_modified = ctx.game.frame_number;
|
||||
@ -90,6 +91,12 @@ static void watcher_callback(XWATCHER_FILE_EVENT event,
|
||||
SDL_UnlockMutex(lock);
|
||||
break;
|
||||
|
||||
case XWATCHER_FILE_UNSPECIFIED:
|
||||
case XWATCHER_FILE_REMOVED:
|
||||
case XWATCHER_FILE_OPENED:
|
||||
case XWATCHER_FILE_ATTRIBUTES_CHANGED:
|
||||
case XWATCHER_FILE_NONE:
|
||||
case XWATCHER_FILE_RENAMED:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -223,6 +223,8 @@ static void render_2d(void) {
|
||||
case PRIMITIVE_2D_TEXT:
|
||||
render_text(¤t->text);
|
||||
break;
|
||||
default:
|
||||
SDL_assert(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -194,6 +194,8 @@ void use_2d_pipeline(void);
|
||||
|
||||
void use_texture_mode(TextureMode mode);
|
||||
|
||||
void upload_quad_vertices(Rect rect);
|
||||
|
||||
void finally_render_sprites(Primitive2D const primitives[],
|
||||
struct SpriteBatch batch,
|
||||
VertexBuffer buffer);
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
#include <SDL2/SDL.h>
|
||||
|
||||
char *paths_in_use;
|
||||
static char *paths_in_use;
|
||||
|
||||
void draw_skybox(const char *paths) {
|
||||
if (paths_in_use && SDL_strcmp(paths, paths_in_use) == 0)
|
||||
|
@ -199,9 +199,14 @@ void render_sprites(const Primitive2D primitives[],
|
||||
v2 = (Vec2){ sprite.rect.x + sprite.rect.w, sprite.rect.y + sprite.rect.h };
|
||||
v3 = (Vec2){ sprite.rect.x + sprite.rect.w, sprite.rect.y };
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wfloat-equal"
|
||||
|
||||
} else if (sprite.rect.w == sprite.rect.h) {
|
||||
/* rotated square case */
|
||||
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
const Vec2 c = frect_center(sprite.rect);
|
||||
const Vec2 t = fast_cossine(sprite.rotation + (float)M_PI_4);
|
||||
const Vec2 d = {
|
||||
|
@ -35,7 +35,7 @@ void draw_triangle(const char *path,
|
||||
.uv2 = uv2,
|
||||
}};
|
||||
|
||||
union UncoloredSpaceTriangle *triangles = (union UncoloredSpaceTriangle *)batch_p->value.primitives;
|
||||
union UncoloredSpaceTriangle *triangles = (union UncoloredSpaceTriangle *)(void *)batch_p->value.primitives;
|
||||
|
||||
arrpush(triangles, triangle);
|
||||
batch_p->value.primitives = (uint8_t *)triangles;
|
||||
@ -66,7 +66,7 @@ void draw_uncolored_space_traingle_batch(struct MeshBatch *batch,
|
||||
/* update pixel-based uvs to correspond with texture atlases */
|
||||
for (size_t i = 0; i < primitives_len; ++i) {
|
||||
struct UncoloredSpaceTrianglePayload *payload =
|
||||
&((union UncoloredSpaceTriangle *)batch->primitives)[i].payload;
|
||||
&((union UncoloredSpaceTriangle *)(void *)batch->primitives)[i].payload;
|
||||
|
||||
payload->uv0.x = xr + ((float)payload->uv0.x / srcrect.w) * wr;
|
||||
payload->uv0.y = yr + ((float)payload->uv0.y / srcrect.h) * hr;
|
||||
|
@ -7,7 +7,6 @@
|
||||
#include <sys/auxv.h>
|
||||
#include <elf.h>
|
||||
#include <linux/limits.h>
|
||||
#define __USE_GNU
|
||||
#include <dlfcn.h>
|
||||
|
||||
#include <SDL2/SDL.h>
|
||||
|
@ -126,6 +126,8 @@ static union AudioContext init_audio_context(const char *path, AudioFileType typ
|
||||
};
|
||||
}
|
||||
|
||||
case AUDIO_FILE_TYPE_UNKNOWN:
|
||||
case AUDIO_FILE_TYPE_COUNT:
|
||||
default:
|
||||
CRY("Audio error", "Unhandled audio format (in init)");
|
||||
return (union AudioContext){0};
|
||||
@ -147,6 +149,8 @@ static void repeat_audio(AudioChannel *channel) {
|
||||
break;
|
||||
}
|
||||
|
||||
case AUDIO_FILE_TYPE_UNKNOWN:
|
||||
case AUDIO_FILE_TYPE_COUNT:
|
||||
default:
|
||||
CRY("Audio error", "Unhandled audio format (in repeat)");
|
||||
break;
|
||||
@ -219,6 +223,8 @@ TWN_API void audio_set(const char *channel, AudioParam param, float value) {
|
||||
}
|
||||
pair->value.panning = value;
|
||||
break;
|
||||
default:
|
||||
CRY("Audio channel parameter setting failed", "Invalid parameter enum given");
|
||||
}
|
||||
}
|
||||
|
||||
@ -229,8 +235,8 @@ static void audio_mixin_streams(const AudioChannel *channel,
|
||||
uint8_t *restrict b,
|
||||
size_t frames)
|
||||
{
|
||||
float *const sa = (float *)a;
|
||||
float *const sb = (float *)b;
|
||||
float *const sa = (float *)(void *)a;
|
||||
float *const sb = (float *)(void *)b;
|
||||
|
||||
const float left_panning = fminf(fabsf(channel->panning - 1.0f), 1.0f);
|
||||
const float right_panning = fminf(fabsf(channel->panning + 1.0f), 1.0f);
|
||||
@ -321,6 +327,8 @@ static void audio_sample_and_mixin_channel(const AudioChannel *channel,
|
||||
break;
|
||||
}
|
||||
|
||||
case AUDIO_FILE_TYPE_UNKNOWN:
|
||||
case AUDIO_FILE_TYPE_COUNT:
|
||||
default:
|
||||
CRY("Audio error", "Unhandled audio format (in sampling)");
|
||||
break;
|
||||
|
@ -15,6 +15,12 @@ static void update_action_pressed_state(InputState *input, Action *action) {
|
||||
switch (action->bindings[i].source) {
|
||||
case BUTTON_SOURCE_NOT_SET:
|
||||
break;
|
||||
case BUTTON_SOURCE_KEYBOARD_CHARACTER:
|
||||
CRY("Action pressed state updated failed", "BUTTON_SOURCE_KEYBOARD_CHARACTER isn't handled");
|
||||
break;
|
||||
case BUTTON_SOURCE_GAMEPAD:
|
||||
CRY("Action pressed state updated failed", "BUTTON_SOURCE_GAMEPAD isn't handled");
|
||||
break;
|
||||
case BUTTON_SOURCE_KEYBOARD_PHYSICAL:
|
||||
/* not pressed */
|
||||
if (input->keyboard_state[action->bindings[i].code.scancode] == 0) {
|
||||
@ -98,6 +104,8 @@ static void input_bind_code_to_action(InputState *input,
|
||||
case BUTTON_SOURCE_MOUSE:
|
||||
is_already_bound = binding->code.mouse_button == code.mouse_button;
|
||||
break;
|
||||
default:
|
||||
SDL_assert(false);
|
||||
}
|
||||
|
||||
if (is_already_bound) {
|
||||
@ -156,6 +164,8 @@ static void input_unbind_code_from_action(InputState *input,
|
||||
case BUTTON_SOURCE_MOUSE:
|
||||
is_bound = binding->code.mouse_button == code.mouse_button;
|
||||
break;
|
||||
default:
|
||||
SDL_assert(false);
|
||||
}
|
||||
|
||||
/* stop early, this won't change */
|
||||
@ -220,7 +230,7 @@ void input_bind_action_control(char const *action_name,
|
||||
input_bind_code_to_action(&ctx.input,
|
||||
action_name,
|
||||
BUTTON_SOURCE_MOUSE,
|
||||
(union ButtonCode) { .mouse_button = SDL_BUTTON(mouse_button)});
|
||||
(union ButtonCode) { .mouse_button = (uint8_t)SDL_BUTTON(mouse_button)});
|
||||
} else
|
||||
log_warn("(%s) Invalid control value given: %i.", __func__, control);
|
||||
}
|
||||
@ -242,7 +252,7 @@ void input_unbind_action_control(char const *action_name,
|
||||
input_unbind_code_from_action(&ctx.input,
|
||||
action_name,
|
||||
BUTTON_SOURCE_MOUSE,
|
||||
(union ButtonCode) { .mouse_button = SDL_BUTTON(mouse_button)});
|
||||
(union ButtonCode) { .mouse_button = (uint8_t)SDL_BUTTON(mouse_button)});
|
||||
} else
|
||||
log_warn("(%s) Invalid control value given: %i.", __func__, control);
|
||||
}
|
||||
|
@ -112,7 +112,7 @@ static void APIENTRY opengl_log(GLenum source,
|
||||
#endif
|
||||
|
||||
|
||||
void preserve_persistent_ctx_fields(void) {
|
||||
static void preserve_persistent_ctx_fields(void) {
|
||||
ctx.game.udata = ctx.game_copy.udata;
|
||||
}
|
||||
|
||||
|
@ -394,7 +394,7 @@ void textures_update_atlas(TextureCache *cache) {
|
||||
add_new_atlas(cache);
|
||||
++cache->atlas_index;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
update_texture_rects_in_atlas(cache, rects);
|
||||
recreate_current_atlas_texture(cache);
|
||||
|
@ -17,10 +17,16 @@ void cry_impl(const char *file, const int line, const char *title, const char *t
|
||||
|
||||
|
||||
static void log_impl(const char *restrict format, va_list args, SDL_LogPriority priority) {
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
|
||||
|
||||
SDL_LogMessageV(SDL_LOG_CATEGORY_APPLICATION,
|
||||
priority,
|
||||
format,
|
||||
args);
|
||||
|
||||
#pragma GCC diagnostic pop
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user