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]; +}