CoreServices.lua 5.0 KB

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