Added textmenu
This commit is contained in:
@ -71,14 +71,15 @@
|
||||
|
||||
// User Interface Objects
|
||||
#include "ui/grid.h"
|
||||
#include "ui/label.h"
|
||||
#include "ui/menuv2.h"
|
||||
#include "ui/rectangle.h"
|
||||
#include "ui/textmenu.h"
|
||||
|
||||
#include "ui/frame.h"
|
||||
#include "ui/image.h"
|
||||
#include "ui/label.h"
|
||||
#include "ui/menu.h"
|
||||
#include "ui/menulist.h"
|
||||
#include "ui/rectangle.h"
|
||||
|
||||
// Utility Objects
|
||||
#include "util/array.h"
|
||||
|
@ -26,6 +26,7 @@ typedef struct {
|
||||
primitive_t primitive;
|
||||
texture_t texture;
|
||||
shader_t shader;
|
||||
font_t font;
|
||||
|
||||
gridbruh_t items[GRID_BRUH_COUNT];
|
||||
} sandboxscene_t;
|
@ -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;
|
31
include/dawn/ui/textmenu.h
Normal file
31
include/dawn/ui/textmenu.h
Normal 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;
|
Reference in New Issue
Block a user