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

control messaging system, keyboard and gamepad inputs

This commit is contained in:
tmj-fstate
2017-04-07 00:36:07 +02:00
parent 886f0dad0f
commit e6f488ed6f
20 changed files with 2237 additions and 151 deletions

61
keyboardinput.h Normal file
View File

@@ -0,0 +1,61 @@
/*
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 "command.h"
class keyboard_input {
public:
// constructors
keyboard_input() { default_bindings(); }
// methods
void
recall_bindings();
bool
key( int const Key, int const Action );
void
mouse( double const Mousex, double const Mousey );
private:
// types
enum keymodifier : int {
shift = 0x10000,
control = 0x20000
};
struct command_setup {
std::string name;
command_target target;
int binding;
};
typedef std::vector<command_setup> commandsetup_sequence;
typedef std::unordered_map<int, user_command> usercommand_map;
// methods
void
default_bindings();
void
bind();
// members
commandsetup_sequence m_commands;
usercommand_map m_bindings;
command_relay m_relay;
bool m_shift{ false };
bool m_ctrl{ false };
};
//---------------------------------------------------------------------------