OSDN Git Service

04fde2685d6f8d132e487f9315dbae061d28ed19
[moflib/moflib.git] / moflib-1.0 / moflib / moflib / mof / KeyPressedEventCondition.cpp
1 #include "mof/KeyPressedEventCondition.hpp"
2
3 mof::KeyPressedEventCondition::KeyPressedEventCondition
4 (
5         mof::InputReceiver::Key key, 
6         const std::shared_ptr<mof::InputReceiver> &pInputReceiver 
7 )
8 : m_key(key) , m_pInputReceiver(pInputReceiver) , m_currentState(false) 
9 {
10         update();
11 }
12
13 mof::KeyPressedEventCondition::~KeyPressedEventCondition(){
14 }
15
16 bool mof::KeyPressedEventCondition::test(){
17         return m_oldState == false &&  m_currentState == true ;
18 }
19
20 void mof::KeyPressedEventCondition::update(){
21         m_oldState = m_currentState;
22         m_currentState = m_pInputReceiver->testKeyState(m_key);
23 }
24
25 bool mof::KeyPressedEventCondition::isDisposable(){
26         return false;
27 }
28
29