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
44
typedef
struct
45
{
46
int16_t
orbitAngle
;
47
int32_t
orbitTimer
;
48
int32_t
orbitUsPerDegree
;
49
int32_t
orbitDirection
;
50
int16_t
diameterAngle
;
51
int32_t
diameterTimer
;
52
paletteColor_t
color
;
53
}
maniaRing_t
;
54
58
typedef
struct
59
{
60
font_t
*
titleFont
;
61
font_t
*
titleFontOutline
;
62
font_t
*
menuFont
;
63
bool
titleFontAllocated
;
65
bool
titleFontOutlineAllocated
;
67
bool
menuFontAllocated
;
69
led_t
leds[CONFIG_NUM_LEDS];
70
wsg_t
batt[4];
71
72
maniaRing_t
rings[2];
73
74
int32_t
ledDecayTimer
;
75
int32_t
ledExciteTimer
;
76
int16_t
currentLed
;
77
bool
ledsOn
;
78
79
menuItem_t
*
selectedItem
;
80
int16_t
selectedShadowIdx
;
81
int32_t
selectedShadowTimer
;
82
int16_t
selectedBounceIdx
;
83
int32_t
selectedBounceTimer
;
84
int32_t
selectedValue
;
85
int32_t
selectedMarqueeTimer
;
86
87
paletteColor_t
titleBgColor
;
88
paletteColor_t
titleTextColor
;
89
paletteColor_t
textOutlineColor
;
90
paletteColor_t
bgColor
;
91
paletteColor_t
outerRingColor
;
92
paletteColor_t
innerRingColor
;
93
paletteColor_t
rowColor
;
94
paletteColor_t
rowTextColor
;
95
const
paletteColor_t
*
shadowColors
;
96
int32_t
shadowColorsLen
;
97
led_t
baseLedColor
;
98
}
menuManiaRenderer_t
;
99
100
menuManiaRenderer_t
*
initMenuManiaRenderer
(
font_t
* titleFont,
font_t
* titleFontOutline,
font_t
* menuFont);
101
void
deinitMenuManiaRenderer
(
menuManiaRenderer_t
* renderer);
102
void
drawMenuMania
(
menu_t
* menu,
menuManiaRenderer_t
* renderer, int64_t elapsedUs);
103
void
setManiaLedsOn
(
menuManiaRenderer_t
* renderer,
bool
ledsOn);
104
void
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
font_t
A font is a collection of font_ch_t for all ASCII characters. Each character has the same height and ...
Definition
font.h:66
fs_font.h
fs_wsg.h
hdw-led.h
led_t
LED colors, with red, green, and blue components.
Definition
hdw-led.h:63
menuManiaRenderer_t::baseLedColor
led_t baseLedColor
The base color of the LED rotation.
Definition
menuManiaRenderer.h:97
menuManiaRenderer_t::rowTextColor
paletteColor_t rowTextColor
The color of the row text.
Definition
menuManiaRenderer.h:94
menuManiaRenderer_t::selectedItem
menuItem_t * selectedItem
Reference to the selected item to tell when it changes.
Definition
menuManiaRenderer.h:79
menuManiaRenderer_t::currentLed
int16_t currentLed
The current LED being excited.
Definition
menuManiaRenderer.h:76
maniaRing_t::orbitDirection
int32_t orbitDirection
The direction to rotate, +1 or -1.
Definition
menuManiaRenderer.h:49
menuManiaRenderer_t::bgColor
paletteColor_t bgColor
The color of the screen background.
Definition
menuManiaRenderer.h:90
menuManiaRenderer_t::menuFontAllocated
bool menuFontAllocated
Definition
menuManiaRenderer.h:67
menuManiaRenderer_t::shadowColors
const paletteColor_t * shadowColors
The colors cycled through as the selected shadow.
Definition
menuManiaRenderer.h:95
maniaRing_t::diameterTimer
int32_t diameterTimer
Timer to grow and shrink the orbit circles.
Definition
menuManiaRenderer.h:51
menuManiaRenderer_t::titleFontAllocated
bool titleFontAllocated
Definition
menuManiaRenderer.h:63
menuManiaRenderer_t::titleFontOutlineAllocated
bool titleFontOutlineAllocated
Definition
menuManiaRenderer.h:65
initMenuManiaRenderer
menuManiaRenderer_t * initMenuManiaRenderer(font_t *titleFont, font_t *titleFontOutline, font_t *menuFont)
Initialize a and return a menu renderer.
Definition
menuManiaRenderer.c:80
drawMenuMania
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
maniaRing_t::orbitTimer
int32_t orbitTimer
Timer to rotate the orbit circles.
Definition
menuManiaRenderer.h:47
menuManiaRenderer_t::selectedValue
int32_t selectedValue
The option index or setting value to tell when it changes.
Definition
menuManiaRenderer.h:84
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.
Definition
menuManiaRenderer.c:670
menuManiaRenderer_t::outerRingColor
paletteColor_t outerRingColor
The color of the outer rotating ring.
Definition
menuManiaRenderer.h:91
menuManiaRenderer_t::innerRingColor
paletteColor_t innerRingColor
The color of the inner rotating ring.
Definition
menuManiaRenderer.h:92
deinitMenuManiaRenderer
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
menuManiaRenderer_t::selectedShadowIdx
int16_t selectedShadowIdx
The index to the color offset for the selected drop shadow.
Definition
menuManiaRenderer.h:80
menuManiaRenderer_t::selectedBounceTimer
int32_t selectedBounceTimer
The timer to bounce the offset for the selected item.
Definition
menuManiaRenderer.h:83
menuManiaRenderer_t::titleTextColor
paletteColor_t titleTextColor
The color of the title text.
Definition
menuManiaRenderer.h:88
setManiaLedsOn
void setManiaLedsOn(menuManiaRenderer_t *renderer, bool ledsOn)
Set the renderer's LEDs to be on or off.
Definition
menuManiaRenderer.c:644
menuManiaRenderer_t::shadowColorsLen
int32_t shadowColorsLen
The number of selected shadow colors to cycle through.
Definition
menuManiaRenderer.h:96
maniaRing_t::color
paletteColor_t color
The color of this ring.
Definition
menuManiaRenderer.h:52
menuManiaRenderer_t::selectedShadowTimer
int32_t selectedShadowTimer
The timer to change the color for the selected drop shadow.
Definition
menuManiaRenderer.h:81
menuManiaRenderer_t::ledsOn
bool ledsOn
true to use the LEDs, false to keep them off
Definition
menuManiaRenderer.h:77
maniaRing_t::diameterAngle
int16_t diameterAngle
Angle to grow and shrink the orbit circles.
Definition
menuManiaRenderer.h:50
menuManiaRenderer_t::selectedMarqueeTimer
int32_t selectedMarqueeTimer
The timer for marquee-ing the selected item text, if too long to fit.
Definition
menuManiaRenderer.h:85
menuManiaRenderer_t::textOutlineColor
paletteColor_t textOutlineColor
The color of the title text outline.
Definition
menuManiaRenderer.h:89
menuManiaRenderer_t::rowColor
paletteColor_t rowColor
The color of the row background.
Definition
menuManiaRenderer.h:93
maniaRing_t::orbitAngle
int16_t orbitAngle
Angle for the orbit circles.
Definition
menuManiaRenderer.h:46
menuManiaRenderer_t::ledExciteTimer
int32_t ledExciteTimer
Timer to excite LEDs.
Definition
menuManiaRenderer.h:75
maniaRing_t::orbitUsPerDegree
int32_t orbitUsPerDegree
Number of microseconds to wait before rotating by one degree.
Definition
menuManiaRenderer.h:48
menuManiaRenderer_t::titleFont
font_t * titleFont
The font to render the title with.
Definition
menuManiaRenderer.h:60
menuManiaRenderer_t::ledDecayTimer
int32_t ledDecayTimer
Timer to decay LEDs.
Definition
menuManiaRenderer.h:74
menuManiaRenderer_t::menuFont
font_t * menuFont
The font to render the menu with.
Definition
menuManiaRenderer.h:62
menuManiaRenderer_t::selectedBounceIdx
int16_t selectedBounceIdx
The index to the bounce offset for the selected item.
Definition
menuManiaRenderer.h:82
menuManiaRenderer_t::titleFontOutline
font_t * titleFontOutline
The font to render the title outline with.
Definition
menuManiaRenderer.h:61
menuManiaRenderer_t::titleBgColor
paletteColor_t titleBgColor
The color of the title background.
Definition
menuManiaRenderer.h:87
maniaRing_t
Definition
menuManiaRenderer.h:45
menuManiaRenderer_t
A struct containing all the state data to render a mania-style menu and LEDs.
Definition
menuManiaRenderer.h:59
menu.h
_menu_t
The underlying data for a menu. This fundamentally is a list of menuItem_t.
Definition
menu.h:173
menuItem_t
The underlying data for an item in a menu. The item may be a single-select, multi-select,...
Definition
menu.h:157
paletteColor_t
paletteColor_t
All 216 possible colors, named like cRGB.
Definition
palette.h:23
wsg_t
A sprite using paletteColor_t colors that can be drawn to the display.
Definition
wsg.h:57
main
menu
menuManiaRenderer.h
Generated by
1.10.0