Fixed block preview texture selection

This commit is contained in:
MihailRis 2022-06-29 15:05:21 +03:00 committed by GitHub
parent 81d246f3d0
commit bb7c63394b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 4 deletions

View File

@ -61,7 +61,6 @@ int initialize_assets(Assets* assets) {
LOAD_SHADER("res/ui.glslv", "res/ui.glslf", "ui");
LOAD_TEXTURE("res/block.png", "block");
LOAD_TEXTURE("res/block_select.png", "block_select");
LOAD_FONT("res/font.png", "normal");
return 0;

View File

@ -132,10 +132,12 @@ void draw_hud(Player* player, Assets* assets, bool devdata, int fps){
batch->render();
// choosen block preview
Texture* blocks = assets->getTexture("block_select");
Texture* blocks = assets->getTexture("block");
batch->texture(blocks);
batch->sprite(14, 278, 68, 68, 16, player->choosenBlock, vec4(0.0f, 0.0f, 0.0f, 1.0f));
batch->sprite(16, 280, 64, 64, 16, player->choosenBlock, vec4(1.0f));
int texid = Block::blocks[player->choosenBlock]->textureFaces[3]; // face-3 is top face of block
batch->sprite(14, 278, 68, 68, 16, texid, vec4(0.0f, 0.0f, 0.0f, 1.0f));
batch->sprite(16, 280, 64, 64, 16, texid, vec4(1.0f));
batch->render();
}