diff options
Diffstat (limited to 'include/entities.h')
-rw-r--r-- | include/entities.h | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/include/entities.h b/include/entities.h index d434546..51032ef 100644 --- a/include/entities.h +++ b/include/entities.h @@ -57,6 +57,8 @@ public: float velx; float vely; Color color; + vec2 index; + //GLuint tex; float duration; bool canMove; bool fountain; @@ -76,13 +78,26 @@ public: fountain = false; gravity = true; behind = false; + index = Texture::getIndex(c); + //tex = text; } ~Particles(){ } void draw(){ - glColor3f(color.red,color.green,color.blue); - glRectf(loc.x,loc.y,loc.x+width,loc.y+height); + //glColor3f(color.red,color.green,color.blue); + glActiveTexture(GL_TEXTURE0); + glBindTexture(GL_TEXTURE_2D, colorIndex); + glEnable(GL_TEXTURE_2D); + glColor3ub(255,255,255); + glBegin(GL_QUADS); + glTexCoord2f(.25*index.x, .125*(index.y + 1)); glVertex2i(loc.x, loc.y); + glTexCoord2f(.25*(index.x+1), .125*(index.y + 1)); glVertex2i(loc.x + width, loc.y); + glTexCoord2f(.25*(index.x+1), .125*index.y); glVertex2i(loc.x + width, loc.y + height); + glTexCoord2f(.25*index.x, .125*index.y); glVertex2i(loc.x, loc.y + width); + glEnd(); + glDisable(GL_TEXTURE_2D); + //glRectf(loc.x,loc.y,loc.x+width,loc.y+height); } bool kill(float delta){ duration -= delta; @@ -93,6 +108,8 @@ public: } }; +void initEntity(); + class Entity{ public: Inventory *inv; |