]> code.bitgloo.com Git - clyne/gamedev.git/commitdiff
merge
authorClyne Sullivan <tullivan99@gmail.com>
Mon, 5 Oct 2015 11:31:54 +0000 (07:31 -0400)
committerClyne Sullivan <tullivan99@gmail.com>
Mon, 5 Oct 2015 11:31:54 +0000 (07:31 -0400)
1  2 
include/entities.h
src/entities.cpp

Simple merge
index 43c7bf3597cf0e7df927300da6a4b4b55a121e6e,64c8cb7de7194c6d897e0e1171eca02eed93ac31..bd0cc6706d86d24064ce69804aa0b282d5254d78
@@@ -21,19 -21,51 +21,50 @@@ void Entity::spawn(float x, float y){      /
  }
  
  void Entity::draw(void){              //draws the entities
+       glMatrixMode(GL_TEXTURE);
+       glLoadIdentity();
+       glEnable(GL_TEXTURE_2D);
+       glBindTexture(GL_TEXTURE_2D,texture);
+       glBegin(GL_QUADS);
        if(type==NPCT){
-               if(NPCp(this)->aiFunc.size()){
-                       glColor3ub(255,255,0);
-                       glRectf(loc.x,loc.y+height+HLINE,loc.x+width,loc.y+height+HLINE*5);
-               }
-               if(gender == MALE)
-                       glColor3ub(0,0,100);
-               else if(gender == FEMALE)
+               if(gender == MALE){
+                       glColor3ub(255,255,255);
+                       glTexCoord2i(0,1);glVertex2i(loc.x, loc.y);
+                       glTexCoord2i(1,1);glVertex2i(loc.x + width, loc.y);
+                       glTexCoord2i(1,0);glVertex2i(loc.x + width, loc.y + height);
+                       glTexCoord2i(0,0);glVertex2i(loc.x, loc.y + height);
 -              }
 -              else if(gender == FEMALE){
++              }else if(gender == FEMALE){
                        glColor3ub(255,105,180);
-       }else if(type==STRUCTURET){
-               glColor3ub(100,0,100);
+                       glTexCoord2i(0,1);glVertex2i(loc.x, loc.y);
+                       glTexCoord2i(1,1);glVertex2i(loc.x + width, loc.y);
+                       glTexCoord2i(1,0);glVertex2i(loc.x + width, loc.y + height);
+                       glTexCoord2i(0,0);glVertex2i(loc.x, loc.y + height);
+               }
+       }
+       if(type==PLAYERT){
+               if(right==true){
+                       glTexCoord2i(0,1);glVertex2i(loc.x, loc.y);
+                       glTexCoord2i(1,1);glVertex2i(loc.x + width, loc.y);
+                       glTexCoord2i(1,0);glVertex2i(loc.x + width, loc.y + height);
+                       glTexCoord2i(0,0);glVertex2i(loc.x, loc.y + height);
+               }if(left==true){
+                       glRotatef(180.0f, 0.0f, 0.0f, 1.0f);
+                       glScalef(-1.0f,1.0f,1.0f);
+                       glTexCoord2i(0,1);glVertex2i(loc.x, loc.y);
+                       glTexCoord2i(1,1);glVertex2i(loc.x + width, loc.y);
+                       glTexCoord2i(1,0);glVertex2i(loc.x + width, loc.y + height);
+                       glTexCoord2i(0,-0);glVertex2i(loc.x, loc.y + height);
+               }
+       }else{
+               glTexCoord2i(0,1);glVertex2i(loc.x, loc.y);
+               glTexCoord2i(1,1);glVertex2i(loc.x + width, loc.y);
+               glTexCoord2i(1,0);glVertex2i(loc.x + width, loc.y + height);
+               glTexCoord2i(0,0);glVertex2i(loc.x, loc.y + height);
        }
-       glRectf(loc.x,loc.y,loc.x+width,loc.y+height);
+       glEnd();
+       glDisable(GL_TEXTURE_2D);
+       glMatrixMode(GL_MODELVIEW);
        if(near){
                ui::setFontSize(14);
                ui::putText(loc.x,loc.y-ui::fontSize-HLINE/2,"%s",name);