Moved some code around.
This commit is contained in:
@ -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) {
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include "../../ui/grid.h"
|
||||
#include "../../ui/menu.h"
|
||||
#include "../../ui/textmenu.h"
|
||||
#include "../../ui/image.h"
|
||||
#include "../../ui/framedtextmenu.h"
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user