SHARE
TWEET

Untitled

a guest Feb 23rd, 2013 36 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include "Buttons/PressedButtonScheduler.h"
  2.  
  3. #include "Buttons/Button.h"
  4. #include "Commands/Command.h"
  5. ToggledPressedButtonScheduler;
  6. ToggledPressedButtonScheduler::ToggledPressedButtonScheduler(bool last, Trigger *button, Command *firstCommand, Command *secondCommand) :
  7.         ButtonScheduler(last, button, firstCommand)
  8. {
  9.         this->m_otherCommand = secondCommand;
  10.         this->m_firstOrSecond = false;
  11. }
  12.  
  13. void ToggledPressedButtonScheduler::Execute()
  14. {
  15.         if (m_button->Grab())
  16.         {
  17.                 if (!m_pressedLast)
  18.                 {
  19.                         m_pressedLast = true;
  20.  
  21.                         if (m_firstOrSecond)
  22.                                 m_otherCommand->Start();
  23.                         else
  24.                                 m_command->Start();
  25.  
  26.                         m_firstOrSecond = !m_firstOrSecond;
  27.                 }
  28.         }
  29.         else
  30.         {
  31.                 m_pressedLast = false;
  32.         }
  33. }
RAW Paste Data
Top