Working with tilesets, about to do UV wrapping.
This commit is contained in:
32
src/duskgl/display/tilesetgl.c
Normal file
32
src/duskgl/display/tilesetgl.c
Normal 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]);
|
||||
}
|
||||
Reference in New Issue
Block a user