]> code.bitgloo.com Git - clyne/gamedev.git/commitdiff
Mouse
authordrumsetmonkey <abelleisle@roadrunner.com>
Wed, 3 Feb 2016 13:43:55 +0000 (08:43 -0500)
committerdrumsetmonkey <abelleisle@roadrunner.com>
Wed, 3 Feb 2016 13:43:55 +0000 (08:43 -0500)
1  2 
include/config.h
main.cpp
src/config.cpp
src/entities.cpp
src/gameplay.cpp
src/ui.cpp

index b63ae06f59d7a81d2ef4844b55aff3a7e6a19215,5e29abf4f7c783f9a260818842122b8cd54ef145..4d56d9c5b8e341c458974266d8d0f8b2d6428513
@@@ -5,10 -5,8 +5,10 @@@
  #include <SDL2/SDL_mixer.h>
  #include <tinyxml2.h>
  
- void readConfig();
+ void readConfig(void);
  
- void updateConfig();
+ void updateConfig(void);
  
 -#endif //CONFIG_H
 +void saveConfig();
 +
 +#endif //CONFIG_H
diff --cc main.cpp
index 9d7f3e085f3c8a64e4162a8e563a71e217c4550f,45d4fdd565e2194685cd23681f16259b0efa3a4e..5fcd65e1d1bedb623a65f2b86a01ea4b835a8473
+++ b/main.cpp
@@@ -123,6 -123,6 +123,7 @@@ unsigned int deltaTime = 0
  GLuint fragShader;
  GLuint shaderProgram;
  GLuint colorIndex;
++GLuint mouseTex;
  
  Mix_Chunk *crickets;
  
@@@ -306,7 -306,7 +307,7 @@@ int main(/*int argc, char *argv[]*/)
        */
        
        ui::initFonts();
--      ui::setFontFace("ttf/Perfect DOS VGA 437.ttf");         // as in gamedev/ttf/<font>
++      ui::setFontFace("ttf/VCR_OSD_MONO_1.001.ttf");          // as in gamedev/ttf/<font>
        
        /*
         *      Initialize the random number generator. At the moment, initRand is a macro pointing to libc's
        */
  
        invUI = Texture::loadTexture("assets/invUI.png" );
++      mouseTex = Texture::loadTexture("assets/mouse.png");
        
        initInventorySprites();
        
@@@ -692,12 -759,12 +693,15 @@@ void render()
        */
  
        glColor3ub(255,255,255);
--
--      glBegin(GL_TRIANGLES);
--              glVertex2i(ui::mouse.x                  ,ui::mouse.y              );
--              glVertex2i(ui::mouse.x+HLINE*3.5,ui::mouse.y              );
--              glVertex2i(ui::mouse.x                  ,ui::mouse.y-HLINE*3.5);
++      glEnable(GL_TEXTURE_2D);
++      glBindTexture(GL_TEXTURE_2D, mouseTex);
++      glBegin(GL_QUADS);
++              glTexCoord2f(0,0);glVertex2i(ui::mouse.x                        ,ui::mouse.y                    );
++              glTexCoord2f(1,0);glVertex2i(ui::mouse.x+HLINE*5        ,ui::mouse.y                    );
++              glTexCoord2f(1,1);glVertex2i(ui::mouse.x+HLINE*5        ,ui::mouse.y-HLINE*5    );
++              glTexCoord2f(0,1);glVertex2i(ui::mouse.x                        ,ui::mouse.y-HLINE*5    );
        glEnd();
++      glDisable(GL_TEXTURE_2D);
        
        /**************************
        ****  END RENDERING   ****
@@@ -754,13 -823,14 +760,21 @@@ void logic()
                         *      Make the NPC 'wander' about the world if they're allowed to do so.
                         *      Entity->canMove is modified when a player interacts with an NPC so
                         *      that the NPC doesn't move when it talks to the player.
-                        *
-                       */
+                        */
  
++/*<<<<<<< HEAD
 +                      if(n->canMove) n->wander((rand() % 120 + 30));
 +
 +                      if(!player->inv->usingi) n->hit = false;
 +                      if(player->inv->usingi && !n->hit && player->inv->detectCollision(vec2{n->loc.x, n->loc.y},vec2{n->loc.x+n->width,n->loc.y+n->height})){
++=======*/
+                       if(n->canMove)
+                               n->wander((rand() % 120 + 30));
+                       
+                       /*if(!player->inv->usingi) n->hit = false;
+                       
+                       if(player->inv->usingi && !n->hit && player->inv->detectCollision((vec2){n->loc.x, n->loc.y},(vec2){n->loc.x+n->width,n->loc.y+n->height})){
++>>>>>>> 7ab072caaaec09720ad79cfed5738e89bc60c44f
                                n->health -= 25;
                                n->hit = true;
                                for(int r = 0; r < (rand()%5);r++)
diff --cc src/config.cpp
index df15e058cdea699ed22906ea7237f21d90c10836,0ed39fd1d0444d9c4a73e01e518a390551737004..87d0f98ce85a427366739361f6172eeb49c21941
@@@ -11,11 -11,10 +11,10 @@@ extern float                VOLUME_MASTER
  extern float           VOLUME_MUSIC;
  
  XMLDocument xml;
 +XMLElement *scr;
 +XMLElement *vol;
  
 -void readConfig(void){
 -      XMLElement *scr;
 -      XMLElement *vol;
 +void readConfig(){
        xml.LoadFile("config/settings.xml");
        scr = xml.FirstChildElement("screen");
        SCREEN_WIDTH  = scr->UnsignedAttribute("width");
  
  }
  
 -void updateConfig(void){
 -      XMLElement *vol = xml.FirstChildElement("volume")->FirstChildElement("master")->ToElement();
 -      vol->SetAttribute("volume",VOLUME_MASTER);
 -      
 +void updateConfig(){
 +      vol->FirstChildElement("master")->SetAttribute("volume",VOLUME_MASTER);
 +      vol->FirstChildElement("music")->SetAttribute("volume",VOLUME_MUSIC);
-       
++
 +      Mix_Volume(0,VOLUME_MASTER);
 +      Mix_VolumeMusic(VOLUME_MUSIC);
 +
 +}
 +
 +void saveConfig(){
        xml.SaveFile("config/settings.xml", false);
- }
+ }
Simple merge
Simple merge
diff --cc src/ui.cpp
index 56ce6516e87a08249476348f81b397e31cdc9620,91fa279ea4bdf3985c90fd53b785483589692309..8e6d8e30f27a5897195c483a70a603ee6625fdc5
@@@ -724,6 -723,6 +724,8 @@@ namespace ui 
        */
  
        void drawMenu(Menu *menu){
++
++              setFontSize(20);
                SDL_Event e;
                        
                mouse.x=premouse.x+offset.x-(SCREEN_WIDTH/2);
                                }
                        }
                }
++              setFontSize(16);
        }
        void dialogAdvance(void){
                unsigned char i;