|
Swadge 2024 2.0.0
APIs to develop games for the Magfest Swadge
|
Data Structures | |
| struct | dialogDrawInfo_t |
| Holds information about how and where to draw the dialog box and its main components. More... | |
| struct | optionDrawInfo_t |
| Holds information about how and where to draw a dialog box option. More... | |
Macros | |
| #define | DIALOG_MARGIN 5 |
| < The space between the dialog box and the edge of the screen | |
| #define | DIALOG_PADDING 5 |
| The space around the. | |
| #define | DIALOG_ICON_MARGIN 5 |
| The space between the edge of the button and the text or image inside. | |
| #define | OPTION_PADDING 2 |
| The space between each option. | |
| #define | OPTION_MARGIN 5 |
| The space between an option's icon and text. | |
| #define | OPTION_ICON_MARGIN 3 |
| The color of the dialog title text. | |
| #define | COL_TITLE c000 |
| The color of the dialog detail text. | |
| #define | COL_DETAIL c000 |
| The color of the dialog's background. | |
| #define | COL_DIALOG_BG c555 |
| The color of the dialog border outline. | |
| #define | COL_DIALOG_BORDER c000 |
| The background color of non-selected options. | |
| #define | COL_OPTION_BG c333 |
| The background color of the selected option. | |
| #define | COL_OPTION_BG_SEL c455 |
| The color of the dialog's border outline. | |
| #define | COL_OPTION_BORDER c444 |
Functions | |
| dialogBox_t * | initDialogBox (const char *title, const char *detail, const wsg_t *icon, dialogBoxCbFn_t cbFn) |
| Allocate and return a new dialogBox_t with the given settings. | |
| void | deinitDialogBox (dialogBox_t *dialogBox) |
| Deallocate all memory associated with the given dialog box. | |
| void | dialogBoxAddOption (dialogBox_t *dialogBox, const char *label, const wsg_t *icon, dialogOptionHint_t hints) |
| Add an option button to a dialog box. | |
| void | dialogBoxReset (dialogBox_t *dialogBox) |
| Clear all options from the given dialog box. | |
| void | drawDialogBox (const dialogBox_t *dialogBox, const font_t *titleFont, const font_t *detailFont, uint16_t x, uint16_t y, uint16_t w, uint16_t h, uint16_t r) |
| Draw the dialog box. | |
| void | dialogBoxButton (dialogBox_t *dialogBox, const buttonEvt_t *evt) |
| Handle button presses for the dialog box. | |
| struct dialogDrawInfo_t |
| struct optionDrawInfo_t |
| Data Fields | ||
|---|---|---|
| uint16_t | x | The X coordinate of the option's left edge. |
| uint16_t | y | The Y coordinate of the option's top edge. |
| uint16_t | w | The total width of the option button. |
| uint16_t | h | The total height of the option button. |
| uint8_t | row | The row of buttons this option is in, starting at 0 for the top row. |
| bool | disabled | Whether this option button is disabled. |
| bool | selected | Whether this option button is currently selected. |
| bool | pressed | Whether this option button is currently being pressed. |
| const dialogBoxOption_t * | option | |
| #define DIALOG_MARGIN 5 |
< The space between the dialog box and the edge of the screen
The space between the edge of the dialog box and the content inside
| #define DIALOG_PADDING 5 |
The space around the.
| #define DIALOG_ICON_MARGIN 5 |
The space between the edge of the button and the text or image inside.
| #define OPTION_PADDING 2 |
The space between each option.
| #define OPTION_MARGIN 5 |
The space between an option's icon and text.
| #define OPTION_ICON_MARGIN 3 |
The color of the dialog title text.
| #define COL_TITLE c000 |
The color of the dialog detail text.
| #define COL_DETAIL c000 |
The color of the dialog's background.
| #define COL_DIALOG_BG c555 |
The color of the dialog border outline.
| #define COL_DIALOG_BORDER c000 |
The background color of non-selected options.
| #define COL_OPTION_BG c333 |
The background color of the selected option.
| #define COL_OPTION_BG_SEL c455 |
The color of the dialog's border outline.
| #define COL_OPTION_BORDER c444 |
| dialogBox_t * initDialogBox | ( | const char * | title, |
| const char * | detail, | ||
| const wsg_t * | icon, | ||
| dialogBoxCbFn_t | cbFn ) |
Allocate and return a new dialogBox_t with the given settings.
The result must be deallocated with deinitDialogBox().
| title | The title text of the dialog box |
| detail | The body text of the dialog box |
| icon | The icon to display in the dialog box, if not NULL |
| cbFn | The callback function to be called when an option is selected |
| void deinitDialogBox | ( | dialogBox_t * | dialogBox | ) |
Deallocate all memory associated with the given dialog box.
| dialogBox | The dialog box to deinitialize |
| void dialogBoxAddOption | ( | dialogBox_t * | dialogBox, |
| const char * | label, | ||
| const wsg_t * | icon, | ||
| dialogOptionHint_t | hints ) |
Add an option button to a dialog box.
| dialogBox | The dialog box to add the button to |
| label | The text of the option button |
| icon | The icon for this button, or NULL for no icon |
| hints | Any number of dialogOptionHint_t, combined with bitwise OR for multiple |
| void dialogBoxReset | ( | dialogBox_t * | dialogBox | ) |
Clear all options from the given dialog box.
| dialogBox | The dialog box to reset |
| void drawDialogBox | ( | const dialogBox_t * | dialogBox, |
| const font_t * | titleFont, | ||
| const font_t * | detailFont, | ||
| uint16_t | x, | ||
| uint16_t | y, | ||
| uint16_t | w, | ||
| uint16_t | h, | ||
| uint16_t | r ) |
Draw the dialog box.
| dialogBox | The dialog box to draw |
| titleFont | The font to use for drawing the dialog box title text |
| detailFont | The font to use for drawing the dialog box detail text |
| x | The X coordinate of the left side of the dialog box, or DIALOG_CENTER to automatically center it |
| y | The Y coordinate of the top of the dialog box, or DIALOG_CENTER to automatically center it |
| w | The width of the dialog box, or if combined with DIALOG_AUTO, the maximum width of the dialog box |
| h | The height of the dialog box, or if combined with DIALOG_AUTO, the maximum height of the dialog box |
| r | The corner-radius of the dialog box |
| void dialogBoxButton | ( | dialogBox_t * | dialogBox, |
| const buttonEvt_t * | evt ) |
Handle button presses for the dialog box.
| dialogBox | The dialog box to update |
| evt | The button event to be handled by the dialog box |