Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
blob: 344e1fa1763f6b094b100f80abbbb2db08f51aab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/*
   client/key.h
   This file is part of the Osirion project and is distributed under
   the terms and conditions of the GNU General Public License version 2
*/

#ifndef __INCLUDED_CLIENT_KEY_H__
#define __INCLUDED_CLIENT_KEY_H__

#include <string>

namespace client {

class Key
{
public:
	/// define a new key
	Key(const char *name, unsigned int keysym, char ascii=0, const char *bind=0);
	~Key();
	
	/// key modifiers
	enum Modifier { None=0, Shift=1, Ctrl=2, Alt=3 };

	/// clear all binds
	void clear();

	/// set the bind for a specific modifier
	void assign(Modifier mod, const char *bind);

	/// clear the bind for a specific modifier
	void clear(Modifier mod);

	/// return the bind for a specific modifier
	std::string const & bind(Modifier mod) const;

	inline float & pressed() { return key_pressed; }

	inline std::string const & name() const { return key_name; }

	inline char ascii() const { return key_ascii; }

	inline unsigned int sym() const { return key_sym; }

private:
	std::string		key_name;
	unsigned int		key_sym;
	char			key_ascii;

	float			key_pressed;

	std::string		key_bind;
	std::string		key_bind_shift;
	std::string		key_bind_ctrl;
	std::string		key_bind_alt;
};

} // namespace client

#endif // __INCLUDED_CLIENT_KEY_H__