mirror of https://github.com/libsdl-org/SDL
examples/snake: Fix up build.
This commit is contained in:
parent
dbb4e05c28
commit
bc8b768b9a
|
@ -186,7 +186,7 @@ add_sdl_example_executable(renderer-primitives SOURCES renderer/02-primitives/re
|
|||
add_sdl_example_executable(audio-simple-playback SOURCES audio/01-simple-playback/simple-playback.c)
|
||||
add_sdl_example_executable(audio-simple-playback-callback SOURCES audio/02-simple-playback-callback/simple-playback-callback.c)
|
||||
add_sdl_example_executable(audio-load-wav SOURCES audio/03-load-wav/load-wav.c DATAFILES ${CMAKE_CURRENT_SOURCE_DIR}/../test/sample.wav)
|
||||
add_sdl_example_executable(snake SOURCES game/01-snake/main.c game/01-snake/snake.c)
|
||||
add_sdl_example_executable(game-snake SOURCES game/01-snake/main.c game/01-snake/snake.c)
|
||||
|
||||
|
||||
if(PSP)
|
||||
|
|
|
@ -34,8 +34,8 @@ static void new_food_pos_(SnakeContext *ctx, RandFunc rand)
|
|||
char x;
|
||||
char y;
|
||||
for (;;) {
|
||||
x = rand(SNAKE_GAME_WIDTH);
|
||||
y = rand(SNAKE_GAME_HEIGHT);
|
||||
x = (char) rand(SNAKE_GAME_WIDTH);
|
||||
y = (char) rand(SNAKE_GAME_HEIGHT);
|
||||
if (snake_cell_at(ctx, x, y) == SNAKE_CELL_NOTHING) {
|
||||
put_cell_at_(ctx, x, y, SNAKE_CELL_FOOD);
|
||||
break;
|
||||
|
|
|
@ -41,7 +41,7 @@ typedef struct
|
|||
unsigned occupied_cells;
|
||||
} SnakeContext;
|
||||
|
||||
typedef int (*RandFunc)(int n);
|
||||
typedef Sint32 SDLCALL (*RandFunc)(Sint32 n);
|
||||
|
||||
void snake_initialize(SnakeContext *ctx, RandFunc rand);
|
||||
void snake_redir(SnakeContext *ctx, SnakeDirection dir);
|
||||
|
|
Loading…
Reference in New Issue