15 const static float scale = 4.0f;
19 Sprite::Sprite(
int tile,
int x,
int y,
int width,
int height) : texture(tile) {
23 int width2 = (int)(width *
scale);
24 int height2 = (int)(height * scale);
26 std::vector<glm::vec2> uv;
31 uv.emplace_back(uv.at(0));
32 uv.emplace_back(uv.at(2));
34 std::vector<glm::vec3> vert;
35 vert.emplace_back(
float(-width2) / 2.0f, 0.0f, 0.0f);
36 vert.emplace_back(
float(-width2) / 2.0f,
float(-height2), 0.0f);
37 vert.emplace_back(
float(width2) / 2.0f,
float(-height2), 0.0f);
38 vert.emplace_back(
float(width2) / 2.0f, 0.0f, 0.0f);
39 vert.emplace_back(vert.at(0));
40 vert.emplace_back(vert.at(2));
45 uv2D = glm::vec4(uv.at(0), uv.at(2));
void bufferData(int elem, int size, void *data)
static const int texelOffset
Sprite(int tile, int x, int y, int width, int height)
static void drawGL(ShaderBuffer &vertices, ShaderBuffer &uvs, glm::vec4 color, unsigned int texture, TextureStorage store=TextureStorage::SYSTEM, unsigned int mode=GL_TRIANGLES, ShaderTexture *target=nullptr, Shader &shader=textShader)
void display(glm::mat4 MVP)
Sprite & getSprite(unsigned long index)
#define assertGreaterThanEqual(x, y)
static const float texelScale
#define assertLessThan(x, y)
void display(glm::mat4 MVP, int index)