CoreServices.lua 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  1. require "Polycode/EventDispatcher"
  2. class "CoreServices" (EventDispatcher)
  3. function CoreServices:getInstance()
  4. local retVal = Polycore.CoreServices_getInstance()
  5. if retVal == nil then return nil end
  6. if Polycore.__ptr_lookup[retVal] ~= nil then
  7. return Polycore.__ptr_lookup[retVal]
  8. else
  9. Polycore.__ptr_lookup[retVal] = CoreServices("__skip_ptr__")
  10. Polycore.__ptr_lookup[retVal].__ptr = retVal
  11. return Polycore.__ptr_lookup[retVal]
  12. end
  13. end
  14. function CoreServices:setInstance(_instance)
  15. local retVal = Polycore.CoreServices_setInstance(_instance.__ptr)
  16. end
  17. function CoreServices:getRenderMutex()
  18. local retVal = Polycore.CoreServices_getRenderMutex()
  19. if retVal == nil then return nil end
  20. if Polycore.__ptr_lookup[retVal] ~= nil then
  21. return Polycore.__ptr_lookup[retVal]
  22. else
  23. Polycore.__ptr_lookup[retVal] = CoreMutex("__skip_ptr__")
  24. Polycore.__ptr_lookup[retVal].__ptr = retVal
  25. return Polycore.__ptr_lookup[retVal]
  26. end
  27. end
  28. function CoreServices:setRenderer(r_enderer)
  29. local retVal = Polycore.CoreServices_setRenderer(self.__ptr, r_enderer.__ptr)
  30. end
  31. function CoreServices:getRenderer()
  32. local retVal = Polycore.CoreServices_getRenderer(self.__ptr)
  33. if retVal == nil then return nil end
  34. if Polycore.__ptr_lookup[retVal] ~= nil then
  35. return Polycore.__ptr_lookup[retVal]
  36. else
  37. Polycore.__ptr_lookup[retVal] = Renderer("__skip_ptr__")
  38. Polycore.__ptr_lookup[retVal].__ptr = retVal
  39. return Polycore.__ptr_lookup[retVal]
  40. end
  41. end
  42. function CoreServices:Update(elapsed)
  43. local retVal = Polycore.CoreServices_Update(self.__ptr, elapsed)
  44. end
  45. function CoreServices:setCore(core)
  46. local retVal = Polycore.CoreServices_setCore(self.__ptr, core.__ptr)
  47. end
  48. function CoreServices:getCore()
  49. local retVal = Polycore.CoreServices_getCore(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] = Core("__skip_ptr__")
  55. Polycore.__ptr_lookup[retVal].__ptr = retVal
  56. return Polycore.__ptr_lookup[retVal]
  57. end
  58. end
  59. function CoreServices:installModule(module)
  60. local retVal = Polycore.CoreServices_installModule(self.__ptr, module.__ptr)
  61. end
  62. function CoreServices:getMaterialManager()
  63. local retVal = Polycore.CoreServices_getMaterialManager(self.__ptr)
  64. if retVal == nil then return nil end
  65. if Polycore.__ptr_lookup[retVal] ~= nil then
  66. return Polycore.__ptr_lookup[retVal]
  67. else
  68. Polycore.__ptr_lookup[retVal] = MaterialManager("__skip_ptr__")
  69. Polycore.__ptr_lookup[retVal].__ptr = retVal
  70. return Polycore.__ptr_lookup[retVal]
  71. end
  72. end
  73. function CoreServices:getScreenManager()
  74. local retVal = Polycore.CoreServices_getScreenManager(self.__ptr)
  75. if retVal == nil then return nil end
  76. if Polycore.__ptr_lookup[retVal] ~= nil then
  77. return Polycore.__ptr_lookup[retVal]
  78. else
  79. Polycore.__ptr_lookup[retVal] = ScreenManager("__skip_ptr__")
  80. Polycore.__ptr_lookup[retVal].__ptr = retVal
  81. return Polycore.__ptr_lookup[retVal]
  82. end
  83. end
  84. function CoreServices:getSceneManager()
  85. local retVal = Polycore.CoreServices_getSceneManager(self.__ptr)
  86. if retVal == nil then return nil end
  87. if Polycore.__ptr_lookup[retVal] ~= nil then
  88. return Polycore.__ptr_lookup[retVal]
  89. else
  90. Polycore.__ptr_lookup[retVal] = SceneManager("__skip_ptr__")
  91. Polycore.__ptr_lookup[retVal].__ptr = retVal
  92. return Polycore.__ptr_lookup[retVal]
  93. end
  94. end
  95. function CoreServices:getTimerManager()
  96. local retVal = Polycore.CoreServices_getTimerManager(self.__ptr)
  97. if retVal == nil then return nil end
  98. if Polycore.__ptr_lookup[retVal] ~= nil then
  99. return Polycore.__ptr_lookup[retVal]
  100. else
  101. Polycore.__ptr_lookup[retVal] = TimerManager("__skip_ptr__")
  102. Polycore.__ptr_lookup[retVal].__ptr = retVal
  103. return Polycore.__ptr_lookup[retVal]
  104. end
  105. end
  106. function CoreServices:getTweenManager()
  107. local retVal = Polycore.CoreServices_getTweenManager(self.__ptr)
  108. if retVal == nil then return nil end
  109. if Polycore.__ptr_lookup[retVal] ~= nil then
  110. return Polycore.__ptr_lookup[retVal]
  111. else
  112. Polycore.__ptr_lookup[retVal] = TweenManager("__skip_ptr__")
  113. Polycore.__ptr_lookup[retVal].__ptr = retVal
  114. return Polycore.__ptr_lookup[retVal]
  115. end
  116. end
  117. function CoreServices:getResourceManager()
  118. local retVal = Polycore.CoreServices_getResourceManager(self.__ptr)
  119. if retVal == nil then return nil end
  120. if Polycore.__ptr_lookup[retVal] ~= nil then
  121. return Polycore.__ptr_lookup[retVal]
  122. else
  123. Polycore.__ptr_lookup[retVal] = ResourceManager("__skip_ptr__")
  124. Polycore.__ptr_lookup[retVal].__ptr = retVal
  125. return Polycore.__ptr_lookup[retVal]
  126. end
  127. end
  128. function CoreServices:getSoundManager()
  129. local retVal = Polycore.CoreServices_getSoundManager(self.__ptr)
  130. if retVal == nil then return nil end
  131. if Polycore.__ptr_lookup[retVal] ~= nil then
  132. return Polycore.__ptr_lookup[retVal]
  133. else
  134. Polycore.__ptr_lookup[retVal] = SoundManager("__skip_ptr__")
  135. Polycore.__ptr_lookup[retVal].__ptr = retVal
  136. return Polycore.__ptr_lookup[retVal]
  137. end
  138. end
  139. function CoreServices:getFontManager()
  140. local retVal = Polycore.CoreServices_getFontManager(self.__ptr)
  141. if retVal == nil then return nil end
  142. if Polycore.__ptr_lookup[retVal] ~= nil then
  143. return Polycore.__ptr_lookup[retVal]
  144. else
  145. Polycore.__ptr_lookup[retVal] = FontManager("__skip_ptr__")
  146. Polycore.__ptr_lookup[retVal].__ptr = retVal
  147. return Polycore.__ptr_lookup[retVal]
  148. end
  149. end
  150. function CoreServices:getConfig()
  151. local retVal = Polycore.CoreServices_getConfig(self.__ptr)
  152. if retVal == nil then return nil end
  153. if Polycore.__ptr_lookup[retVal] ~= nil then
  154. return Polycore.__ptr_lookup[retVal]
  155. else
  156. Polycore.__ptr_lookup[retVal] = Config("__skip_ptr__")
  157. Polycore.__ptr_lookup[retVal].__ptr = retVal
  158. return Polycore.__ptr_lookup[retVal]
  159. end
  160. end
  161. function CoreServices:getScreenInfo(width, height, hz)
  162. local retVal = Polycore.CoreServices_getScreenInfo(self.__ptr, width.__ptr, height.__ptr, hz.__ptr)
  163. end
  164. function CoreServices:__delete()
  165. Polycore.__ptr_lookup[self.__ptr] = nil
  166. Polycore.delete_CoreServices(self.__ptr)
  167. end