Dawn/src/ui/textmenu.h
2021-09-08 23:10:59 -07:00

58 lines
1.3 KiB
C

/**
* Copyright (c) 2021 Dominic Masters
*
* This software is released under the MIT License.
* https://opensource.org/licenses/MIT
*/
#pragma once
#include <dawn/dawn.h>
#include "menuv2.h"
#include "grid.h"
#include "label.h"
#include "rectangle.h"
/** Callback to be notified from the menu when the menu items are selected. */
void _textMenuOnSelect(menuv2_t *menu, uint8_t i);
/** Callback to lisen for resize events from the grid subsystem */
void _textMenuOnResize(
void *user, uint8_t i,
float screenWidth, float screenHeight,
float x, float y,
float width, float height
);
/**
* Initialize a text menu item.
*
* @param menu Menu to initialize.
* @param font Font to use during initialization.
*/
void textMenuInit(textmenu_t *menu, font_t *font);
/**
* Add text to a menu list.
*
* @param menu Menu to add to.
* @param item Text to add (must be a constant value).
* @return The grid subsystem item.
*/
gridchild_t * textMenuListAdd(textmenu_t *menu, char *item);
/**
* Render a text menu list.
*
* @param menu Menu to render.
* @param shader Shader to use.
* @param x X position of the menu.
* @param y Y position of the menu.
*/
void textMenuListRender(textmenu_t *menu, shader_t *shader, float x, float y);
/**
* Dispose/Cleanup a text menu.
*
* @param menu Text menu to dispose.
*/
void textMenuDispse(textmenu_t *menu);