From 5a36d153a274978dcf18a9ceda28929f7998a562 Mon Sep 17 00:00:00 2001 From: P. J. McDermott Date: Sat, 20 Mar 2021 16:16:21 -0400 Subject: db_game_play(), db_level_play(): New stub funcs --- diff --git a/src/game.c b/src/game.c index 0cab8e5..a94c401 100644 --- a/src/game.c +++ b/src/game.c @@ -17,6 +17,7 @@ * along with Dodge Balls. If not, see . */ +#include #include #include #include @@ -459,6 +460,12 @@ db_game_get_desc(struct db_game *game) return game->desc; } +int +db_game_play(SDL_Renderer *renderer, struct db_game *game) +{ + return db_level_play(renderer, game->level_head); +} + void db_game_free(struct db_game *game) { diff --git a/src/game.h b/src/game.h index 8065105..3e6f4b2 100644 --- a/src/game.h +++ b/src/game.h @@ -20,6 +20,8 @@ #ifndef DB_GAME_H_ #define DB_GAME_H_ +#include + struct db_game; int db_games_find(const char *games_dir, struct db_game ***games); @@ -27,6 +29,7 @@ const char *db_game_get_name(struct db_game *game) __attribute__((__pure__)); const char *db_game_get_desc(struct db_game *game) __attribute__((__pure__)); +int db_game_play(SDL_Renderer *renderer, struct db_game *game); void db_game_free(struct db_game *game); #endif /* DB_GAME_H_ */ diff --git a/src/level.c b/src/level.c index 70c7748..3738b7a 100644 --- a/src/level.c +++ b/src/level.c @@ -17,6 +17,7 @@ * along with Dodge Balls. If not, see . */ +#include #include #include "level.h" #include "output.h" @@ -47,3 +48,13 @@ db_level_new(const char *game_id, const char *level_id, struct db_level *prev) return level; } + +int +db_level_play(SDL_Renderer *renderer, struct db_level *level) +{ + db_dbg("Playing %s/%s", level->game_id, level->level_id); + + SDL_RenderClear(renderer); + + return 0; +} diff --git a/src/level.h b/src/level.h index 5d1ce64..666af3c 100644 --- a/src/level.h +++ b/src/level.h @@ -20,9 +20,12 @@ #ifndef DB_LEVEL_H_ #define DB_LEVEL_H_ +#include + struct db_level; struct db_level *db_level_new(const char *game_id, const char *level_id, struct db_level *prev); +int db_level_play(SDL_Renderer *renderer, struct db_level *level); #endif /* DB_LEVEL_H_ */ diff --git a/src/main-menu.c b/src/main-menu.c index 0fbb8c8..de47174 100644 --- a/src/main-menu.c +++ b/src/main-menu.c @@ -96,13 +96,15 @@ _db_main_menu_action_quit(void *user_data_1 __attribute__((__unused__)), static int _db_main_menu_action_game(void *user_data_1, void *user_data_2) { + SDL_Renderer *renderer; struct db_game *game; - game = user_data_2; + renderer = user_data_1; + game = user_data_2; db_dbg("Loading game \"%s\"", db_game_get_name(game)); - return 0; + return db_game_play(renderer, game); } int -- cgit v0.9.1