diff options
Diffstat (limited to 'src/main-menu.c')
-rw-r--r-- | src/main-menu.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/main-menu.c b/src/main-menu.c index 0bd135d..74f8bff 100644 --- a/src/main-menu.c +++ b/src/main-menu.c @@ -75,7 +75,11 @@ _db_main_menu_text(TTF_Font *font, const char *text, SDL_Color *color, static int _db_main_menu_action_help(void *user_data __attribute__((__unused__))) { - return db_help(); + SDL_Window *window; + + window = user_data; + + return db_help(window); } static int @@ -99,7 +103,7 @@ _db_main_menu_action_game(void *user_data) } int -db_main_menu(void) +db_main_menu(SDL_Window *window) { const char *games_dir; char *font_path; @@ -120,7 +124,11 @@ db_main_menu(void) games_dir = db_get_games_dir(); font_path = db_strcat(db_get_fonts_dir(), "/UbuntuTitling-Bold.ttf"); - renderer = db_get_renderer(); + renderer = SDL_GetRenderer(window); + if (renderer == NULL) { + db_err("Failed to get renderer (%s)", SDL_GetError()); + return -1; + } text_color.r = DB_COLOR_FORE_R; text_color.g = DB_COLOR_FORE_G; @@ -183,7 +191,7 @@ db_main_menu(void) buttons[0]->rect.x = DB_WINDOW_W - DB_WINDOW_P - buttons[0]->rect.w; buttons[0]->rect.y = DB_WINDOW_P; buttons[0]->action = &_db_main_menu_action_help; - buttons[0]->user_data = NULL; + buttons[0]->user_data = window; /* Render quit button */ buttons[1] = malloc(sizeof(**buttons)); |