From 5dd24926451065aa74079950422b0061bf3c698a Mon Sep 17 00:00:00 2001 From: captain0xff Date: Wed, 12 Feb 2025 02:03:40 +0530 Subject: [PATCH] updated the snake demo to be C++ compatible --- examples/demo/01-snake/snake.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/demo/01-snake/snake.c b/examples/demo/01-snake/snake.c index a7f667d533..0aca862d75 100644 --- a/examples/demo/01-snake/snake.c +++ b/examples/demo/01-snake/snake.c @@ -208,7 +208,7 @@ void snake_step(SnakeContext *ctx) } } -static int handle_key_event_(SnakeContext *ctx, SDL_Scancode key_code) +static SDL_AppResult handle_key_event_(SnakeContext *ctx, SDL_Scancode key_code) { switch (key_code) { /* Quit. */ @@ -309,7 +309,7 @@ SDL_AppResult SDL_AppInit(void **appstate, int argc, char *argv[]) return SDL_APP_FAILURE; } - AppState *as = SDL_calloc(1, sizeof(AppState)); + AppState *as = (AppState *)SDL_calloc(1, sizeof(AppState)); if (!as) { return SDL_APP_FAILURE; }