mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-05-26 01:46:20 +08:00
examples/snake: Fix up build.
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user