InputEvent.js 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. require('Polycode/Event')
  2. function InputEvent() {
  3. if(arguments[0] != "__skip_ptr__") {
  4. this.__ptr = Polycode.InputEvent()
  5. }
  6. Object.defineProperties(this, {
  7. 'mouseButton': { enumerable: true, configurable: true, get: InputEvent.prototype.__get_mouseButton, set: InputEvent.prototype.__set_mouseButton},
  8. 'mousePosition': { enumerable: true, configurable: true, get: InputEvent.prototype.__get_mousePosition, set: InputEvent.prototype.__set_mousePosition},
  9. 'key': { enumerable: true, configurable: true, get: InputEvent.prototype.__get_key, set: InputEvent.prototype.__set_key},
  10. 'charCode': { enumerable: true, configurable: true, get: InputEvent.prototype.__get_charCode, set: InputEvent.prototype.__set_charCode},
  11. 'timestamp': { enumerable: true, configurable: true, get: InputEvent.prototype.__get_timestamp, set: InputEvent.prototype.__set_timestamp},
  12. 'touch': { enumerable: true, configurable: true, get: InputEvent.prototype.__get_touch, set: InputEvent.prototype.__set_touch},
  13. 'touchType': { enumerable: true, configurable: true, get: InputEvent.prototype.__get_touchType, set: InputEvent.prototype.__set_touchType},
  14. 'joystickDeviceID': { enumerable: true, configurable: true, get: InputEvent.prototype.__get_joystickDeviceID, set: InputEvent.prototype.__set_joystickDeviceID},
  15. 'joystickAxisValue': { enumerable: true, configurable: true, get: InputEvent.prototype.__get_joystickAxisValue, set: InputEvent.prototype.__set_joystickAxisValue},
  16. 'joystickButton': { enumerable: true, configurable: true, get: InputEvent.prototype.__get_joystickButton, set: InputEvent.prototype.__set_joystickButton},
  17. 'joystickAxis': { enumerable: true, configurable: true, get: InputEvent.prototype.__get_joystickAxis, set: InputEvent.prototype.__set_joystickAxis},
  18. 'joystickIndex': { enumerable: true, configurable: true, get: InputEvent.prototype.__get_joystickIndex, set: InputEvent.prototype.__set_joystickIndex},
  19. 'hitDistance': { enumerable: true, configurable: true, get: InputEvent.prototype.__get_hitDistance, set: InputEvent.prototype.__set_hitDistance}
  20. })
  21. }
  22. InputEvent.prototype = Object.create(Event.prototype);
  23. InputEvent.prototype.__get_mouseButton = function() {
  24. return Polycode.InputEvent__get_mouseButton(this.__ptr)
  25. }
  26. InputEvent.prototype.__set_mouseButton = function(val) {
  27. Polycode.InputEvent__set_mouseButton(this.__ptr, val)
  28. }
  29. InputEvent.prototype.__get_mousePosition = function() {
  30. var retVal = new Vector2()
  31. retVal.__ptr = Polycode.InputEvent__get_mousePosition(this.__ptr)
  32. return retVal
  33. }
  34. InputEvent.prototype.__set_mousePosition = function(val) {
  35. Polycode.InputEvent__set_mousePosition(this.__ptr, val.__ptr)
  36. }
  37. InputEvent.prototype.__get_key = function() {
  38. return Polycode.InputEvent__get_key(this.__ptr)
  39. }
  40. InputEvent.prototype.__set_key = function(val) {
  41. Polycode.InputEvent__set_key(this.__ptr, val)
  42. }
  43. InputEvent.prototype.__get_charCode = function() {
  44. var retVal = new wchar_t()
  45. retVal.__ptr = Polycode.InputEvent__get_charCode(this.__ptr)
  46. return retVal
  47. }
  48. InputEvent.prototype.__set_charCode = function(val) {
  49. Polycode.InputEvent__set_charCode(this.__ptr, val.__ptr)
  50. }
  51. InputEvent.prototype.__get_timestamp = function() {
  52. return Polycode.InputEvent__get_timestamp(this.__ptr)
  53. }
  54. InputEvent.prototype.__set_timestamp = function(val) {
  55. Polycode.InputEvent__set_timestamp(this.__ptr, val)
  56. }
  57. InputEvent.prototype.__get_touch = function() {
  58. var retVal = new TouchInfo()
  59. retVal.__ptr = Polycode.InputEvent__get_touch(this.__ptr)
  60. return retVal
  61. }
  62. InputEvent.prototype.__set_touch = function(val) {
  63. Polycode.InputEvent__set_touch(this.__ptr, val.__ptr)
  64. }
  65. InputEvent.prototype.__get_touchType = function() {
  66. return Polycode.InputEvent__get_touchType(this.__ptr)
  67. }
  68. InputEvent.prototype.__set_touchType = function(val) {
  69. Polycode.InputEvent__set_touchType(this.__ptr, val)
  70. }
  71. InputEvent.prototype.__get_joystickDeviceID = function() {
  72. return Polycode.InputEvent__get_joystickDeviceID(this.__ptr)
  73. }
  74. InputEvent.prototype.__set_joystickDeviceID = function(val) {
  75. Polycode.InputEvent__set_joystickDeviceID(this.__ptr, val)
  76. }
  77. InputEvent.prototype.__get_joystickAxisValue = function() {
  78. return Polycode.InputEvent__get_joystickAxisValue(this.__ptr)
  79. }
  80. InputEvent.prototype.__set_joystickAxisValue = function(val) {
  81. Polycode.InputEvent__set_joystickAxisValue(this.__ptr, val)
  82. }
  83. InputEvent.prototype.__get_joystickButton = function() {
  84. return Polycode.InputEvent__get_joystickButton(this.__ptr)
  85. }
  86. InputEvent.prototype.__set_joystickButton = function(val) {
  87. Polycode.InputEvent__set_joystickButton(this.__ptr, val)
  88. }
  89. InputEvent.prototype.__get_joystickAxis = function() {
  90. return Polycode.InputEvent__get_joystickAxis(this.__ptr)
  91. }
  92. InputEvent.prototype.__set_joystickAxis = function(val) {
  93. Polycode.InputEvent__set_joystickAxis(this.__ptr, val)
  94. }
  95. InputEvent.prototype.__get_joystickIndex = function() {
  96. return Polycode.InputEvent__get_joystickIndex(this.__ptr)
  97. }
  98. InputEvent.prototype.__set_joystickIndex = function(val) {
  99. Polycode.InputEvent__set_joystickIndex(this.__ptr, val)
  100. }
  101. InputEvent.prototype.__get_hitDistance = function() {
  102. return Polycode.InputEvent__get_hitDistance(this.__ptr)
  103. }
  104. InputEvent.prototype.__set_hitDistance = function(val) {
  105. Polycode.InputEvent__set_hitDistance(this.__ptr, val)
  106. }
  107. Duktape.fin(InputEvent.prototype, function (x) {
  108. if (x === InputEvent.prototype) {
  109. return;
  110. }
  111. Polycode.InputEvent__delete(x.__ptr)
  112. })
  113. InputEvent.prototype.getMousePosition = function() {
  114. var retVal = new Vector2()
  115. retVal.__ptr = Polycode.InputEvent_getMousePosition(this.__ptr)
  116. return retVal
  117. }
  118. InputEvent.prototype.getKey = function() {
  119. return Polycode.InputEvent_getKey(this.__ptr)
  120. }
  121. InputEvent.prototype.getMouseButton = function() {
  122. return Polycode.InputEvent_getMouseButton(this.__ptr)
  123. }
  124. InputEvent.prototype.getCharCode = function() {
  125. var retVal = new wchar_t()
  126. retVal.__ptr = Polycode.InputEvent_getCharCode(this.__ptr)
  127. return retVal
  128. }
  129. InputEvent.prototype.keyCode = function() {
  130. return Polycode.InputEvent_keyCode(this.__ptr)
  131. }