Dawn/include/dawn/ui/menu.h

33 lines
633 B
C

/**
* Copyright (c) 2021 Dominic Masters
*
* This software is released under the MIT License.
* https://opensource.org/licenses/MIT
*/
#pragma once
#include "../libs.h"
/** The maximum number of items a menu can hold */
#define MENU_ITEMS_MAX 32
/** Callback for when menu events are fired. */
typedef void menucallback_t(void *user, uint8_t i);
typedef struct {
uint8_t x;
uint8_t y;
uint8_t width;
uint8_t height;
} menuitem_t;
typedef struct {
menuitem_t items[MENU_ITEMS_MAX];
uint8_t itemCount;
uint8_t selected;
uint8_t cursorX;
uint8_t cursorY;
void *user;
menucallback_t *onSelect;
} menu_t;