Moved some code around.

This commit is contained in:
2021-09-13 09:23:36 -07:00
parent a11b0ca2f1
commit e6ef96ae78
17 changed files with 348 additions and 540 deletions

View File

@ -7,7 +7,7 @@
#include "sandboxscene.h"
framedtextmenu_t menu;
framedtextmenu_t ftm;
bool sandboxSceneInit(sandboxscene_t *game) {
assetFontLoad(&game->font, "fonts/opensans/OpenSans-Regular.ttf");
@ -15,19 +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, 2, 3, 0, 0);
gridchild_t *child = textMenuListAdd(&menu.menu, "First");
gridChildAddBreakpoint(child, 0,0, 1,1);
child = textMenuListAdd(&menu.menu, "Second");
gridChildAddBreakpoint(child, 0,1, 1,1);
child = textMenuListAdd(&menu.menu, "Third");
gridChildAddBreakpoint(child, 0,2, 1,1);
child = textMenuListAdd(&menu.menu, "Fourth");
gridChildAddBreakpoint(child, 1,0, 1,1);
menuitem_t *item;
framedTextMenuInit(&ftm, &game->font, &game->texture);
ftm.menu.grid.rows = 3;
item = textMenuAdd(&ftm.menu, "Option 1");
item->y = 0;
item = textMenuAdd(&ftm.menu, "Option 2");
item->y = 1;
item = textMenuAdd(&ftm.menu, "Option 3");
item->y = 2;
return true;
}
@ -46,12 +43,10 @@ void sandboxSceneUpdate(sandboxscene_t *game, engine_t *engine) {
shaderUse(&game->shader);
shaderUseCamera(&game->shader, &game->camera);
shaderUseTexture(&game->shader, &game->texture);
float x, y;
framedTextMenuUpdate(&menu, engine);
framedTextMenuRender(&menu, &game->shader, 0, 0);
framedTextMenuResize(&ftm, 400, 400);
framedTextMenuUpdate(&ftm, engine);
framedTextMenuRender(&ftm, &game->shader, 0, 0);
}
void sandboxSceneDispose(sandboxscene_t *game) {

View File

@ -22,6 +22,7 @@
#include "../../ui/grid.h"
#include "../../ui/menu.h"
#include "../../ui/textmenu.h"
#include "../../ui/image.h"
#include "../../ui/framedtextmenu.h"
/**