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

Macros

#define ITEMS_PER_PAGE   5
 
#define PARALLELOGRAM_X_OFFSET   13
 
#define PARALLELOGRAM_HEIGHT   25
 
#define PARALLELOGRAM_WIDTH   229
 
#define ROW_MARGIN   8
 
#define DROP_SHADOW_OFFSET   (ROW_MARGIN / 2)
 
#define ARROW_MARGIN   4
 
#define ARROW_WIDTH   2
 
#define UP_ARROW_HEIGHT   10
 
#define UP_ARROW_MARGIN   2
 
#define ORBIT_RING_RADIUS_1   26
 
#define ORBIT_RING_RADIUS_2   18
 
#define RING_STROKE_THICKNESS   8
 
#define MIN_RING_RADIUS   64
 
#define MAX_RING_RADIUS   114
 

Functions

menuManiaRenderer_tinitMenuManiaRenderer (font_t *titleFont, font_t *titleFontOutline, font_t *menuFont)
 Initialize a and return a menu renderer.
 
void deinitMenuManiaRenderer (menuManiaRenderer_t *renderer)
 Deinitialize a menu renderer and free associated memory. This will not free the font passed into initMenuManiaRenderer()
 
void drawMenuMania (menu_t *menu, menuManiaRenderer_t *renderer, int64_t elapsedUs)
 Draw a themed menu to the display and control the LEDs.
 
void setManiaLedsOn (menuManiaRenderer_t *renderer, bool ledsOn)
 Set the renderer's LEDs to be on or off.
 
void recolorMenuManiaRenderer (menuManiaRenderer_t *renderer, paletteColor_t titleBgColor, paletteColor_t titleTextColor, paletteColor_t textOutlineColor, paletteColor_t bgColor, paletteColor_t outerRingColor, paletteColor_t innerRingColor, paletteColor_t rowColor, paletteColor_t rowTextColor, const paletteColor_t *shadowColors, int32_t shadowColorsLen, led_t baseLedColor)
 Recolor a menu renderer.
 

Macro Definition Documentation

◆ ITEMS_PER_PAGE

#define ITEMS_PER_PAGE   5

◆ PARALLELOGRAM_X_OFFSET

#define PARALLELOGRAM_X_OFFSET   13

◆ PARALLELOGRAM_HEIGHT

#define PARALLELOGRAM_HEIGHT   25

◆ PARALLELOGRAM_WIDTH

#define PARALLELOGRAM_WIDTH   229

◆ ROW_MARGIN

#define ROW_MARGIN   8

◆ DROP_SHADOW_OFFSET

#define DROP_SHADOW_OFFSET   (ROW_MARGIN / 2)

◆ ARROW_MARGIN

#define ARROW_MARGIN   4

◆ ARROW_WIDTH

#define ARROW_WIDTH   2

◆ UP_ARROW_HEIGHT

#define UP_ARROW_HEIGHT   10

◆ UP_ARROW_MARGIN

#define UP_ARROW_MARGIN   2

◆ ORBIT_RING_RADIUS_1

#define ORBIT_RING_RADIUS_1   26

◆ ORBIT_RING_RADIUS_2

#define ORBIT_RING_RADIUS_2   18

◆ RING_STROKE_THICKNESS

#define RING_STROKE_THICKNESS   8

◆ MIN_RING_RADIUS

#define MIN_RING_RADIUS   64

◆ MAX_RING_RADIUS

#define MAX_RING_RADIUS   114

Function Documentation

◆ initMenuManiaRenderer()

menuManiaRenderer_t * initMenuManiaRenderer ( 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 deinitMenuManiaRenderer() when done

◆ deinitMenuManiaRenderer()

void deinitMenuManiaRenderer ( menuManiaRenderer_t * renderer)

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

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

◆ drawMenuMania()

void drawMenuMania ( menu_t * menu,
menuManiaRenderer_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

◆ setManiaLedsOn()

void setManiaLedsOn ( menuManiaRenderer_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

◆ recolorMenuManiaRenderer()

void recolorMenuManiaRenderer ( menuManiaRenderer_t * renderer,
paletteColor_t titleBgColor,
paletteColor_t titleTextColor,
paletteColor_t textOutlineColor,
paletteColor_t bgColor,
paletteColor_t outerRingColor,
paletteColor_t innerRingColor,
paletteColor_t rowColor,
paletteColor_t rowTextColor,
const paletteColor_t * shadowColors,
int32_t shadowColorsLen,
led_t baseLedColor )

Recolor a menu renderer.

Parameters
rendererThe menu renderer to recolor
titleBgColorThe color of the title background
titleTextColorThe color of the title text
textOutlineColorThe color of the title text outline
bgColorThe color of the screen background
outerRingColorThe color of the outer rotating ring
innerRingColorThe color of the inner rotating ring
rowColorThe color of the row background
rowTextColorThe color of the row text
shadowColorsThe colors cycled through as the selected shadow
shadowColorsLenThe number of selected shadow colors to cycle through
baseLedColorThe color of the LED illumination