platformInput_ScriptBinding.h 3.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. //-----------------------------------------------------------------------------
  2. // Copyright (c) 2013 GarageGames, LLC
  3. //
  4. // Permission is hereby granted, free of charge, to any person obtaining a copy
  5. // of this software and associated documentation files (the "Software"), to
  6. // deal in the Software without restriction, including without limitation the
  7. // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
  8. // sell copies of the Software, and to permit persons to whom the Software is
  9. // furnished to do so, subject to the following conditions:
  10. //
  11. // The above copyright notice and this permission notice shall be included in
  12. // all copies or substantial portions of the Software.
  13. //
  14. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18. // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  19. // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
  20. // IN THE SOFTWARE.
  21. //-----------------------------------------------------------------------------
  22. #include "console/console.h"
  23. #include "platform/platformInput.h"
  24. //------------------------------------------------------------------------------
  25. ConsoleFunction( activateKeyboard, bool, 1, 1, "() Use the activateKeyboard function to enable directInput polling of the keyboard.\n"
  26. "@return Returns a true if polling was successfully enabled.\n"
  27. "@sa deactivateKeyboard")
  28. {
  29. return Input::activateKeyboard();
  30. }
  31. //------------------------------------------------------------------------------
  32. ConsoleFunction( deactivateKeyboard, void, 1, 1, "() Use the deactivateKeyboard function to disable directInput polling of the keyboard.\n"
  33. "@return No return value.\n"
  34. "@sa activateKeyboard")
  35. {
  36. Input::deactivateKeyboard();
  37. }
  38. //------------------------------------------------------------------------------
  39. ConsoleFunction( enableMouse, void, 1, 1, "() Use the enableMouse function to enable mouse input.\n"
  40. "@return No return value.\n"
  41. "@sa disableMouse")
  42. {
  43. Input::enableMouse();
  44. }
  45. //------------------------------------------------------------------------------
  46. ConsoleFunction( disableMouse, void, 1, 1, "() Use the disableMouse function to disable mouse input.\n"
  47. "@return No return value.\n"
  48. "@sa enableMouse")
  49. {
  50. Input::disableMouse();
  51. }
  52. //------------------------------------------------------------------------------
  53. ConsoleFunction( enableJoystick, bool, 1, 1, "() Use the enableJoystick function to enable joystick input if it is present.\n"
  54. "@return Will return true if the joystick is present and was successfully enabled, false otherwise.\n"
  55. "@sa disableJoystick, getJoystickAxes, isJoystickDetected")
  56. {
  57. return Input::enableJoystick();
  58. }
  59. //------------------------------------------------------------------------------
  60. ConsoleFunction( disableJoystick, void, 1, 1, "() Use the disableJoystick function to disable joystick input.\n"
  61. "@return No return value.\n"
  62. "@sa enableJoystick, getJoystickAxes, isJoystickEnabled")
  63. {
  64. Input::disableJoystick();
  65. }
  66. //------------------------------------------------------------------------------
  67. ConsoleFunction( echoInputState, void, 1, 1, "() Use the echoInputState function to dump the input state of the mouse, keyboard, and joystick to the console.\n"
  68. "@return No return value.\n"
  69. "@sa activateDirectInput, deactivateDirectInput, activateKeyboard, deactivateKeyboard, disableJoystick, enableJoystick, enableMouse, disableMouse")
  70. {
  71. Input::echoInputState();
  72. }