dsekai
World engine for retrocomputers.
Loading...
Searching...
No Matches
Data Structures | Macros | Typedefs | Functions | Variables
Menus

On-screen menu handling world-specific functions. More...

Data Structures

struct  MENU_STATE
 

Macros

#define MENU_TABLE(f)   f( 0, main ) f( 1, items ) f( 2, craft ) f( 3, save ) f( 4, quit )
 Defines the top-level menu items and callbacks used to handle each submenu.
 
#define MENU_TEXT_SZ   20
 Maximum length of a menu item's display text.
 
#define MENU_RENDERER_PROTOTYPES(idx, name)   void menu_renderer_ ## name( struct DSEKAI_STATE* state );
 
#define MENU_HANDLER_PROTOTYPES(idx, name)   int16_t menu_handler_ ## name( INPUT_VAL in_char, int16_t click_x, int16_t click_y, struct DSEKAI_STATE* state );
 
#define MENU_FLAG_ITEM_OPEN_SEL_USE   0x01
 
#define MENU_FLAG_ITEM_OPEN_SEL_CRAFT   0x02
 
#define MENU_FLAG_ITEM_OPEN_SEL_DROP   0x03
 
#define MENU_FLAG_ITEM_OPEN_SEL_MASK   0x03
 
#define MENU_TABLE_CONSTS(idx, name)   extern RES_CONST uint8_t gc_menu_idx_ ## name;
 

Typedefs

typedef void(* MENU_RENDERER) (struct DSEKAI_STATE *state)
 Render a currently active menu on-screen.
 
typedef int16_t(* MENU_HANDLER) (INPUT_VAL in_char, int16_t click_x, int16_t click_y, struct DSEKAI_STATE *state)
 Handle input for a currently active menu.
 

Functions

void menu_open (struct DSEKAI_STATE *state)
 Open the on-screen menu, pausing the current engine.
 
void menu_close (struct DSEKAI_STATE *state)
 Close the on-screen menu, resuming the current engine.
 

Variables

RES_CONST MENU_RENDERER gc_menu_renderers []
 Table of callbacks used to draw menus.
 
RES_CONST MENU_HANDLER gc_menu_handlers []
 Table of callacks used to handle menu input.
 
RES_CONST char gc_menu_tokens [][MENU_TEXT_SZ]
 Table of menu item names as strings.
 

Detailed Description

On-screen menu handling world-specific functions.

Variable Documentation

◆ gc_menu_handlers

RES_CONST MENU_HANDLER gc_menu_handlers[]
extern

Table of callacks used to handle menu input.

These should close the menu's WINDOW and set MENU_FLAG_DIRTY on global MENU_STATE.

◆ gc_menu_renderers

RES_CONST MENU_RENDERER gc_menu_renderers[]
extern

Table of callbacks used to draw menus.

These are called once when the menu is opened, and should create a WINDOW.