This commit is contained in:
2026-11-08 07:45:01 -05:00
commit 36e093f84c
1109 changed files with 254529 additions and 0 deletions
+33
View File
@@ -0,0 +1,33 @@
#ifndef TEXTURE_CLASS_H
#define TEXTURE_CLASS_H
#include <string>
#include <vector>
#include <glad/glad.h>
// A loaded image and nothing else. Game elements wear one through a SurfaceTexture,
// get these from the ResourceManager.
class Texture {
public:
GLuint ID;
std::string path;
int width = 0;
int height = 0;
std::vector<unsigned char> pixels; // RGBA, row 0 is the bottom of the image
Texture(const char* filename);
Texture(const unsigned char* encoded, int size, const std::string& name); // a png, jpg or the like already in memory
Texture(int newWidth, int newHeight); // blank white
Texture(const Texture& source); // an independent copy with its own GL texture
// Sends pixels to the GPU after they've been edited
void Upload();
void Delete();
private:
void CreateGLTexture();
};
#endif