diff --git a/src/img/playersprite.png b/src/img/playersprite.png new file mode 100644 index 0000000..2393c70 Binary files /dev/null and b/src/img/playersprite.png differ diff --git a/src/render/textures.cpp b/src/render/textures.cpp index cff1139..879c4f9 100644 --- a/src/render/textures.cpp +++ b/src/render/textures.cpp @@ -1,11 +1,31 @@ #include "../../include/raylib-cpp.hpp" +#include #include using namespace std; -typedef vector TextureAtlas; typedef int ID; +struct TextureAtlas { + vector atlas; + + Texture GetTexture(ID id) { + if (atlas.size() >= id) { + return atlas[0]; + } + return atlas[id]; + } + + bool LoadImage(const char *path) { + atlas.push_back(LoadTexture(path)); + } + + bool AddTexture(Texture texture){ + atlas.push_back(texture); + } + +}; + Texture defaultTexture; void GenDefaultTexture(){ @@ -16,14 +36,8 @@ void GenDefaultTexture(){ TextureAtlas NewTextureAtlas() { TextureAtlas atlas; - atlas.push_back(defaultTexture); - + atlas.AddTexture(defaultTexture); return atlas; } -Texture GetTexture(ID id, TextureAtlas atlas) { - if (atlas.size() >= id) { - return atlas[0]; - } - return atlas[id]; -} +