Core.lua 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  1. require "Polycode/EventDispatcher"
  2. class "Core" (EventDispatcher)
  3. EVENT_CORE_RESIZE = 0
  4. function Core:Update()
  5. local retVal = Polycore.Core_Update(self.__ptr)
  6. return retVal
  7. end
  8. function Core:getTicks()
  9. local retVal = Polycore.Core_getTicks(self.__ptr)
  10. if Polycore.__ptr_lookup[retVal] ~= nil then
  11. return Polycore.__ptr_lookup[retVal]
  12. else
  13. Polycore.__ptr_lookup[retVal] = unsignedint("__skip_ptr__")
  14. Polycore.__ptr_lookup[retVal].__ptr = retVal
  15. return Polycore.__ptr_lookup[retVal]
  16. end
  17. end
  18. function Core:enableMouse(newval)
  19. local retVal = Polycore.Core_enableMouse(self.__ptr, newval)
  20. end
  21. function Core:setCursor(cursorType)
  22. local retVal = Polycore.Core_setCursor(self.__ptr, cursorType)
  23. end
  24. function Core:createThread(target)
  25. local retVal = Polycore.Core_createThread(self.__ptr, target.__ptr)
  26. end
  27. function Core:lockMutex(mutex)
  28. local retVal = Polycore.Core_lockMutex(self.__ptr, mutex.__ptr)
  29. end
  30. function Core:unlockMutex(mutex)
  31. local retVal = Polycore.Core_unlockMutex(self.__ptr, mutex.__ptr)
  32. end
  33. function Core:createMutex()
  34. local retVal = Polycore.Core_createMutex(self.__ptr)
  35. if Polycore.__ptr_lookup[retVal] ~= nil then
  36. return Polycore.__ptr_lookup[retVal]
  37. else
  38. Polycore.__ptr_lookup[retVal] = CoreMutex("__skip_ptr__")
  39. Polycore.__ptr_lookup[retVal].__ptr = retVal
  40. return Polycore.__ptr_lookup[retVal]
  41. end
  42. end
  43. function Core:copyStringToClipboard(str)
  44. local retVal = Polycore.Core_copyStringToClipboard(self.__ptr, str)
  45. end
  46. function Core:getClipboardString()
  47. local retVal = Polycore.Core_getClipboardString(self.__ptr)
  48. if Polycore.__ptr_lookup[retVal] ~= nil then
  49. return Polycore.__ptr_lookup[retVal]
  50. else
  51. Polycore.__ptr_lookup[retVal] = String("__skip_ptr__")
  52. Polycore.__ptr_lookup[retVal].__ptr = retVal
  53. return Polycore.__ptr_lookup[retVal]
  54. end
  55. end
  56. function Core:getServices()
  57. local retVal = Polycore.Core_getServices(self.__ptr)
  58. if Polycore.__ptr_lookup[retVal] ~= nil then
  59. return Polycore.__ptr_lookup[retVal]
  60. else
  61. Polycore.__ptr_lookup[retVal] = CoreServices("__skip_ptr__")
  62. Polycore.__ptr_lookup[retVal].__ptr = retVal
  63. return Polycore.__ptr_lookup[retVal]
  64. end
  65. end
  66. function Core:getFPS()
  67. local retVal = Polycore.Core_getFPS(self.__ptr)
  68. return retVal
  69. end
  70. function Core:Shutdown()
  71. local retVal = Polycore.Core_Shutdown(self.__ptr)
  72. end
  73. function Core:isFullscreen()
  74. local retVal = Polycore.Core_isFullscreen(self.__ptr)
  75. return retVal
  76. end
  77. function Core:getAALevel()
  78. local retVal = Polycore.Core_getAALevel(self.__ptr)
  79. return retVal
  80. end
  81. function Core:getInput()
  82. local retVal = Polycore.Core_getInput(self.__ptr)
  83. if Polycore.__ptr_lookup[retVal] ~= nil then
  84. return Polycore.__ptr_lookup[retVal]
  85. else
  86. Polycore.__ptr_lookup[retVal] = CoreInput("__skip_ptr__")
  87. Polycore.__ptr_lookup[retVal].__ptr = retVal
  88. return Polycore.__ptr_lookup[retVal]
  89. end
  90. end
  91. function Core:getXRes()
  92. local retVal = Polycore.Core_getXRes(self.__ptr)
  93. return retVal
  94. end
  95. function Core:getYRes()
  96. local retVal = Polycore.Core_getYRes(self.__ptr)
  97. return retVal
  98. end
  99. function Core:getNumVideoModes()
  100. local retVal = Polycore.Core_getNumVideoModes(self.__ptr)
  101. return retVal
  102. end
  103. function Core:createFolder(folderPath)
  104. local retVal = Polycore.Core_createFolder(self.__ptr, folderPath)
  105. end
  106. function Core:copyDiskItem(itemPath, destItemPath)
  107. local retVal = Polycore.Core_copyDiskItem(self.__ptr, itemPath, destItemPath)
  108. end
  109. function Core:moveDiskItem(itemPath, destItemPath)
  110. local retVal = Polycore.Core_moveDiskItem(self.__ptr, itemPath, destItemPath)
  111. end
  112. function Core:removeDiskItem(itemPath)
  113. local retVal = Polycore.Core_removeDiskItem(self.__ptr, itemPath)
  114. end
  115. function Core:openFolderPicker()
  116. local retVal = Polycore.Core_openFolderPicker(self.__ptr)
  117. if Polycore.__ptr_lookup[retVal] ~= nil then
  118. return Polycore.__ptr_lookup[retVal]
  119. else
  120. Polycore.__ptr_lookup[retVal] = String("__skip_ptr__")
  121. Polycore.__ptr_lookup[retVal].__ptr = retVal
  122. return Polycore.__ptr_lookup[retVal]
  123. end
  124. end
  125. function Core:setVideoModeIndex(index, fullScreen, aaLevel)
  126. local retVal = Polycore.Core_setVideoModeIndex(self.__ptr, index, fullScreen, aaLevel)
  127. end
  128. function Core:setVideoMode(xRes, yRes, fullScreen, aaLevel)
  129. local retVal = Polycore.Core_setVideoMode(self.__ptr, xRes, yRes, fullScreen, aaLevel)
  130. end
  131. function Core:resizeTo(xRes, yRes)
  132. local retVal = Polycore.Core_resizeTo(self.__ptr, xRes, yRes)
  133. end
  134. function Core:doSleep()
  135. local retVal = Polycore.Core_doSleep(self.__ptr)
  136. end
  137. function Core:getElapsed()
  138. local retVal = Polycore.Core_getElapsed(self.__ptr)
  139. return retVal
  140. end
  141. function Core:getTicksFloat()
  142. local retVal = Polycore.Core_getTicksFloat(self.__ptr)
  143. return retVal
  144. end
  145. function Core:setUserPointer(ptr)
  146. local retVal = Polycore.Core_setUserPointer(self.__ptr, ptr.__ptr)
  147. end
  148. function Core:getUserPointer()
  149. local retVal = Polycore.Core_getUserPointer(self.__ptr)
  150. if Polycore.__ptr_lookup[retVal] ~= nil then
  151. return Polycore.__ptr_lookup[retVal]
  152. else
  153. Polycore.__ptr_lookup[retVal] = void("__skip_ptr__")
  154. Polycore.__ptr_lookup[retVal].__ptr = retVal
  155. return Polycore.__ptr_lookup[retVal]
  156. end
  157. end