File size: 1,589 Bytes
24b81cb |
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 |
#ifdef GAME_TEMPLATE
enum InputTrigger
{
UP, ///< call listener when button/key is released
DOWN, ///< call listener when button/key is pressed
PRESSED, ///< call listener in each tick when button/key is pressed
VALUE ///< call listener in each tick with current value
};
class ActionManager
{
void ActionManager(ActionManager parent);
proto native external bool RegisterAction(string actionName);
proto native external bool RegisterContext(string contextName);
proto native external float LocalValue(string actionName);
proto native external bool GetActionTriggered(string actionName);
proto native external bool ActivateAction(string actionName, int duration = 0);
proto native external bool IsActionActive(string actionName);
proto native external bool ActivateContext(string contextName, int duration = 0);
proto native external bool IsContextActive(string contextName);
proto external void AddActionListener(string actionName, InputTrigger trigger, func callback);
proto native external void SetContextDebug(string contextName, bool bDebug);
proto native void SetParent(ActionManager parent);
proto native void SetDebug(bool bDebug);
};
class InputManager: ActionManager
{
private void InputManager(ActionManager parent) {};
private void ~InputManager() {};
proto native external void ResetAction(string actionName);
proto native void SetCursorPosition(int x, int y);
proto native external bool RegisterActionManager(ActionManager pManager);
proto native external bool UnregisterActionManager(ActionManager pManager);
};
#endif
|