StarTrekV3_Linux  Version3
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Friends Macros Pages
KeyMapper.h
Go to the documentation of this file.
1 //
2 // ___.--------._____________,------' -----.`----._
3 // \ ` - . _ /\
4 // `.__________ ` - | | __,---"-._
5 // `-----------.______ ,'_/ ________,------'___________`----.___________
6 // `-----.____,' \===========================================/
7 // | :| >--------------.----------.---------------'
8 // / :| _,--' ,--' `--.__.--'
9 // / : |--'______________/_
10 // ,---,' : \__________________`--.
11 // `__________ |/|
12 // `------._ |\|
13 // `--._________,-'
14 //
15 //
16 //
17 // Credits go to Paramount pictures for the star - trek concept and universe.
18 
19 
20 // Copyright (C) 2015 - 2016 E.J.M. Martens
21 //
22 // This program is free software; you can redistribute it and/or
23 // modify it under the terms of the GNU General Public License
24 // as published by the Free Software Foundation; either version 2
25 // of the License, or (at your option) any later version.
26 //
27 // This program is distributed in the hope that it will be useful,
28 // but WITHOUT ANY WARRANTY; without even the implied warranty of
29 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30 // GNU General Public License for more details.
31 //
32 // You should have received a copy of the GNU General Public License
33 // along with this program; if not, write to the Free Software
34 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
35 
36 #ifndef _KEYMAPPER
37 #define _KEYMAPPER
38 
39 #include <allegro5/allegro.h>
40 #include <allegro5/allegro_font.h>
41 #include <allegro5/allegro_ttf.h>
42 #include <string>
43 #include <iostream>
44 #include <fstream>
45 
46 using namespace std;
47 
48 #define NUMBER_OF_KEYS 14
49 
50 enum KEYS{
51  UP = 0,
78  };
79 
80 
82 {
83  private:
84  int m_KeyMap[KEY_MAX];
85  int m_nMapping;
86  ALLEGRO_COLOR m_ColorMapped;
87  ALLEGRO_COLOR m_ColorMapping;
88  ALLEGRO_FONT * m_pFont;
89 
90  protected:
91 
92 
93  public:
94  TKeyMapper(ALLEGRO_COLOR a_ColorMapped, ALLEGRO_COLOR a_ColorMapping,ALLEGRO_FONT * a_pFont);
95  void SetDefaultMapping();
96  bool MapKey(int a_nKey);
97  void DrawMapping();
98  bool IsKey(int a_nKeyNr,KEYS a_MappedKey);
99  void Save(ofstream & a_SaveStream);
100  void Load(ifstream & a_LoadStream);
101 
102 };
103 
104 
105 
106 
107 #endif
Definition: KeyMapper.h:74
Definition: KeyMapper.h:57
Definition: KeyMapper.h:59
Definition: KeyMapper.h:81
Definition: KeyMapper.h:56
Definition: KeyMapper.h:63
Definition: KeyMapper.h:77
Definition: KeyMapper.h:70
Definition: KeyMapper.h:65
KEYS
Definition: KeyMapper.h:50
Definition: KeyMapper.h:61
Definition: KeyMapper.h:67
Definition: KeyMapper.h:58
Definition: KeyMapper.h:62
Definition: KeyMapper.h:55
Definition: KeyMapper.h:64
Definition: KeyMapper.h:75
Definition: KeyMapper.h:68
Definition: KeyMapper.h:73
Definition: KeyMapper.h:51
Definition: KeyMapper.h:54
Definition: KeyMapper.h:71
Definition: KeyMapper.h:53
Definition: KeyMapper.h:60
Definition: KeyMapper.h:72
Definition: KeyMapper.h:76
Definition: KeyMapper.h:69
Definition: KeyMapper.h:66
Definition: KeyMapper.h:52