commit 064789f536b44856af8db1738ba863cd894aa419
parent b68302b1300ad74f915d2c20b6f61abd9d19d982
Author: bsandro <email@bsandro.tech>
Date: Sun, 4 Sep 2022 02:07:07 +0300
Fixed undefined behavior with assignment of the increment operation result
Diffstat:
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/main.c b/main.c
@@ -5,6 +5,7 @@
#include <SDL.h>
#include <SDL_image.h>
#include <SDL_ttf.h>
+#include <time.h>
#ifdef __APPLE__
#define WINDOW_FLAGS SDL_WINDOW_METAL | SDL_WINDOW_ALLOW_HIGHDPI
@@ -92,7 +93,7 @@ void draw_game(uint64_t ftime, struct game_t *game) {
game->ship.velocity = 0;
}
- game->ship.angle = ++game->ship.angle % 360;
+ game->ship.angle = (game->ship.angle+1) % 360;
SDL_RenderClear(game->renderer);
@@ -253,7 +254,7 @@ int main(int argc, char *argv[]) {
// menu
struct menu_t menu = {0};
menu.game = &game;
- menu.font = TTF_OpenFont("assets/APL386.ttf", 30 * s_dpi_scale);
+ menu.font = TTF_OpenFont("./assets/APL386.ttf", 30 * s_dpi_scale);
assert(menu.font != NULL);
// main game loop