DummyCore.lua 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. require "Polycode/Core"
  2. class "DummyCore" (Core)
  3. function DummyCore:DummyCore(...)
  4. local arg = {...}
  5. if type(arg[1]) == "table" and count(arg) == 1 then
  6. if ""..arg[1].__classname == "Core" then
  7. self.__ptr = arg[1].__ptr
  8. return
  9. end
  10. end
  11. for k,v in pairs(arg) do
  12. if type(v) == "table" then
  13. if v.__ptr ~= nil then
  14. arg[k] = v.__ptr
  15. end
  16. end
  17. end
  18. if self.__ptr == nil and arg[1] ~= "__skip_ptr__" then
  19. self.__ptr = Polycode.DummyCore(unpack(arg))
  20. end
  21. end
  22. function DummyCore:Render()
  23. local retVal = Polycode.DummyCore_Render(self.__ptr)
  24. end
  25. function DummyCore:systemUpdate()
  26. local retVal = Polycode.DummyCore_systemUpdate(self.__ptr)
  27. return retVal
  28. end
  29. function DummyCore:setCursor(cursorType)
  30. local retVal = Polycode.DummyCore_setCursor(self.__ptr, cursorType)
  31. end
  32. function DummyCore:createThread(target)
  33. local retVal = Polycode.DummyCore_createThread(self.__ptr, target.__ptr)
  34. end
  35. function DummyCore:createMutex()
  36. local retVal = Polycode.DummyCore_createMutex(self.__ptr)
  37. if retVal == nil then return nil end
  38. local __c = _G["CoreMutex"]("__skip_ptr__")
  39. __c.__ptr = retVal
  40. return __c
  41. end
  42. function DummyCore:copyStringToClipboard(str)
  43. local retVal = Polycode.DummyCore_copyStringToClipboard(self.__ptr, str)
  44. end
  45. function DummyCore:getClipboardString()
  46. local retVal = Polycode.DummyCore_getClipboardString(self.__ptr)
  47. return retVal
  48. end
  49. function DummyCore:createFolder(folderPath)
  50. local retVal = Polycode.DummyCore_createFolder(self.__ptr, folderPath)
  51. end
  52. function DummyCore:copyDiskItem(itemPath, destItemPath)
  53. local retVal = Polycode.DummyCore_copyDiskItem(self.__ptr, itemPath, destItemPath)
  54. end
  55. function DummyCore:moveDiskItem(itemPath, destItemPath)
  56. local retVal = Polycode.DummyCore_moveDiskItem(self.__ptr, itemPath, destItemPath)
  57. end
  58. function DummyCore:removeDiskItem(itemPath)
  59. local retVal = Polycode.DummyCore_removeDiskItem(self.__ptr, itemPath)
  60. end
  61. function DummyCore:openFolderPicker()
  62. local retVal = Polycode.DummyCore_openFolderPicker(self.__ptr)
  63. return retVal
  64. end
  65. function DummyCore:openFilePicker(extensions, allowMultiple)
  66. local retVal = Polycode.DummyCore_openFilePicker(self.__ptr, extensions.__ptr, allowMultiple)
  67. if retVal == nil then return nil end
  68. for i=1,count(retVal) do
  69. local __c = _G["String"]("__skip_ptr__")
  70. __c.__ptr = retVal[i]
  71. retVal[i] = __c
  72. end
  73. return retVal
  74. end
  75. function DummyCore:saveFilePicker(extensions)
  76. local retVal = Polycode.DummyCore_saveFilePicker(self.__ptr, extensions.__ptr)
  77. return retVal
  78. end
  79. function DummyCore:handleVideoModeChange(modeInfo)
  80. local retVal = Polycode.DummyCore_handleVideoModeChange(self.__ptr, modeInfo.__ptr)
  81. end
  82. function DummyCore:flushRenderContext()
  83. local retVal = Polycode.DummyCore_flushRenderContext(self.__ptr)
  84. end
  85. function DummyCore:openURL(url)
  86. local retVal = Polycode.DummyCore_openURL(self.__ptr, url)
  87. end
  88. function DummyCore:getTicks()
  89. local retVal = Polycode.DummyCore_getTicks(self.__ptr)
  90. return retVal
  91. end
  92. function DummyCore:executeExternalCommand(command, args, inDirectory)
  93. local retVal = Polycode.DummyCore_executeExternalCommand(self.__ptr, command, args, inDirectory)
  94. return retVal
  95. end
  96. function DummyCore:systemParseFolder(pathString, showHidden, targetVector)
  97. local retVal = Polycode.DummyCore_systemParseFolder(self.__ptr, pathString, showHidden, targetVector.__ptr)
  98. return retVal
  99. end
  100. function DummyCore:__delete()
  101. if self then Polycode.delete_DummyCore(self.__ptr) end
  102. end