Newer
Older
ESP32-RetroPlay / main / tasks / game / game_menu.h
#ifndef GAME_MENU_H
#define GAME_MENU_H

#include <stdbool.h>
#include "game_framework.h" // For game_t structure
#include "freertos/queue.h" // For QueueHandle_t

// Structure to define a menu item
typedef struct {
    const char *name;
    const game_t *game_instance; // Pointer to the game instance
} menu_item_t;

/**
 * @brief Displays a menu and allows the user to select a game.
 *
 * This function will display a list of available games on the OLED screen.
 * It will listen for button inputs to navigate the menu and select a game.
 *
 * @param menu_items An array of menu_item_t structures representing the games.
 * @param num_items The number of items in the menu_items array.
 * @param button_queue The queue handle for receiving button inputs (e.g., jump/select, left/right).
 * @return A pointer to the selected menu_item_t instance, or NULL if no selection is made
 * (though in this context, a selection is expected).
 */
const menu_item_t* run_game_menu(const menu_item_t menu_items[], size_t num_items, QueueHandle_t button_queue);

#endif // GAME_MENU_H