InputEvent.js 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  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. 'timestamp': { enumerable: true, configurable: true, get: InputEvent.prototype.__get_timestamp, set: InputEvent.prototype.__set_timestamp},
  11. 'text': { enumerable: true, configurable: true, get: InputEvent.prototype.__get_text, set: InputEvent.prototype.__set_text},
  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_timestamp = function() {
  44. return Polycode.InputEvent__get_timestamp(this.__ptr)
  45. }
  46. InputEvent.prototype.__set_timestamp = function(val) {
  47. Polycode.InputEvent__set_timestamp(this.__ptr, val)
  48. }
  49. InputEvent.prototype.__get_text = function() {
  50. return Polycode.InputEvent__get_text(this.__ptr)
  51. }
  52. InputEvent.prototype.__set_text = function(val) {
  53. Polycode.InputEvent__set_text(this.__ptr, val)
  54. }
  55. InputEvent.prototype.__get_touch = function() {
  56. var retVal = new TouchInfo()
  57. retVal.__ptr = Polycode.InputEvent__get_touch(this.__ptr)
  58. return retVal
  59. }
  60. InputEvent.prototype.__set_touch = function(val) {
  61. Polycode.InputEvent__set_touch(this.__ptr, val.__ptr)
  62. }
  63. InputEvent.prototype.__get_touchType = function() {
  64. return Polycode.InputEvent__get_touchType(this.__ptr)
  65. }
  66. InputEvent.prototype.__set_touchType = function(val) {
  67. Polycode.InputEvent__set_touchType(this.__ptr, val)
  68. }
  69. InputEvent.prototype.__get_joystickDeviceID = function() {
  70. return Polycode.InputEvent__get_joystickDeviceID(this.__ptr)
  71. }
  72. InputEvent.prototype.__set_joystickDeviceID = function(val) {
  73. Polycode.InputEvent__set_joystickDeviceID(this.__ptr, val)
  74. }
  75. InputEvent.prototype.__get_joystickAxisValue = function() {
  76. return Polycode.InputEvent__get_joystickAxisValue(this.__ptr)
  77. }
  78. InputEvent.prototype.__set_joystickAxisValue = function(val) {
  79. Polycode.InputEvent__set_joystickAxisValue(this.__ptr, val)
  80. }
  81. InputEvent.prototype.__get_joystickButton = function() {
  82. return Polycode.InputEvent__get_joystickButton(this.__ptr)
  83. }
  84. InputEvent.prototype.__set_joystickButton = function(val) {
  85. Polycode.InputEvent__set_joystickButton(this.__ptr, val)
  86. }
  87. InputEvent.prototype.__get_joystickAxis = function() {
  88. return Polycode.InputEvent__get_joystickAxis(this.__ptr)
  89. }
  90. InputEvent.prototype.__set_joystickAxis = function(val) {
  91. Polycode.InputEvent__set_joystickAxis(this.__ptr, val)
  92. }
  93. InputEvent.prototype.__get_joystickIndex = function() {
  94. return Polycode.InputEvent__get_joystickIndex(this.__ptr)
  95. }
  96. InputEvent.prototype.__set_joystickIndex = function(val) {
  97. Polycode.InputEvent__set_joystickIndex(this.__ptr, val)
  98. }
  99. InputEvent.prototype.__get_hitDistance = function() {
  100. return Polycode.InputEvent__get_hitDistance(this.__ptr)
  101. }
  102. InputEvent.prototype.__set_hitDistance = function(val) {
  103. Polycode.InputEvent__set_hitDistance(this.__ptr, val)
  104. }
  105. Duktape.fin(InputEvent.prototype, function (x) {
  106. if (x === InputEvent.prototype) {
  107. return;
  108. }
  109. Polycode.InputEvent__delete(x.__ptr)
  110. })
  111. InputEvent.prototype.getMousePosition = function() {
  112. var retVal = new Vector2()
  113. retVal.__ptr = Polycode.InputEvent_getMousePosition(this.__ptr)
  114. return retVal
  115. }
  116. InputEvent.prototype.getKey = function() {
  117. return Polycode.InputEvent_getKey(this.__ptr)
  118. }
  119. InputEvent.prototype.getMouseButton = function() {
  120. return Polycode.InputEvent_getMouseButton(this.__ptr)
  121. }
  122. InputEvent.prototype.keyCode = function() {
  123. return Polycode.InputEvent_keyCode(this.__ptr)
  124. }