diff options
Diffstat (limited to 'main.cpp')
-rw-r--r-- | main.cpp | 38 |
1 files changed, 26 insertions, 12 deletions
@@ -122,6 +122,7 @@ unsigned int deltaTime = 0; GLuint fragShader; GLuint shaderProgram; GLuint colorIndex; +GLuint mouseTex; Mix_Chunk *crickets; @@ -301,7 +302,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 @@ -397,6 +398,7 @@ int main(/*int argc, char *argv[]*/){ */ invUI = Texture::loadTexture("assets/invUI.png" ); + mouseTex = Texture::loadTexture("assets/mouse.png"); initInventorySprites(); @@ -459,8 +461,7 @@ void mainLoop(void){ currentTime = millis(); deltaTime = currentTime - prevTime; - if(currentMenu != NULL) - goto MENU; + if(currentMenu)goto MENU; /* * Run the logic handler if MSEC_PER_TICK milliseconds have passed. @@ -600,11 +601,9 @@ void render(){ currentWorld->draw(player); - /* * Calculate the player's hand angle. */ - handAngle = atan((ui::mouse.y - (player->loc.y + player->height/2)) / (ui::mouse.x - player->loc.x + player->width/2))*180/PI; if(ui::mouse.x < player->loc.x){ if(handAngle <= 0) @@ -625,6 +624,11 @@ void render(){ player->inv->draw(); /* +<<<<<<< HEAD + * Here we draw a black overlay if it's been requested. + */ + + /* * Here we draw a black overlay if it's been requested. */ @@ -686,7 +690,7 @@ void render(){ } - if(currentMenu != NULL){ + if(currentMenu){ ui::drawMenu(currentMenu); } @@ -694,13 +698,16 @@ void render(){ * Draw a white triangle as a replacement for the mouse's cursor. */ - glColor3ub(255,200,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); + glColor3ub(255,255,255); + 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 **** @@ -755,12 +762,19 @@ void logic(){ * 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++) |