aboutsummaryrefslogtreecommitdiff
path: root/backends/common/user-action.h
blob: 31b547370839fdc159cacc7abc94e0019df97001 (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
60
61
62
63
64
65
66
67
68
69
70
#ifndef COMMON_USERACTION
#define COMMON_USERACTION

#include "common/events.h"
#include "common/list.h"
#include "common/str.h"

namespace Common {

struct HardwareKey;

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;

	/** Hardware key that is mapped to this UserAction */
	HardwareKey *hwKey;

	UserAction(	String des = "", 
		UserActionCategory cat = kGenericUserActionCategory,
		UserActionType ty = kGenericUserActionType,
		int pr = 0, int gr = 0, int fl = 0 ) {
			description = des;
			category = cat;
			type = ty;
			priority = pr;
			group = gr;
			flags = fl;
			hwKey = 0;
	}
};

} // end of namespace Common

#endif