-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathInput.h
More file actions
95 lines (65 loc) · 2.15 KB
/
Input.h
File metadata and controls
95 lines (65 loc) · 2.15 KB
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
/*
* Input.h
* Prototyp
*
* Created by Christian Pehle on 24.08.09.
* Copyright 2009 Universität Heidelberg. All rights reserved.
*
*/
#ifndef InputManager_H
#define InputManager_H
#include <OIS/OISInputManager.h>
#include <OIS/OISMouse.h>
#include <OIS/OISKeyboard.h>
#include <Ogre/OgreRenderWindow.h>
namespace Orbifold {
class InputHandler :
public OIS::MouseListener,
public OIS::KeyListener
{
public:
void static initialise(Ogre::RenderWindow *window);
void static shutdown();
static InputHandler* getSingleton();
void capture();
void updateWindowDimensions(int height, int width);
//Mouse
void addMouseListener(OIS::MouseListener *mouseListener, const std::string& instanceName);
void removeMouseListener(const std::string& instanceName);
void removeMouseListener(OIS::MouseListener *mouseListener);
void removeAllMouseListeners();
//Keyboard
void addKeyListener(OIS::KeyListener *keyListener, const std::string& instanceName);
void removeKeyListener(const std::string& instanceName);
void removeKeyListener(OIS::KeyListener *keyListener);
void removeAllKeyListeners();
//
void removeAllListeners();
//Callbacks
bool mouseMoved(const OIS::MouseEvent &evt);
bool mousePressed(const OIS::MouseEvent &evt, OIS::MouseButtonID);
bool mouseReleased(const OIS::MouseEvent &evt, OIS::MouseButtonID);
bool keyPressed(const OIS::KeyEvent &evt);
bool keyReleased(const OIS::KeyEvent &evt);
//
OIS::Mouse* getMouse();
OIS::Keyboard* getKeyboard();
protected:
static InputHandler* instance;
OIS::InputManager *inputsystem;
OIS::Mouse *mouse;
OIS::Keyboard *keyboard;
void initMouse(Ogre::RenderWindow* window);
void initKeyboard();
std::map<std::string, OIS::KeyListener*> keyListeners;
std::map<std::string, OIS::MouseListener*> mouseListeners;
std::map<std::string, OIS::KeyListener*>::iterator itKeyListener;
std::map<std::string, OIS::MouseListener*>::iterator itMouseListener;
std::map<std::string, OIS::KeyListener*>::iterator itKeyListenerEnd;
std::map<std::string, OIS::MouseListener*>::iterator itMouseListenerEnd;
private:
InputHandler();
~InputHandler();
};
}
#endif