VEndymionV

Untitled

Sep 3rd, 2018
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. void Scene::renderHPBar() {
  2.  
  3. // koniec gry, brak zdrowia
  4. if (Player::HP <= Player::minHP) {
  5. //gameOver = true;
  6. }
  7.  
  8. glMatrixMode(GL_PROJECTION);
  9. glPushMatrix();
  10. glLoadIdentity();
  11. gluOrtho2D(0, 100, 0, 100);
  12. glDisable(GL_LIGHTING);
  13. glDisable(GL_CULL_FACE);
  14.  
  15. glBegin(GL_QUADS);
  16. glColor3f(1, 0, 0);
  17. glVertex2f(2, 97);
  18. glVertex2f(2, 95);
  19. glVertex2f(2 + 30 * (Player::HP / Player::maxHP), 95);
  20. glVertex2f(2 + 30 * (Player::HP / Player::maxHP), 97);
  21.  
  22. glColor3f(0, 0, 0);
  23. glVertex2f(2 + 30 * (Player::HP / Player::maxHP), 97);
  24. glVertex2f(2 + 30 * (Player::HP / Player::maxHP), 95);
  25. glVertex2f(32, 95);
  26. glVertex2f(32, 97);
  27. /*
  28. glColor3f(0, 0.3, 0);
  29. glVertex2f(1, 98);
  30. glVertex2f(1, 94);
  31. glVertex2f(33, 94);
  32. glVertex2f(33, 98);
  33. */
  34. glEnd();
  35.  
  36. glEnable(GL_LIGHTING);
  37. glEnable(GL_CULL_FACE);
  38. glPopMatrix();
  39. glMatrixMode(GL_MODELVIEW);
  40. }
Advertisement
Add Comment
Please, Sign In to add comment