SDL_Libretro 0.1.0
SDL3-power libretro frontend.
Loading...
Searching...
No Matches
Macros | Functions
SDL_libretro_menu.h File Reference

SDL_libretro - menu system built on nuklear_console. More...

Go to the source code of this file.

Macros

#define SDL_LIBRETRO_MENU_DEFAULT_STYLE   SDL_LIBRETRO_MENU_STYLE_CATPPUCCIN_MOCHA
 The style applied when the menu is created.
 
#define SDL_LIBRETRO_MENU_FONT_HEIGHT   13
 Base height in pixels for the menu font, multiplied by the UI scale and a whole-number display scale.
 
#define SDL_LIBRETRO_MENU_TOGGLE_KEY   SDLK_F1
 The keyboard key that toggles the menu.
 

Functions

bool SDL_Libretro_AddMenuButton (SDL_LibretroMenu *menu, const char *label, SDL_LibretroMenuCallback callback, void *userdata)
 Adds a button to the main menu, just above Quit.
 
bool SDL_Libretro_AddMenuCheckbox (SDL_LibretroMenu *menu, const char *label, bool *value, SDL_LibretroMenuCallback callback, void *userdata)
 Adds a checkbox to the main menu, just above Quit.
 
SDL_LibretroMenu * SDL_Libretro_CreateMenu (SDL_Libretro *lr)
 Creates the in-app menu for a libretro context.
 
void SDL_Libretro_DestroyMenu (SDL_LibretroMenu *menu)
 Destroys a menu created with SDL_Libretro_CreateMenu().
 
SDL_Libretro * SDL_Libretro_GetMenuLibretro (const SDL_LibretroMenu *menu)
 Gets the libretro context the menu was created for.
 
SDL_LibretroMenuStyle SDL_Libretro_GetMenuStyle (const SDL_LibretroMenu *menu)
 Gets the menu's active color theme.
 
void * SDL_Libretro_GetMenuUserData (const SDL_LibretroMenu *menu)
 Gets the data attached with SDL_Libretro_SetMenuUserData().
 
bool SDL_Libretro_HandleMenuEvent (SDL_LibretroMenu *menu, const SDL_Event *event)
 Routes an event to the menu; call this for every event, before SDL_Libretro_HandleEvent().
 
bool SDL_Libretro_IsMenuOpen (const SDL_LibretroMenu *menu)
 Checks whether the menu is currently shown.
 
void SDL_Libretro_MenuScreenshotClicked (SDL_LibretroMenu *menu, void *userdata)
 A ready-made menu callback that saves a PNG screenshot of the current frame, reporting the result in the menu.
 
bool SDL_Libretro_OpenMenuPath (SDL_LibretroMenu *menu, const char *path)
 Opens the menu and navigates to a page by its slash-separated label path, e.g.
 
void SDL_Libretro_RenderMenu (SDL_LibretroMenu *menu)
 Draws the menu laid out by SDL_Libretro_UpdateMenu() to the renderer.
 
void SDL_Libretro_SetMenuOpen (SDL_LibretroMenu *menu, bool open)
 Opens or closes the menu.
 
bool SDL_Libretro_SetMenuStyle (SDL_LibretroMenu *menu, SDL_LibretroMenuStyle style)
 Applies a color theme to the menu.
 
void SDL_Libretro_SetMenuUserData (SDL_LibretroMenu *menu, void *userData)
 Attaches generic application data to the menu.
 
void SDL_Libretro_ToggleMenu (SDL_LibretroMenu *menu)
 Opens the menu when it is closed, or closes it when it is open.
 
void SDL_Libretro_UpdateMenu (SDL_LibretroMenu *menu)
 Processes input and lays out the menu for this frame.
 

Detailed Description

SDL_libretro - menu system built on nuklear_console.

Provides an in-app menu (Load Game, save states, core options, settings, About) rendered with Nuklear through the SDL3 renderer backend, driven by nuklear_console for keyboard/gamepad-friendly navigation.

Enabled by defining SDL_LIBRETRO_ENABLE_MENU alongside SDL_LIBRETRO_IMPLEMENTATION. Requires the vendored Nuklear, nuklear_console, nuklear_gamepad and c-vector submodules on the include path (handled by the SDL_libretro_menu CMake target).

Frame contract, with SDL_Libretro_HandleMenuEvent() called for each event:

if (!SDL_Libretro_IsMenuOpen(menu)) SDL_Libretro_Update(lr);
SDL_Libretro_Render(lr, renderer, NULL);
SDL_Libretro_UpdateMenu(menu);
SDL_Libretro_RenderMenu(menu);
SDL_RenderPresent(renderer);

Definition in file SDL_libretro_menu.h.

Macro Definition Documentation

◆ SDL_LIBRETRO_MENU_DEFAULT_STYLE

#define SDL_LIBRETRO_MENU_DEFAULT_STYLE   SDL_LIBRETRO_MENU_STYLE_CATPPUCCIN_MOCHA

The style applied when the menu is created.

See also
SDL_Libretro_SetMenuStyle()

Definition at line 125 of file SDL_libretro_menu.h.

◆ SDL_LIBRETRO_MENU_FONT_HEIGHT

#define SDL_LIBRETRO_MENU_FONT_HEIGHT   13

Base height in pixels for the menu font, multiplied by the UI scale and a whole-number display scale.

The default font (ProggyClean) is a pixel font that only renders cleanly at 13px and integer multiples of it, so the height stays on that grid.

Definition at line 116 of file SDL_libretro_menu.h.

◆ SDL_LIBRETRO_MENU_TOGGLE_KEY

#define SDL_LIBRETRO_MENU_TOGGLE_KEY   SDLK_F1

The keyboard key that toggles the menu.

See also
SDL_Libretro_HandleMenuEvent()

Definition at line 106 of file SDL_libretro_menu.h.