Swadge 2024 2.0.0
APIs to develop games for the Magfest Swadge
Loading...
Searching...
No Matches
menuMegaRenderer.h
Go to the documentation of this file.
1
26
27#pragma once
28
29#include "hdw-led.h"
30#include "menu.h"
31#include "fs_wsg.h"
32#include "fs_font.h"
33#include "wsgPalette.h"
34
86
87menuMegaRenderer_t* initMenuMegaRenderer(font_t* titleFont, font_t* titleFontOutline, font_t* menuFont);
89void drawMenuBody(uint16_t topLeftX, uint16_t topLeftY, uint8_t expansionHeight, bool flipLR,
90 menuMegaRenderer_t* renderer);
91void drawMenuMega(menu_t* menu, menuMegaRenderer_t* renderer, int64_t elapsedUs);
92void setMegaLedsOn(menuMegaRenderer_t* renderer, bool ledsOn);
93void setDrawBody(menuMegaRenderer_t* renderer, bool drawBody);
94void setBodyHeight(menuMegaRenderer_t* renderer, int16_t height);
98 const paletteColor_t* bgColors, int32_t numBgColors);
A font is a collection of font_ch_t for all ASCII characters. Each character has the same height and ...
Definition font.h:66
LED colors, with red, green, and blue components.
Definition hdw-led.h:63
struct node node_t
A node in a doubly linked list with pointers to the previous and next values (which may be NULL),...
wsg_t batt[4]
Images for the battery levels.
Definition menuMegaRenderer.h:51
void setBodyHeight(menuMegaRenderer_t *renderer, int16_t height)
Set the height of the body between top and bottom decorated parts If the given height is negative,...
Definition menuMegaRenderer.c:215
void drawMenuBody(uint16_t topLeftX, uint16_t topLeftY, uint8_t expansionHeight, bool flipLR, menuMegaRenderer_t *renderer)
Draw the menu body background.
Definition menuMegaRenderer.c:354
int32_t bgColorTimer
A timer to increment bgColorDeg in order to cycle through bgColors.
Definition menuMegaRenderer.h:73
int32_t bgColorIdx
The current index into bgColors.
Definition menuMegaRenderer.h:77
led_t leds[CONFIG_NUM_LEDS]
An array with the RGB LED state to be output.
Definition menuMegaRenderer.h:79
bool conveyorBeltStyle
true to draw a sliding background and sliding lights
Definition menuMegaRenderer.h:84
wsg_t submenu
A double right arrow (enter submenu)
Definition menuMegaRenderer.h:49
bool menuFontAllocated
Definition menuMegaRenderer.h:63
bool drawBody
true to draw the sci-fi rectangle body background, false to skip it
Definition menuMegaRenderer.h:82
bool titleFontAllocated
Definition menuMegaRenderer.h:59
menuMegaRenderer_t * initMenuMegaRenderer(font_t *titleFont, font_t *titleFontOutline, font_t *menuFont)
Initialize a and return a menu renderer.
Definition menuMegaRenderer.c:65
void deinitMenuMegaRenderer(menuMegaRenderer_t *renderer)
Deinitialize a menu renderer and free associated memory. This will not free the font passed into init...
Definition menuMegaRenderer.c:158
bool titleFontOutlineAllocated
Definition menuMegaRenderer.h:61
wsg_t item_sel
Background image for the selected item.
Definition menuMegaRenderer.h:44
wsgPalette_t palette
A palette to recolor menu images with.
Definition menuMegaRenderer.h:52
wsg_t item
Background image for non-selected items.
Definition menuMegaRenderer.h:43
wsg_t body_top
The top part of the menu's background image.
Definition menuMegaRenderer.h:41
wsg_t body_bottom
The bottom part of the menu's background image.
Definition menuMegaRenderer.h:42
int32_t bgColorDeg
Definition menuMegaRenderer.h:74
wsg_t prev
A single left arrow (previous option)
Definition menuMegaRenderer.h:48
wsg_t bg
The screen's background image with cutout hexagons.
Definition menuMegaRenderer.h:40
uint16_t bodyHeight
the height of the middle portion of the body, between top and bottom decorated parts
Definition menuMegaRenderer.h:83
wsg_t up
A single up arrow (previous page)
Definition menuMegaRenderer.h:45
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.
Definition menuMegaRenderer.c:244
int32_t numBgColors
The number of colors in bgColors.
Definition menuMegaRenderer.h:72
int32_t shadowMarqueeTimer
The timer for marquee-ing the selected item text, if too long to fit.
Definition menuMegaRenderer.h:67
void setDrawBody(menuMegaRenderer_t *renderer, bool drawBody)
Set whether or not to draw the sci-fi rectangle background body.
Definition menuMegaRenderer.c:203
node_t * currentItem
The currently selected menu item, resets selectedMarqueeTimer when changed.
Definition menuMegaRenderer.h:69
wsg_t down
A single down arrow (next page)
Definition menuMegaRenderer.h:46
int32_t yOff
An offset to the hexagons to make them scroll smoothly.
Definition menuMegaRenderer.h:76
bool ledsOn
true if LEDs should be set by this renderer, false to leave LEDs alone
Definition menuMegaRenderer.h:80
void setMegaLedsOn(menuMegaRenderer_t *renderer, bool ledsOn)
Set the renderer's LEDs to be on or off.
Definition menuMegaRenderer.c:581
int32_t selectedMarqueeTimer
The timer for marquee-ing the selected item text, if too long to fit.
Definition menuMegaRenderer.h:66
int32_t pageArrowTimer
The timer for blinking page up/down arrows.
Definition menuMegaRenderer.h:68
wsg_t next
A single right arrow (next option)
Definition menuMegaRenderer.h:47
paletteColor_t textOutlineColor
The color to outline text with.
Definition menuMegaRenderer.h:55
const paletteColor_t * bgColors
A list of colors to cycle through for the background hexagons.
Definition menuMegaRenderer.h:71
font_t * titleFont
The font to render the title with.
Definition menuMegaRenderer.h:56
font_t * menuFont
The font to render the menu with.
Definition menuMegaRenderer.h:58
paletteColor_t textFillColor
The color to fill text with.
Definition menuMegaRenderer.h:54
wsg_t back
A double left arrow (exit submenu)
Definition menuMegaRenderer.h:50
font_t * titleFontOutline
The font to render the title outline with.
Definition menuMegaRenderer.h:57
void drawMenuMega(menu_t *menu, menuMegaRenderer_t *renderer, int64_t elapsedUs)
Draw a themed menu to the display and control the LEDs.
Definition menuMegaRenderer.c:381
A struct containing all the state data to render a mega-style menu and LEDs.
Definition menuMegaRenderer.h:39
struct _menu_t menu_t
The underlying data for a menu. This fundamentally is a list of menuItem_t.
Definition menu.h:153
paletteColor_t
All 216 possible colors, named like cRGB.
Definition palette.h:23
Provides palette swap functionality for Swadge.
Definition wsgPalette.h:74
A sprite using paletteColor_t colors that can be drawn to the display.
Definition wsg.h:57