From: drumsetmonkey Date: Wed, 3 Feb 2016 13:43:55 +0000 (-0500) Subject: Mouse X-Git-Url: https://code.bitgloo.com/?a=commitdiff_plain;h=00c312051599729074ff3584a0528c1883e1ff42;p=clyne%2Fgamedev.git Mouse --- 00c312051599729074ff3584a0528c1883e1ff42 diff --cc include/config.h index b63ae06,5e29abf..4d56d9c --- a/include/config.h +++ b/include/config.h @@@ -5,10 -5,8 +5,10 @@@ #include #include - void readConfig(); + void readConfig(void); - void updateConfig(); + void updateConfig(void); -#endif //CONFIG_H +void saveConfig(); + +#endif //CONFIG_H diff --cc main.cpp index 9d7f3e0,45d4fdd..5fcd65e --- a/main.cpp +++ 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/ ++ ui::setFontFace("ttf/VCR_OSD_MONO_1.001.ttf"); // as in gamedev/ttf/ /* * Initialize the random number generator. At the moment, initRand is a macro pointing to libc's @@@ -405,6 -405,6 +406,7 @@@ */ 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 df15e05,0ed39fd..87d0f98 --- a/src/config.cpp +++ b/src/config.cpp @@@ -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"); @@@ -29,15 -28,9 +28,15 @@@ } -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); - } + } diff --cc src/ui.cpp index 56ce651,91fa279..8e6d8e3 --- a/src/ui.cpp +++ b/src/ui.cpp @@@ -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); @@@ -870,6 -869,6 +872,7 @@@ } } } ++ setFontSize(16); } void dialogAdvance(void){ unsigned char i;