Swadge ESP32-S2
APIs to develop for the Magfest Swadge
Loading...
Searching...
No Matches
menuZorldoRenderer.c File Reference

Macros

#define ITEMS_PER_PAGE   5
#define ITEM_MARGIN   1
#define ITEM_HEIGHT   31
#define Y_SECTION_MARGIN   6
#define Y_ITEM_START   55
#define MAX_ITEM_TEXT_WIDTH   191
#define ARROW_PERIOD_US   1000000
#define DEFAULT_BODY_HEIGHT   66
#define CLOUD_COUNT   4
#define CLOUD_LIGHT_COLOR_1   c555
#define CLOUD_LIGHT_COLOR_2   c444
#define CLOUD_DARK_COLOR_1   c222
#define CLOUD_DARK_COLOR_2   c111
#define CLOUD_MIN_X   (-500)
#define CLOUD_MIN_Y_VISIBLE   5
#define CLOUD_MIN_SPEED_PX_PER_SEC   4
#define CLOUD_MAX_SPEED_PX_PER_SEC   25
#define BATTERY_LVL_FULL   872
#define BATTERY_LVL_DEAD   452
#define BATTERY_TOP_INSET   3
#define BATTERY_SIDE_BOTTOM_INSET   2

Functions

menuZorldoRenderer_tinitMenuZorldoRenderer (font_t *titleFont, font_t *menuFont)
 Initialize a and return a menu renderer.
void deinitMenuZorldoRenderer (menuZorldoRenderer_t *renderer)
 Deinitialize a menu renderer and free associated memory. This will not free the font passed into initMenuZorldoRenderer().
void setDrawMenuZorldoBody (menuZorldoRenderer_t *renderer, bool drawBody)
 Set whether or not to draw the menu background.
void setMenuZorldoBodyHeight (menuZorldoRenderer_t *renderer, int16_t height)
 Set the height of the body between top and bottom decorated parts If the given height is negative, it will be set to the default height.
void drawMenuZorldoBody (uint16_t topLeftX, uint16_t topLeftY, menuZorldoRenderer_t *renderer, int64_t elapsedUs)
 Draw the menu body background.
void drawMenuZorldo (menu_t *menu, menuZorldoRenderer_t *renderer, int64_t elapsedUs)
 Draw a themed menu to the display and control the LEDs.
void setZorldoLedsOn (menuZorldoRenderer_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

◆ ITEM_HEIGHT

#define ITEM_HEIGHT   31

◆ Y_SECTION_MARGIN

#define Y_SECTION_MARGIN   6

◆ 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

◆ DEFAULT_BODY_HEIGHT

#define DEFAULT_BODY_HEIGHT   66

◆ CLOUD_COUNT

#define CLOUD_COUNT   4

◆ CLOUD_LIGHT_COLOR_1

#define CLOUD_LIGHT_COLOR_1   c555

◆ CLOUD_LIGHT_COLOR_2

#define CLOUD_LIGHT_COLOR_2   c444

◆ CLOUD_DARK_COLOR_1

#define CLOUD_DARK_COLOR_1   c222

◆ CLOUD_DARK_COLOR_2

#define CLOUD_DARK_COLOR_2   c111

◆ CLOUD_MIN_X

#define CLOUD_MIN_X   (-500)

◆ CLOUD_MIN_Y_VISIBLE

#define CLOUD_MIN_Y_VISIBLE   5

◆ CLOUD_MIN_SPEED_PX_PER_SEC

#define CLOUD_MIN_SPEED_PX_PER_SEC   4

◆ CLOUD_MAX_SPEED_PX_PER_SEC

#define CLOUD_MAX_SPEED_PX_PER_SEC   25

◆ BATTERY_LVL_FULL

#define BATTERY_LVL_FULL   872

◆ BATTERY_LVL_DEAD

#define BATTERY_LVL_DEAD   452

◆ BATTERY_TOP_INSET

#define BATTERY_TOP_INSET   3

◆ BATTERY_SIDE_BOTTOM_INSET

#define BATTERY_SIDE_BOTTOM_INSET   2

Function Documentation

◆ initMenuZorldoRenderer()

menuZorldoRenderer_t * initMenuZorldoRenderer ( font_t * titleFont,
font_t * menuFont )

Initialize a and return a menu renderer.

Parameters
titleFontThe font used to draw the title, preferably PIX_ROMANA_FONT. If this is NULL it will be allocated by the renderer in SPIRAM.
menuFontThe font used to draw this menu, preferably MINISHCAP_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 deinitMenuZorldoRenderer() when done

◆ deinitMenuZorldoRenderer()

void deinitMenuZorldoRenderer ( menuZorldoRenderer_t * renderer)

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

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

◆ setDrawMenuZorldoBody()

void setDrawMenuZorldoBody ( menuZorldoRenderer_t * renderer,
bool drawBody )

Set whether or not to draw the menu background.

Parameters
rendererThe renderer.
drawBodytrue to draw the body background, false to skip it

◆ setMenuZorldoBodyHeight()

void setMenuZorldoBodyHeight ( menuZorldoRenderer_t * renderer,
int16_t height )

Set the height of the body between top and bottom decorated parts If the given height is negative, it will be set to the default height.

Parameters
rendererThe renderer to adjust the body height for
heightThe new height. If the given value is negative, the default height will be set.

◆ drawMenuZorldoBody()

void drawMenuZorldoBody ( uint16_t topLeftX,
uint16_t topLeftY,
menuZorldoRenderer_t * renderer,
int64_t elapsedUs )

Draw the menu body background.

Parameters
topLeftXThe X coordinate of the top left corner of the body
topLeftYThe Y coordinate of the top left corner of the body
rendererThe renderer to draw a body with
elapsedUsThe time elapsed since this function was last called, for cloud animation

◆ drawMenuZorldo()

void drawMenuZorldo ( menu_t * menu,
menuZorldoRenderer_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

◆ setZorldoLedsOn()

void setZorldoLedsOn ( menuZorldoRenderer_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