Swadge 2024 2.0.0
APIs to develop games for the Magfest Swadge
Loading...
Searching...
No Matches
menuMegaRenderer.c File Reference

Macros

#define ITEMS_PER_PAGE   5
 
#define ITEM_MARGIN   1
 
#define Y_SECTION_MARGIN   13
 
#define Y_ITEM_START   55
 
#define MAX_ITEM_TEXT_WIDTH   191
 
#define ARROW_PERIOD_US   1000000
 

Functions

menuMegaRenderer_tinitMenuMegaRenderer (font_t *titleFont, font_t *titleFontOutline, font_t *menuFont)
 Initialize a and return a menu renderer.
 
void deinitMenuMegaRenderer (menuMegaRenderer_t *renderer)
 Deinitialize a menu renderer and free associated memory. This will not free the font passed into initMenuMegaRenderer()
 
void recolorMenuMegaRenderer (menuMegaRenderer_t *renderer, paletteColor_t textFill, paletteColor_t textOutline, paletteColor_t c1, paletteColor_t c2, paletteColor_t c3, paletteColor_t c4, paletteColor_t c5, paletteColor_t c6, paletteColor_t c7, paletteColor_t c8, const paletteColor_t *bgColors, int32_t numBgColors)
 Recolor the Mega menu renderer. Arguments c1 through c8 should get progressively lighter.
 
void drawMenuMega (menu_t *menu, menuMegaRenderer_t *renderer, int64_t elapsedUs)
 Draw a themed menu to the display and control the LEDs.
 
void setMegaLedsOn (menuMegaRenderer_t *renderer, bool ledsOn)
 Set the renderer's LEDs to be on or off.
 

Macro Definition Documentation

◆ ITEMS_PER_PAGE

#define ITEMS_PER_PAGE   5

◆ ITEM_MARGIN

#define ITEM_MARGIN   1

◆ Y_SECTION_MARGIN

#define Y_SECTION_MARGIN   13

◆ Y_ITEM_START

#define Y_ITEM_START   55

◆ MAX_ITEM_TEXT_WIDTH

#define MAX_ITEM_TEXT_WIDTH   191

◆ ARROW_PERIOD_US

#define ARROW_PERIOD_US   1000000

Function Documentation

◆ initMenuMegaRenderer()

menuMegaRenderer_t * initMenuMegaRenderer ( font_t * titleFont,
font_t * titleFontOutline,
font_t * menuFont )

Initialize a and return a menu renderer.

Parameters
titleFontThe font used to draw the title, preferably RIGHTEOUS_150_FONT. If this is NULL it will be allocated by the renderer in SPIRAM.
titleFontOutlineThe outline font used to draw the title. If this is NULL it will be allocated by the renderer in SPIRAM.
menuFontThe font used to draw this menu, preferably RODIN_EB_FONT. If this is NULL it will be allocated by the renderer in SPIRAM.
Returns
A pointer to the menu renderer. This memory is allocated and must be freed with deinitMenuMegaRenderer() when done

◆ deinitMenuMegaRenderer()

void deinitMenuMegaRenderer ( menuMegaRenderer_t * renderer)

Deinitialize a menu renderer and free associated memory. This will not free the font passed into initMenuMegaRenderer()

Parameters
rendererThe renderer to deinitialize. It must not be used after deinitialization.

◆ recolorMenuMegaRenderer()

void recolorMenuMegaRenderer ( menuMegaRenderer_t * renderer,
paletteColor_t textFill,
paletteColor_t textOutline,
paletteColor_t c1,
paletteColor_t c2,
paletteColor_t c3,
paletteColor_t c4,
paletteColor_t c5,
paletteColor_t c6,
paletteColor_t c7,
paletteColor_t c8,
const paletteColor_t * bgColors,
int32_t numBgColors )

Recolor the Mega menu renderer. Arguments c1 through c8 should get progressively lighter.

Parameters
rendererThe renderer to recolor
textFillThe color of the text fill, originally white
textOutlineThe color of the text outline, originally black
c1Replacement for Darkest blue
c2Replacement for Very dark blue
c3Replacement for Dark blue
c4Replacement for Dark moderate blue
c5Replacement for Dark strong blue
c6Replacement for Light strong blue
c7Replacement for Pure cyan
c8Replacement for Very pale cyan
bgColorsA list of colors to cycle through in the hexagonal background. May be NULL for no change.
numBgColorsThe length of bgColors

◆ drawMenuMega()

void drawMenuMega ( menu_t * menu,
menuMegaRenderer_t * renderer,
int64_t elapsedUs )

Draw a themed menu to the display and control the LEDs.

Parameters
menuThe menu to draw
rendererThe renderer to draw with
elapsedUsThe time elapsed since this function was last called, for LED animation

◆ setMegaLedsOn()

void setMegaLedsOn ( menuMegaRenderer_t * renderer,
bool ledsOn )

Set the renderer's LEDs to be on or off.

Parameters
rendererThe renderer to set
ledsOntrue to animate the LEDs, false to keep them off