57 lines
1.4 KiB
C
57 lines
1.4 KiB
C
/**
|
|
* Copyright (c) 2021 Dominic Masters
|
|
*
|
|
* This software is released under the MIT License.
|
|
* https://opensource.org/licenses/MIT
|
|
*/
|
|
|
|
#include "sandboxscene.h"
|
|
|
|
framedtextmenu_t menu;
|
|
|
|
bool sandboxSceneInit(sandboxscene_t *game) {
|
|
assetFontLoad(&game->font, "fonts/opensans/OpenSans-Regular.ttf");
|
|
assetTextureLoad(&game->texture, "test_texture.png");
|
|
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);
|
|
|
|
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);
|
|
|
|
return true;
|
|
}
|
|
|
|
void sandboxSceneUpdate(sandboxscene_t *game, engine_t *engine) {
|
|
cameraLookAt(&game->camera,
|
|
0, 0, 10,
|
|
0, 0, 0
|
|
);
|
|
|
|
cameraOrtho(&game->camera,
|
|
0, engine->render.width,
|
|
engine->render.height, 0,
|
|
0.01f, 1000.0f
|
|
);
|
|
|
|
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);
|
|
}
|
|
|
|
void sandboxSceneDispose(sandboxscene_t *game) {
|
|
|
|
} |