Fixed loading example.

This commit is contained in:
2021-11-03 12:51:48 -07:00
parent 7097e7a1d4
commit a2c622ddc1
2 changed files with 10 additions and 14 deletions

View File

@ -9,14 +9,15 @@
bool sandboxGameInit(sandboxgame_t *game) {
// assetTextureLoad(&game->texture, "textures/test_texture.png");
quadInit(&game->quad, 0, 0,0,0,0, 500,500,1,1);
game->texture.width = -1;
assetManagerInit(&game->manager);
assetManagerLoadTexture(&game->manager, &game->texture, "textures/test_texture.png");
assetManagerLoadFont(&game->manager, &game->font, "fonts/opensans/OpenSans-Regular.ttf");
assetManagerLoadTexture(&game->manager, &game->texture,
"textures/test_texture.png"
);
assetManagerLoadFont(&game->manager, &game->font,
"fonts/opensans/OpenSans-Regular.ttf"
);
assetManagerShaderLoad(&game->manager, &game->shader,
"shaders/textured.vert",
"shaders/textured.frag"
@ -45,13 +46,9 @@ void sandboxGameUpdate(sandboxgame_t *game) {
shaderUse(&game->shader);
shaderUseCamera(&game->shader, &camera);
if(game->texture.width != -1) {
shaderUseTexture(&game->shader, &game->texture);
shaderUsePosition(&game->shader, 0,0,0, 0,0,0);
primitiveDraw(&game->quad, 0, -1);
}
shaderUseTexture(&game->shader, &game->texture);
shaderUsePosition(&game->shader, 0,0,0, 0,0,0);
primitiveDraw(&game->quad, 0, -1);
}
void sandboxGameDispose(sandboxgame_t *game) {

View File

@ -21,10 +21,9 @@ typedef struct {
engine_t engine;
shader_t shader;
font_t font;
texture_t texture;
primitive_t quad;
assetmanager_t manager;
texture_t texture;
} sandboxgame_t;
/**