-
Notifications
You must be signed in to change notification settings - Fork 0
/
HRP4EventHandler.cpp
49 lines (46 loc) · 1.27 KB
/
HRP4EventHandler.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#include "HRP4EventHandler.hpp"
//==============================================================================
NaoEventHandler::NaoEventHandler(
NaoWorldNode* node)
: mNode(node)
{
// Do nothing
}
//==============================================================================
bool NaoEventHandler::handle(
const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter&)
{
if(ea.getEventType() == osgGA::GUIEventAdapter::KEYDOWN)
{
if(ea.getKey() == 'r' || ea.getKey() == 'R')
{
mNode->reset();
return true;
}
else if(ea.getKey() == 'a' || ea.getKey() == 'A')
{
mNode->pushForwardAtlas();
return true;
}
else if(ea.getKey() == 's' || ea.getKey() == 'S')
{
mNode->pushBackwardAtlas();
return true;
}
else if(ea.getKey() == 'd' || ea.getKey() == 'D')
{
mNode->pushLeftAtlas();
return true;
}
else if(ea.getKey() == 'f' || ea.getKey() == 'F')
{
mNode->pushRightAtlas();
return true;
}
}
// The return value should be 'true' if the input has been fully handled
// and should not be visible to any remaining event handlers. It should be
// false if the input has not been fully handled and should be viewed by
// any remaining event handlers.
return false;
}