]> code.bitgloo.com Git - clyne/gamedev.git/commitdiff
Converted all of the entities to the new texture library
authordrumsetmonkey <abelleisle@roadrunner.com>
Thu, 22 Oct 2015 15:52:29 +0000 (11:52 -0400)
committerdrumsetmonkey <abelleisle@roadrunner.com>
Thu, 22 Oct 2015 15:52:29 +0000 (11:52 -0400)
include/entities.h
main.cpp
src/entities.cpp

index e71789aa3f63d310ce8b8918758f184f9bb71599..43e744ece81dd2ece7556273dfaae458ff3b5b41 100644 (file)
@@ -58,7 +58,7 @@ public:
 
        char* name;
        GENDER gender;
-       GLuint texture[3];        //TODO: ADD TEXTURES
+       //GLuint texture[3];      //TODO: ADD TEXTURES
        Texturec* tex;
 
 
index 69cad2019ba19029eb22daf2187e95511ca47063..373dbea80d0d0f7387708893523ec27dbb4378ab 100644 (file)
--- a/main.cpp
+++ b/main.cpp
@@ -659,7 +659,7 @@ void logic(){
         *      click detection is done as well for NPC/player interaction.
         * 
        */
-        std::cout << "Game Loop: "<< loops << std::endl;
+        //std::cout << "Game Loop: "<< loops << std::endl;
        
        for(int i=0;i<=entity.size();i++){
                
index 7a4da65f3dfb62e888a6791e0d360fb8f9c6d9d7..6d2b58c8b29764c4a3258bdd848869372111c8ce 100644 (file)
@@ -49,10 +49,7 @@ NPC::NPC(){  //sets all of the NPC specific traits on object creation
        alive = true;
        canMove = true;
        near = false;
-       texture[0] = Texture::loadTexture("assets/NPC.png");
-       texture[1] = 0;
-       texture[2] = 0;
-       //tex = new Texturec("assets/NPC.png");
+       tex = new Texturec(1,"assets/NPC.png");
        inv = new Inventory(NPC_INV_SIZE);
 }
 
@@ -61,9 +58,7 @@ Structures::Structures(){ //sets the structure type
        speed = 0;
        alive = true;
        near = false;
-       texture[0] = Texture::loadTexture("assets/house1.png");
-       texture[1] = 0;
-       texture[2] = 0;
+       tex = new Texturec(1,"assets/house1.png");
 }
 
 Mob::Mob(){
@@ -75,9 +70,7 @@ Mob::Mob(){
        alive = true;
        canMove = true;
        near = false;
-       texture[0] = Texture::loadTexture("assets/rabbit.png");
-       texture[1] = Texture::loadTexture("assets/rabbit1.png");
-       texture[2] = 0;
+       tex = new Texturec(2, "assets/rabbit.png", "assets/rabbit.png1");
        inv = new Inventory(NPC_INV_SIZE);
 }
 
@@ -136,18 +129,16 @@ void Entity::draw(void){          //draws the entities
                switch(subtype){
                        case 1: //RABBIT
                                if(ground == 0){
-                                       glBindTexture(GL_TEXTURE_2D, texture[1]);
+                                       glBindTexture(GL_TEXTURE_2D, tex->image[1]);
                                }else if(ground == 1){
-                                       glBindTexture(GL_TEXTURE_2D, texture[0]);                                       
+                                       glBindTexture(GL_TEXTURE_2D, tex->image[0]);                                    
                                }
                                break;
                        default:
                        break;
                }
-       }/*else if(type == NPCT){
-               glBindTexture(GL_TEXTURE_2D, tex->image);
-       }*/else{
-               glBindTexture(GL_TEXTURE_2D,texture[0]);
+       }else{
+               glBindTexture(GL_TEXTURE_2D,tex->image[0]);
        }
        glColor3ub(255,255,255);
        glBegin(GL_QUADS);