Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private:
- // -------------------------
- // Datamembers
- // -------------------------
- TextBox *m_txtBzBTWPtr, *m_txtBTWPtr, *m_txtBmBTWPtr;
- Button *m_btnBerekenenPtr;
- double m_Getal1;
- double m_Getal2;
- String m_sTekst;
- TextBox *m_txtRPtr;
- Button *m_btnTekenPtr, *m_btnVergrotenPtr, *m_btnVerkleinenPtr, *m_btnVulPtr, *m_btnRoPtr, *m_btnGrPtr, *m_btnGePtr;
- bool m_TekenCirkel;
- int m_Straal;
- int m_Xpos;
- int m_Ypos;
- int m_StraalInt;
- String m_sStraal;
- // StringOef methods
- //-----------------------------------------------------------------
- StringOef::StringOef():m_txtBzBTWPtr(), m_txtBTWPtr(), m_txtBmBTWPtr(), m_btnBerekenenPtr(),
- m_Getal1(),m_Getal2(),m_sTekst(), m_txtRPtr(), m_btnTekenPtr(), m_btnVergrotenPtr(), m_btnVerkleinenPtr(), m_btnVulPtr(), m_btnRoPtr(), m_btnGrPtr(), m_btnGePtr(),
- m_TekenCirkel(false)
- {
- }
- StringOef::~StringOef()
- {
- // nothing to destroy
- }
- void StringOef::GameInitialize(HINSTANCE hInstance)
- {
- AbstractGame::GameInitialize(hInstance);
- GAME_ENGINE->SetTitle("StringOef");
- //GAME_ENGINE->RunGameLoop(true);
- // Stel de optionele waarden in
- GAME_ENGINE->SetWidth(800);
- GAME_ENGINE->SetHeight(600);
- GAME_ENGINE->SetFrameRate(50);
- }
- void StringOef::GameStart()
- {
- m_btnBerekenenPtr = new Button("Berekenen");
- m_btnBerekenenPtr->SetBounds(185, 125, 150, 25);
- m_btnBerekenenPtr->AddActionListener(this);
- m_btnBerekenenPtr->Show();
- m_txtBzBTWPtr = new TextBox();
- m_txtBzBTWPtr->SetBounds(185, 20, 150, 25);
- m_txtBzBTWPtr->AddActionListener(this);
- m_txtBzBTWPtr->Show();
- m_txtBTWPtr = new TextBox();
- m_txtBTWPtr->SetBounds(185, 55, 150, 25);
- m_txtBTWPtr->AddActionListener(this);
- m_txtBTWPtr->Show();
- m_txtBTWPtr->SetEnabled(false);
- m_txtBmBTWPtr = new TextBox();
- m_txtBmBTWPtr->SetBounds(185, 90, 150, 25);
- m_txtBmBTWPtr->AddActionListener(this);
- m_txtBmBTWPtr->Show();
- m_txtBmBTWPtr->SetEnabled(false);
- m_txtRPtr = new TextBox();
- m_txtRPtr->SetBounds(0, 575, 100, 25);
- m_txtRPtr->AddActionListener(this);
- m_txtRPtr->Show();
- m_btnTekenPtr = new Button("Tekenen");
- m_btnTekenPtr->SetBounds(100, 575, 100, 25);
- m_btnTekenPtr->AddActionListener(this);
- m_btnTekenPtr->Show();
- m_btnVergrotenPtr = new Button("Vergroten");
- m_btnVergrotenPtr->SetBounds(200, 575, 100, 25);
- m_btnVergrotenPtr->AddActionListener(this);
- m_btnVergrotenPtr->Show();
- m_btnVerkleinenPtr = new Button("Verkleinen");
- m_btnVerkleinenPtr->SetBounds(300, 575, 100, 25);
- m_btnVerkleinenPtr->AddActionListener(this);
- m_btnVerkleinenPtr->Show();
- m_btnVulPtr = new Button("Vullen");
- m_btnVulPtr->SetBounds(400, 575, 100, 25);
- m_btnVulPtr->AddActionListener(this);
- m_btnVulPtr->Show();
- m_btnRoPtr = new Button("Rood");
- m_btnRoPtr->SetBounds(500, 575, 100, 25);
- m_btnRoPtr->AddActionListener(this);
- m_btnRoPtr->Show();
- m_btnGrPtr = new Button("Groen");
- m_btnGrPtr->SetBounds(600, 575, 100, 25);
- m_btnGrPtr->AddActionListener(this);
- m_btnGrPtr->Show();
- m_btnGePtr = new Button("Geel");
- m_btnGePtr->SetBounds(700, 575, 100, 25);
- m_btnGePtr->AddActionListener(this);
- m_btnGePtr->Show();
- }
- void StringOef::GameEnd()
- {
- delete m_btnBerekenenPtr;
- delete m_txtBzBTWPtr;
- delete m_txtBTWPtr;
- delete m_txtBmBTWPtr;
- delete m_txtRPtr,m_btnTekenPtr, m_btnVergrotenPtr, m_btnVerkleinenPtr, m_btnVulPtr, m_btnRoPtr, m_btnGrPtr, m_btnGePtr;
- }
- void StringOef::GamePaint(RECT rect)
- {
- GAME_ENGINE->DrawString(String("Bedrag zonder BTW"), 20, 25, 170, 25);
- GAME_ENGINE->DrawString(String("BTW"), 20, 60, 170, 25);
- GAME_ENGINE->DrawString(String("Bedrag met BTW"), 20, 95, 170, 25);
- if (m_TekenCirkel == true )
- {
- m_Xpos = 300;
- m_Ypos = 300;
- GAME_ENGINE->SetColor(RGB (0, 0, 0));
- GAME_ENGINE->DrawOval(m_Xpos, m_Ypos, m_StraalInt, m_StraalInt);
- }
- }
- void StringOef::CallAction(Caller* callerPtr)
- {
- if(callerPtr == m_btnBerekenenPtr || callerPtr == m_txtBzBTWPtr)
- {
- m_txtBTWPtr->SetText("21.0");
- m_sTekst = m_txtBzBTWPtr->GetText();
- m_Getal1 = m_sTekst.ToDouble();
- m_Getal2 = m_Getal1 * 1.21;
- m_txtBmBTWPtr->SetText(String("") + m_Getal2);
- }
- if(callerPtr == m_btnTekenPtr)
- {
- m_sStraal = m_txtRPtr->GetText();
- m_StraalInt = m_sStraal.ToInteger();
- m_StraalInt = m_StraalInt + m_StraalInt;
- m_TekenCirkel = true;
- GAME_ENGINE->Repaint();
- }
- if(callerPtr == m_btnVergrotenPtr)
- {
- m_Straal = m_Straal + 10;
- m_Xpos = m_Xpos + 5;
- m_Ypos = m_Ypos + 5;
- GAME_ENGINE->Repaint();
- }
- if(callerPtr == m_btnVerkleinenPtr)
- {
- m_Straal = m_Straal - 10;
- m_Xpos = m_Xpos -5;
- m_Ypos = m_Ypos -5;
- GAME_ENGINE->Repaint();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement