Added textmenu

This commit is contained in:
2021-09-08 23:10:59 -07:00
parent f19ec89aba
commit 9ef961f871
10 changed files with 196 additions and 72 deletions

View File

@ -29,7 +29,7 @@ typedef struct {
/** Callback to receive when a grid child is to be resized */
typedef void gridchildresizecallback_t(
void *user, int32_t i,
void *user, uint8_t i,
float screenWidth, float screenHeight,
float x, float y,
float width, float height
@ -47,7 +47,6 @@ typedef struct {
typedef struct {
gridchildbreakpoint_t breakpoints[GRID_BREAKPOINT_COUNT];
uint8_t breakpointCount;
gridchildresizecallback_t *onResize;
} gridchild_t;
/** Definitio of a grid */
@ -65,9 +64,10 @@ typedef struct {
/** Internal size reference, used for caching resize events */
float width;
float height;
float x;
float y;
/** Pointer to any custom user data */
void *user;
/** Callback to listen for when children are resized */
gridchildresizecallback_t *onResize;
} grid_t;

View File

@ -0,0 +1,31 @@
// Copyright (c) 2021 Dominic Masters
//
// This software is released under the MIT License.
// https://opensource.org/licenses/MIT
#pragma once
#include "../libs.h"
#include "menuv2.h"
#include "grid.h"
#include "label.h"
#include "rectangle.h"
typedef void textmenucallback_t(void *user, uint8_t i, char *text);
typedef struct {
float x, y;
float width, height;
} textmenulabelinfo_t;
typedef struct {
menuv2_t menu;
char *texts[GRID_CHILD_COUNT];
font_t *font;
label_t labels[GRID_CHILD_COUNT];
rectangle_t rectangle;
textmenulabelinfo_t labelInfo[GRID_CHILD_COUNT];
textmenucallback_t *onSelect;
void *user;
} textmenu_t;