summaryrefslogtreecommitdiff
path: root/src/client/inputhandler.h
diff options
context:
space:
mode:
authorVincent Glize <vincentglize@hotmail.fr>2017-06-21 08:04:45 +0200
committerLoïc Blot <nerzhul@users.noreply.github.com>2017-06-21 08:04:45 +0200
commitaf3badf7a9307acd4993764cd805718849e4f942 (patch)
tree0e096b45eebc2e20ae8a5be3faaedc9234217934 /src/client/inputhandler.h
parent76074ad81abe68aa2b7af4d072b659f60f1af38c (diff)
downloadminetest-af3badf7a9307acd4993764cd805718849e4f942.tar.gz
minetest-af3badf7a9307acd4993764cd805718849e4f942.tar.bz2
minetest-af3badf7a9307acd4993764cd805718849e4f942.zip
C++11 cleanup on constructors dir client (#6012)
* C++11 cleanup on constructors dir client
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