Swadge 2024 2.0.0
APIs to develop games for the Magfest Swadge
Loading...
Searching...
No Matches
menuManiaRenderer.h
Go to the documentation of this file.
1
27#ifndef _MENU_MANIA_RENDERER_H_
28#define _MENU_MANIA_RENDERER_H_
29
30#include "menu.h"
31#include "fs_font.h"
32#include "fs_wsg.h"
33#include "hdw-led.h"
34
35#define Y_SECTION_MARGIN 14
36#define TITLE_BG_HEIGHT 40
37
39#define MANIA_TITLE_HEIGHT (TITLE_BG_HEIGHT + Y_SECTION_MARGIN)
40
42#define MANIA_BODY_HEIGHT (TFT_HEIGHT - MANIA_TITLE_HEIGHT)
43
44typedef struct
45{
46 int16_t orbitAngle;
47 int32_t orbitTimer;
50 int16_t diameterAngle;
51 int32_t diameterTimer;
54
99
100menuManiaRenderer_t* initMenuManiaRenderer(font_t* titleFont, font_t* titleFontOutline, font_t* menuFont);
102void drawMenuMania(menu_t* menu, menuManiaRenderer_t* renderer, int64_t elapsedUs);
103void setManiaLedsOn(menuManiaRenderer_t* renderer, bool ledsOn);
104void recolorMenuManiaRenderer(menuManiaRenderer_t* renderer, paletteColor_t titleBgColor, paletteColor_t titleTextColor,
105 paletteColor_t textOutlineColor, paletteColor_t bgColor, paletteColor_t outerRingColor,
106 paletteColor_t innerRingColor, paletteColor_t rowColor, paletteColor_t rowTextColor,
107 const paletteColor_t* shadowColors, int32_t shadowColorsLen, led_t baseLedColor);
108
109#endif
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
led_t baseLedColor
The base color of the LED rotation.
Definition menuManiaRenderer.h:97
paletteColor_t rowTextColor
The color of the row text.
Definition menuManiaRenderer.h:94
menuItem_t * selectedItem
Reference to the selected item to tell when it changes.
Definition menuManiaRenderer.h:79
int16_t currentLed
The current LED being excited.
Definition menuManiaRenderer.h:76
int32_t orbitDirection
The direction to rotate, +1 or -1.
Definition menuManiaRenderer.h:49
paletteColor_t bgColor
The color of the screen background.
Definition menuManiaRenderer.h:90
bool menuFontAllocated
Definition menuManiaRenderer.h:67
const paletteColor_t * shadowColors
The colors cycled through as the selected shadow.
Definition menuManiaRenderer.h:95
int32_t diameterTimer
Timer to grow and shrink the orbit circles.
Definition menuManiaRenderer.h:51
bool titleFontAllocated
Definition menuManiaRenderer.h:63
bool titleFontOutlineAllocated
Definition menuManiaRenderer.h:65
menuManiaRenderer_t * initMenuManiaRenderer(font_t *titleFont, font_t *titleFontOutline, font_t *menuFont)
Initialize a and return a menu renderer.
Definition menuManiaRenderer.c:80
void drawMenuMania(menu_t *menu, menuManiaRenderer_t *renderer, int64_t elapsedUs)
Draw a themed menu to the display and control the LEDs.
Definition menuManiaRenderer.c:370
int32_t orbitTimer
Timer to rotate the orbit circles.
Definition menuManiaRenderer.h:47
int32_t selectedValue
The option index or setting value to tell when it changes.
Definition menuManiaRenderer.h:84
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.
Definition menuManiaRenderer.c:670
paletteColor_t outerRingColor
The color of the outer rotating ring.
Definition menuManiaRenderer.h:91
paletteColor_t innerRingColor
The color of the inner rotating ring.
Definition menuManiaRenderer.h:92
void deinitMenuManiaRenderer(menuManiaRenderer_t *renderer)
Deinitialize a menu renderer and free associated memory. This will not free the font passed into init...
Definition menuManiaRenderer.c:183
int16_t selectedShadowIdx
The index to the color offset for the selected drop shadow.
Definition menuManiaRenderer.h:80
int32_t selectedBounceTimer
The timer to bounce the offset for the selected item.
Definition menuManiaRenderer.h:83
paletteColor_t titleTextColor
The color of the title text.
Definition menuManiaRenderer.h:88
void setManiaLedsOn(menuManiaRenderer_t *renderer, bool ledsOn)
Set the renderer's LEDs to be on or off.
Definition menuManiaRenderer.c:644
int32_t shadowColorsLen
The number of selected shadow colors to cycle through.
Definition menuManiaRenderer.h:96
paletteColor_t color
The color of this ring.
Definition menuManiaRenderer.h:52
int32_t selectedShadowTimer
The timer to change the color for the selected drop shadow.
Definition menuManiaRenderer.h:81
bool ledsOn
true to use the LEDs, false to keep them off
Definition menuManiaRenderer.h:77
int16_t diameterAngle
Angle to grow and shrink the orbit circles.
Definition menuManiaRenderer.h:50
int32_t selectedMarqueeTimer
The timer for marquee-ing the selected item text, if too long to fit.
Definition menuManiaRenderer.h:85
paletteColor_t textOutlineColor
The color of the title text outline.
Definition menuManiaRenderer.h:89
paletteColor_t rowColor
The color of the row background.
Definition menuManiaRenderer.h:93
int16_t orbitAngle
Angle for the orbit circles.
Definition menuManiaRenderer.h:46
int32_t ledExciteTimer
Timer to excite LEDs.
Definition menuManiaRenderer.h:75
int32_t orbitUsPerDegree
Number of microseconds to wait before rotating by one degree.
Definition menuManiaRenderer.h:48
font_t * titleFont
The font to render the title with.
Definition menuManiaRenderer.h:60
int32_t ledDecayTimer
Timer to decay LEDs.
Definition menuManiaRenderer.h:74
font_t * menuFont
The font to render the menu with.
Definition menuManiaRenderer.h:62
int16_t selectedBounceIdx
The index to the bounce offset for the selected item.
Definition menuManiaRenderer.h:82
font_t * titleFontOutline
The font to render the title outline with.
Definition menuManiaRenderer.h:61
paletteColor_t titleBgColor
The color of the title background.
Definition menuManiaRenderer.h:87
Definition menuManiaRenderer.h:45
A struct containing all the state data to render a mania-style menu and LEDs.
Definition menuManiaRenderer.h:59
The underlying data for a menu. This fundamentally is a list of menuItem_t.
Definition menu.h:173
The underlying data for an item in a menu. The item may be a single-select, multi-select,...
Definition menu.h:157
paletteColor_t
All 216 possible colors, named like cRGB.
Definition palette.h:23
A sprite using paletteColor_t colors that can be drawn to the display.
Definition wsg.h:57