platformInput_ScriptBinding.h 3.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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. /*! Use the activateKeyboard function to enable directInput polling of the keyboard.
  26. @return Returns a true if polling was successfully enabled.
  27. @sa deactivateKeyboard
  28. */
  29. ConsoleFunctionWithDocs( activateKeyboard, ConsoleBool, 1, 1, ())
  30. {
  31. return Input::activateKeyboard();
  32. }
  33. //------------------------------------------------------------------------------
  34. /*! Use the deactivateKeyboard function to disable directInput polling of the keyboard.
  35. @return No return value.
  36. @sa activateKeyboard
  37. */
  38. ConsoleFunctionWithDocs( deactivateKeyboard, ConsoleVoid, 1, 1, ())
  39. {
  40. Input::deactivateKeyboard();
  41. }
  42. //------------------------------------------------------------------------------
  43. /*! Use the enableMouse function to enable mouse input.
  44. @return No return value.
  45. @sa disableMouse
  46. */
  47. ConsoleFunctionWithDocs( enableMouse, ConsoleVoid, 1, 1, ())
  48. {
  49. Input::enableMouse();
  50. }
  51. //------------------------------------------------------------------------------
  52. /*! Use the disableMouse function to disable mouse input.
  53. @return No return value.
  54. @sa enableMouse
  55. */
  56. ConsoleFunctionWithDocs( disableMouse, ConsoleVoid, 1, 1, ())
  57. {
  58. Input::disableMouse();
  59. }
  60. //------------------------------------------------------------------------------
  61. /*! Use the enableJoystick function to enable joystick input if it is present.
  62. @return Will return true if the joystick is present and was successfully enabled, false otherwise.
  63. @sa disableJoystick, getJoystickAxes, isJoystickDetected
  64. */
  65. ConsoleFunctionWithDocs( enableJoystick, ConsoleBool, 1, 1, ())
  66. {
  67. return Input::enableJoystick();
  68. }
  69. //------------------------------------------------------------------------------
  70. /*! Use the disableJoystick function to disable joystick input.
  71. @return No return value.
  72. @sa enableJoystick, getJoystickAxes, isJoystickEnabled
  73. */
  74. ConsoleFunctionWithDocs( disableJoystick, ConsoleVoid, 1, 1, ())
  75. {
  76. Input::disableJoystick();
  77. }
  78. //------------------------------------------------------------------------------
  79. /*! Use the echoInputState function to dump the input state of the mouse, keyboard, and joystick to the console.
  80. @return No return value.
  81. @sa activateDirectInput, deactivateDirectInput, activateKeyboard, deactivateKeyboard, disableJoystick, enableJoystick, enableMouse, disableMouse
  82. */
  83. ConsoleFunctionWithDocs( echoInputState, ConsoleVoid, 1, 1, ())
  84. {
  85. Input::echoInputState();
  86. }