2
0

Core.js 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330
  1. function Core() {
  2. Object.defineProperties(this, {
  3. 'eventMutex': { enumerable: true, configurable: true, get: Core.prototype.__get_eventMutex, set: Core.prototype.__set_eventMutex},
  4. 'paused': { enumerable: true, configurable: true, get: Core.prototype.__get_paused, set: Core.prototype.__set_paused},
  5. 'pauseOnLoseFocus': { enumerable: true, configurable: true, get: Core.prototype.__get_pauseOnLoseFocus, set: Core.prototype.__set_pauseOnLoseFocus},
  6. 'defaultScreenWidth': { enumerable: true, configurable: true, get: Core.prototype.__get_defaultScreenWidth, set: Core.prototype.__set_defaultScreenWidth},
  7. 'defaultScreenHeight': { enumerable: true, configurable: true, get: Core.prototype.__get_defaultScreenHeight, set: Core.prototype.__set_defaultScreenHeight},
  8. 'deviceAttitude': { enumerable: true, configurable: true, get: Core.prototype.__get_deviceAttitude, set: Core.prototype.__set_deviceAttitude}
  9. })
  10. }
  11. Core.prototype.__get_eventMutex = function() {
  12. var retVal = new CoreMutex()
  13. retVal.__ptr = Polycode.Core__get_eventMutex(this.__ptr)
  14. return retVal
  15. }
  16. Core.prototype.__set_eventMutex = function(val) {
  17. Polycode.Core__set_eventMutex(this.__ptr, val.__ptr)
  18. }
  19. Core.prototype.__get_paused = function() {
  20. return Polycode.Core__get_paused(this.__ptr)
  21. }
  22. Core.prototype.__set_paused = function(val) {
  23. Polycode.Core__set_paused(this.__ptr, val)
  24. }
  25. Core.prototype.__get_pauseOnLoseFocus = function() {
  26. return Polycode.Core__get_pauseOnLoseFocus(this.__ptr)
  27. }
  28. Core.prototype.__set_pauseOnLoseFocus = function(val) {
  29. Polycode.Core__set_pauseOnLoseFocus(this.__ptr, val)
  30. }
  31. Core.prototype.__get_defaultScreenWidth = function() {
  32. return Polycode.Core__get_defaultScreenWidth(this.__ptr)
  33. }
  34. Core.prototype.__set_defaultScreenWidth = function(val) {
  35. Polycode.Core__set_defaultScreenWidth(this.__ptr, val)
  36. }
  37. Core.prototype.__get_defaultScreenHeight = function() {
  38. return Polycode.Core__get_defaultScreenHeight(this.__ptr)
  39. }
  40. Core.prototype.__set_defaultScreenHeight = function(val) {
  41. Polycode.Core__set_defaultScreenHeight(this.__ptr, val)
  42. }
  43. Core.prototype.__get_deviceAttitude = function() {
  44. var retVal = new Quaternion()
  45. retVal.__ptr = Polycode.Core__get_deviceAttitude(this.__ptr)
  46. return retVal
  47. }
  48. Core.prototype.__set_deviceAttitude = function(val) {
  49. Polycode.Core__set_deviceAttitude(this.__ptr, val.__ptr)
  50. }
  51. Duktape.fin(Core.prototype, function (x) {
  52. if (x === Core.prototype) {
  53. return;
  54. }
  55. Polycode.Core__delete(x.__ptr)
  56. })
  57. Core.prototype.Update = function() {
  58. return Polycode.Core_Update(this.__ptr)
  59. }
  60. Core.prototype.Render = function() {
  61. Polycode.Core_Render(this.__ptr)
  62. }
  63. Core.prototype.fixedUpdate = function() {
  64. return Polycode.Core_fixedUpdate(this.__ptr)
  65. }
  66. Core.prototype.systemUpdate = function() {
  67. return Polycode.Core_systemUpdate(this.__ptr)
  68. }
  69. Core.prototype.updateAndRender = function() {
  70. return Polycode.Core_updateAndRender(this.__ptr)
  71. }
  72. Core.prototype.enableMouse = function(newval) {
  73. Polycode.Core_enableMouse(this.__ptr, newval)
  74. }
  75. Core.prototype.captureMouse = function(newval) {
  76. Polycode.Core_captureMouse(this.__ptr, newval)
  77. }
  78. Core.prototype.setCursor = function(cursorType) {
  79. Polycode.Core_setCursor(this.__ptr, cursorType)
  80. }
  81. Core.prototype.warpCursor = function(x,y) {
  82. Polycode.Core_warpCursor(this.__ptr, x,y)
  83. }
  84. Core.prototype.createThread = function(target) {
  85. Polycode.Core_createThread(this.__ptr, target)
  86. }
  87. Core.prototype.lockMutex = function(mutex) {
  88. Polycode.Core_lockMutex(this.__ptr, mutex)
  89. }
  90. Core.prototype.unlockMutex = function(mutex) {
  91. Polycode.Core_unlockMutex(this.__ptr, mutex)
  92. }
  93. Core.prototype.createMutex = function() {
  94. var retVal = new CoreMutex()
  95. retVal.__ptr = Polycode.Core_createMutex(this.__ptr)
  96. return retVal
  97. }
  98. Core.prototype.copyStringToClipboard = function(str) {
  99. Polycode.Core_copyStringToClipboard(this.__ptr, str)
  100. }
  101. Core.prototype.getClipboardString = function() {
  102. return Polycode.Core_getClipboardString(this.__ptr)
  103. }
  104. Core.prototype.getServices = function() {
  105. var retVal = new CoreServices()
  106. retVal.__ptr = Polycode.Core_getServices(this.__ptr)
  107. return retVal
  108. }
  109. Core.prototype.getFPS = function() {
  110. return Polycode.Core_getFPS(this.__ptr)
  111. }
  112. Core.prototype.Shutdown = function() {
  113. Polycode.Core_Shutdown(this.__ptr)
  114. }
  115. Core.prototype.isFullscreen = function() {
  116. return Polycode.Core_isFullscreen(this.__ptr)
  117. }
  118. Core.prototype.getAALevel = function() {
  119. return Polycode.Core_getAALevel(this.__ptr)
  120. }
  121. Core.prototype.getInput = function() {
  122. var retVal = new CoreInput()
  123. retVal.__ptr = Polycode.Core_getInput(this.__ptr)
  124. return retVal
  125. }
  126. Core.prototype.getXRes = function() {
  127. return Polycode.Core_getXRes(this.__ptr)
  128. }
  129. Core.prototype.getYRes = function() {
  130. return Polycode.Core_getYRes(this.__ptr)
  131. }
  132. Core.prototype.getBackingXRes = function() {
  133. return Polycode.Core_getBackingXRes(this.__ptr)
  134. }
  135. Core.prototype.getBackingYRes = function() {
  136. return Polycode.Core_getBackingYRes(this.__ptr)
  137. }
  138. Core.prototype.getScreenWidth = function() {
  139. return Polycode.Core_getScreenWidth(this.__ptr)
  140. }
  141. Core.prototype.getScreenHeight = function() {
  142. return Polycode.Core_getScreenHeight(this.__ptr)
  143. }
  144. Core.prototype.createFolder = function(folderPath) {
  145. Polycode.Core_createFolder(this.__ptr, folderPath)
  146. }
  147. Core.prototype.copyDiskItem = function(itemPath,destItemPath) {
  148. Polycode.Core_copyDiskItem(this.__ptr, itemPath,destItemPath)
  149. }
  150. Core.prototype.moveDiskItem = function(itemPath,destItemPath) {
  151. Polycode.Core_moveDiskItem(this.__ptr, itemPath,destItemPath)
  152. }
  153. Core.prototype.removeDiskItem = function(itemPath) {
  154. Polycode.Core_removeDiskItem(this.__ptr, itemPath)
  155. }
  156. Core.prototype.openFolderPicker = function() {
  157. return Polycode.Core_openFolderPicker(this.__ptr)
  158. }
  159. Core.prototype.setFramerate = function(frameRate,maxFixedCycles) {
  160. Polycode.Core_setFramerate(this.__ptr, frameRate,maxFixedCycles)
  161. }
  162. Core.prototype.openFilePicker = function(extensions,allowMultiple) {
  163. Polycode.Core_openFilePicker(this.__ptr, extensions,allowMultiple)
  164. }
  165. Core.prototype.saveFilePicker = function(extensions) {
  166. return Polycode.Core_saveFilePicker(this.__ptr, extensions)
  167. }
  168. Core.prototype.handleVideoModeChange = function(modeInfo) {
  169. Polycode.Core_handleVideoModeChange(this.__ptr, modeInfo)
  170. }
  171. Core.prototype.flushRenderContext = function() {
  172. Polycode.Core_flushRenderContext(this.__ptr)
  173. }
  174. Core.prototype.prepareRenderContext = function() {
  175. Polycode.Core_prepareRenderContext(this.__ptr)
  176. }
  177. Core.prototype.openFile = function(fileName,opts) {
  178. var retVal = new CoreFile()
  179. retVal.__ptr = Polycode.Core_openFile(this.__ptr, fileName,opts)
  180. return retVal
  181. }
  182. Core.prototype.closeFile = function(file) {
  183. Polycode.Core_closeFile(this.__ptr, file)
  184. }
  185. Core.prototype.addFileSource = function(type,source) {
  186. Polycode.Core_addFileSource(this.__ptr, type,source)
  187. }
  188. Core.prototype.removeFileSource = function(type,source) {
  189. Polycode.Core_removeFileSource(this.__ptr, type,source)
  190. }
  191. Core.prototype.parseFolder = function(pathString,showHidden) {
  192. Polycode.Core_parseFolder(this.__ptr, pathString,showHidden)
  193. }
  194. Core.prototype.systemParseFolder = function(pathString,showHidden,targetVector) {
  195. return Polycode.Core_systemParseFolder(this.__ptr, pathString,showHidden,targetVector)
  196. }
  197. Core.prototype.getResourcePathForFile = function(fileName) {
  198. return Polycode.Core_getResourcePathForFile(this.__ptr, fileName)
  199. }
  200. Core.prototype.setVideoMode = function(xRes,yRes,fullScreen,vSync,aaLevel,anisotropyLevel,retinaSupport) {
  201. Polycode.Core_setVideoMode(this.__ptr, xRes,yRes,fullScreen,vSync,aaLevel,anisotropyLevel,retinaSupport)
  202. }
  203. Core.prototype.resizeTo = function(xRes,yRes) {
  204. Polycode.Core_resizeTo(this.__ptr, xRes,yRes)
  205. }
  206. Core.prototype.doSleep = function() {
  207. Polycode.Core_doSleep(this.__ptr)
  208. }
  209. Core.prototype.openURL = function(url) {
  210. Polycode.Core_openURL(this.__ptr, url)
  211. }
  212. Core.prototype.getElapsed = function() {
  213. return Polycode.Core_getElapsed(this.__ptr)
  214. }
  215. Core.prototype.getTicks = function() {
  216. return Polycode.Core_getTicks(this.__ptr)
  217. }
  218. Core.prototype.getRefreshIntervalMs = function() {
  219. return Polycode.Core_getRefreshIntervalMs(this.__ptr)
  220. }
  221. Core.prototype.getTimeSleptMs = function() {
  222. return Polycode.Core_getTimeSleptMs(this.__ptr)
  223. }
  224. Core.prototype.getFixedTimestep = function() {
  225. return Polycode.Core_getFixedTimestep(this.__ptr)
  226. }
  227. Core.prototype.getTicksFloat = function() {
  228. return Polycode.Core_getTicksFloat(this.__ptr)
  229. }
  230. Core.prototype.setUserPointer = function(ptr) {
  231. Polycode.Core_setUserPointer(this.__ptr, ptr)
  232. }
  233. Core.prototype.getUserPointer = function() {
  234. Polycode.Core_getUserPointer(this.__ptr)
  235. }
  236. Core.prototype.executeExternalCommand = function(command,args,inDirectory) {
  237. return Polycode.Core_executeExternalCommand(this.__ptr, command,args,inDirectory)
  238. }
  239. Core.prototype.getDefaultWorkingDirectory = function() {
  240. return Polycode.Core_getDefaultWorkingDirectory(this.__ptr)
  241. }
  242. Core.prototype.getUserHomeDirectory = function() {
  243. return Polycode.Core_getUserHomeDirectory(this.__ptr)
  244. }
  245. Core.prototype.makeApplicationMain = function() {
  246. Polycode.Core_makeApplicationMain(this.__ptr)
  247. }
  248. Core.prototype.getEventMutex = function() {
  249. var retVal = new CoreMutex()
  250. retVal.__ptr = Polycode.Core_getEventMutex(this.__ptr)
  251. return retVal
  252. }
  253. Core.prototype.removeThread = function(thread) {
  254. Polycode.Core_removeThread(this.__ptr, thread)
  255. }