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: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 Polycore.__ptr_lookup[retVal] ~= nil then
  26. return Polycore.__ptr_lookup[retVal]
  27. else
  28. Polycore.__ptr_lookup[retVal] = CoreMutex("__skip_ptr__")
  29. Polycore.__ptr_lookup[retVal].__ptr = retVal
  30. return Polycore.__ptr_lookup[retVal]
  31. end
  32. end
  33. function Core:copyStringToClipboard(str)
  34. local retVal = Polycore.Core_copyStringToClipboard(self.__ptr, str)
  35. end
  36. function Core:getClipboardString()
  37. local retVal = Polycore.Core_getClipboardString(self.__ptr)
  38. if Polycore.__ptr_lookup[retVal] ~= nil then
  39. return Polycore.__ptr_lookup[retVal]
  40. else
  41. Polycore.__ptr_lookup[retVal] = String("__skip_ptr__")
  42. Polycore.__ptr_lookup[retVal].__ptr = retVal
  43. return Polycore.__ptr_lookup[retVal]
  44. end
  45. end
  46. function Core:getServices()
  47. local retVal = Polycore.Core_getServices(self.__ptr)
  48. if Polycore.__ptr_lookup[retVal] ~= nil then
  49. return Polycore.__ptr_lookup[retVal]
  50. else
  51. Polycore.__ptr_lookup[retVal] = CoreServices("__skip_ptr__")
  52. Polycore.__ptr_lookup[retVal].__ptr = retVal
  53. return Polycore.__ptr_lookup[retVal]
  54. end
  55. end
  56. function Core:getFPS()
  57. local retVal = Polycore.Core_getFPS(self.__ptr)
  58. return retVal
  59. end
  60. function Core:Shutdown()
  61. local retVal = Polycore.Core_Shutdown(self.__ptr)
  62. end
  63. function Core:isFullscreen()
  64. local retVal = Polycore.Core_isFullscreen(self.__ptr)
  65. return retVal
  66. end
  67. function Core:getAALevel()
  68. local retVal = Polycore.Core_getAALevel(self.__ptr)
  69. return retVal
  70. end
  71. function Core:getInput()
  72. local retVal = Polycore.Core_getInput(self.__ptr)
  73. if Polycore.__ptr_lookup[retVal] ~= nil then
  74. return Polycore.__ptr_lookup[retVal]
  75. else
  76. Polycore.__ptr_lookup[retVal] = CoreInput("__skip_ptr__")
  77. Polycore.__ptr_lookup[retVal].__ptr = retVal
  78. return Polycore.__ptr_lookup[retVal]
  79. end
  80. end
  81. function Core:getXRes()
  82. local retVal = Polycore.Core_getXRes(self.__ptr)
  83. return retVal
  84. end
  85. function Core:getYRes()
  86. local retVal = Polycore.Core_getYRes(self.__ptr)
  87. return retVal
  88. end
  89. function Core:getNumVideoModes()
  90. local retVal = Polycore.Core_getNumVideoModes(self.__ptr)
  91. return retVal
  92. end
  93. function Core:createFolder(folderPath)
  94. local retVal = Polycore.Core_createFolder(self.__ptr, folderPath)
  95. end
  96. function Core:copyDiskItem(itemPath, destItemPath)
  97. local retVal = Polycore.Core_copyDiskItem(self.__ptr, itemPath, destItemPath)
  98. end
  99. function Core:moveDiskItem(itemPath, destItemPath)
  100. local retVal = Polycore.Core_moveDiskItem(self.__ptr, itemPath, destItemPath)
  101. end
  102. function Core:removeDiskItem(itemPath)
  103. local retVal = Polycore.Core_removeDiskItem(self.__ptr, itemPath)
  104. end
  105. function Core:openFolderPicker()
  106. local retVal = Polycore.Core_openFolderPicker(self.__ptr)
  107. if Polycore.__ptr_lookup[retVal] ~= nil then
  108. return Polycore.__ptr_lookup[retVal]
  109. else
  110. Polycore.__ptr_lookup[retVal] = String("__skip_ptr__")
  111. Polycore.__ptr_lookup[retVal].__ptr = retVal
  112. return Polycore.__ptr_lookup[retVal]
  113. end
  114. end
  115. function Core:setVideoModeIndex(index, fullScreen, aaLevel)
  116. local retVal = Polycore.Core_setVideoModeIndex(self.__ptr, index, fullScreen, aaLevel)
  117. end
  118. function Core:setVideoMode(xRes, yRes, fullScreen, aaLevel)
  119. local retVal = Polycore.Core_setVideoMode(self.__ptr, xRes, yRes, fullScreen, aaLevel)
  120. end
  121. function Core:resizeTo(xRes, yRes)
  122. local retVal = Polycore.Core_resizeTo(self.__ptr, xRes, yRes)
  123. end
  124. function Core:doSleep()
  125. local retVal = Polycore.Core_doSleep(self.__ptr)
  126. end
  127. function Core:getElapsed()
  128. local retVal = Polycore.Core_getElapsed(self.__ptr)
  129. return retVal
  130. end
  131. function Core:getTicks()
  132. local retVal = Polycore.Core_getTicks(self.__ptr)
  133. if Polycore.__ptr_lookup[retVal] ~= nil then
  134. return Polycore.__ptr_lookup[retVal]
  135. else
  136. Polycore.__ptr_lookup[retVal] = unsignedint("__skip_ptr__")
  137. Polycore.__ptr_lookup[retVal].__ptr = retVal
  138. return Polycore.__ptr_lookup[retVal]
  139. end
  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