aboutsummaryrefslogtreecommitdiff
path: root/src/client/inputhandler.h
diff options
context:
space:
mode:
authorLoïc Blot <nerzhul@users.noreply.github.com>2017-08-15 20:30:30 +0200
committerGitHub <noreply@github.com>2017-08-15 20:30:30 +0200
commit9dd0f952e09471f15f59a98c1ae650d99499cd77 (patch)
treeef600d29b8b753353657ac6740d47208dd0e5d09 /src/client/inputhandler.h
parent64c7a689ad8a596f6b72afe200d9ced20cdd9630 (diff)
downloaddragonfireclient-9dd0f952e09471f15f59a98c1ae650d99499cd77.tar.xz
Modernize client code (#6250)
* Various code style fixes * Use range based for loops * Use empty instead of empty objects * Use C++11 default keyword for trivial constructors and destructors * Drop some useless casts * Use emplace_back instead of push_back to improve performance of some vectors push
Diffstat (limited to 'src/client/inputhandler.h')
-rw-r--r--src/client/inputhandler.h13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/client/inputhandler.h b/src/client/inputhandler.h
index 822e27863..bc8251887 100644
--- a/src/client/inputhandler.h
+++ b/src/client/inputhandler.h
@@ -180,8 +180,9 @@ private:
class InputHandler
{
public:
- InputHandler() {}
- virtual ~InputHandler() {}
+ InputHandler() = default;
+
+ virtual ~InputHandler() = default;
virtual bool isKeyDown(const KeyPress &keyCode) = 0;
virtual bool wasKeyDown(const KeyPress &keyCode) = 0;
@@ -243,9 +244,10 @@ public:
return RenderingEngine::get_raw_device()
->getCursorControl()
->getPosition();
- } else {
- return m_mousepos;
}
+
+ return m_mousepos;
+
}
virtual void setMousePos(s32 x, s32 y)
{
@@ -287,7 +289,8 @@ private:
class RandomInputHandler : public InputHandler
{
public:
- RandomInputHandler() {}
+ RandomInputHandler() = default;
+
virtual bool isKeyDown(const KeyPress &keyCode) { return keydown[keyCode]; }
virtual bool wasKeyDown(const KeyPress &keyCode) { return false; }
virtual v2s32 getMousePos() { return mousepos; }