SHARE
TWEET
Untitled
a guest
Feb 23rd, 2013
36
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
- #include "Buttons/PressedButtonScheduler.h"
- #include "Buttons/Button.h"
- #include "Commands/Command.h"
- ToggledPressedButtonScheduler;
- ToggledPressedButtonScheduler::ToggledPressedButtonScheduler(bool last, Trigger *button, Command *firstCommand, Command *secondCommand) :
- ButtonScheduler(last, button, firstCommand)
- {
- this->m_otherCommand = secondCommand;
- this->m_firstOrSecond = false;
- }
- void ToggledPressedButtonScheduler::Execute()
- {
- if (m_button->Grab())
- {
- if (!m_pressedLast)
- {
- m_pressedLast = true;
- if (m_firstOrSecond)
- m_otherCommand->Start();
- else
- m_command->Start();
- m_firstOrSecond = !m_firstOrSecond;
- }
- }
- else
- {
- m_pressedLast = false;
- }
- }
RAW Paste Data
