inputmanager.c 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #ifdef GAME_TEMPLATE
  2. enum InputTrigger
  3. {
  4. UP, ///< call listener when button/key is released
  5. DOWN, ///< call listener when button/key is pressed
  6. PRESSED, ///< call listener in each tick when button/key is pressed
  7. VALUE ///< call listener in each tick with current value
  8. };
  9. class ActionManager
  10. {
  11. void ActionManager(ActionManager parent);
  12. proto native external bool RegisterAction(string actionName);
  13. proto native external bool RegisterContext(string contextName);
  14. proto native external float LocalValue(string actionName);
  15. proto native external bool GetActionTriggered(string actionName);
  16. proto native external bool ActivateAction(string actionName, int duration = 0);
  17. proto native external bool IsActionActive(string actionName);
  18. proto native external bool ActivateContext(string contextName, int duration = 0);
  19. proto native external bool IsContextActive(string contextName);
  20. proto external void AddActionListener(string actionName, InputTrigger trigger, func callback);
  21. proto native external void SetContextDebug(string contextName, bool bDebug);
  22. proto native void SetParent(ActionManager parent);
  23. proto native void SetDebug(bool bDebug);
  24. };
  25. class InputManager: ActionManager
  26. {
  27. private void InputManager(ActionManager parent) {};
  28. private void ~InputManager() {};
  29. proto native external void ResetAction(string actionName);
  30. proto native void SetCursorPosition(int x, int y);
  31. proto native external bool RegisterActionManager(ActionManager pManager);
  32. proto native external bool UnregisterActionManager(ActionManager pManager);
  33. };
  34. #endif