summaryrefslogtreecommitdiff
path: root/src/client/inputhandler.h
diff options
context:
space:
mode:
authorest31 <MTest31@outlook.com>2016-05-27 08:35:07 +0200
committerest31 <MTest31@outlook.com>2016-06-03 19:42:57 +0200
commit2060fd9cbe587d7e8ffe0cecdd67925f13a56c05 (patch)
treef9f74c0a6609b0063fec6ed6f3d43fe42e43d5f1 /src/client/inputhandler.h
parent1e86c89f3614cf298916149a8f13d44ea671da64 (diff)
downloadminetest-2060fd9cbe587d7e8ffe0cecdd67925f13a56c05.tar.gz
minetest-2060fd9cbe587d7e8ffe0cecdd67925f13a56c05.tar.bz2
minetest-2060fd9cbe587d7e8ffe0cecdd67925f13a56c05.zip
Initial Gamepad support
Adds initial ingame gamepad support to minetest. Full Formspec support is not implemented yet and can be added by a later change.
Diffstat (limited to 'src/client/inputhandler.h')
-rw-r--r--src/client/inputhandler.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/client/inputhandler.h b/src/client/inputhandler.h
index 73e507fdc..824b0da2e 100644
--- a/src/client/inputhandler.h
+++ b/src/client/inputhandler.h
@@ -21,6 +21,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#define INPUT_HANDLER_H
#include "irrlichttypes_extrabloated.h"
+#include "joystick_controller.h"
class MyEventReceiver : public IEventReceiver
{
@@ -62,6 +63,14 @@ public:
return true;
}
#endif
+
+ if (event.EventType == irr::EET_JOYSTICK_INPUT_EVENT) {
+ /* TODO add a check like:
+ if (event.JoystickEvent != joystick_we_listen_for)
+ return false;
+ */
+ return joystick->handleEvent(event.JoystickEvent);
+ }
// handle mouse events
if (event.EventType == irr::EET_MOUSE_INPUT_EVENT) {
if (noMenuActive() == false) {
@@ -172,6 +181,8 @@ public:
s32 mouse_wheel;
+ JoystickController *joystick;
+
#ifdef HAVE_TOUCHSCREENGUI
TouchScreenGUI* m_touchscreengui;
#endif
@@ -202,6 +213,7 @@ public:
m_receiver(receiver),
m_mousepos(0,0)
{
+ m_receiver->joystick = &joystick;
}
virtual bool isKeyDown(const KeyPress &keyCode)
{
@@ -288,6 +300,7 @@ public:
void clear()
{
+ joystick.clear();
m_receiver->clearInput();
}
private: