| 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
 | #ifndef COMMON_USERACTION
#define COMMON_USERACTION
#include "common/events.h"
#include "common/list.h"
#include "common/str.h"
namespace Common {
struct HardwareKey;
class Keymap;
enum UserActionType {
	kGenericUserActionType,
	// common actions
	kDirectionUpUserAction,
	kDirectionDownUserAction,
	kDirectionLeftUserAction,
	kDirectionRightUserAction,
	kLeftClickUserAction,
	kRightClickUserAction,
	kSaveUserAction,
	kMenuUserAction,
	kUserActionTypeMax
};
enum UserActionCategory {
	kGenericUserActionCategory,
	// classes of action - probably need to be slightly more specific than this
	kInGameUserAction,   // effects the actual gameplay
	kSystemUserAction,   //show a menu / change volume / etc
	kUserActionCategoryMax
};
struct UserAction {
	/** unique id used for saving/loading to config */
	int32 id;
	/** Human readable description */
	String description;
	/** Events to be sent when mapped key is pressed */
	List<Event> events;
	UserActionCategory category;
	UserActionType type;
	int priority;
	int group;
	int flags;
private:
	/** Hardware key that is mapped to this UserAction */
	const HardwareKey *_hwKey;
	Keymap *_parent;
public:
	UserAction(	String des = "", 
		UserActionCategory cat = kGenericUserActionCategory,
		UserActionType ty = kGenericUserActionType,
		int pr = 0, int gr = 0, int fl = 0 );
	void setParent(Keymap *parent);
	void mapKey(const HardwareKey *key);
	const HardwareKey *getMappedKey() const;
};
} // end of namespace Common
#endif
 |