dusk/src/duskgl/display/tilesetgl.c
2025-03-05 14:04:50 -06:00

32 lines
792 B
C

/**
* 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/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]);
}