16
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-07-21 18:19:19 +02:00

refactored mouse input processor, tweaks to mouse input support, fix for diesel engine compressor, added progress bar label

This commit is contained in:
tmj-fstate
2017-07-10 19:36:23 +02:00
parent 9a008ecff5
commit 16718d53bb
15 changed files with 520 additions and 343 deletions

60
mouseinput.h Normal file
View File

@@ -0,0 +1,60 @@
/*
This Source Code Form is subject to the
terms of the Mozilla Public License, v.
2.0. If a copy of the MPL was not
distributed with this file, You can
obtain one at
http://mozilla.org/MPL/2.0/.
*/
#pragma once
#include <unordered_map>
#include <array>
#include "command.h"
class mouse_input {
public:
// constructors
mouse_input() { default_bindings(); }
// methods
bool
init() { return true; }
void
move( double const Mousex, double const Mousey );
void
button( int const Button, int const Action );
void
poll();
private:
// types
struct mouse_commands {
user_command left;
user_command right;
mouse_commands( user_command const Left, user_command const Right ):
left(Left), right(Right)
{}
};
typedef std::unordered_map<std::string, mouse_commands> controlcommands_map;
// methods
void
default_bindings();
// members
controlcommands_map m_mousecommands;
user_command m_mousecommandleft { user_command::none }; // last if any command issued with left mouse button
user_command m_mousecommandright { user_command::none }; // last if any command issued with right mouse button
command_relay m_relay;
double m_updateaccumulator { 0.0 };
bool m_pickmodepanning { false }; // indicates mouse is in view panning mode
glm::dvec2 m_cursorposition; // stored last mouse position, used for panning
};
//---------------------------------------------------------------------------