From 835b40046a0f195617dbfd6a8d26edcab160e016 Mon Sep 17 00:00:00 2001 From: nosch Date: Sat, 30 Aug 2025 23:35:41 +0200 Subject: [PATCH] started texture processing --- src/render/textures.cpp | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 src/render/textures.cpp diff --git a/src/render/textures.cpp b/src/render/textures.cpp new file mode 100644 index 0000000..cff1139 --- /dev/null +++ b/src/render/textures.cpp @@ -0,0 +1,29 @@ +#include "../../include/raylib-cpp.hpp" +#include + +using namespace std; + +typedef vector TextureAtlas; +typedef int ID; + +Texture defaultTexture; + +void GenDefaultTexture(){ + Image img = GenImageChecked(64, 64, 16, 16, PURPLE, BLACK); + defaultTexture = LoadTextureFromImage(img); + UnloadImage(img); +} + +TextureAtlas NewTextureAtlas() { + TextureAtlas atlas; + atlas.push_back(defaultTexture); + + return atlas; +} + +Texture GetTexture(ID id, TextureAtlas atlas) { + if (atlas.size() >= id) { + return atlas[0]; + } + return atlas[id]; +}