Advertisement
Guest User

Untitled

a guest
Jun 23rd, 2017
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.79 KB | None | 0 0
  1. private:
  2. // -------------------------
  3. // Datamembers
  4. // -------------------------
  5.  
  6. TextBox *m_txtBzBTWPtr, *m_txtBTWPtr, *m_txtBmBTWPtr;
  7. Button *m_btnBerekenenPtr;
  8. double m_Getal1;
  9. double m_Getal2;
  10. String m_sTekst;
  11.  
  12. TextBox *m_txtRPtr;
  13. Button *m_btnTekenPtr, *m_btnVergrotenPtr, *m_btnVerkleinenPtr, *m_btnVulPtr, *m_btnRoPtr, *m_btnGrPtr, *m_btnGePtr;
  14. bool m_TekenCirkel;
  15. int m_Straal;
  16. int m_Xpos;
  17. int m_Ypos;
  18. int m_StraalInt;
  19. String m_sStraal;
  20.  
  21.  
  22. // StringOef methods
  23. //-----------------------------------------------------------------
  24.  
  25. StringOef::StringOef():m_txtBzBTWPtr(), m_txtBTWPtr(), m_txtBmBTWPtr(), m_btnBerekenenPtr(),
  26. m_Getal1(),m_Getal2(),m_sTekst(), m_txtRPtr(), m_btnTekenPtr(), m_btnVergrotenPtr(), m_btnVerkleinenPtr(), m_btnVulPtr(), m_btnRoPtr(), m_btnGrPtr(), m_btnGePtr(),
  27. m_TekenCirkel(false)
  28. {
  29.  
  30. }
  31.  
  32. StringOef::~StringOef()
  33. {
  34. // nothing to destroy
  35. }
  36.  
  37. void StringOef::GameInitialize(HINSTANCE hInstance)
  38. {
  39. AbstractGame::GameInitialize(hInstance);
  40. GAME_ENGINE->SetTitle("StringOef");
  41. //GAME_ENGINE->RunGameLoop(true);
  42.  
  43. // Stel de optionele waarden in
  44. GAME_ENGINE->SetWidth(800);
  45. GAME_ENGINE->SetHeight(600);
  46. GAME_ENGINE->SetFrameRate(50);
  47. }
  48.  
  49. void StringOef::GameStart()
  50. {
  51. m_btnBerekenenPtr = new Button("Berekenen");
  52. m_btnBerekenenPtr->SetBounds(185, 125, 150, 25);
  53. m_btnBerekenenPtr->AddActionListener(this);
  54. m_btnBerekenenPtr->Show();
  55.  
  56. m_txtBzBTWPtr = new TextBox();
  57. m_txtBzBTWPtr->SetBounds(185, 20, 150, 25);
  58. m_txtBzBTWPtr->AddActionListener(this);
  59. m_txtBzBTWPtr->Show();
  60.  
  61. m_txtBTWPtr = new TextBox();
  62. m_txtBTWPtr->SetBounds(185, 55, 150, 25);
  63. m_txtBTWPtr->AddActionListener(this);
  64. m_txtBTWPtr->Show();
  65. m_txtBTWPtr->SetEnabled(false);
  66.  
  67. m_txtBmBTWPtr = new TextBox();
  68. m_txtBmBTWPtr->SetBounds(185, 90, 150, 25);
  69. m_txtBmBTWPtr->AddActionListener(this);
  70. m_txtBmBTWPtr->Show();
  71. m_txtBmBTWPtr->SetEnabled(false);
  72.  
  73.  
  74.  
  75. m_txtRPtr = new TextBox();
  76. m_txtRPtr->SetBounds(0, 575, 100, 25);
  77. m_txtRPtr->AddActionListener(this);
  78. m_txtRPtr->Show();
  79.  
  80. m_btnTekenPtr = new Button("Tekenen");
  81. m_btnTekenPtr->SetBounds(100, 575, 100, 25);
  82. m_btnTekenPtr->AddActionListener(this);
  83. m_btnTekenPtr->Show();
  84.  
  85. m_btnVergrotenPtr = new Button("Vergroten");
  86. m_btnVergrotenPtr->SetBounds(200, 575, 100, 25);
  87. m_btnVergrotenPtr->AddActionListener(this);
  88. m_btnVergrotenPtr->Show();
  89.  
  90. m_btnVerkleinenPtr = new Button("Verkleinen");
  91. m_btnVerkleinenPtr->SetBounds(300, 575, 100, 25);
  92. m_btnVerkleinenPtr->AddActionListener(this);
  93. m_btnVerkleinenPtr->Show();
  94.  
  95. m_btnVulPtr = new Button("Vullen");
  96. m_btnVulPtr->SetBounds(400, 575, 100, 25);
  97. m_btnVulPtr->AddActionListener(this);
  98. m_btnVulPtr->Show();
  99.  
  100. m_btnRoPtr = new Button("Rood");
  101. m_btnRoPtr->SetBounds(500, 575, 100, 25);
  102. m_btnRoPtr->AddActionListener(this);
  103. m_btnRoPtr->Show();
  104.  
  105. m_btnGrPtr = new Button("Groen");
  106. m_btnGrPtr->SetBounds(600, 575, 100, 25);
  107. m_btnGrPtr->AddActionListener(this);
  108. m_btnGrPtr->Show();
  109.  
  110. m_btnGePtr = new Button("Geel");
  111. m_btnGePtr->SetBounds(700, 575, 100, 25);
  112. m_btnGePtr->AddActionListener(this);
  113. m_btnGePtr->Show();
  114. }
  115.  
  116. void StringOef::GameEnd()
  117. {
  118. delete m_btnBerekenenPtr;
  119. delete m_txtBzBTWPtr;
  120. delete m_txtBTWPtr;
  121. delete m_txtBmBTWPtr;
  122. delete m_txtRPtr,m_btnTekenPtr, m_btnVergrotenPtr, m_btnVerkleinenPtr, m_btnVulPtr, m_btnRoPtr, m_btnGrPtr, m_btnGePtr;
  123. }
  124.  
  125. void StringOef::GamePaint(RECT rect)
  126. {
  127. GAME_ENGINE->DrawString(String("Bedrag zonder BTW"), 20, 25, 170, 25);
  128. GAME_ENGINE->DrawString(String("BTW"), 20, 60, 170, 25);
  129. GAME_ENGINE->DrawString(String("Bedrag met BTW"), 20, 95, 170, 25);
  130.  
  131. if (m_TekenCirkel == true )
  132. {
  133. m_Xpos = 300;
  134. m_Ypos = 300;
  135.  
  136. GAME_ENGINE->SetColor(RGB (0, 0, 0));
  137. GAME_ENGINE->DrawOval(m_Xpos, m_Ypos, m_StraalInt, m_StraalInt);
  138.  
  139. }
  140.  
  141.  
  142.  
  143.  
  144.  
  145. }
  146. void StringOef::CallAction(Caller* callerPtr)
  147. {
  148.  
  149. if(callerPtr == m_btnBerekenenPtr || callerPtr == m_txtBzBTWPtr)
  150. {
  151. m_txtBTWPtr->SetText("21.0");
  152. m_sTekst = m_txtBzBTWPtr->GetText();
  153. m_Getal1 = m_sTekst.ToDouble();
  154. m_Getal2 = m_Getal1 * 1.21;
  155. m_txtBmBTWPtr->SetText(String("") + m_Getal2);
  156.  
  157. }
  158.  
  159. if(callerPtr == m_btnTekenPtr)
  160. {
  161. m_sStraal = m_txtRPtr->GetText();
  162. m_StraalInt = m_sStraal.ToInteger();
  163. m_StraalInt = m_StraalInt + m_StraalInt;
  164.  
  165. m_TekenCirkel = true;
  166. GAME_ENGINE->Repaint();
  167. }
  168. if(callerPtr == m_btnVergrotenPtr)
  169. {
  170. m_Straal = m_Straal + 10;
  171. m_Xpos = m_Xpos + 5;
  172. m_Ypos = m_Ypos + 5;
  173. GAME_ENGINE->Repaint();
  174. }
  175.  
  176. if(callerPtr == m_btnVerkleinenPtr)
  177. {
  178. m_Straal = m_Straal - 10;
  179. m_Xpos = m_Xpos -5;
  180. m_Ypos = m_Ypos -5;
  181. GAME_ENGINE->Repaint();
  182. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement