Core.lua 5.5 KB

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