Added framed text menu.

This commit is contained in:
2021-09-10 10:13:39 -07:00
parent 9f37156e8f
commit 896b98c9aa
11 changed files with 182 additions and 28 deletions

View File

@ -7,7 +7,7 @@
#include "sandboxscene.h"
textmenu_t menu;
framedtextmenu_t menu;
bool sandboxSceneInit(sandboxscene_t *game) {
assetFontLoad(&game->font, "fonts/opensans/OpenSans-Regular.ttf");
@ -15,16 +15,16 @@ bool sandboxSceneInit(sandboxscene_t *game) {
assetShaderLoad(&game->shader,
"shaders/textured.vert", "shaders/textured.frag"
);
framedTextMenuInit(&menu, &game->font, &game->texture);
gridAddBreakpoint(&menu.menu.menu.grid, -1, 3, 1, 0, 0);
textMenuInit(&menu, &game->font);
gridAddBreakpoint(&menu.menu.grid, -1, 3, 1, 0, 0);
gridchild_t *child = textMenuListAdd(&menu, "First");
gridchild_t *child = textMenuListAdd(&menu.menu, "First");
gridChildAddBreakpoint(child, 0,0, 1,1);
child = textMenuListAdd(&menu, "Second");
child = textMenuListAdd(&menu.menu, "Second");
gridChildAddBreakpoint(child, 0,1, 1,1);
child = textMenuListAdd(&menu, "Third");
child = textMenuListAdd(&menu.menu, "Third");
gridChildAddBreakpoint(child, 0,2, 1,1);
return true;
@ -46,13 +46,10 @@ void sandboxSceneUpdate(sandboxscene_t *game, engine_t *engine) {
shaderUseCamera(&game->shader, &game->camera);
shaderUseTexture(&game->shader, &game->texture);
gridSetSize(&menu.menu.grid,
engine->render.width, engine->render.height,
100.0f, FONT_LINE_HEIGHT * fontGetScale(16.0f) * 3,
0, 0
);
menu2Update(&menu.menu, engine);
textMenuListRender(&menu, &game->shader, 0, 0);
float x, y;
framedTextMenuUpdate(&menu, engine);
framedTextMenuRender(&menu, &game->shader, 0, 0);
}
void sandboxSceneDispose(sandboxscene_t *game) {

View File

@ -20,6 +20,7 @@
#include "../../ui/grid.h"
#include "../../ui/menuv2.h"
#include "../../ui/textmenu.h"
#include "../../ui/framedtextmenu.h"
/**
* Initialize the sandbox scene test game.