1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

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
This commit is contained in:
Loïc Blot 2017-08-15 20:30:30 +02:00 committed by GitHub
parent 64c7a689ad
commit 9dd0f952e0
9 changed files with 104 additions and 113 deletions

View file

@ -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; }