diff options
author | P. J. McDermott <pj@pehjota.net> | 2021-03-20 16:16:21 (EDT) |
---|---|---|
committer | P. J. McDermott <pj@pehjota.net> | 2021-03-20 16:16:21 (EDT) |
commit | 5a36d153a274978dcf18a9ceda28929f7998a562 (patch) | |
tree | ee16d539e5ecd0593ed82e9fe14e4e4b2dfd3507 | |
parent | c61639e4ee50c5394003d135c05469240fcd62fe (diff) | |
download | dodge-balls-5a36d153a274978dcf18a9ceda28929f7998a562.zip dodge-balls-5a36d153a274978dcf18a9ceda28929f7998a562.tar.gz dodge-balls-5a36d153a274978dcf18a9ceda28929f7998a562.tar.bz2 |
db_game_play(), db_level_play(): New stub funcs
-rw-r--r-- | src/game.c | 7 | ||||
-rw-r--r-- | src/game.h | 3 | ||||
-rw-r--r-- | src/level.c | 11 | ||||
-rw-r--r-- | src/level.h | 3 | ||||
-rw-r--r-- | src/main-menu.c | 6 |
5 files changed, 28 insertions, 2 deletions
@@ -17,6 +17,7 @@ * along with Dodge Balls. If not, see <http://www.gnu.org/licenses/>. */ +#include <SDL.h> #include <expat.h> #include <dirent.h> #include <stdio.h> @@ -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) { @@ -20,6 +20,8 @@ #ifndef DB_GAME_H_ #define DB_GAME_H_ +#include <SDL.h> + 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 <http://www.gnu.org/licenses/>. */ +#include <SDL.h> #include <stdlib.h> #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 <SDL.h> + 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 |