You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

GUI.cpp 1.2KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. #include "GUI.hpp"
  2. extern "C"
  3. {
  4. #include <math.h>
  5. }
  6. void Script_GUI::Start()
  7. {
  8. vie = 3;
  9. score = 0;
  10. level = 1;
  11. vulnerability = 0;
  12. }
  13. void Script_GUI::UpdateEverySecond()
  14. {
  15. if(vulnerability > 0)vulnerability --;
  16. else vulnerability = 0;
  17. }
  18. void Script_GUI::Update()
  19. {
  20. const unsigned char svie[]={0x6d, 0x93, 0x83, 0x45, 0x29, 0x11, };
  21. ML_rectangle(105,0,127,63,1,ML_WHITE,ML_WHITE);
  22. ML_line(104,0,104,63,ML_BLACK);
  23. PrintMini(107,7,"Score",0);
  24. PrintV(107,15,score);
  25. if(vie > 0)ML_bmp_or(svie,105,30,7,6);
  26. if(vie > 1)ML_bmp_or(svie,113,30,7,6);
  27. if(vie > 2)ML_bmp_or_cl(svie,121,30,7,6);
  28. PrintMini(107,47,"Level",0);
  29. PrintV(115,55,level);
  30. }
  31. void Script_GUI::DelVie(int v)
  32. {
  33. if(v < 0)return;
  34. vie -= v;
  35. if(vie <= 0)
  36. {
  37. ML_clear_vram();
  38. PrintXY(25,28,"You Lose",0);
  39. ML_display_vram();
  40. Sleep(1500);
  41. GetEngine()->StopGame();
  42. }
  43. }
  44. void Script_GUI::AddScore(int v)
  45. {
  46. if(v > 0)score += v;
  47. }
  48. void Script_GUI::SetVulnerability(int v)
  49. {
  50. if( v > 0)vulnerability = v;
  51. }
  52. int Script_GUI::GetVulnerability()
  53. {
  54. return vulnerability;
  55. }