aboutsummaryrefslogtreecommitdiff
path: root/src/client/inputhandler.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/inputhandler.h')
-rw-r--r--src/client/inputhandler.h48
1 files changed, 19 insertions, 29 deletions
diff --git a/src/client/inputhandler.h b/src/client/inputhandler.h
index 7c422d189..19733e3ec 100644
--- a/src/client/inputhandler.h
+++ b/src/client/inputhandler.h
@@ -141,24 +141,23 @@ public:
MyEventReceiver()
{
- clearInput();
#ifdef HAVE_TOUCHSCREENGUI
m_touchscreengui = NULL;
#endif
}
- bool leftclicked;
- bool rightclicked;
- bool leftreleased;
- bool rightreleased;
+ bool leftclicked = false;
+ bool rightclicked = false;
+ bool leftreleased = false;
+ bool rightreleased = false;
- bool left_active;
- bool middle_active;
- bool right_active;
+ bool left_active = false;
+ bool middle_active = false;
+ bool right_active = false;
- s32 mouse_wheel;
+ s32 mouse_wheel = 0;
- JoystickController *joystick;
+ JoystickController *joystick = nullptr;
#ifdef HAVE_TOUCHSCREENGUI
TouchScreenGUI *m_touchscreengui;
@@ -221,7 +220,7 @@ class RealInputHandler : public InputHandler
{
public:
RealInputHandler(IrrlichtDevice *device, MyEventReceiver *receiver)
- : m_device(device), m_receiver(receiver), m_mousepos(0, 0)
+ : m_device(device), m_receiver(receiver)
{
m_receiver->joystick = &joystick;
}
@@ -277,24 +276,15 @@ public:
}
private:
- IrrlichtDevice *m_device;
- MyEventReceiver *m_receiver;
+ IrrlichtDevice *m_device = nullptr;
+ MyEventReceiver *m_receiver = nullptr;
v2s32 m_mousepos;
};
class RandomInputHandler : public InputHandler
{
public:
- RandomInputHandler()
- {
- leftdown = false;
- rightdown = false;
- leftclicked = false;
- rightclicked = false;
- leftreleased = false;
- rightreleased = false;
- keydown.clear();
- }
+ RandomInputHandler() {}
virtual bool isKeyDown(const KeyPress &keyCode) { return keydown[keyCode]; }
virtual bool wasKeyDown(const KeyPress &keyCode) { return false; }
virtual v2s32 getMousePos() { return mousepos; }
@@ -390,12 +380,12 @@ private:
KeyList keydown;
v2s32 mousepos;
v2s32 mousespeed;
- bool leftdown;
- bool rightdown;
- bool leftclicked;
- bool rightclicked;
- bool leftreleased;
- bool rightreleased;
+ bool leftdown = false;
+ bool rightdown = false;
+ bool leftclicked = false;
+ bool rightclicked = false;
+ bool leftreleased = false;
+ bool rightreleased = false;
};
#endif