#include <SDL2/SDL.h>
Go to the source code of this file.
|
void | EZ_process_events (SDL_Window *window, SDL_Renderer *renderer, char *flags) |
| Processes all pending events for the application.
|
|
void | EZ_draw_menu (SDL_Window *window, SDL_Renderer *renderer) |
| Draws the current menu on the screen.
|
|
int | EZ_select_menu (int selected_menu) |
| Selects a menu to be the current menu.
|
|
void | EZ_unload_menus (void) |
| Unloads all menus and frees associated resources.
|
|
◆ EZ_draw_menu()
void EZ_draw_menu |
( |
SDL_Window * | window, |
|
|
SDL_Renderer * | renderer ) |
Draws the current menu on the screen.
This function checks if the current menu index is within the valid range and if the current menu's drawable elements are visible. It then sets the render draw color to the background color of the current menu and clears the renderer. After that, it iterates through all drawable elements of the current menu, sets their respective colors, and renders them to the screen.
- Parameters
-
window | A pointer to the SDL_Window. |
renderer | A pointer to the SDL_Renderer. |
- Exceptions
-
If | the current_menu index is out of range, the function will terminate the program with an error message. |
◆ EZ_process_events()
void EZ_process_events |
( |
SDL_Window * | window, |
|
|
SDL_Renderer * | renderer, |
|
|
char * | flags ) |
Processes all pending events for the application.
This function polls for all pending SDL events and processes them accordingly. It handles window events, such as closing the window, and sends other events to the current menu for further processing.
- Parameters
-
window | A pointer to the SDL_Window. |
renderer | A pointer to the SDL_Renderer. |
flags | A pointer to a char flag that can be set to indicate certain states, such as when the window is requested to be closed. |
◆ EZ_select_menu()
int EZ_select_menu |
( |
int | selected_menu | ) |
|
Selects a menu to be the current menu.
This function sets the current menu to the menu specified by the selected_menu index. It ensures that the selected_menu index is within the valid range of available menus.
- Parameters
-
selected_menu | The index of the menu to be selected. |
- Returns
- Returns 1 if the menu was successfully selected, 0 if the selected_menu index is out of range.
◆ EZ_unload_menus()
void EZ_unload_menus |
( |
void | | ) |
|
Unloads all menus and frees associated resources.
This function iterates through all menus in the EZ_menus array and calls their respective unload_menu function if it is not NULL. This ensures that any resources allocated for the menus are properly released.
◆ EZ_menus