Working with tilesets, about to do UV wrapping.

This commit is contained in:
2025-03-05 07:14:56 -06:00
parent 04eb4736d8
commit 40c97d6eb7
17 changed files with 303 additions and 5 deletions

View File

@@ -0,0 +1,32 @@
/**
* Copyright (c) 2025 Dominic Masters
*
* This software is released under the MIT License.
* https://opensource.org/licenses/MIT
*/
#include "tilesetgl.h"
#include "assert/assert.h"
const char* TILESET_GL_TEXTURES_PATHS[TILESET_COUNT] = {
NULL,
"textures/bolder-8x8.png"
};
texture_t TILESET_GL_TEXTURES[TILESET_SLOT_COUNT];
void tilesetGLBind() {
uint8_t i;
do {
if(TILESET_SLOTS[i] == TILESET_NULL) continue;
textureBind(TILESET_GL_TEXTURES + i, i);
} while(++i < TILESET_SLOT_COUNT);
}
void tilesetBind(const tilesetid_t id, const uint8_t slot) {
assertTrue(slot < TILESET_SLOT_COUNT, "Invalid slot");
assertTrue(id < TILESET_COUNT, "Invalid tileset id");
TILESET_SLOTS[slot] = id;
textureLoad(TILESET_GL_TEXTURES + slot, TILESET_GL_TEXTURES_PATHS[id]);
}