Swadge 2024 2.0.0
APIs to develop games for the Magfest Swadge
Loading...
Searching...
No Matches
wheel_menu.h
Go to the documentation of this file.
1
26#ifndef _WHEEL_MENU_H_
27#define _WHEEL_MENU_H_
28
29#include "menu.h"
30#include "menu_utils.h"
31#include "wsg.h"
32#include "geometry.h"
33#include "palette.h"
34
51
58
85
86wheelMenuRenderer_t* initWheelMenu(const font_t* font, uint16_t anchorAngle, const rectangle_t* textBox);
88void drawWheelMenu(menu_t* menu, wheelMenuRenderer_t* renderer, int64_t elapsedUs);
89
91void wheelMenuSetItemInfo(wheelMenuRenderer_t* renderer, const char* label, const wsg_t* icon, uint8_t position,
92 wheelScrollDir_t scrollDir);
93void wheelMenuSetItemIcon(wheelMenuRenderer_t* renderer, const char* label, const wsg_t* icon);
94void wheelMenuSetItemColor(wheelMenuRenderer_t* renderer, const char* label, paletteColor_t selectedBg,
95 paletteColor_t unselectedBg);
96void wheelMenuSetItemTextIcon(wheelMenuRenderer_t* renderer, const char* label, const char* textIcon);
97void wheelMenuSetItemSize(wheelMenuRenderer_t* renderer, const char* label, int16_t w, int16_t h,
98 wheelMenuShapeFlags_t shapeFlags);
99menu_t* wheelMenuTouch(menu_t* menu, wheelMenuRenderer_t* renderer, uint16_t angle, uint16_t radius);
100menu_t* wheelMenuButton(menu_t* menu, wheelMenuRenderer_t* renderer, const buttonEvt_t* evt);
102bool wheelMenuActive(menu_t* menu, wheelMenuRenderer_t* renderer);
103
104#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
Signed integer representation of a rectangle.
Definition geometry.h:59
A button event containing the button that triggered the event, whether it was pressed or released,...
Definition hdw-btn.h:117
A doubly linked list with pointers to the first and last nodes.
Definition linked_list.h:87
The underlying data for a menu. This fundamentally is a list of menuItem_t.
Definition menu.h:173
paletteColor_t
All 216 possible colors, named like cRGB.
Definition palette.h:23
bool active
Whether the menu should be shown, regardless of touch.
Definition wheel_menu.h:79
list_t itemInfos
The list holding each item's information.
Definition wheel_menu.h:66
paletteColor_t unselBgColor
Default background color of unselected items.
Definition wheel_menu.h:74
paletteColor_t textColor
Color of the selected menu item text label.
Definition wheel_menu.h:73
uint16_t anchorAngle
The angle around which the 0th menu item will be centered.
Definition wheel_menu.h:67
bool zoomed
Whether or not a settings item is selected.
Definition wheel_menu.h:80
const font_t * font
The font to draw the menu labels with.
Definition wheel_menu.h:64
int32_t timer
The timer for animations.
Definition wheel_menu.h:83
uint16_t x
The X position of the center of the menu.
Definition wheel_menu.h:68
void wheelMenuSetItemInfo(wheelMenuRenderer_t *renderer, const char *label, const wsg_t *icon, uint8_t position, wheelScrollDir_t scrollDir)
Sets the icon and ring position for the item with the given label.
Definition wheel_menu.c:137
paletteColor_t borderColor
Color of the circle borders.
Definition wheel_menu.h:76
bool customBack
Whether the center "back" circle has been customized.
Definition wheel_menu.h:77
bool touched
Whether the touchpad is currently touched.
Definition wheel_menu.h:78
void wheelMenuSetItemSize(wheelMenuRenderer_t *renderer, const char *label, int16_t w, int16_t h, wheelMenuShapeFlags_t shapeFlags)
Set specific dimensions for a menu item.
Definition wheel_menu.c:204
uint16_t unselR
The radius of unselected items' sectors.
Definition wheel_menu.h:71
menu_t * wheelMenuTouchRelease(menu_t *menu, wheelMenuRenderer_t *renderer)
Inform the wheel menu that the touchpad has been released, selecting the current item.
Definition wheel_menu.c:942
bool zoomBackSelected
Whether or not the center is selected while zoomed.
Definition wheel_menu.h:81
wheelMenuRenderer_t * initWheelMenu(const font_t *font, uint16_t anchorAngle, const rectangle_t *textBox)
Initializes and returns a new wheel menu with the default settings.
Definition wheel_menu.c:76
menu_t * wheelMenuButton(menu_t *menu, wheelMenuRenderer_t *renderer, const buttonEvt_t *evt)
Handle a button press, used for when a setting or option menu item can be scrolled.
Definition wheel_menu.c:861
uint16_t y
The Y position of the center of the menu.
Definition wheel_menu.h:69
void wheelMenuSetItemIcon(wheelMenuRenderer_t *renderer, const char *label, const wsg_t *icon)
Set the icon for an item with the given label.
Definition wheel_menu.c:159
uint16_t selR
The radius of the selected sector.
Definition wheel_menu.h:72
menu_t * wheelMenuTouch(menu_t *menu, wheelMenuRenderer_t *renderer, uint16_t angle, uint16_t radius)
Register a touchpad touch event with the wheel menu.
Definition wheel_menu.c:685
wheelMenuShapeFlags_t
Definition wheel_menu.h:53
@ WM_SHAPE_ROUNDED_RECT
Definition wheel_menu.h:55
@ WM_SHAPE_SQUARE
Definition wheel_menu.h:56
@ WM_SHAPE_DEFAULT
Definition wheel_menu.h:54
uint16_t spokeR
The radial offset of the ring items.
Definition wheel_menu.h:70
paletteColor_t selBgColor
Default background color of selected items.
Definition wheel_menu.h:75
void wheelMenuSetItemColor(wheelMenuRenderer_t *renderer, const char *label, paletteColor_t selectedBg, paletteColor_t unselectedBg)
Set both the selected and unselected background colors for the item with the given laebl.
Definition wheel_menu.c:172
void wheelMenuSetColor(wheelMenuRenderer_t *renderer, paletteColor_t textColor)
Set the text color for the selected item.
Definition wheel_menu.c:123
void drawWheelMenu(menu_t *menu, wheelMenuRenderer_t *renderer, int64_t elapsedUs)
Draw the wheel menu onto the screen.
Definition wheel_menu.c:221
bool wheelMenuActive(menu_t *menu, wheelMenuRenderer_t *renderer)
Returns whether or not the wheel menu is active and should be drawn.
Definition wheel_menu.c:1036
void wheelMenuSetItemTextIcon(wheelMenuRenderer_t *renderer, const char *label, const char *textIcon)
Set a short text string to use a very short text tring as an item's icon, instead of an image.
Definition wheel_menu.c:188
uint8_t zoomValue
The current selected option/value if zoomed.
Definition wheel_menu.h:82
const rectangle_t * textBox
A pointer to the text box to draw the selected item's label inside.
Definition wheel_menu.h:65
wheelScrollDir_t
Wheel scroll directions.
Definition wheel_menu.h:39
@ SCROLL_HORIZ
Allow scrolling setting value with Let/Right D-Pad buttons.
Definition wheel_menu.h:42
@ ZOOM_GAUGE
When zoomed to a settings item, display it as a gauge.
Definition wheel_menu.h:47
@ ZOOM_CONVEYOR
When zoomed to a settings item, display it as a rotating conveyor belt.
Definition wheel_menu.h:48
@ ZOOM_SUBMENU
When zoomed to a settings item, display it as a submenu.
Definition wheel_menu.h:46
@ NO_SCROLL
Do not allow setting values to scroll with buttons.
Definition wheel_menu.h:40
@ MASK_ZOOM
Mask for all zoom options.
Definition wheel_menu.h:49
@ SCROLL_VERT
Allow scrolling setting value with Up/Down D-Pad buttons.
Definition wheel_menu.h:41
@ SCROLL_REVERSE
Flip the direction of scrolling.
Definition wheel_menu.h:43
@ SCROLL_HORIZ_R
Allow scrolling setting value with Up/Down, reversed.
Definition wheel_menu.h:45
@ SCROLL_VERT_R
Allow scrolling setting value with Up/Down, reversed.
Definition wheel_menu.h:44
void deinitWheelMenu(wheelMenuRenderer_t *renderer)
Deinitialize and free all memory associated with the wheel menu renderer.
Definition wheel_menu.c:106
Renderer for a menu wheel.
Definition wheel_menu.h:63
A sprite using paletteColor_t colors that can be drawn to the display.
Definition wsg.h:57