Преглед изворни кода

Removed CoreServices from the codebase. Removed Timer and TimerManager, removed Tween and TweenManager, made entity Update function take elapsed time, made SceneLabels force material in constructor, UI components now require an explicit resource pool pointer and core passed in constructor. Probably broke a lot of stuff :)

Ivan Safrin пре 9 година
родитељ
комит
4671d4143f
100 измењених фајлова са 895 додато и 1382 уклоњено
  1. 1 2
      bindings/javascript/Polycode.js
  2. 0 4
      bindings/javascript/Polycode/Camera.js
  3. 6 0
      bindings/javascript/Polycode/Core.js
  4. 0 9
      bindings/javascript/Polycode/CoreInput.js
  5. 0 8
      bindings/javascript/Polycode/Data.js
  6. 4 4
      bindings/javascript/Polycode/Entity.js
  7. 1 0
      bindings/javascript/Polycode/Event.js
  8. 2 2
      bindings/javascript/Polycode/Font.js
  9. 2 14
      bindings/javascript/Polycode/Image.js
  10. 2 2
      bindings/javascript/Polycode/Material.js
  11. 0 8
      bindings/javascript/Polycode/Mesh.js
  12. 24 0
      bindings/javascript/Polycode/RenderBuffer.js
  13. 12 1
      bindings/javascript/Polycode/RenderDataArray.js
  14. 30 0
      bindings/javascript/Polycode/RendererPlatformData.js
  15. 12 5
      bindings/javascript/Polycode/Resource.js
  16. 30 0
      bindings/javascript/Polycode/ResourcePool.js
  17. 4 4
      bindings/javascript/Polycode/Scene.js
  18. 2 2
      bindings/javascript/Polycode/SceneEntityInstance.js
  19. 0 4
      bindings/javascript/Polycode/SceneEntityInstanceResourceEntry.js
  20. 2 2
      bindings/javascript/Polycode/SceneLabel.js
  21. 2 2
      bindings/javascript/Polycode/SceneLight.js
  22. 2 12
      bindings/javascript/Polycode/SceneMesh.js
  23. 2 2
      bindings/javascript/Polycode/SceneParticleEmitter.js
  24. 2 2
      bindings/javascript/Polycode/SceneSound.js
  25. 0 6
      bindings/javascript/Polycode/ShaderBinding.js
  26. 0 4
      bindings/javascript/Polycode/ShaderProgram.js
  27. 4 12
      bindings/javascript/Polycode/Skeleton.js
  28. 2 2
      bindings/javascript/Polycode/SkeletonAnimation.js
  29. 2 14
      bindings/javascript/Polycode/Sound.js
  30. 0 4
      bindings/javascript/Polycode/Texture.js
  31. BIN
      bindings/javascript/js_Polycode.pak
  32. 1 2
      bindings/lua/Polycode.lua
  33. 0 4
      bindings/lua/Polycode/Camera.lua
  34. 8 0
      bindings/lua/Polycode/Core.lua
  35. 0 5
      bindings/lua/Polycode/CoreInput.lua
  36. 0 10
      bindings/lua/Polycode/Data.lua
  37. 4 4
      bindings/lua/Polycode/Entity.lua
  38. 1 0
      bindings/lua/Polycode/Event.lua
  39. 0 29
      bindings/lua/Polycode/Image.lua
  40. 2 2
      bindings/lua/Polycode/Material.lua
  41. 0 8
      bindings/lua/Polycode/Mesh.lua
  42. 26 0
      bindings/lua/Polycode/RenderBuffer.lua
  43. 9 0
      bindings/lua/Polycode/RenderDataArray.lua
  44. 39 0
      bindings/lua/Polycode/RendererPlatformData.lua
  45. 9 4
      bindings/lua/Polycode/Resource.lua
  46. 40 0
      bindings/lua/Polycode/ResourcePool.lua
  47. 2 2
      bindings/lua/Polycode/Scene.lua
  48. 0 20
      bindings/lua/Polycode/SceneEntityInstance.lua
  49. 0 4
      bindings/lua/Polycode/SceneEntityInstanceResourceEntry.lua
  50. 0 12
      bindings/lua/Polycode/SceneMesh.lua
  51. 2 2
      bindings/lua/Polycode/SceneParticleEmitter.lua
  52. 0 8
      bindings/lua/Polycode/ShaderBinding.lua
  53. 0 4
      bindings/lua/Polycode/ShaderProgram.lua
  54. 2 10
      bindings/lua/Polycode/Skeleton.lua
  55. 2 2
      bindings/lua/Polycode/SkeletonAnimation.lua
  56. 0 14
      bindings/lua/Polycode/Sound.lua
  57. 0 4
      bindings/lua/Polycode/Texture.lua
  58. BIN
      bindings/lua/lua_Polycode.pak
  59. 8 40
      build/osx/PolycodeCore/PolycodeCore.xcodeproj/project.pbxproj
  60. 1 0
      build/osx/TemplateApp/TemplateApp/PolycodeTemplateApp.h
  61. 5 3
      build/osx/TemplateApp/TemplateApp/PolycodeTemplateApp.mm
  62. 0 5
      include/Polycode.h
  63. 168 285
      include/polycode/bindings/javascript/PolycodeJSWrappers.h
  64. 219 389
      include/polycode/bindings/lua/PolycodeLuaWrappers.h
  65. 1 6
      include/polycode/core/PolyCamera.h
  66. 3 9
      include/polycode/core/PolyClient.h
  67. 0 9
      include/polycode/core/PolyCocoaCore.h
  68. 14 7
      include/polycode/core/PolyConfig.h
  69. 19 42
      include/polycode/core/PolyCore.h
  70. 1 5
      include/polycode/core/PolyCoreInput.h
  71. 0 157
      include/polycode/core/PolyCoreServices.h
  72. 4 2
      include/polycode/core/PolyData.h
  73. 2 6
      include/polycode/core/PolyEntity.h
  74. 2 1
      include/polycode/core/PolyEvent.h
  75. 3 1
      include/polycode/core/PolyFont.h
  76. 1 0
      include/polycode/core/PolyGPUDrawBuffer.h
  77. 3 3
      include/polycode/core/PolyGlobals.h
  78. 8 7
      include/polycode/core/PolyImage.h
  79. 2 2
      include/polycode/core/PolyMaterial.h
  80. 4 4
      include/polycode/core/PolyMesh.h
  81. 8 6
      include/polycode/core/PolyObject.h
  82. 3 1
      include/polycode/core/PolyOpenGLGraphicsInterface.h
  83. 1 2
      include/polycode/core/PolyParticleEmitter.h
  84. 2 8
      include/polycode/core/PolyPeer.h
  85. 4 1
      include/polycode/core/PolyRenderDataArray.h
  86. 7 5
      include/polycode/core/PolyRenderer.h
  87. 27 37
      include/polycode/core/PolyRendererPlatformData.h
  88. 5 3
      include/polycode/core/PolyResource.h
  89. 25 11
      include/polycode/core/PolyResourceManager.h
  90. 5 5
      include/polycode/core/PolyScene.h
  91. 6 3
      include/polycode/core/PolySceneEntityInstance.h
  92. 2 2
      include/polycode/core/PolySceneLabel.h
  93. 2 2
      include/polycode/core/PolySceneLight.h
  94. 0 1
      include/polycode/core/PolySceneLine.h
  95. 7 11
      include/polycode/core/PolySceneMesh.h
  96. 0 1
      include/polycode/core/PolySceneRenderTexture.h
  97. 11 4
      include/polycode/core/PolySceneSound.h
  98. 3 2
      include/polycode/core/PolySceneSprite.h
  99. 5 5
      include/polycode/core/PolyServer.h
  100. 7 8
      include/polycode/core/PolyShader.h

+ 1 - 2
bindings/javascript/Polycode.js

@@ -15,7 +15,6 @@ require('Polycode/CoreFileExtension')
 require('Polycode/OSFileEntry')
 require('Polycode/CoreInput')
 require('Polycode/JoystickInfo')
-require('Polycode/CoreServices')
 require('Polycode/Data')
 require('Polycode/MouseEventResult')
 require('Polycode/EntityProp')
@@ -58,6 +57,7 @@ require('Polycode/RendererThreadJob')
 require('Polycode/RenderThread')
 require('Polycode/RenderThreadDebugInfo')
 require('Polycode/Renderer')
+require('Polycode/RendererPlatformData')
 require('Polycode/Resource')
 require('Polycode/ScriptResourceLoader')
 require('Polycode/ResourcePool')
@@ -106,7 +106,6 @@ require('Polycode/SoundManager')
 require('Polycode/String')
 require('Polycode/RenderBuffer')
 require('Polycode/Texture')
-require('Polycode/Timer')
 require('Polycode/Vector2')
 require('Polycode/Vector3')
 require('Polycode/Vector4')

+ 0 - 4
bindings/javascript/Polycode/Camera.js

@@ -118,10 +118,6 @@ Camera.prototype.setPostFilter = function(material) {
 	Polycode.Camera_setPostFilter(this.__ptr, material)
 }
 
-Camera.prototype.setPostFilterByName = function(shaderName) {
-	Polycode.Camera_setPostFilterByName(this.__ptr, shaderName)
-}
-
 Camera.prototype.removePostFilter = function() {
 	Polycode.Camera_removePostFilter(this.__ptr)
 }

+ 6 - 0
bindings/javascript/Polycode/Core.js

@@ -286,3 +286,9 @@ Core.prototype.getUserHomeDirectory = function() {
 Core.prototype.makeApplicationMain = function() {
 	Polycode.Core_makeApplicationMain(this.__ptr)
 }
+
+Core.prototype.getConfig = function() {
+	var retVal = new ConfigRef("__skip_ptr__")
+	retVal.__ptr = Polycode.Core_getConfig(this.__ptr)
+	return retVal
+}

+ 0 - 9
bindings/javascript/Polycode/CoreInput.js

@@ -8,7 +8,6 @@ function CoreInput() {
 		'simulateTouchWithMouse': { enumerable: true, configurable: true, get: CoreInput.prototype.__get_simulateTouchWithMouse, set: CoreInput.prototype.__set_simulateTouchWithMouse},
 		'simulateTouchAsPen': { enumerable: true, configurable: true, get: CoreInput.prototype.__get_simulateTouchAsPen, set: CoreInput.prototype.__set_simulateTouchAsPen},
 		'simulateMouseWithTouch': { enumerable: true, configurable: true, get: CoreInput.prototype.__get_simulateMouseWithTouch, set: CoreInput.prototype.__set_simulateMouseWithTouch},
-		'ignoreOffScreenTouch': { enumerable: true, configurable: true, get: CoreInput.prototype.__get_ignoreOffScreenTouch, set: CoreInput.prototype.__set_ignoreOffScreenTouch},
 		'keyRepeat': { enumerable: true, configurable: true, get: CoreInput.prototype.__get_keyRepeat, set: CoreInput.prototype.__set_keyRepeat},
 		'mousePosition': { enumerable: true, configurable: true, get: CoreInput.prototype.__get_mousePosition, set: CoreInput.prototype.__set_mousePosition},
 		'deltaMousePosition': { enumerable: true, configurable: true, get: CoreInput.prototype.__get_deltaMousePosition, set: CoreInput.prototype.__set_deltaMousePosition}
@@ -45,14 +44,6 @@ CoreInput.prototype.__set_simulateMouseWithTouch = function(val) {
 	Polycode.CoreInput__set_simulateMouseWithTouch(this.__ptr, val)
 }
 
-CoreInput.prototype.__get_ignoreOffScreenTouch = function() {
-	return Polycode.CoreInput__get_ignoreOffScreenTouch(this.__ptr)
-}
-
-CoreInput.prototype.__set_ignoreOffScreenTouch = function(val) {
-	Polycode.CoreInput__set_ignoreOffScreenTouch(this.__ptr, val)
-}
-
 CoreInput.prototype.__get_keyRepeat = function() {
 	return Polycode.CoreInput__get_keyRepeat(this.__ptr)
 }

+ 0 - 8
bindings/javascript/Polycode/Data.js

@@ -12,10 +12,6 @@ Duktape.fin(Data.prototype, function (x) {
 	Polycode.Data__delete(x.__ptr)
 })
 
-Data.prototype.loadFromFile = function(fileName) {
-	return Polycode.Data_loadFromFile(this.__ptr, fileName)
-}
-
 Data.prototype.getAsString = function(encoding) {
 	return Polycode.Data_getAsString(this.__ptr, encoding)
 }
@@ -23,7 +19,3 @@ Data.prototype.getAsString = function(encoding) {
 Data.prototype.setFromString = function(str,encoding) {
 	Polycode.Data_setFromString(this.__ptr, str, encoding)
 }
-
-Data.prototype.saveToFile = function(fileName) {
-	return Polycode.Data_saveToFile(this.__ptr, fileName)
-}

+ 4 - 4
bindings/javascript/Polycode/Entity.js

@@ -213,8 +213,8 @@ Entity.prototype.initEntity = function() {
 	Polycode.Entity_initEntity(this.__ptr)
 }
 
-Entity.prototype.Update = function() {
-	Polycode.Entity_Update(this.__ptr)
+Entity.prototype.Update = function(elapsed) {
+	Polycode.Entity_Update(this.__ptr, elapsed)
 }
 
 Entity.prototype.fixedUpdate = function() {
@@ -541,8 +541,8 @@ Entity.prototype.getInverseY = function() {
 	return Polycode.Entity_getInverseY(this.__ptr)
 }
 
-Entity.prototype.doUpdates = function() {
-	Polycode.Entity_doUpdates(this.__ptr)
+Entity.prototype.doUpdates = function(elapsed) {
+	Polycode.Entity_doUpdates(this.__ptr, elapsed)
 }
 
 Entity.prototype.doFixedUpdates = function() {

+ 1 - 0
bindings/javascript/Polycode/Event.js

@@ -18,6 +18,7 @@ Event.RESOURCE_RELOAD_EVENT = EVENTBASE_EVENT + 5
 Event.SELECT_EVENT = EVENTBASE_EVENT + 6
 Event.REMOVE_EVENT = EVENTBASE_EVENT + 7
 Event.RESOURCE_CHANGE_EVENT = EVENTBASE_EVENT + 8
+Event.RESOURCE_DESTROY_EVENT = EVENTBASE_EVENT + 9
 Event.EVENTBASE_NONPOLYCODE = 0x10000
 
 Event.prototype.__get_deleteOnDispatch = function() {

+ 2 - 2
bindings/javascript/Polycode/Font.js

@@ -1,8 +1,8 @@
 require('Polycode/Resource')
 
-function Font(fileName,FTLibrary) {
+function Font() {
 	if(arguments[0] != "__skip_ptr__") {
-		this.__ptr = Polycode.Font(fileName,FTLibrary)
+		this.__ptr = Polycode.Font()
 	}
 	Object.defineProperties(this, {
 		'loaded': { enumerable: true, configurable: true, get: Font.prototype.__get_loaded, set: Font.prototype.__set_loaded}

+ 2 - 14
bindings/javascript/Polycode/Image.js

@@ -1,6 +1,6 @@
-function Image(fileName) {
+function Image() {
 	if(arguments[0] != "__skip_ptr__") {
-		this.__ptr = Polycode.Image(fileName)
+		this.__ptr = Polycode.Image()
 	}
 }
 
@@ -9,14 +9,6 @@ Image.IMAGE_RGBA = 1
 Image.IMAGE_FP16 = 2
 
 
-Image.prototype.loadImage = function(fileName) {
-	return Polycode.Image_loadImage(this.__ptr, fileName)
-}
-
-Image.prototype.saveImage = function(fileName) {
-	return Polycode.Image_saveImage(this.__ptr, fileName)
-}
-
 Image.prototype.createEmpty = function(width,height,fillColor) {
 	Polycode.Image_createEmpty(this.__ptr, width, height, fillColor)
 }
@@ -98,7 +90,3 @@ Image.prototype.getHeight = function() {
 Image.prototype.premultiplyAlpha = function() {
 	Polycode.Image_premultiplyAlpha(this.__ptr)
 }
-
-Image.prototype.savePNG = function(fileName) {
-	return Polycode.Image_savePNG(this.__ptr, fileName)
-}

+ 2 - 2
bindings/javascript/Polycode/Material.js

@@ -63,8 +63,8 @@ Material.prototype.removeShaderRenderTarget = function(index) {
 	Polycode.Material_removeShaderRenderTarget(this.__ptr, index)
 }
 
-Material.prototype.recreateRenderTargets = function() {
-	Polycode.Material_recreateRenderTargets(this.__ptr)
+Material.prototype.recreateRenderTargets = function(screenSize) {
+	Polycode.Material_recreateRenderTargets(this.__ptr, screenSize)
 }
 
 Material.prototype.getName = function() {

+ 0 - 8
bindings/javascript/Polycode/Mesh.js

@@ -10,14 +10,6 @@ function Mesh() {
 Mesh.prototype = Object.create(Resource.prototype)
 
 
-Mesh.prototype.loadMesh = function(fileName) {
-	Polycode.Mesh_loadMesh(this.__ptr, fileName)
-}
-
-Mesh.prototype.saveToFile = function(fileName,writeNormals,writeTangents,writeColors,writeBoneWeights,writeUVs,writeSecondaryUVs) {
-	Polycode.Mesh_saveToFile(this.__ptr, fileName, writeNormals, writeTangents, writeColors, writeBoneWeights, writeUVs, writeSecondaryUVs)
-}
-
 Mesh.prototype.addSubmesh = function(newSubmesh) {
 	Polycode.Mesh_addSubmesh(this.__ptr, newSubmesh)
 }

+ 24 - 0
bindings/javascript/Polycode/RenderBuffer.js

@@ -2,9 +2,33 @@ function RenderBuffer(width,height,attachDepthBuffer,floatingPoint) {
 	if(arguments[0] != "__skip_ptr__") {
 		this.__ptr = Polycode.RenderBuffer(width,height,attachDepthBuffer,floatingPoint)
 	}
+	Object.defineProperties(this, {
+		'platformData': { enumerable: true, configurable: true, get: RenderBuffer.prototype.__get_platformData, set: RenderBuffer.prototype.__set_platformData},
+		'depthBufferPlatformData': { enumerable: true, configurable: true, get: RenderBuffer.prototype.__get_depthBufferPlatformData, set: RenderBuffer.prototype.__set_depthBufferPlatformData}
+	})
 }
 
 
+RenderBuffer.prototype.__get_platformData = function() {
+	var retVal = new RendererPlatformData("__skip_ptr__")
+	retVal.__ptr = 	Polycode.RenderBuffer__get_platformData(this.__ptr)
+	return retVal
+}
+
+RenderBuffer.prototype.__set_platformData = function(val) {
+	Polycode.RenderBuffer__set_platformData(this.__ptr, val.__ptr)
+}
+
+RenderBuffer.prototype.__get_depthBufferPlatformData = function() {
+	var retVal = new RendererPlatformData("__skip_ptr__")
+	retVal.__ptr = 	Polycode.RenderBuffer__get_depthBufferPlatformData(this.__ptr)
+	return retVal
+}
+
+RenderBuffer.prototype.__set_depthBufferPlatformData = function(val) {
+	Polycode.RenderBuffer__set_depthBufferPlatformData(this.__ptr, val.__ptr)
+}
+
 Duktape.fin(RenderBuffer.prototype, function (x) {
 	if (x === RenderBuffer.prototype) {
 		return;

+ 12 - 1
bindings/javascript/Polycode/RenderDataArray.js

@@ -4,7 +4,8 @@ function RenderDataArray(type) {
 	}
 	Object.defineProperties(this, {
 		'type': { enumerable: true, configurable: true, get: RenderDataArray.prototype.__get_type, set: RenderDataArray.prototype.__set_type},
-		'customArrayName': { enumerable: true, configurable: true, get: RenderDataArray.prototype.__get_customArrayName, set: RenderDataArray.prototype.__set_customArrayName}
+		'customArrayName': { enumerable: true, configurable: true, get: RenderDataArray.prototype.__get_customArrayName, set: RenderDataArray.prototype.__set_customArrayName},
+		'platformData': { enumerable: true, configurable: true, get: RenderDataArray.prototype.__get_platformData, set: RenderDataArray.prototype.__set_platformData}
 	})
 }
 
@@ -39,6 +40,16 @@ RenderDataArray.prototype.__set_customArrayName = function(val) {
 	Polycode.RenderDataArray__set_customArrayName(this.__ptr, val)
 }
 
+RenderDataArray.prototype.__get_platformData = function() {
+	var retVal = new RendererPlatformData("__skip_ptr__")
+	retVal.__ptr = 	Polycode.RenderDataArray__get_platformData(this.__ptr)
+	return retVal
+}
+
+RenderDataArray.prototype.__set_platformData = function(val) {
+	Polycode.RenderDataArray__set_platformData(this.__ptr, val.__ptr)
+}
+
 Duktape.fin(RenderDataArray.prototype, function (x) {
 	if (x === RenderDataArray.prototype) {
 		return;

+ 30 - 0
bindings/javascript/Polycode/RendererPlatformData.js

@@ -0,0 +1,30 @@
+function RendererPlatformData() {
+	if(arguments[0] != "__skip_ptr__") {
+		this.__ptr = Polycode.RendererPlatformData()
+	}
+	Object.defineProperties(this, {
+		'type': { enumerable: true, configurable: true, get: RendererPlatformData.prototype.__get_type, set: RendererPlatformData.prototype.__set_type}
+	})
+}
+
+RendererPlatformData.PLATFORM_DATA_NONE = 0
+RendererPlatformData.PLATFORM_DATA_TEXTURE = 1
+RendererPlatformData.PLATFORM_DATA_RENDER_BUFFER = 2
+RendererPlatformData.PLATFORM_DATA_PROGRAM = 3
+RendererPlatformData.PLATFORM_DATA_SHADER = 4
+RendererPlatformData.PLATFORM_DATA_SUBMESH = 5
+
+RendererPlatformData.prototype.__get_type = function() {
+	return Polycode.RendererPlatformData__get_type(this.__ptr)
+}
+
+RendererPlatformData.prototype.__set_type = function(val) {
+	Polycode.RendererPlatformData__set_type(this.__ptr, val)
+}
+
+Duktape.fin(RendererPlatformData.prototype, function (x) {
+	if (x === RendererPlatformData.prototype) {
+		return;
+	}
+	Polycode.RendererPlatformData__delete(x.__ptr)
+})

+ 12 - 5
bindings/javascript/Polycode/Resource.js

@@ -6,7 +6,8 @@ function Resource(type) {
 	}
 	Object.defineProperties(this, {
 		'reloadOnFileModify': { enumerable: true, configurable: true, get: Resource.prototype.__get_reloadOnFileModify, set: Resource.prototype.__set_reloadOnFileModify},
-		'resourceFileTime': { enumerable: true, configurable: true, get: Resource.prototype.__get_resourceFileTime, set: Resource.prototype.__set_resourceFileTime}
+		'resourceFileTime': { enumerable: true, configurable: true, get: Resource.prototype.__get_resourceFileTime, set: Resource.prototype.__set_resourceFileTime},
+		'platformData': { enumerable: true, configurable: true, get: Resource.prototype.__get_platformData, set: Resource.prototype.__set_platformData}
 	})
 }
 
@@ -41,6 +42,16 @@ Resource.prototype.__set_resourceFileTime = function(val) {
 	Polycode.Resource__set_resourceFileTime(this.__ptr, val.__ptr)
 }
 
+Resource.prototype.__get_platformData = function() {
+	var retVal = new RendererPlatformData("__skip_ptr__")
+	retVal.__ptr = 	Polycode.Resource__get_platformData(this.__ptr)
+	return retVal
+}
+
+Resource.prototype.__set_platformData = function(val) {
+	Polycode.Resource__set_platformData(this.__ptr, val.__ptr)
+}
+
 Duktape.fin(Resource.prototype, function (x) {
 	if (x === Resource.prototype) {
 		return;
@@ -48,10 +59,6 @@ Duktape.fin(Resource.prototype, function (x) {
 	Polycode.Resource__delete(x.__ptr)
 })
 
-Resource.prototype.reloadResource = function() {
-	Polycode.Resource_reloadResource(this.__ptr)
-}
-
 Resource.prototype.getResourceName = function() {
 	return Polycode.Resource_getResourceName(this.__ptr)
 }

+ 30 - 0
bindings/javascript/Polycode/ResourcePool.js

@@ -92,6 +92,36 @@ ResourcePool.prototype.getResource = function(resourceType,resourceName) {
 	return retVal
 }
 
+ResourcePool.prototype.getFont = function(name) {
+	var retVal = new Font("__skip_ptr__")
+	retVal.__ptr = Polycode.ResourcePool_getFont(this.__ptr, name)
+	return retVal
+}
+
+ResourcePool.prototype.getMaterial = function(name) {
+	var retVal = new Material("__skip_ptr__")
+	retVal.__ptr = Polycode.ResourcePool_getMaterial(this.__ptr, name)
+	return retVal
+}
+
+ResourcePool.prototype.getShader = function(name) {
+	var retVal = new Shader("__skip_ptr__")
+	retVal.__ptr = Polycode.ResourcePool_getShader(this.__ptr, name)
+	return retVal
+}
+
+ResourcePool.prototype.loadTexture = function(name) {
+	var retVal = new Texture("__skip_ptr__")
+	retVal.__ptr = Polycode.ResourcePool_loadTexture(this.__ptr, name)
+	return retVal
+}
+
+ResourcePool.prototype.loadMesh = function(name) {
+	var retVal = new Mesh("__skip_ptr__")
+	retVal.__ptr = Polycode.ResourcePool_loadMesh(this.__ptr, name)
+	return retVal
+}
+
 ResourcePool.prototype.getName = function() {
 	return Polycode.ResourcePool_getName(this.__ptr)
 }

+ 4 - 4
bindings/javascript/Polycode/Scene.js

@@ -1,8 +1,8 @@
 require('Polycode/EventDispatcher')
 
-function Scene(sceneType) {
+function Scene() {
 	if(arguments[0] != "__skip_ptr__") {
-		this.__ptr = Polycode.Scene(sceneType)
+		this.__ptr = Polycode.Scene()
 	}
 	Object.defineProperties(this, {
 		'clearColor': { enumerable: true, configurable: true, get: Scene.prototype.__get_clearColor, set: Scene.prototype.__set_clearColor},
@@ -140,8 +140,8 @@ Scene.prototype.fixedUpdate = function() {
 	Polycode.Scene_fixedUpdate(this.__ptr)
 }
 
-Scene.prototype.Update = function() {
-	Polycode.Scene_Update(this.__ptr)
+Scene.prototype.Update = function(elapsed) {
+	Polycode.Scene_Update(this.__ptr, elapsed)
 }
 
 Scene.prototype.isEnabled = function() {

+ 2 - 2
bindings/javascript/Polycode/SceneEntityInstance.js

@@ -1,8 +1,8 @@
 require('Polycode/Entity')
 
-function SceneEntityInstance(fileName) {
+function SceneEntityInstance() {
 	if(arguments[0] != "__skip_ptr__") {
-		this.__ptr = Polycode.SceneEntityInstance(fileName)
+		this.__ptr = Polycode.SceneEntityInstance()
 	}
 	Object.defineProperties(this, {
 		'cloneUsingReload': { enumerable: true, configurable: true, get: SceneEntityInstance.prototype.__get_cloneUsingReload, set: SceneEntityInstance.prototype.__set_cloneUsingReload},

+ 0 - 4
bindings/javascript/Polycode/SceneEntityInstanceResourceEntry.js

@@ -15,7 +15,3 @@ Duktape.fin(SceneEntityInstanceResourceEntry.prototype, function (x) {
 	}
 	Polycode.SceneEntityInstanceResourceEntry__delete(x.__ptr)
 })
-
-SceneEntityInstanceResourceEntry.prototype.reloadResource = function() {
-	Polycode.SceneEntityInstanceResourceEntry_reloadResource(this.__ptr)
-}

+ 2 - 2
bindings/javascript/Polycode/SceneLabel.js

@@ -1,8 +1,8 @@
 require('Polycode/ScenePrimitive')
 
-function SceneLabel(text,size,fontName,amode,actualHeight) {
+function SceneLabel(material,text,size,font,amode,actualHeight) {
 	if(arguments[0] != "__skip_ptr__") {
-		this.__ptr = Polycode.SceneLabel(text,size,fontName,amode,actualHeight)
+		this.__ptr = Polycode.SceneLabel(material,text,size,font,amode,actualHeight)
 	}
 	Object.defineProperties(this, {
 		'positionAtBaseline': { enumerable: true, configurable: true, get: SceneLabel.prototype.__get_positionAtBaseline, set: SceneLabel.prototype.__set_positionAtBaseline}

+ 2 - 2
bindings/javascript/Polycode/SceneLight.js

@@ -1,8 +1,8 @@
 require('Polycode/Entity')
 
-function SceneLight(type,intensity,constantAttenuation,linearAttenuation,quadraticAttenuation) {
+function SceneLight(type,intensity,constantAttenuation,linearAttenuation,quadraticAttenuation,depthMapMaterial) {
 	if(arguments[0] != "__skip_ptr__") {
-		this.__ptr = Polycode.SceneLight(type,intensity,constantAttenuation,linearAttenuation,quadraticAttenuation)
+		this.__ptr = Polycode.SceneLight(type,intensity,constantAttenuation,linearAttenuation,quadraticAttenuation,depthMapMaterial)
 	}
 }
 

+ 2 - 12
bindings/javascript/Polycode/SceneMesh.js

@@ -1,8 +1,8 @@
 require('Polycode/Entity')
 
-function SceneMesh(fileName) {
+function SceneMesh() {
 	if(arguments[0] != "__skip_ptr__") {
-		this.__ptr = Polycode.SceneMesh(fileName)
+		this.__ptr = Polycode.SceneMesh()
 	}
 	Object.defineProperties(this, {
 		'lineWidth': { enumerable: true, configurable: true, get: SceneMesh.prototype.__get_lineWidth, set: SceneMesh.prototype.__set_lineWidth},
@@ -105,12 +105,6 @@ SceneMesh.prototype.getMaterial = function() {
 	return retVal
 }
 
-SceneMesh.prototype.loadSkeleton = function(fileName) {
-	var retVal = new Skeleton("__skip_ptr__")
-	retVal.__ptr = Polycode.SceneMesh_loadSkeleton(this.__ptr, fileName)
-	return retVal
-}
-
 SceneMesh.prototype.clearMaterial = function() {
 	Polycode.SceneMesh_clearMaterial(this.__ptr)
 }
@@ -145,10 +139,6 @@ SceneMesh.prototype.setFilename = function(fileName) {
 	Polycode.SceneMesh_setFilename(this.__ptr, fileName)
 }
 
-SceneMesh.prototype.loadFromFile = function(fileName) {
-	Polycode.SceneMesh_loadFromFile(this.__ptr, fileName)
-}
-
 SceneMesh.prototype.customHitDetection = function(ray) {
 	return Polycode.SceneMesh_customHitDetection(this.__ptr, ray)
 }

+ 2 - 2
bindings/javascript/Polycode/SceneParticleEmitter.js

@@ -149,8 +149,8 @@ SceneParticleEmitter.prototype.fixedUpdate = function() {
 	Polycode.SceneParticleEmitter_fixedUpdate(this.__ptr)
 }
 
-SceneParticleEmitter.prototype.updateParticles = function() {
-	Polycode.SceneParticleEmitter_updateParticles(this.__ptr)
+SceneParticleEmitter.prototype.updateParticles = function(elapsed) {
+	Polycode.SceneParticleEmitter_updateParticles(this.__ptr, elapsed)
 }
 
 SceneParticleEmitter.prototype.triggerParticles = function(allAtOnce) {

+ 2 - 2
bindings/javascript/Polycode/SceneSound.js

@@ -1,8 +1,8 @@
 require('Polycode/Entity')
 
-function SceneSound(fileName,referenceDistance,maxDistance,directionalSound) {
+function SceneSound() {
 	if(arguments[0] != "__skip_ptr__") {
-		this.__ptr = Polycode.SceneSound(fileName,referenceDistance,maxDistance,directionalSound)
+		this.__ptr = Polycode.SceneSound()
 	}
 }
 

+ 0 - 6
bindings/javascript/Polycode/ShaderBinding.js

@@ -44,12 +44,6 @@ ShaderBinding.prototype.removeParam = function(name) {
 	Polycode.ShaderBinding_removeParam(this.__ptr, name)
 }
 
-ShaderBinding.prototype.loadTextureForParam = function(paramName,fileName) {
-	var retVal = new Texture("__skip_ptr__")
-	retVal.__ptr = Polycode.ShaderBinding_loadTextureForParam(this.__ptr, paramName, fileName)
-	return retVal
-}
-
 ShaderBinding.prototype.setTextureForParam = function(paramName,texture) {
 	Polycode.ShaderBinding_setTextureForParam(this.__ptr, paramName, texture)
 }

+ 0 - 4
bindings/javascript/Polycode/ShaderProgram.js

@@ -32,7 +32,3 @@ Duktape.fin(ShaderProgram.prototype, function (x) {
 ShaderProgram.prototype.reloadProgram = function() {
 	Polycode.ShaderProgram_reloadProgram(this.__ptr)
 }
-
-ShaderProgram.prototype.reloadResource = function() {
-	Polycode.ShaderProgram_reloadResource(this.__ptr)
-}

+ 4 - 12
bindings/javascript/Polycode/Skeleton.js

@@ -1,8 +1,8 @@
 require('Polycode/Entity')
 
-function Skeleton(fileName) {
+function Skeleton() {
 	if(arguments[0] != "__skip_ptr__") {
-		this.__ptr = Polycode.Skeleton(fileName)
+		this.__ptr = Polycode.Skeleton()
 	}
 }
 
@@ -16,10 +16,6 @@ Duktape.fin(Skeleton.prototype, function (x) {
 	Polycode.Skeleton__delete(x.__ptr)
 })
 
-Skeleton.prototype.loadSkeleton = function(fileName) {
-	Polycode.Skeleton_loadSkeleton(this.__ptr, fileName)
-}
-
 Skeleton.prototype.playAnimationByName = function(animName,weight,once,restartIfPlaying) {
 	Polycode.Skeleton_playAnimationByName(this.__ptr, animName, weight, once, restartIfPlaying)
 }
@@ -32,16 +28,12 @@ Skeleton.prototype.stopAllAnimations = function() {
 	Polycode.Skeleton_stopAllAnimations(this.__ptr)
 }
 
-Skeleton.prototype.addAnimation = function(name,fileName) {
-	Polycode.Skeleton_addAnimation(this.__ptr, name, fileName)
-}
-
 Skeleton.prototype.stopAnimationByName = function(name) {
 	Polycode.Skeleton_stopAnimationByName(this.__ptr, name)
 }
 
-Skeleton.prototype.Update = function() {
-	Polycode.Skeleton_Update(this.__ptr)
+Skeleton.prototype.Update = function(elapsed) {
+	Polycode.Skeleton_Update(this.__ptr, elapsed)
 }
 
 Skeleton.prototype.getBoneByName = function(name) {

+ 2 - 2
bindings/javascript/Polycode/SkeletonAnimation.js

@@ -28,8 +28,8 @@ SkeletonAnimation.prototype.Reset = function() {
 	Polycode.SkeletonAnimation_Reset(this.__ptr)
 }
 
-SkeletonAnimation.prototype.Update = function() {
-	Polycode.SkeletonAnimation_Update(this.__ptr)
+SkeletonAnimation.prototype.Update = function(elapsed) {
+	Polycode.SkeletonAnimation_Update(this.__ptr, elapsed)
 }
 
 SkeletonAnimation.prototype.setSpeed = function(speed) {

+ 2 - 14
bindings/javascript/Polycode/Sound.js

@@ -1,6 +1,6 @@
-function Sound(fileName) {
+function Sound() {
 	if(arguments[0] != "__skip_ptr__") {
-		this.__ptr = Polycode.Sound(fileName)
+		this.__ptr = Polycode.Sound()
 	}
 }
 
@@ -16,10 +16,6 @@ Sound.prototype.getSampleAsNumber = function(offset,channel,position,orientation
 	return Polycode.Sound_getSampleAsNumber(this.__ptr, offset, channel, position, orientation)
 }
 
-Sound.prototype.loadFile = function(fileName) {
-	Polycode.Sound_loadFile(this.__ptr, fileName)
-}
-
 Sound.prototype.Play = function(loop,restartSound) {
 	Polycode.Sound_Play(this.__ptr, loop, restartSound)
 }
@@ -120,14 +116,6 @@ Sound.prototype.getMaxDistance = function() {
 	return Polycode.Sound_getMaxDistance(this.__ptr)
 }
 
-Sound.prototype.loadWAV = function(fileName) {
-	return Polycode.Sound_loadWAV(this.__ptr, fileName)
-}
-
-Sound.prototype.loadOGG = function(fileName) {
-	return Polycode.Sound_loadOGG(this.__ptr, fileName)
-}
-
 Sound.prototype.soundCheck = function(result,err) {
 	Polycode.Sound_soundCheck(this.__ptr, result, err)
 }

+ 0 - 4
bindings/javascript/Polycode/Texture.js

@@ -74,10 +74,6 @@ Texture.prototype.__set_depthTexture = function(val) {
 }
 
 
-Texture.prototype.reloadResource = function() {
-	Polycode.Texture_reloadResource(this.__ptr)
-}
-
 Texture.prototype.getWidth = function() {
 	return Polycode.Texture_getWidth(this.__ptr)
 }

BIN
bindings/javascript/js_Polycode.pak


+ 1 - 2
bindings/lua/Polycode.lua

@@ -15,7 +15,6 @@ require "Polycode/CoreFileExtension"
 require "Polycode/OSFileEntry"
 require "Polycode/CoreInput"
 require "Polycode/JoystickInfo"
-require "Polycode/CoreServices"
 require "Polycode/Data"
 require "Polycode/MouseEventResult"
 require "Polycode/EntityProp"
@@ -58,6 +57,7 @@ require "Polycode/RendererThreadJob"
 require "Polycode/RenderThread"
 require "Polycode/RenderThreadDebugInfo"
 require "Polycode/Renderer"
+require "Polycode/RendererPlatformData"
 require "Polycode/Resource"
 require "Polycode/ScriptResourceLoader"
 require "Polycode/ResourcePool"
@@ -106,7 +106,6 @@ require "Polycode/SoundManager"
 require "Polycode/String"
 require "Polycode/RenderBuffer"
 require "Polycode/Texture"
-require "Polycode/Timer"
 require "Polycode/Vector2"
 require "Polycode/Vector3"
 require "Polycode/Vector4"

+ 0 - 4
bindings/lua/Polycode/Camera.lua

@@ -145,10 +145,6 @@ function Camera:setPostFilter(material)
 	local retVal = Polycode.Camera_setPostFilter(self.__ptr, material.__ptr)
 end
 
-function Camera:setPostFilterByName(shaderName)
-	local retVal = Polycode.Camera_setPostFilterByName(self.__ptr, shaderName)
-end
-
 function Camera:removePostFilter()
 	local retVal =  Polycode.Camera_removePostFilter(self.__ptr)
 end

+ 8 - 0
bindings/lua/Polycode/Core.lua

@@ -315,6 +315,14 @@ function Core:makeApplicationMain()
 	local retVal =  Polycode.Core_makeApplicationMain(self.__ptr)
 end
 
+function Core:getConfig()
+	local retVal =  Polycode.Core_getConfig(self.__ptr)
+	if retVal == nil then return nil end
+	local __c = _G["ConfigRef"]("__skip_ptr__")
+	__c.__ptr = retVal
+	return __c
+end
+
 function Core:__delete()
 	if self then Polycode.delete_Core(self.__ptr) end
 end

+ 0 - 5
bindings/lua/Polycode/CoreInput.lua

@@ -13,8 +13,6 @@ function CoreInput:__getvar(name)
 		return Polycode.CoreInput_get_simulateTouchAsPen(self.__ptr)
 	elseif name == "simulateMouseWithTouch" then
 		return Polycode.CoreInput_get_simulateMouseWithTouch(self.__ptr)
-	elseif name == "ignoreOffScreenTouch" then
-		return Polycode.CoreInput_get_ignoreOffScreenTouch(self.__ptr)
 	elseif name == "keyRepeat" then
 		return Polycode.CoreInput_get_keyRepeat(self.__ptr)
 	elseif name == "mousePosition" then
@@ -45,9 +43,6 @@ function CoreInput:__setvar(name,value)
 	elseif name == "simulateMouseWithTouch" then
 		Polycode.CoreInput_set_simulateMouseWithTouch(self.__ptr, value)
 		return true
-	elseif name == "ignoreOffScreenTouch" then
-		Polycode.CoreInput_set_ignoreOffScreenTouch(self.__ptr, value)
-		return true
 	elseif name == "keyRepeat" then
 		Polycode.CoreInput_set_keyRepeat(self.__ptr, value)
 		return true

+ 0 - 10
bindings/lua/Polycode/Data.lua

@@ -15,11 +15,6 @@ function Data:Data(...)
 	end
 end
 
-function Data:loadFromFile(fileName)
-	local retVal = Polycode.Data_loadFromFile(self.__ptr, fileName)
-	return retVal
-end
-
 function Data:getAsString(encoding)
 	local retVal = Polycode.Data_getAsString(self.__ptr, encoding)
 	return retVal
@@ -29,11 +24,6 @@ function Data:setFromString(str, encoding)
 	local retVal = Polycode.Data_setFromString(self.__ptr, str, encoding)
 end
 
-function Data:saveToFile(fileName)
-	local retVal = Polycode.Data_saveToFile(self.__ptr, fileName)
-	return retVal
-end
-
 function Data:__delete()
 	if self then Polycode.delete_Data(self.__ptr) end
 end

+ 4 - 4
bindings/lua/Polycode/Entity.lua

@@ -163,8 +163,8 @@ function Entity:initEntity()
 	local retVal =  Polycode.Entity_initEntity(self.__ptr)
 end
 
-function Entity:Update()
-	local retVal =  Polycode.Entity_Update(self.__ptr)
+function Entity:Update(elapsed)
+	local retVal = Polycode.Entity_Update(self.__ptr, elapsed)
 end
 
 function Entity:fixedUpdate()
@@ -545,8 +545,8 @@ function Entity:getInverseY()
 	return retVal
 end
 
-function Entity:doUpdates()
-	local retVal =  Polycode.Entity_doUpdates(self.__ptr)
+function Entity:doUpdates(elapsed)
+	local retVal = Polycode.Entity_doUpdates(self.__ptr, elapsed)
 end
 
 function Entity:doFixedUpdates()

+ 1 - 0
bindings/lua/Polycode/Event.lua

@@ -10,6 +10,7 @@ Event.RESOURCE_RELOAD_EVENT = Event.EVENTBASE_EVENT + 5
 Event.SELECT_EVENT = Event.EVENTBASE_EVENT + 6
 Event.REMOVE_EVENT = Event.EVENTBASE_EVENT + 7
 Event.RESOURCE_CHANGE_EVENT = Event.EVENTBASE_EVENT + 8
+Event.RESOURCE_DESTROY_EVENT = Event.EVENTBASE_EVENT + 9
 Event.EVENTBASE_NONPOLYCODE = 0x10000
 
 function Event:__getvar(name)

+ 0 - 29
bindings/lua/Polycode/Image.lua

@@ -4,30 +4,6 @@ Image.IMAGE_RGB = 0
 Image.IMAGE_RGBA = 1
 Image.IMAGE_FP16 = 2
 
-function Image:Image(...)
-	local arg = {...}
-	for k,v in pairs(arg) do
-		if type(v) == "table" then
-			if v.__ptr ~= nil then
-				arg[k] = v.__ptr
-			end
-		end
-	end
-	if self.__ptr == nil and arg[1] ~= "__skip_ptr__" then
-		self.__ptr = Polycode.Image(unpack(arg))
-	end
-end
-
-function Image:loadImage(fileName)
-	local retVal = Polycode.Image_loadImage(self.__ptr, fileName)
-	return retVal
-end
-
-function Image:saveImage(fileName)
-	local retVal = Polycode.Image_saveImage(self.__ptr, fileName)
-	return retVal
-end
-
 function Image:createEmpty(width, height, fillColor)
 	local retVal = Polycode.Image_createEmpty(self.__ptr, width, height, fillColor.__ptr)
 end
@@ -118,11 +94,6 @@ function Image:premultiplyAlpha()
 	local retVal =  Polycode.Image_premultiplyAlpha(self.__ptr)
 end
 
-function Image:savePNG(fileName)
-	local retVal = Polycode.Image_savePNG(self.__ptr, fileName)
-	return retVal
-end
-
 function Image:__delete()
 	if self then Polycode.delete_Image(self.__ptr) end
 end

+ 2 - 2
bindings/lua/Polycode/Material.lua

@@ -79,8 +79,8 @@ function Material:removeShaderRenderTarget(index)
 	local retVal = Polycode.Material_removeShaderRenderTarget(self.__ptr, index)
 end
 
-function Material:recreateRenderTargets()
-	local retVal =  Polycode.Material_recreateRenderTargets(self.__ptr)
+function Material:recreateRenderTargets(screenSize)
+	local retVal = Polycode.Material_recreateRenderTargets(self.__ptr, screenSize.__ptr)
 end
 
 function Material:getName()

+ 0 - 8
bindings/lua/Polycode/Mesh.lua

@@ -23,14 +23,6 @@ function Mesh:Mesh(...)
 	end
 end
 
-function Mesh:loadMesh(fileName)
-	local retVal = Polycode.Mesh_loadMesh(self.__ptr, fileName)
-end
-
-function Mesh:saveToFile(fileName, writeNormals, writeTangents, writeColors, writeBoneWeights, writeUVs, writeSecondaryUVs)
-	local retVal = Polycode.Mesh_saveToFile(self.__ptr, fileName, writeNormals, writeTangents, writeColors, writeBoneWeights, writeUVs, writeSecondaryUVs)
-end
-
 function Mesh:addSubmesh(newSubmesh)
 	local retVal = Polycode.Mesh_addSubmesh(self.__ptr, newSubmesh.__ptr)
 end

+ 26 - 0
bindings/lua/Polycode/RenderBuffer.lua

@@ -1,6 +1,32 @@
 class "RenderBuffer"
 
 
+function RenderBuffer:__getvar(name)
+	if name == "platformData" then
+		local retVal = Polycode.RenderBuffer_get_platformData(self.__ptr)
+		if retVal == nil then return nil end
+		local __c = _G["RendererPlatformData"]("__skip_ptr__")
+		__c.__ptr = retVal
+		return __c
+	elseif name == "depthBufferPlatformData" then
+		local retVal = Polycode.RenderBuffer_get_depthBufferPlatformData(self.__ptr)
+		if retVal == nil then return nil end
+		local __c = _G["RendererPlatformData"]("__skip_ptr__")
+		__c.__ptr = retVal
+		return __c
+	end
+end
+
+function RenderBuffer:__setvar(name,value)
+	if name == "platformData" then
+		Polycode.RenderBuffer_set_platformData(self.__ptr, value.__ptr)
+		return true
+	elseif name == "depthBufferPlatformData" then
+		Polycode.RenderBuffer_set_depthBufferPlatformData(self.__ptr, value.__ptr)
+		return true
+	end
+	return false
+end
 function RenderBuffer:RenderBuffer(...)
 	local arg = {...}
 	for k,v in pairs(arg) do

+ 9 - 0
bindings/lua/Polycode/RenderDataArray.lua

@@ -20,6 +20,12 @@ function RenderDataArray:__getvar(name)
 		return Polycode.RenderDataArray_get_type(self.__ptr)
 	elseif name == "customArrayName" then
 		return Polycode.RenderDataArray_get_customArrayName(self.__ptr)
+	elseif name == "platformData" then
+		local retVal = Polycode.RenderDataArray_get_platformData(self.__ptr)
+		if retVal == nil then return nil end
+		local __c = _G["RendererPlatformData"]("__skip_ptr__")
+		__c.__ptr = retVal
+		return __c
 	end
 end
 
@@ -30,6 +36,9 @@ function RenderDataArray:__setvar(name,value)
 	elseif name == "customArrayName" then
 		Polycode.RenderDataArray_set_customArrayName(self.__ptr, value)
 		return true
+	elseif name == "platformData" then
+		Polycode.RenderDataArray_set_platformData(self.__ptr, value.__ptr)
+		return true
 	end
 	return false
 end

+ 39 - 0
bindings/lua/Polycode/RendererPlatformData.lua

@@ -0,0 +1,39 @@
+class "RendererPlatformData"
+
+RendererPlatformData.PLATFORM_DATA_NONE = 0
+RendererPlatformData.PLATFORM_DATA_TEXTURE = 1
+RendererPlatformData.PLATFORM_DATA_RENDER_BUFFER = 2
+RendererPlatformData.PLATFORM_DATA_PROGRAM = 3
+RendererPlatformData.PLATFORM_DATA_SHADER = 4
+RendererPlatformData.PLATFORM_DATA_SUBMESH = 5
+
+function RendererPlatformData:__getvar(name)
+	if name == "type" then
+		return Polycode.RendererPlatformData_get_type(self.__ptr)
+	end
+end
+
+function RendererPlatformData:__setvar(name,value)
+	if name == "type" then
+		Polycode.RendererPlatformData_set_type(self.__ptr, value)
+		return true
+	end
+	return false
+end
+function RendererPlatformData:RendererPlatformData(...)
+	local arg = {...}
+	for k,v in pairs(arg) do
+		if type(v) == "table" then
+			if v.__ptr ~= nil then
+				arg[k] = v.__ptr
+			end
+		end
+	end
+	if self.__ptr == nil and arg[1] ~= "__skip_ptr__" then
+		self.__ptr = Polycode.RendererPlatformData(unpack(arg))
+	end
+end
+
+function RendererPlatformData:__delete()
+	if self then Polycode.delete_RendererPlatformData(self.__ptr) end
+end

+ 9 - 4
bindings/lua/Polycode/Resource.lua

@@ -22,6 +22,12 @@ function Resource:__getvar(name)
 		local __c = _G["size_t"]("__skip_ptr__")
 		__c.__ptr = retVal
 		return __c
+	elseif name == "platformData" then
+		local retVal = Polycode.Resource_get_platformData(self.__ptr)
+		if retVal == nil then return nil end
+		local __c = _G["RendererPlatformData"]("__skip_ptr__")
+		__c.__ptr = retVal
+		return __c
 	end
 	if EventDispatcher["__getvar"] ~= nil then
 		return EventDispatcher.__getvar(self, name)
@@ -35,6 +41,9 @@ function Resource:__setvar(name,value)
 	elseif name == "resourceFileTime" then
 		Polycode.Resource_set_resourceFileTime(self.__ptr, value.__ptr)
 		return true
+	elseif name == "platformData" then
+		Polycode.Resource_set_platformData(self.__ptr, value.__ptr)
+		return true
 	end
 	if EventDispatcher["__setvar"] ~= nil then
 		return EventDispatcher.__setvar(self, name, value)
@@ -62,10 +71,6 @@ function Resource:Resource(...)
 	end
 end
 
-function Resource:reloadResource()
-	local retVal =  Polycode.Resource_reloadResource(self.__ptr)
-end
-
 function Resource:getResourceName()
 	local retVal =  Polycode.Resource_getResourceName(self.__ptr)
 	return retVal

+ 40 - 0
bindings/lua/Polycode/ResourcePool.lua

@@ -103,6 +103,46 @@ function ResourcePool:getResource(resourceType, resourceName)
 	return __c
 end
 
+function ResourcePool:getFont(name)
+	local retVal = Polycode.ResourcePool_getFont(self.__ptr, name)
+	if retVal == nil then return nil end
+	local __c = _G["shared_ptr<Font>"]("__skip_ptr__")
+	__c.__ptr = retVal
+	return __c
+end
+
+function ResourcePool:getMaterial(name)
+	local retVal = Polycode.ResourcePool_getMaterial(self.__ptr, name)
+	if retVal == nil then return nil end
+	local __c = _G["shared_ptr<Material>"]("__skip_ptr__")
+	__c.__ptr = retVal
+	return __c
+end
+
+function ResourcePool:getShader(name)
+	local retVal = Polycode.ResourcePool_getShader(self.__ptr, name)
+	if retVal == nil then return nil end
+	local __c = _G["shared_ptr<Shader>"]("__skip_ptr__")
+	__c.__ptr = retVal
+	return __c
+end
+
+function ResourcePool:loadTexture(name)
+	local retVal = Polycode.ResourcePool_loadTexture(self.__ptr, name)
+	if retVal == nil then return nil end
+	local __c = _G["shared_ptr<Texture>"]("__skip_ptr__")
+	__c.__ptr = retVal
+	return __c
+end
+
+function ResourcePool:loadMesh(name)
+	local retVal = Polycode.ResourcePool_loadMesh(self.__ptr, name)
+	if retVal == nil then return nil end
+	local __c = _G["shared_ptr<Mesh>"]("__skip_ptr__")
+	__c.__ptr = retVal
+	return __c
+end
+
 function ResourcePool:getName()
 	local retVal =  Polycode.ResourcePool_getName(self.__ptr)
 	return retVal

+ 2 - 2
bindings/lua/Polycode/Scene.lua

@@ -132,8 +132,8 @@ function Scene:fixedUpdate()
 	local retVal =  Polycode.Scene_fixedUpdate(self.__ptr)
 end
 
-function Scene:Update()
-	local retVal =  Polycode.Scene_Update(self.__ptr)
+function Scene:Update(elapsed)
+	local retVal = Polycode.Scene_Update(self.__ptr, elapsed)
 end
 
 function Scene:isEnabled()

+ 0 - 20
bindings/lua/Polycode/SceneEntityInstance.lua

@@ -28,26 +28,6 @@ function SceneEntityInstance:__setvar(name,value)
 		return false
 	end
 end
-function SceneEntityInstance:SceneEntityInstance(...)
-	local arg = {...}
-	if type(arg[1]) == "table" and count(arg) == 1 then
-		if ""..arg[1].__classname == "Entity" then
-			self.__ptr = arg[1].__ptr
-			return
-		end
-	end
-	for k,v in pairs(arg) do
-		if type(v) == "table" then
-			if v.__ptr ~= nil then
-				arg[k] = v.__ptr
-			end
-		end
-	end
-	if self.__ptr == nil and arg[1] ~= "__skip_ptr__" then
-		self.__ptr = Polycode.SceneEntityInstance(unpack(arg))
-	end
-end
-
 function SceneEntityInstance:reloadEntityInstance()
 	local retVal =  Polycode.SceneEntityInstance_reloadEntityInstance(self.__ptr)
 end

+ 0 - 4
bindings/lua/Polycode/SceneEntityInstanceResourceEntry.lua

@@ -23,10 +23,6 @@ function SceneEntityInstanceResourceEntry:SceneEntityInstanceResourceEntry(...)
 	end
 end
 
-function SceneEntityInstanceResourceEntry:reloadResource()
-	local retVal =  Polycode.SceneEntityInstanceResourceEntry_reloadResource(self.__ptr)
-end
-
 function SceneEntityInstanceResourceEntry:__delete()
 	if self then Polycode.delete_SceneEntityInstanceResourceEntry(self.__ptr) end
 end

+ 0 - 12
bindings/lua/Polycode/SceneMesh.lua

@@ -110,14 +110,6 @@ function SceneMesh:getMaterial()
 	return __c
 end
 
-function SceneMesh:loadSkeleton(fileName)
-	local retVal = Polycode.SceneMesh_loadSkeleton(self.__ptr, fileName)
-	if retVal == nil then return nil end
-	local __c = _G["shared_ptr<Skeleton>"]("__skip_ptr__")
-	__c.__ptr = retVal
-	return __c
-end
-
 function SceneMesh:clearMaterial()
 	local retVal =  Polycode.SceneMesh_clearMaterial(self.__ptr)
 end
@@ -155,10 +147,6 @@ function SceneMesh:setFilename(fileName)
 	local retVal = Polycode.SceneMesh_setFilename(self.__ptr, fileName)
 end
 
-function SceneMesh:loadFromFile(fileName)
-	local retVal = Polycode.SceneMesh_loadFromFile(self.__ptr, fileName)
-end
-
 function SceneMesh:customHitDetection(ray)
 	local retVal = Polycode.SceneMesh_customHitDetection(self.__ptr, ray.__ptr)
 	return retVal

+ 2 - 2
bindings/lua/Polycode/SceneParticleEmitter.lua

@@ -163,8 +163,8 @@ function SceneParticleEmitter:fixedUpdate()
 	local retVal =  Polycode.SceneParticleEmitter_fixedUpdate(self.__ptr)
 end
 
-function SceneParticleEmitter:updateParticles()
-	local retVal =  Polycode.SceneParticleEmitter_updateParticles(self.__ptr)
+function SceneParticleEmitter:updateParticles(elapsed)
+	local retVal = Polycode.SceneParticleEmitter_updateParticles(self.__ptr, elapsed)
 end
 
 function SceneParticleEmitter:triggerParticles(allAtOnce)

+ 0 - 8
bindings/lua/Polycode/ShaderBinding.lua

@@ -56,14 +56,6 @@ function ShaderBinding:removeParam(name)
 	local retVal = Polycode.ShaderBinding_removeParam(self.__ptr, name)
 end
 
-function ShaderBinding:loadTextureForParam(paramName, fileName)
-	local retVal = Polycode.ShaderBinding_loadTextureForParam(self.__ptr, paramName, fileName)
-	if retVal == nil then return nil end
-	local __c = _G["shared_ptr<Texture>"]("__skip_ptr__")
-	__c.__ptr = retVal
-	return __c
-end
-
 function ShaderBinding:setTextureForParam(paramName, texture)
 	local retVal = Polycode.ShaderBinding_setTextureForParam(self.__ptr, paramName, texture.__ptr)
 end

+ 0 - 4
bindings/lua/Polycode/ShaderProgram.lua

@@ -49,10 +49,6 @@ function ShaderProgram:reloadProgram()
 	local retVal =  Polycode.ShaderProgram_reloadProgram(self.__ptr)
 end
 
-function ShaderProgram:reloadResource()
-	local retVal =  Polycode.ShaderProgram_reloadResource(self.__ptr)
-end
-
 function ShaderProgram:__delete()
 	if self then Polycode.delete_ShaderProgram(self.__ptr) end
 end

+ 2 - 10
bindings/lua/Polycode/Skeleton.lua

@@ -23,10 +23,6 @@ function Skeleton:Skeleton(...)
 	end
 end
 
-function Skeleton:loadSkeleton(fileName)
-	local retVal = Polycode.Skeleton_loadSkeleton(self.__ptr, fileName)
-end
-
 function Skeleton:playAnimationByName(animName, weight, once, restartIfPlaying)
 	local retVal = Polycode.Skeleton_playAnimationByName(self.__ptr, animName, weight, once, restartIfPlaying)
 end
@@ -39,16 +35,12 @@ function Skeleton:stopAllAnimations()
 	local retVal =  Polycode.Skeleton_stopAllAnimations(self.__ptr)
 end
 
-function Skeleton:addAnimation(name, fileName)
-	local retVal = Polycode.Skeleton_addAnimation(self.__ptr, name, fileName)
-end
-
 function Skeleton:stopAnimationByName(name)
 	local retVal = Polycode.Skeleton_stopAnimationByName(self.__ptr, name)
 end
 
-function Skeleton:Update()
-	local retVal =  Polycode.Skeleton_Update(self.__ptr)
+function Skeleton:Update(elapsed)
+	local retVal = Polycode.Skeleton_Update(self.__ptr, elapsed)
 end
 
 function Skeleton:getBoneByName(name)

+ 2 - 2
bindings/lua/Polycode/SkeletonAnimation.lua

@@ -32,8 +32,8 @@ function SkeletonAnimation:Reset()
 	local retVal =  Polycode.SkeletonAnimation_Reset(self.__ptr)
 end
 
-function SkeletonAnimation:Update()
-	local retVal =  Polycode.SkeletonAnimation_Update(self.__ptr)
+function SkeletonAnimation:Update(elapsed)
+	local retVal = Polycode.SkeletonAnimation_Update(self.__ptr, elapsed)
 end
 
 function SkeletonAnimation:setSpeed(speed)

+ 0 - 14
bindings/lua/Polycode/Sound.lua

@@ -20,10 +20,6 @@ function Sound:getSampleAsNumber(offset, channel, position, orientation)
 	return retVal
 end
 
-function Sound:loadFile(fileName)
-	local retVal = Polycode.Sound_loadFile(self.__ptr, fileName)
-end
-
 function Sound:Play(loop, restartSound)
 	local retVal = Polycode.Sound_Play(self.__ptr, loop, restartSound)
 end
@@ -136,16 +132,6 @@ function Sound:getMaxDistance()
 	return retVal
 end
 
-function Sound:loadWAV(fileName)
-	local retVal = Polycode.Sound_loadWAV(self.__ptr, fileName)
-	return retVal
-end
-
-function Sound:loadOGG(fileName)
-	local retVal = Polycode.Sound_loadOGG(self.__ptr, fileName)
-	return retVal
-end
-
 function Sound:soundCheck(result, err)
 	local retVal = Polycode.Sound_soundCheck(self.__ptr, result, err)
 end

+ 0 - 4
bindings/lua/Polycode/Texture.lua

@@ -55,10 +55,6 @@ function Texture:__setvar(name,value)
 		return false
 	end
 end
-function Texture:reloadResource()
-	local retVal =  Polycode.Texture_reloadResource(self.__ptr)
-end
-
 function Texture:getWidth()
 	local retVal =  Polycode.Texture_getWidth(self.__ptr)
 	return retVal

BIN
bindings/lua/lua_Polycode.pak


+ 8 - 40
build/osx/PolycodeCore/PolycodeCore.xcodeproj/project.pbxproj

@@ -13,6 +13,8 @@
 		8A5EF4FC1CD90E4800F8466A /* PolycodeLua.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8A5EF4FB1CD90E4800F8466A /* PolycodeLua.cpp */; };
 		8A5EF4FF1CD90F0200F8466A /* PolycodeLua.h in Headers */ = {isa = PBXBuildFile; fileRef = 8A5EF4FD1CD90F0200F8466A /* PolycodeLua.h */; };
 		8A5EF5001CD90F0200F8466A /* PolycodeLuaWrappers.h in Headers */ = {isa = PBXBuildFile; fileRef = 8A5EF4FE1CD90F0200F8466A /* PolycodeLuaWrappers.h */; };
+		8A6010D21D4AC501009B0B35 /* PolyRendererPlatformData.h in Headers */ = {isa = PBXBuildFile; fileRef = 8A6010D11D4AC501009B0B35 /* PolyRendererPlatformData.h */; };
+		8A6010D41D4AC516009B0B35 /* PolyRendererPlatformData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8A6010D31D4AC516009B0B35 /* PolyRendererPlatformData.cpp */; };
 		8A7349081B86A53C00F660C0 /* lodepng.h in Headers */ = {isa = PBXBuildFile; fileRef = 8A7349071B86A53C00F660C0 /* lodepng.h */; };
 		8A73490A1B86A54800F660C0 /* lodepng.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8A7349091B86A54800F660C0 /* lodepng.cpp */; };
 		8A825F231B829BA70039E823 /* PolyPAAudioInterface.h in Headers */ = {isa = PBXBuildFile; fileRef = 8A825F221B829BA70039E823 /* PolyPAAudioInterface.h */; };
@@ -26,7 +28,6 @@
 		8A86523A1B72865C009F94DD /* PolyConfig.h in Headers */ = {isa = PBXBuildFile; fileRef = 8A8651EF1B72865C009F94DD /* PolyConfig.h */; };
 		8A86523B1B72865C009F94DD /* PolyCore.h in Headers */ = {isa = PBXBuildFile; fileRef = 8A8651F01B72865C009F94DD /* PolyCore.h */; };
 		8A86523C1B72865C009F94DD /* PolyCoreInput.h in Headers */ = {isa = PBXBuildFile; fileRef = 8A8651F11B72865C009F94DD /* PolyCoreInput.h */; };
-		8A86523D1B72865C009F94DD /* PolyCoreServices.h in Headers */ = {isa = PBXBuildFile; fileRef = 8A8651F21B72865C009F94DD /* PolyCoreServices.h */; };
 		8A86523E1B72865C009F94DD /* PolyCubemap.h in Headers */ = {isa = PBXBuildFile; fileRef = 8A8651F31B72865C009F94DD /* PolyCubemap.h */; };
 		8A86523F1B72865C009F94DD /* PolyData.h in Headers */ = {isa = PBXBuildFile; fileRef = 8A8651F41B72865C009F94DD /* PolyData.h */; };
 		8A8652401B72865C009F94DD /* PolyEntity.h in Headers */ = {isa = PBXBuildFile; fileRef = 8A8651F51B72865C009F94DD /* PolyEntity.h */; };
@@ -77,10 +78,6 @@
 		8A8652731B72865C009F94DD /* PolyString.h in Headers */ = {isa = PBXBuildFile; fileRef = 8A8652281B72865C009F94DD /* PolyString.h */; };
 		8A8652741B72865C009F94DD /* PolyTexture.h in Headers */ = {isa = PBXBuildFile; fileRef = 8A8652291B72865C009F94DD /* PolyTexture.h */; };
 		8A8652751B72865C009F94DD /* PolyThreaded.h in Headers */ = {isa = PBXBuildFile; fileRef = 8A86522A1B72865C009F94DD /* PolyThreaded.h */; };
-		8A8652761B72865C009F94DD /* PolyTimer.h in Headers */ = {isa = PBXBuildFile; fileRef = 8A86522B1B72865C009F94DD /* PolyTimer.h */; };
-		8A8652771B72865C009F94DD /* PolyTimerManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 8A86522C1B72865C009F94DD /* PolyTimerManager.h */; };
-		8A8652781B72865C009F94DD /* PolyTween.h in Headers */ = {isa = PBXBuildFile; fileRef = 8A86522D1B72865C009F94DD /* PolyTween.h */; };
-		8A8652791B72865C009F94DD /* PolyTweenManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 8A86522E1B72865C009F94DD /* PolyTweenManager.h */; };
 		8A86527A1B72865C009F94DD /* PolyVector2.h in Headers */ = {isa = PBXBuildFile; fileRef = 8A86522F1B72865C009F94DD /* PolyVector2.h */; };
 		8A86527B1B72865C009F94DD /* PolyVector3.h in Headers */ = {isa = PBXBuildFile; fileRef = 8A8652301B72865C009F94DD /* PolyVector3.h */; };
 		8A86527C1B72865C009F94DD /* PolyVector4.h in Headers */ = {isa = PBXBuildFile; fileRef = 8A8652311B72865C009F94DD /* PolyVector4.h */; };
@@ -98,7 +95,6 @@
 		8A8652DC1B72867F009F94DD /* PolyConfig.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8A8652911B72867E009F94DD /* PolyConfig.cpp */; };
 		8A8652DD1B72867F009F94DD /* PolyCore.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8A8652921B72867E009F94DD /* PolyCore.cpp */; };
 		8A8652DE1B72867F009F94DD /* PolyCoreInput.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8A8652931B72867E009F94DD /* PolyCoreInput.cpp */; };
-		8A8652DF1B72867F009F94DD /* PolyCoreServices.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8A8652941B72867E009F94DD /* PolyCoreServices.cpp */; };
 		8A8652E01B72867F009F94DD /* PolyCubemap.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8A8652951B72867E009F94DD /* PolyCubemap.cpp */; };
 		8A8652E11B72867F009F94DD /* PolyData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8A8652961B72867E009F94DD /* PolyData.cpp */; };
 		8A8652E21B72867F009F94DD /* PolyEntity.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8A8652971B72867E009F94DD /* PolyEntity.cpp */; };
@@ -146,10 +142,6 @@
 		8A8653111B72867F009F94DD /* PolyString.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8A8652C61B72867F009F94DD /* PolyString.cpp */; };
 		8A8653121B72867F009F94DD /* PolyTexture.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8A8652C71B72867F009F94DD /* PolyTexture.cpp */; };
 		8A8653131B72867F009F94DD /* PolyThreaded.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8A8652C81B72867F009F94DD /* PolyThreaded.cpp */; };
-		8A8653141B72867F009F94DD /* PolyTimer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8A8652C91B72867F009F94DD /* PolyTimer.cpp */; };
-		8A8653151B72867F009F94DD /* PolyTimerManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8A8652CA1B72867F009F94DD /* PolyTimerManager.cpp */; };
-		8A8653161B72867F009F94DD /* PolyTween.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8A8652CB1B72867F009F94DD /* PolyTween.cpp */; };
-		8A8653171B72867F009F94DD /* PolyTweenManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8A8652CC1B72867F009F94DD /* PolyTweenManager.cpp */; };
 		8A8653181B72867F009F94DD /* PolyVector2.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8A8652CD1B72867F009F94DD /* PolyVector2.cpp */; };
 		8A8653191B72867F009F94DD /* PolyVector3.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8A8652CE1B72867F009F94DD /* PolyVector3.cpp */; };
 		8A86531A1B72867F009F94DD /* PolyVector4.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8A8652CF1B72867F009F94DD /* PolyVector4.cpp */; };
@@ -177,6 +169,8 @@
 		8A5EF4FB1CD90E4800F8466A /* PolycodeLua.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PolycodeLua.cpp; path = ../../../src/bindings/lua/PolycodeLua.cpp; sourceTree = "<group>"; };
 		8A5EF4FD1CD90F0200F8466A /* PolycodeLua.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PolycodeLua.h; path = ../../../include/polycode/bindings/lua/PolycodeLua.h; sourceTree = "<group>"; };
 		8A5EF4FE1CD90F0200F8466A /* PolycodeLuaWrappers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PolycodeLuaWrappers.h; path = ../../../include/polycode/bindings/lua/PolycodeLuaWrappers.h; sourceTree = "<group>"; };
+		8A6010D11D4AC501009B0B35 /* PolyRendererPlatformData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PolyRendererPlatformData.h; path = ../../../include/polycode/core/PolyRendererPlatformData.h; sourceTree = "<group>"; };
+		8A6010D31D4AC516009B0B35 /* PolyRendererPlatformData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PolyRendererPlatformData.cpp; path = ../../../src/core/PolyRendererPlatformData.cpp; sourceTree = "<group>"; };
 		8A7349071B86A53C00F660C0 /* lodepng.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = lodepng.h; path = ../../../include/lodepng.h; sourceTree = "<group>"; };
 		8A7349091B86A54800F660C0 /* lodepng.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = lodepng.cpp; path = ../../../src/core/lodepng.cpp; sourceTree = "<group>"; };
 		8A825F221B829BA70039E823 /* PolyPAAudioInterface.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PolyPAAudioInterface.h; path = ../../../include/polycode/core/PolyPAAudioInterface.h; sourceTree = "<group>"; };
@@ -190,7 +184,6 @@
 		8A8651EF1B72865C009F94DD /* PolyConfig.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PolyConfig.h; path = ../../../include/polycode/core/PolyConfig.h; sourceTree = "<group>"; };
 		8A8651F01B72865C009F94DD /* PolyCore.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PolyCore.h; path = ../../../include/polycode/core/PolyCore.h; sourceTree = "<group>"; };
 		8A8651F11B72865C009F94DD /* PolyCoreInput.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PolyCoreInput.h; path = ../../../include/polycode/core/PolyCoreInput.h; sourceTree = "<group>"; };
-		8A8651F21B72865C009F94DD /* PolyCoreServices.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PolyCoreServices.h; path = ../../../include/polycode/core/PolyCoreServices.h; sourceTree = "<group>"; };
 		8A8651F31B72865C009F94DD /* PolyCubemap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PolyCubemap.h; path = ../../../include/polycode/core/PolyCubemap.h; sourceTree = "<group>"; };
 		8A8651F41B72865C009F94DD /* PolyData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PolyData.h; path = ../../../include/polycode/core/PolyData.h; sourceTree = "<group>"; };
 		8A8651F51B72865C009F94DD /* PolyEntity.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PolyEntity.h; path = ../../../include/polycode/core/PolyEntity.h; sourceTree = "<group>"; };
@@ -241,10 +234,6 @@
 		8A8652281B72865C009F94DD /* PolyString.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PolyString.h; path = ../../../include/polycode/core/PolyString.h; sourceTree = "<group>"; };
 		8A8652291B72865C009F94DD /* PolyTexture.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PolyTexture.h; path = ../../../include/polycode/core/PolyTexture.h; sourceTree = "<group>"; };
 		8A86522A1B72865C009F94DD /* PolyThreaded.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PolyThreaded.h; path = ../../../include/polycode/core/PolyThreaded.h; sourceTree = "<group>"; };
-		8A86522B1B72865C009F94DD /* PolyTimer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PolyTimer.h; path = ../../../include/polycode/core/PolyTimer.h; sourceTree = "<group>"; };
-		8A86522C1B72865C009F94DD /* PolyTimerManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PolyTimerManager.h; path = ../../../include/polycode/core/PolyTimerManager.h; sourceTree = "<group>"; };
-		8A86522D1B72865C009F94DD /* PolyTween.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PolyTween.h; path = ../../../include/polycode/core/PolyTween.h; sourceTree = "<group>"; };
-		8A86522E1B72865C009F94DD /* PolyTweenManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PolyTweenManager.h; path = ../../../include/polycode/core/PolyTweenManager.h; sourceTree = "<group>"; };
 		8A86522F1B72865C009F94DD /* PolyVector2.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PolyVector2.h; path = ../../../include/polycode/core/PolyVector2.h; sourceTree = "<group>"; };
 		8A8652301B72865C009F94DD /* PolyVector3.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PolyVector3.h; path = ../../../include/polycode/core/PolyVector3.h; sourceTree = "<group>"; };
 		8A8652311B72865C009F94DD /* PolyVector4.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PolyVector4.h; path = ../../../include/polycode/core/PolyVector4.h; sourceTree = "<group>"; };
@@ -262,7 +251,6 @@
 		8A8652911B72867E009F94DD /* PolyConfig.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PolyConfig.cpp; path = ../../../src/core/PolyConfig.cpp; sourceTree = "<group>"; };
 		8A8652921B72867E009F94DD /* PolyCore.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PolyCore.cpp; path = ../../../src/core/PolyCore.cpp; sourceTree = "<group>"; };
 		8A8652931B72867E009F94DD /* PolyCoreInput.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PolyCoreInput.cpp; path = ../../../src/core/PolyCoreInput.cpp; sourceTree = "<group>"; };
-		8A8652941B72867E009F94DD /* PolyCoreServices.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PolyCoreServices.cpp; path = ../../../src/core/PolyCoreServices.cpp; sourceTree = "<group>"; };
 		8A8652951B72867E009F94DD /* PolyCubemap.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PolyCubemap.cpp; path = ../../../src/core/PolyCubemap.cpp; sourceTree = "<group>"; };
 		8A8652961B72867E009F94DD /* PolyData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PolyData.cpp; path = ../../../src/core/PolyData.cpp; sourceTree = "<group>"; };
 		8A8652971B72867E009F94DD /* PolyEntity.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PolyEntity.cpp; path = ../../../src/core/PolyEntity.cpp; sourceTree = "<group>"; };
@@ -310,10 +298,6 @@
 		8A8652C61B72867F009F94DD /* PolyString.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PolyString.cpp; path = ../../../src/core/PolyString.cpp; sourceTree = "<group>"; };
 		8A8652C71B72867F009F94DD /* PolyTexture.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PolyTexture.cpp; path = ../../../src/core/PolyTexture.cpp; sourceTree = "<group>"; };
 		8A8652C81B72867F009F94DD /* PolyThreaded.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PolyThreaded.cpp; path = ../../../src/core/PolyThreaded.cpp; sourceTree = "<group>"; };
-		8A8652C91B72867F009F94DD /* PolyTimer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PolyTimer.cpp; path = ../../../src/core/PolyTimer.cpp; sourceTree = "<group>"; };
-		8A8652CA1B72867F009F94DD /* PolyTimerManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PolyTimerManager.cpp; path = ../../../src/core/PolyTimerManager.cpp; sourceTree = "<group>"; };
-		8A8652CB1B72867F009F94DD /* PolyTween.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PolyTween.cpp; path = ../../../src/core/PolyTween.cpp; sourceTree = "<group>"; };
-		8A8652CC1B72867F009F94DD /* PolyTweenManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PolyTweenManager.cpp; path = ../../../src/core/PolyTweenManager.cpp; sourceTree = "<group>"; };
 		8A8652CD1B72867F009F94DD /* PolyVector2.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PolyVector2.cpp; path = ../../../src/core/PolyVector2.cpp; sourceTree = "<group>"; };
 		8A8652CE1B72867F009F94DD /* PolyVector3.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PolyVector3.cpp; path = ../../../src/core/PolyVector3.cpp; sourceTree = "<group>"; };
 		8A8652CF1B72867F009F94DD /* PolyVector4.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PolyVector4.cpp; path = ../../../src/core/PolyVector4.cpp; sourceTree = "<group>"; };
@@ -374,7 +358,6 @@
 				8A8652911B72867E009F94DD /* PolyConfig.cpp */,
 				8A8652921B72867E009F94DD /* PolyCore.cpp */,
 				8A8652931B72867E009F94DD /* PolyCoreInput.cpp */,
-				8A8652941B72867E009F94DD /* PolyCoreServices.cpp */,
 				8A8652951B72867E009F94DD /* PolyCubemap.cpp */,
 				8A8652961B72867E009F94DD /* PolyData.cpp */,
 				8A8652971B72867E009F94DD /* PolyEntity.cpp */,
@@ -401,6 +384,7 @@
 				8A8652AF1B72867F009F94DD /* PolyRectangle.cpp */,
 				8A8652B01B72867F009F94DD /* PolyRenderDataArray.cpp */,
 				8A8652B11B72867F009F94DD /* PolyRenderer.cpp */,
+				8A6010D31D4AC516009B0B35 /* PolyRendererPlatformData.cpp */,
 				8A8652B21B72867F009F94DD /* PolyResource.cpp */,
 				8A8652B31B72867F009F94DD /* PolyResourceManager.cpp */,
 				8A8652B41B72867F009F94DD /* PolyScene.cpp */,
@@ -423,10 +407,6 @@
 				8A8652C61B72867F009F94DD /* PolyString.cpp */,
 				8A8652C71B72867F009F94DD /* PolyTexture.cpp */,
 				8A8652C81B72867F009F94DD /* PolyThreaded.cpp */,
-				8A8652C91B72867F009F94DD /* PolyTimer.cpp */,
-				8A8652CA1B72867F009F94DD /* PolyTimerManager.cpp */,
-				8A8652CB1B72867F009F94DD /* PolyTween.cpp */,
-				8A8652CC1B72867F009F94DD /* PolyTweenManager.cpp */,
 				8A8652CD1B72867F009F94DD /* PolyVector2.cpp */,
 				8A8652CE1B72867F009F94DD /* PolyVector3.cpp */,
 				8A8652CF1B72867F009F94DD /* PolyVector4.cpp */,
@@ -467,7 +447,6 @@
 				8A8651EF1B72865C009F94DD /* PolyConfig.h */,
 				8A8651F01B72865C009F94DD /* PolyCore.h */,
 				8A8651F11B72865C009F94DD /* PolyCoreInput.h */,
-				8A8651F21B72865C009F94DD /* PolyCoreServices.h */,
 				8A8651F31B72865C009F94DD /* PolyCubemap.h */,
 				8A8651F41B72865C009F94DD /* PolyData.h */,
 				8A8651F51B72865C009F94DD /* PolyEntity.h */,
@@ -496,6 +475,7 @@
 				8A86520F1B72865C009F94DD /* PolyRectangle.h */,
 				8A8652101B72865C009F94DD /* PolyRenderDataArray.h */,
 				8A8652111B72865C009F94DD /* PolyRenderer.h */,
+				8A6010D11D4AC501009B0B35 /* PolyRendererPlatformData.h */,
 				8A8652121B72865C009F94DD /* PolyResource.h */,
 				8A8652131B72865C009F94DD /* PolyResourceManager.h */,
 				8A8652141B72865C009F94DD /* PolyScene.h */,
@@ -519,10 +499,6 @@
 				8A8652281B72865C009F94DD /* PolyString.h */,
 				8A8652291B72865C009F94DD /* PolyTexture.h */,
 				8A86522A1B72865C009F94DD /* PolyThreaded.h */,
-				8A86522B1B72865C009F94DD /* PolyTimer.h */,
-				8A86522C1B72865C009F94DD /* PolyTimerManager.h */,
-				8A86522D1B72865C009F94DD /* PolyTween.h */,
-				8A86522E1B72865C009F94DD /* PolyTweenManager.h */,
 				8A86522F1B72865C009F94DD /* PolyVector2.h */,
 				8A8652301B72865C009F94DD /* PolyVector3.h */,
 				8A8652311B72865C009F94DD /* PolyVector4.h */,
@@ -538,7 +514,6 @@
 			buildActionMask = 2147483647;
 			files = (
 				8A86526A1B72865C009F94DD /* PolySceneSprite.h in Headers */,
-				8A8652791B72865C009F94DD /* PolyTweenManager.h in Headers */,
 				8A7349081B86A53C00F660C0 /* lodepng.h in Headers */,
 				8A86523E1B72865C009F94DD /* PolyCubemap.h in Headers */,
 				8A8652741B72865C009F94DD /* PolyTexture.h in Headers */,
@@ -574,18 +549,16 @@
 				8A8652751B72865C009F94DD /* PolyThreaded.h in Headers */,
 				8A8652691B72865C009F94DD /* PolySceneSound.h in Headers */,
 				8A8652431B72865C009F94DD /* PolyEventHandler.h in Headers */,
-				8A86523D1B72865C009F94DD /* PolyCoreServices.h in Headers */,
 				8A8652481B72865C009F94DD /* PolyGPUDrawBuffer.h in Headers */,
 				8A8652871B72866C009F94DD /* stb_image.h in Headers */,
 				8A8652711B72865C009F94DD /* PolySound.h in Headers */,
 				8A86525C1B72865C009F94DD /* PolyRenderer.h in Headers */,
 				8A86527C1B72865C009F94DD /* PolyVector4.h in Headers */,
 				8A86525D1B72865C009F94DD /* PolyResource.h in Headers */,
-				8A8652761B72865C009F94DD /* PolyTimer.h in Headers */,
 				8A86524C1B72865C009F94DD /* PolyLabel.h in Headers */,
 				8A8652881B72866C009F94DD /* tinystr.h in Headers */,
+				8A6010D21D4AC501009B0B35 /* PolyRendererPlatformData.h in Headers */,
 				8A86527B1B72865C009F94DD /* PolyVector3.h in Headers */,
-				8A8652771B72865C009F94DD /* PolyTimerManager.h in Headers */,
 				8A8652501B72865C009F94DD /* PolyMatrix4.h in Headers */,
 				8A86525B1B72865C009F94DD /* PolyRenderDataArray.h in Headers */,
 				8A8652851B72866C009F94DD /* Polycode.h in Headers */,
@@ -595,7 +568,6 @@
 				8A86523B1B72865C009F94DD /* PolyCore.h in Headers */,
 				8A8652371B72865C009F94DD /* PolyCocoaCore.h in Headers */,
 				8A8652861B72866C009F94DD /* rgbe.h in Headers */,
-				8A8652781B72865C009F94DD /* PolyTween.h in Headers */,
 				8A8652491B72865C009F94DD /* PolyImage.h in Headers */,
 				8A9D122F1CDD503C00ACD484 /* PolycodeJS.h in Headers */,
 				8A86526E1B72865C009F94DD /* PolyShader.h in Headers */,
@@ -704,7 +676,6 @@
 				8A8652E51B72867F009F94DD /* PolyEventHandler.cpp in Sources */,
 				8A8653081B72867F009F94DD /* PolySceneRenderTexture.cpp in Sources */,
 				8A8652E91B72867F009F94DD /* PolyGPUDrawBuffer.cpp in Sources */,
-				8A8652DF1B72867F009F94DD /* PolyCoreServices.cpp in Sources */,
 				8A8652FC1B72867F009F94DD /* PolyRenderer.cpp in Sources */,
 				8A8653131B72867F009F94DD /* PolyThreaded.cpp in Sources */,
 				AA5DCB931D2433BE0021D0F8 /* stb_vorbis.cpp in Sources */,
@@ -719,7 +690,6 @@
 				8A8652FF1B72867F009F94DD /* PolyScene.cpp in Sources */,
 				8A8652DB1B72867F009F94DD /* PolyColor.cpp in Sources */,
 				8A8652ED1B72867F009F94DD /* PolyLogger.cpp in Sources */,
-				8A8653151B72867F009F94DD /* PolyTimerManager.cpp in Sources */,
 				8A8652FB1B72867F009F94DD /* PolyRenderDataArray.cpp in Sources */,
 				8A8653071B72867F009F94DD /* PolyScenePrimitive.cpp in Sources */,
 				8A8652F71B72867F009F94DD /* PolyQuaternion.cpp in Sources */,
@@ -739,12 +709,10 @@
 				8A825F251B829BC20039E823 /* PolyPAAudioInterface.cpp in Sources */,
 				8A8653041B72867F009F94DD /* PolySceneLine.cpp in Sources */,
 				8A8653191B72867F009F94DD /* PolyVector3.cpp in Sources */,
-				8A8653141B72867F009F94DD /* PolyTimer.cpp in Sources */,
 				8A86530D1B72867F009F94DD /* PolySkeleton.cpp in Sources */,
 				8A86530E1B72867F009F94DD /* PolySocket.cpp in Sources */,
 				8A86531B1B72867F009F94DD /* rgbe.cpp in Sources */,
 				8A86538F1B742DCD009F94DD /* PolyBasicFileProvider.cpp in Sources */,
-				8A8653171B72867F009F94DD /* PolyTweenManager.cpp in Sources */,
 				8A8653901B742DCD009F94DD /* PolyPhysFSFileProvider.cpp in Sources */,
 				8A8652D81B72867F009F94DD /* PolyCamera.cpp in Sources */,
 				8A86530C1B72867F009F94DD /* PolyShader.cpp in Sources */,
@@ -763,10 +731,10 @@
 				8A8652F41B72867F009F94DD /* PolyParticleEmitter.cpp in Sources */,
 				8A8652F91B72867F009F94DD /* PolyRay.cpp in Sources */,
 				8A8653031B72867F009F94DD /* PolySceneLight.cpp in Sources */,
-				8A8653161B72867F009F94DD /* PolyTween.cpp in Sources */,
 				8A8652D71B72867F009F94DD /* PolyBone.cpp in Sources */,
 				8A86530F1B72867F009F94DD /* PolySound.cpp in Sources */,
 				8A8652F61B72867F009F94DD /* PolyPerlin.cpp in Sources */,
+				8A6010D41D4AC516009B0B35 /* PolyRendererPlatformData.cpp in Sources */,
 				8A8653101B72867F009F94DD /* PolySoundManager.cpp in Sources */,
 				8A8653921B7434D8009F94DD /* PolyCoreFileProvider.cpp in Sources */,
 				8A8653061B72867F009F94DD /* PolySceneMesh.cpp in Sources */,

+ 1 - 0
build/osx/TemplateApp/TemplateApp/PolycodeTemplateApp.h

@@ -20,6 +20,7 @@ private:
     Core *core;
     std::vector<SceneMesh*> tests;
     SceneLabel *fpsLabel;
+	SceneLabel *label;
     Scene *scene;
     Number counter;
     Entity *sourceEntity;

+ 5 - 3
build/osx/TemplateApp/TemplateApp/PolycodeTemplateApp.mm

@@ -9,16 +9,16 @@ PolycodeTemplateApp::PolycodeTemplateApp(PolycodeView *view) {
     core = new CocoaCore(view, 1280/2,720/2,false,false, 0,0,60, 0, true);
     
     core->addFileSource("archive", "default.pak");
-    ResourcePool *globalPool = Services()->getResourceManager()->getGlobalPool();
+    ResourcePool *globalPool = core->getResourceManager()->getGlobalPool();
     globalPool->loadResourcesFromFolder("default", true);
 
     core->addFileSource("archive", "hdr.pak");
     globalPool->loadResourcesFromFolder("hdr", true);
 	
-	scene = new Scene(Scene::SCENE_2D);
+	scene = new Scene(core, Scene::SCENE_2D);
 	scene->useClearColor = true;
 	
-	SceneLabel *label = new SceneLabel("Hello World", 32, "mono", Label::ANTIALIAS_FULL, 0.1);
+	label = new SceneLabel(globalPool->getMaterial("Unlit"), "Hello World", 32, globalPool->getFont("mono"), Label::ANTIALIAS_FULL, 0.1);
 	scene->addChild(label);
 	/*
 	core->addFileSource("archive", "lua_Polycode.pak");
@@ -38,6 +38,8 @@ PolycodeTemplateApp::~PolycodeTemplateApp() {
 bool PolycodeTemplateApp::Update() {
 	bool res = core->Update();
 	
+	label->Roll(core->getElapsed() * 40.0);
+	
 	RenderFrame *frame = new RenderFrame(core->getViewport());
 	scene->Render(frame, NULL, NULL, NULL, false);
 	core->getRenderer()->submitRenderFrame(frame);

+ 0 - 5
include/Polycode.h

@@ -33,9 +33,6 @@
 #include "polycode/core/PolyEvent.h"
 #include "polycode/core/PolyEventDispatcher.h"
 #include "polycode/core/PolyEventHandler.h"
-#include "polycode/core/PolyTimer.h"
-#include "polycode/core/PolyTween.h"
-#include "polycode/core/PolyTweenManager.h"
 #include "polycode/core/PolyResourceManager.h"
 #include "polycode/core/PolyCore.h"
 #include "polycode/core/PolyCoreInput.h"
@@ -49,7 +46,6 @@
 #include "polycode/core/PolyRectangle.h"
 #include "polycode/core/PolyRenderer.h"
 #include "polycode/core/PolyRenderDataArray.h"
-#include "polycode/core/PolyCoreServices.h"
 #include "polycode/core/PolyImage.h"
 #include "polycode/core/PolyLabel.h"
 #include "polycode/core/PolyFont.h"
@@ -57,7 +53,6 @@
 #include "polycode/core/PolyMaterial.h"
 #include "polycode/core/PolyMesh.h"
 #include "polycode/core/PolyShader.h"
-#include "polycode/core/PolyCoreServices.h"
 #include "polycode/core/PolyCamera.h"
 #include "polycode/core/PolyScene.h"
 #include "polycode/core/PolyEntity.h"

+ 168 - 285
include/polycode/bindings/javascript/PolycodeJSWrappers.h

@@ -16,7 +16,6 @@ extern "C" {
 #include "polycode/core/PolyCore.h"
 #include "polycode/core/PolyCoreFileProvider.h"
 #include "polycode/core/PolyCoreInput.h"
-#include "polycode/core/PolyCoreServices.h"
 #include "polycode/core/PolyCubemap.h"
 #include "polycode/core/PolyData.h"
 #include "polycode/core/PolyEntity.h"
@@ -45,6 +44,7 @@ extern "C" {
 #include "polycode/core/PolyRectangle.h"
 #include "polycode/core/PolyRenderDataArray.h"
 #include "polycode/core/PolyRenderer.h"
+#include "polycode/core/PolyRendererPlatformData.h"
 #include "polycode/core/PolyResource.h"
 #include "polycode/core/PolyResourceManager.h"
 #include "polycode/core/PolyScene.h"
@@ -64,8 +64,6 @@ extern "C" {
 #include "polycode/core/PolySoundManager.h"
 #include "polycode/core/PolyString.h"
 #include "polycode/core/PolyTexture.h"
-#include "polycode/core/PolyTimer.h"
-#include "polycode/core/PolyTimerManager.h"
 #include "polycode/core/PolyVector2.h"
 #include "polycode/core/PolyVector3.h"
 #include "polycode/core/PolyVector4.h"
@@ -740,13 +738,6 @@ namespace Polycode {
 		return 0;
 	}
 
-	duk_ret_t Polycode_Camera_setPostFilterByName(duk_context *context) {
-		std::shared_ptr<Camera> *inst = (std::shared_ptr<Camera>*)duk_to_pointer(context, 0);
-		String shaderName = duk_to_string(context, 1);
-		(*inst)->setPostFilterByName(shaderName);
-		return 0;
-	}
-
 	duk_ret_t Polycode_Camera_removePostFilter(duk_context *context) {
 		std::shared_ptr<Camera> *inst = (std::shared_ptr<Camera>*)duk_to_pointer(context, 0);
 		(*inst)->removePostFilter();
@@ -1620,6 +1611,14 @@ namespace Polycode {
 		return 0;
 	}
 
+	duk_ret_t Polycode_Core_getConfig(duk_context *context) {
+		std::shared_ptr<Core> *inst = (std::shared_ptr<Core>*)duk_to_pointer(context, 0);
+		std::shared_ptr<ConfigRef> *retInst = new std::shared_ptr<ConfigRef>;
+		*(*retInst) = (*inst)->getConfig();
+		duk_push_pointer(context, (void*)retInst);
+		return 1;
+	}
+
 	duk_ret_t Polycode_VideoModeChangeInfo(duk_context *context) {
 		std::shared_ptr<VideoModeChangeInfo> *inst = new std::shared_ptr<VideoModeChangeInfo>;
 		(*inst) = std::make_shared<VideoModeChangeInfo>();
@@ -2179,18 +2178,6 @@ namespace Polycode {
 		return 0;
 	}
 
-	duk_ret_t Polycode_CoreInput__get_ignoreOffScreenTouch(duk_context *context) {
-		std::shared_ptr<CoreInput> *inst = (std::shared_ptr<CoreInput>*)duk_to_pointer(context, 0);
-		duk_push_boolean(context, (*inst)->ignoreOffScreenTouch);
-		return 1;
-	}
-
-	duk_ret_t Polycode_CoreInput__set_ignoreOffScreenTouch(duk_context *context) {
-		CoreInput *inst = (CoreInput*)duk_to_pointer(context, 0);
-		inst->ignoreOffScreenTouch = duk_to_boolean(context, 1);
-		return 0;
-	}
-
 	duk_ret_t Polycode_CoreInput__get_keyRepeat(duk_context *context) {
 		std::shared_ptr<CoreInput> *inst = (std::shared_ptr<CoreInput>*)duk_to_pointer(context, 0);
 		duk_push_boolean(context, (*inst)->keyRepeat);
@@ -2456,30 +2443,6 @@ namespace Polycode {
 		return 0;
 	}
 
-	duk_ret_t Polycode_CoreServices__delete(duk_context *context) {
-		std::shared_ptr<CoreServices> *inst = (std::shared_ptr<CoreServices>*)duk_to_pointer(context, 0);
-		delete inst;
-		return 0;
-	}
-
-	duk_ret_t Polycode_CoreServices_createInstance(duk_context *context) {
-		CoreServices::createInstance();
-		return 0;
-	}
-
-	duk_ret_t Polycode_CoreServices_Update(duk_context *context) {
-		std::shared_ptr<CoreServices> *inst = (std::shared_ptr<CoreServices>*)duk_to_pointer(context, 0);
-		int elapsed = duk_to_int(context, 1);
-		(*inst)->Update(elapsed);
-		return 0;
-	}
-
-	duk_ret_t Polycode_CoreServices_fixedUpdate(duk_context *context) {
-		std::shared_ptr<CoreServices> *inst = (std::shared_ptr<CoreServices>*)duk_to_pointer(context, 0);
-		(*inst)->fixedUpdate();
-		return 0;
-	}
-
 	duk_ret_t Polycode_Data(duk_context *context) {
 		std::shared_ptr<Data> *inst = new std::shared_ptr<Data>;
 		(*inst) = std::make_shared<Data>();
@@ -2493,13 +2456,6 @@ namespace Polycode {
 		return 0;
 	}
 
-	duk_ret_t Polycode_Data_loadFromFile(duk_context *context) {
-		std::shared_ptr<Data> *inst = (std::shared_ptr<Data>*)duk_to_pointer(context, 0);
-		String fileName = duk_to_string(context, 1);
-		duk_push_boolean(context, (*inst)->loadFromFile(fileName));
-		return 1;
-	}
-
 	duk_ret_t Polycode_Data_getAsString(duk_context *context) {
 		std::shared_ptr<Data> *inst = (std::shared_ptr<Data>*)duk_to_pointer(context, 0);
 		int encoding = duk_to_int(context, 1);
@@ -2515,13 +2471,6 @@ namespace Polycode {
 		return 0;
 	}
 
-	duk_ret_t Polycode_Data_saveToFile(duk_context *context) {
-		std::shared_ptr<Data> *inst = (std::shared_ptr<Data>*)duk_to_pointer(context, 0);
-		String fileName = duk_to_string(context, 1);
-		duk_push_boolean(context, (*inst)->saveToFile(fileName));
-		return 1;
-	}
-
 	duk_ret_t Polycode_MouseEventResult(duk_context *context) {
 		std::shared_ptr<MouseEventResult> *inst = new std::shared_ptr<MouseEventResult>;
 		(*inst) = std::make_shared<MouseEventResult>();
@@ -2973,7 +2922,8 @@ namespace Polycode {
 
 	duk_ret_t Polycode_Entity_Update(duk_context *context) {
 		std::shared_ptr<Entity> *inst = (std::shared_ptr<Entity>*)duk_to_pointer(context, 0);
-		(*inst)->Update();
+		Number elapsed = duk_to_number(context, 1);
+		(*inst)->Update(elapsed);
 		return 0;
 	}
 
@@ -3512,7 +3462,8 @@ namespace Polycode {
 
 	duk_ret_t Polycode_Entity_doUpdates(duk_context *context) {
 		std::shared_ptr<Entity> *inst = (std::shared_ptr<Entity>*)duk_to_pointer(context, 0);
-		(*inst)->doUpdates();
+		Number elapsed = duk_to_number(context, 1);
+		(*inst)->doUpdates(elapsed);
 		return 0;
 	}
 
@@ -3745,10 +3696,8 @@ namespace Polycode {
 	}
 
 	duk_ret_t Polycode_Font(duk_context *context) {
-		String fileName = duk_to_string(context, 0);
-		FT_Library FTLibrary = *(FT_Library*)duk_to_pointer(context, 1);
 		std::shared_ptr<Font> *inst = new std::shared_ptr<Font>;
-		(*inst) = std::make_shared<Font>(fileName,FTLibrary);
+		(*inst) = std::make_shared<Font>();
 		duk_push_pointer(context, (void*)inst);
 		return 1;
 	}
@@ -4322,9 +4271,8 @@ namespace Polycode {
 	}
 
 	duk_ret_t Polycode_Image(duk_context *context) {
-		String fileName = duk_to_string(context, 0);
 		std::shared_ptr<Image> *inst = new std::shared_ptr<Image>;
-		(*inst) = std::make_shared<Image>(fileName);
+		(*inst) = std::make_shared<Image>();
 		duk_push_pointer(context, (void*)inst);
 		return 1;
 	}
@@ -4335,20 +4283,6 @@ namespace Polycode {
 		return 0;
 	}
 
-	duk_ret_t Polycode_Image_loadImage(duk_context *context) {
-		std::shared_ptr<Image> *inst = (std::shared_ptr<Image>*)duk_to_pointer(context, 0);
-		String fileName = duk_to_string(context, 1);
-		duk_push_boolean(context, (*inst)->loadImage(fileName));
-		return 1;
-	}
-
-	duk_ret_t Polycode_Image_saveImage(duk_context *context) {
-		std::shared_ptr<Image> *inst = (std::shared_ptr<Image>*)duk_to_pointer(context, 0);
-		String fileName = duk_to_string(context, 1);
-		duk_push_boolean(context, (*inst)->saveImage(fileName));
-		return 1;
-	}
-
 	duk_ret_t Polycode_Image_createEmpty(duk_context *context) {
 		std::shared_ptr<Image> *inst = (std::shared_ptr<Image>*)duk_to_pointer(context, 0);
 		int width = duk_to_int(context, 1);
@@ -4505,13 +4439,6 @@ namespace Polycode {
 		return 0;
 	}
 
-	duk_ret_t Polycode_Image_savePNG(duk_context *context) {
-		std::shared_ptr<Image> *inst = (std::shared_ptr<Image>*)duk_to_pointer(context, 0);
-		String fileName = duk_to_string(context, 1);
-		duk_push_boolean(context, (*inst)->savePNG(fileName));
-		return 1;
-	}
-
 	duk_ret_t Polycode_TouchInfo(duk_context *context) {
 		std::shared_ptr<TouchInfo> *inst = new std::shared_ptr<TouchInfo>;
 		(*inst) = std::make_shared<TouchInfo>();
@@ -5146,7 +5073,8 @@ namespace Polycode {
 
 	duk_ret_t Polycode_Material_recreateRenderTargets(duk_context *context) {
 		std::shared_ptr<Material> *inst = (std::shared_ptr<Material>*)duk_to_pointer(context, 0);
-		(*inst)->recreateRenderTargets();
+		Vector2 screenSize = *(Vector2*)duk_to_pointer(context, 1);
+		(*inst)->recreateRenderTargets(screenSize);
 		return 0;
 	}
 
@@ -5413,26 +5341,6 @@ namespace Polycode {
 		return 0;
 	}
 
-	duk_ret_t Polycode_Mesh_loadMesh(duk_context *context) {
-		std::shared_ptr<Mesh> *inst = (std::shared_ptr<Mesh>*)duk_to_pointer(context, 0);
-		String fileName = duk_to_string(context, 1);
-		(*inst)->loadMesh(fileName);
-		return 0;
-	}
-
-	duk_ret_t Polycode_Mesh_saveToFile(duk_context *context) {
-		std::shared_ptr<Mesh> *inst = (std::shared_ptr<Mesh>*)duk_to_pointer(context, 0);
-		String fileName = duk_to_string(context, 1);
-		bool writeNormals = duk_to_boolean(context, 2);
-		bool writeTangents = duk_to_boolean(context, 3);
-		bool writeColors = duk_to_boolean(context, 4);
-		bool writeBoneWeights = duk_to_boolean(context, 5);
-		bool writeUVs = duk_to_boolean(context, 6);
-		bool writeSecondaryUVs = duk_to_boolean(context, 7);
-		(*inst)->saveToFile(fileName,writeNormals,writeTangents,writeColors,writeBoneWeights,writeUVs,writeSecondaryUVs);
-		return 0;
-	}
-
 	duk_ret_t Polycode_Mesh_addSubmesh(duk_context *context) {
 		std::shared_ptr<Mesh> *inst = (std::shared_ptr<Mesh>*)duk_to_pointer(context, 0);
 		MeshGeometry newSubmesh = *(MeshGeometry*)duk_to_pointer(context, 1);
@@ -6444,7 +6352,8 @@ namespace Polycode {
 
 	duk_ret_t Polycode_SceneParticleEmitter_updateParticles(duk_context *context) {
 		std::shared_ptr<SceneParticleEmitter> *inst = (std::shared_ptr<SceneParticleEmitter>*)duk_to_pointer(context, 0);
-		(*inst)->updateParticles();
+		Number elapsed = duk_to_number(context, 1);
+		(*inst)->updateParticles(elapsed);
 		return 0;
 	}
 
@@ -7219,6 +7128,21 @@ namespace Polycode {
 		return 0;
 	}
 
+	duk_ret_t Polycode_RenderDataArray__get_platformData(duk_context *context) {
+		std::shared_ptr<RenderDataArray> *inst = (std::shared_ptr<RenderDataArray>*)duk_to_pointer(context, 0);
+		std::shared_ptr<RendererPlatformData> *retInst = new std::shared_ptr<RendererPlatformData>;
+		*retInst = std::make_shared<RendererPlatformData>();
+		*(*retInst) = (*inst)->platformData;
+		duk_push_pointer(context, (void*)retInst);
+		return 1;
+	}
+
+	duk_ret_t Polycode_RenderDataArray__set_platformData(duk_context *context) {
+		RenderDataArray *inst = (RenderDataArray*)duk_to_pointer(context, 0);
+		inst->platformData = *(RendererPlatformData*)duk_to_pointer(context, 1);
+		return 0;
+	}
+
 	duk_ret_t Polycode_RenderDataArray__delete(duk_context *context) {
 		std::shared_ptr<RenderDataArray> *inst = (std::shared_ptr<RenderDataArray>*)duk_to_pointer(context, 0);
 		delete inst;
@@ -7497,6 +7421,31 @@ namespace Polycode {
 		return 1;
 	}
 
+	duk_ret_t Polycode_RendererPlatformData(duk_context *context) {
+		std::shared_ptr<RendererPlatformData> *inst = new std::shared_ptr<RendererPlatformData>;
+		(*inst) = std::make_shared<RendererPlatformData>();
+		duk_push_pointer(context, (void*)inst);
+		return 1;
+	}
+
+	duk_ret_t Polycode_RendererPlatformData__get_type(duk_context *context) {
+		std::shared_ptr<RendererPlatformData> *inst = (std::shared_ptr<RendererPlatformData>*)duk_to_pointer(context, 0);
+		duk_push_int(context, (*inst)->type);
+		return 1;
+	}
+
+	duk_ret_t Polycode_RendererPlatformData__set_type(duk_context *context) {
+		RendererPlatformData *inst = (RendererPlatformData*)duk_to_pointer(context, 0);
+		inst->type = duk_to_int(context, 1);
+		return 0;
+	}
+
+	duk_ret_t Polycode_RendererPlatformData__delete(duk_context *context) {
+		std::shared_ptr<RendererPlatformData> *inst = (std::shared_ptr<RendererPlatformData>*)duk_to_pointer(context, 0);
+		delete inst;
+		return 0;
+	}
+
 	duk_ret_t Polycode_Resource(duk_context *context) {
 		int type = duk_to_int(context, 0);
 		std::shared_ptr<Resource> *inst = new std::shared_ptr<Resource>;
@@ -7532,15 +7481,24 @@ namespace Polycode {
 		return 0;
 	}
 
-	duk_ret_t Polycode_Resource__delete(duk_context *context) {
+	duk_ret_t Polycode_Resource__get_platformData(duk_context *context) {
 		std::shared_ptr<Resource> *inst = (std::shared_ptr<Resource>*)duk_to_pointer(context, 0);
-		delete inst;
+		std::shared_ptr<RendererPlatformData> *retInst = new std::shared_ptr<RendererPlatformData>;
+		*retInst = std::make_shared<RendererPlatformData>();
+		*(*retInst) = (*inst)->platformData;
+		duk_push_pointer(context, (void*)retInst);
+		return 1;
+	}
+
+	duk_ret_t Polycode_Resource__set_platformData(duk_context *context) {
+		Resource *inst = (Resource*)duk_to_pointer(context, 0);
+		inst->platformData = *(RendererPlatformData*)duk_to_pointer(context, 1);
 		return 0;
 	}
 
-	duk_ret_t Polycode_Resource_reloadResource(duk_context *context) {
+	duk_ret_t Polycode_Resource__delete(duk_context *context) {
 		std::shared_ptr<Resource> *inst = (std::shared_ptr<Resource>*)duk_to_pointer(context, 0);
-		(*inst)->reloadResource();
+		delete inst;
 		return 0;
 	}
 
@@ -7715,6 +7673,51 @@ namespace Polycode {
 		return 1;
 	}
 
+	duk_ret_t Polycode_ResourcePool_getFont(duk_context *context) {
+		std::shared_ptr<ResourcePool> *inst = (std::shared_ptr<ResourcePool>*)duk_to_pointer(context, 0);
+		String name = duk_to_string(context, 1);
+		std::shared_ptr<shared_ptr<Font>> *retInst = new std::shared_ptr<shared_ptr<Font>>;
+		*(*retInst) = (*inst)->getFont(name);
+		duk_push_pointer(context, (void*)retInst);
+		return 1;
+	}
+
+	duk_ret_t Polycode_ResourcePool_getMaterial(duk_context *context) {
+		std::shared_ptr<ResourcePool> *inst = (std::shared_ptr<ResourcePool>*)duk_to_pointer(context, 0);
+		String name = duk_to_string(context, 1);
+		std::shared_ptr<shared_ptr<Material>> *retInst = new std::shared_ptr<shared_ptr<Material>>;
+		*(*retInst) = (*inst)->getMaterial(name);
+		duk_push_pointer(context, (void*)retInst);
+		return 1;
+	}
+
+	duk_ret_t Polycode_ResourcePool_getShader(duk_context *context) {
+		std::shared_ptr<ResourcePool> *inst = (std::shared_ptr<ResourcePool>*)duk_to_pointer(context, 0);
+		String name = duk_to_string(context, 1);
+		std::shared_ptr<shared_ptr<Shader>> *retInst = new std::shared_ptr<shared_ptr<Shader>>;
+		*(*retInst) = (*inst)->getShader(name);
+		duk_push_pointer(context, (void*)retInst);
+		return 1;
+	}
+
+	duk_ret_t Polycode_ResourcePool_loadTexture(duk_context *context) {
+		std::shared_ptr<ResourcePool> *inst = (std::shared_ptr<ResourcePool>*)duk_to_pointer(context, 0);
+		String name = duk_to_string(context, 1);
+		std::shared_ptr<shared_ptr<Texture>> *retInst = new std::shared_ptr<shared_ptr<Texture>>;
+		*(*retInst) = (*inst)->loadTexture(name);
+		duk_push_pointer(context, (void*)retInst);
+		return 1;
+	}
+
+	duk_ret_t Polycode_ResourcePool_loadMesh(duk_context *context) {
+		std::shared_ptr<ResourcePool> *inst = (std::shared_ptr<ResourcePool>*)duk_to_pointer(context, 0);
+		String name = duk_to_string(context, 1);
+		std::shared_ptr<shared_ptr<Mesh>> *retInst = new std::shared_ptr<shared_ptr<Mesh>>;
+		*(*retInst) = (*inst)->loadMesh(name);
+		duk_push_pointer(context, (void*)retInst);
+		return 1;
+	}
+
 	duk_ret_t Polycode_ResourcePool_getName(duk_context *context) {
 		std::shared_ptr<ResourcePool> *inst = (std::shared_ptr<ResourcePool>*)duk_to_pointer(context, 0);
 		duk_push_string(context, (*inst)->getName().c_str());
@@ -7908,9 +7911,8 @@ namespace Polycode {
 	}
 
 	duk_ret_t Polycode_Scene(duk_context *context) {
-		int sceneType = duk_to_int(context, 0);
 		std::shared_ptr<Scene> *inst = new std::shared_ptr<Scene>;
-		(*inst) = std::make_shared<Scene>(sceneType);
+		(*inst) = std::make_shared<Scene>();
 		duk_push_pointer(context, (void*)inst);
 		return 1;
 	}
@@ -8101,7 +8103,8 @@ namespace Polycode {
 
 	duk_ret_t Polycode_Scene_Update(duk_context *context) {
 		std::shared_ptr<Scene> *inst = (std::shared_ptr<Scene>*)duk_to_pointer(context, 0);
-		(*inst)->Update();
+		Number elapsed = duk_to_number(context, 1);
+		(*inst)->Update(elapsed);
 		return 0;
 	}
 
@@ -8157,16 +8160,9 @@ namespace Polycode {
 		return 0;
 	}
 
-	duk_ret_t Polycode_SceneEntityInstanceResourceEntry_reloadResource(duk_context *context) {
-		std::shared_ptr<SceneEntityInstanceResourceEntry> *inst = (std::shared_ptr<SceneEntityInstanceResourceEntry>*)duk_to_pointer(context, 0);
-		(*inst)->reloadResource();
-		return 0;
-	}
-
 	duk_ret_t Polycode_SceneEntityInstance(duk_context *context) {
-		String fileName = duk_to_string(context, 0);
 		std::shared_ptr<SceneEntityInstance> *inst = new std::shared_ptr<SceneEntityInstance>;
-		(*inst) = std::make_shared<SceneEntityInstance>(fileName);
+		(*inst) = std::make_shared<SceneEntityInstance>();
 		duk_push_pointer(context, (void*)inst);
 		return 1;
 	}
@@ -8313,13 +8309,14 @@ namespace Polycode {
 	}
 
 	duk_ret_t Polycode_SceneLabel(duk_context *context) {
-		String text = duk_to_string(context, 0);
-		int size = duk_to_int(context, 1);
-		String fontName = duk_to_string(context, 2);
-		int amode = duk_to_int(context, 3);
-		Number actualHeight = duk_to_number(context, 4);
+		shared_ptr<Material> material = *(shared_ptr<Material>*)duk_to_pointer(context, 0);
+		String text = duk_to_string(context, 1);
+		int size = duk_to_int(context, 2);
+		shared_ptr<Font> font = *(shared_ptr<Font>*)duk_to_pointer(context, 3);
+		int amode = duk_to_int(context, 4);
+		Number actualHeight = duk_to_number(context, 5);
 		std::shared_ptr<SceneLabel> *inst = new std::shared_ptr<SceneLabel>;
-		(*inst) = std::make_shared<SceneLabel>(text,size,fontName,amode,actualHeight);
+		(*inst) = std::make_shared<SceneLabel>(material,text,size,font,amode,actualHeight);
 		duk_push_pointer(context, (void*)inst);
 		return 1;
 	}
@@ -8387,8 +8384,9 @@ namespace Polycode {
 		Number constantAttenuation = duk_to_number(context, 2);
 		Number linearAttenuation = duk_to_number(context, 3);
 		Number quadraticAttenuation = duk_to_number(context, 4);
+		shared_ptr<Material> depthMapMaterial = *(shared_ptr<Material>*)duk_to_pointer(context, 5);
 		std::shared_ptr<SceneLight> *inst = new std::shared_ptr<SceneLight>;
-		(*inst) = std::make_shared<SceneLight>(type,intensity,constantAttenuation,linearAttenuation,quadraticAttenuation);
+		(*inst) = std::make_shared<SceneLight>(type,intensity,constantAttenuation,linearAttenuation,quadraticAttenuation,depthMapMaterial);
 		duk_push_pointer(context, (void*)inst);
 		return 1;
 	}
@@ -8658,9 +8656,8 @@ namespace Polycode {
 	}
 
 	duk_ret_t Polycode_SceneMesh(duk_context *context) {
-		String fileName = duk_to_string(context, 0);
 		std::shared_ptr<SceneMesh> *inst = new std::shared_ptr<SceneMesh>;
-		(*inst) = std::make_shared<SceneMesh>(fileName);
+		(*inst) = std::make_shared<SceneMesh>();
 		duk_push_pointer(context, (void*)inst);
 		return 1;
 	}
@@ -8800,15 +8797,6 @@ namespace Polycode {
 		return 1;
 	}
 
-	duk_ret_t Polycode_SceneMesh_loadSkeleton(duk_context *context) {
-		std::shared_ptr<SceneMesh> *inst = (std::shared_ptr<SceneMesh>*)duk_to_pointer(context, 0);
-		String fileName = duk_to_string(context, 1);
-		std::shared_ptr<shared_ptr<Skeleton>> *retInst = new std::shared_ptr<shared_ptr<Skeleton>>;
-		*(*retInst) = (*inst)->loadSkeleton(fileName);
-		duk_push_pointer(context, (void*)retInst);
-		return 1;
-	}
-
 	duk_ret_t Polycode_SceneMesh_clearMaterial(duk_context *context) {
 		std::shared_ptr<SceneMesh> *inst = (std::shared_ptr<SceneMesh>*)duk_to_pointer(context, 0);
 		(*inst)->clearMaterial();
@@ -8864,13 +8852,6 @@ namespace Polycode {
 		return 0;
 	}
 
-	duk_ret_t Polycode_SceneMesh_loadFromFile(duk_context *context) {
-		std::shared_ptr<SceneMesh> *inst = (std::shared_ptr<SceneMesh>*)duk_to_pointer(context, 0);
-		String fileName = duk_to_string(context, 1);
-		(*inst)->loadFromFile(fileName);
-		return 0;
-	}
-
 	duk_ret_t Polycode_SceneMesh_customHitDetection(duk_context *context) {
 		std::shared_ptr<SceneMesh> *inst = (std::shared_ptr<SceneMesh>*)duk_to_pointer(context, 0);
 		Ray ray = *(Ray*)duk_to_pointer(context, 1);
@@ -9009,12 +8990,8 @@ namespace Polycode {
 	}
 
 	duk_ret_t Polycode_SceneSound(duk_context *context) {
-		String fileName = duk_to_string(context, 0);
-		Number referenceDistance = duk_to_number(context, 1);
-		Number maxDistance = duk_to_number(context, 2);
-		bool directionalSound = duk_to_boolean(context, 3);
 		std::shared_ptr<SceneSound> *inst = new std::shared_ptr<SceneSound>;
-		(*inst) = std::make_shared<SceneSound>(fileName,referenceDistance,maxDistance,directionalSound);
+		(*inst) = std::make_shared<SceneSound>();
 		duk_push_pointer(context, (void*)inst);
 		return 1;
 	}
@@ -10080,12 +10057,6 @@ namespace Polycode {
 		return 0;
 	}
 
-	duk_ret_t Polycode_ShaderProgram_reloadResource(duk_context *context) {
-		std::shared_ptr<ShaderProgram> *inst = (std::shared_ptr<ShaderProgram>*)duk_to_pointer(context, 0);
-		(*inst)->reloadResource();
-		return 0;
-	}
-
 	duk_ret_t Polycode_AttributeBinding(duk_context *context) {
 		std::shared_ptr<AttributeBinding> *inst = new std::shared_ptr<AttributeBinding>;
 		(*inst) = std::make_shared<AttributeBinding>();
@@ -10187,16 +10158,6 @@ namespace Polycode {
 		return 0;
 	}
 
-	duk_ret_t Polycode_ShaderBinding_loadTextureForParam(duk_context *context) {
-		std::shared_ptr<ShaderBinding> *inst = (std::shared_ptr<ShaderBinding>*)duk_to_pointer(context, 0);
-		String paramName = duk_to_string(context, 1);
-		String fileName = duk_to_string(context, 2);
-		std::shared_ptr<shared_ptr<Texture>> *retInst = new std::shared_ptr<shared_ptr<Texture>>;
-		*(*retInst) = (*inst)->loadTextureForParam(paramName,fileName);
-		duk_push_pointer(context, (void*)retInst);
-		return 1;
-	}
-
 	duk_ret_t Polycode_ShaderBinding_setTextureForParam(duk_context *context) {
 		std::shared_ptr<ShaderBinding> *inst = (std::shared_ptr<ShaderBinding>*)duk_to_pointer(context, 0);
 		String paramName = duk_to_string(context, 1);
@@ -10291,7 +10252,8 @@ namespace Polycode {
 
 	duk_ret_t Polycode_SkeletonAnimation_Update(duk_context *context) {
 		std::shared_ptr<SkeletonAnimation> *inst = (std::shared_ptr<SkeletonAnimation>*)duk_to_pointer(context, 0);
-		(*inst)->Update();
+		Number elapsed = duk_to_number(context, 1);
+		(*inst)->Update(elapsed);
 		return 0;
 	}
 
@@ -10322,9 +10284,8 @@ namespace Polycode {
 	}
 
 	duk_ret_t Polycode_Skeleton(duk_context *context) {
-		String fileName = duk_to_string(context, 0);
 		std::shared_ptr<Skeleton> *inst = new std::shared_ptr<Skeleton>;
-		(*inst) = std::make_shared<Skeleton>(fileName);
+		(*inst) = std::make_shared<Skeleton>();
 		duk_push_pointer(context, (void*)inst);
 		return 1;
 	}
@@ -10335,13 +10296,6 @@ namespace Polycode {
 		return 0;
 	}
 
-	duk_ret_t Polycode_Skeleton_loadSkeleton(duk_context *context) {
-		std::shared_ptr<Skeleton> *inst = (std::shared_ptr<Skeleton>*)duk_to_pointer(context, 0);
-		String fileName = duk_to_string(context, 1);
-		(*inst)->loadSkeleton(fileName);
-		return 0;
-	}
-
 	duk_ret_t Polycode_Skeleton_playAnimationByName(duk_context *context) {
 		std::shared_ptr<Skeleton> *inst = (std::shared_ptr<Skeleton>*)duk_to_pointer(context, 0);
 		String animName = duk_to_string(context, 1);
@@ -10365,14 +10319,6 @@ namespace Polycode {
 		return 0;
 	}
 
-	duk_ret_t Polycode_Skeleton_addAnimation(duk_context *context) {
-		std::shared_ptr<Skeleton> *inst = (std::shared_ptr<Skeleton>*)duk_to_pointer(context, 0);
-		String name = duk_to_string(context, 1);
-		String fileName = duk_to_string(context, 2);
-		(*inst)->addAnimation(name,fileName);
-		return 0;
-	}
-
 	duk_ret_t Polycode_Skeleton_stopAnimationByName(duk_context *context) {
 		std::shared_ptr<Skeleton> *inst = (std::shared_ptr<Skeleton>*)duk_to_pointer(context, 0);
 		String name = duk_to_string(context, 1);
@@ -10382,7 +10328,8 @@ namespace Polycode {
 
 	duk_ret_t Polycode_Skeleton_Update(duk_context *context) {
 		std::shared_ptr<Skeleton> *inst = (std::shared_ptr<Skeleton>*)duk_to_pointer(context, 0);
-		(*inst)->Update();
+		Number elapsed = duk_to_number(context, 1);
+		(*inst)->Update(elapsed);
 		return 0;
 	}
 
@@ -10544,9 +10491,8 @@ namespace Polycode {
 	}
 
 	duk_ret_t Polycode_Sound(duk_context *context) {
-		String fileName = duk_to_string(context, 0);
 		std::shared_ptr<Sound> *inst = new std::shared_ptr<Sound>;
-		(*inst) = std::make_shared<Sound>(fileName);
+		(*inst) = std::make_shared<Sound>();
 		duk_push_pointer(context, (void*)inst);
 		return 1;
 	}
@@ -10567,13 +10513,6 @@ namespace Polycode {
 		return 1;
 	}
 
-	duk_ret_t Polycode_Sound_loadFile(duk_context *context) {
-		std::shared_ptr<Sound> *inst = (std::shared_ptr<Sound>*)duk_to_pointer(context, 0);
-		String fileName = duk_to_string(context, 1);
-		(*inst)->loadFile(fileName);
-		return 0;
-	}
-
 	duk_ret_t Polycode_Sound_Play(duk_context *context) {
 		std::shared_ptr<Sound> *inst = (std::shared_ptr<Sound>*)duk_to_pointer(context, 0);
 		bool loop = duk_to_boolean(context, 1);
@@ -10738,20 +10677,6 @@ namespace Polycode {
 		return 1;
 	}
 
-	duk_ret_t Polycode_Sound_loadWAV(duk_context *context) {
-		std::shared_ptr<Sound> *inst = (std::shared_ptr<Sound>*)duk_to_pointer(context, 0);
-		String fileName = duk_to_string(context, 1);
-		duk_push_boolean(context, (*inst)->loadWAV(fileName));
-		return 1;
-	}
-
-	duk_ret_t Polycode_Sound_loadOGG(duk_context *context) {
-		std::shared_ptr<Sound> *inst = (std::shared_ptr<Sound>*)duk_to_pointer(context, 0);
-		String fileName = duk_to_string(context, 1);
-		duk_push_boolean(context, (*inst)->loadOGG(fileName));
-		return 1;
-	}
-
 	duk_ret_t Polycode_Sound_soundCheck(duk_context *context) {
 		std::shared_ptr<Sound> *inst = (std::shared_ptr<Sound>*)duk_to_pointer(context, 0);
 		bool result = duk_to_boolean(context, 1);
@@ -11104,6 +11029,36 @@ namespace Polycode {
 		return 1;
 	}
 
+	duk_ret_t Polycode_RenderBuffer__get_platformData(duk_context *context) {
+		std::shared_ptr<RenderBuffer> *inst = (std::shared_ptr<RenderBuffer>*)duk_to_pointer(context, 0);
+		std::shared_ptr<RendererPlatformData> *retInst = new std::shared_ptr<RendererPlatformData>;
+		*retInst = std::make_shared<RendererPlatformData>();
+		*(*retInst) = (*inst)->platformData;
+		duk_push_pointer(context, (void*)retInst);
+		return 1;
+	}
+
+	duk_ret_t Polycode_RenderBuffer__set_platformData(duk_context *context) {
+		RenderBuffer *inst = (RenderBuffer*)duk_to_pointer(context, 0);
+		inst->platformData = *(RendererPlatformData*)duk_to_pointer(context, 1);
+		return 0;
+	}
+
+	duk_ret_t Polycode_RenderBuffer__get_depthBufferPlatformData(duk_context *context) {
+		std::shared_ptr<RenderBuffer> *inst = (std::shared_ptr<RenderBuffer>*)duk_to_pointer(context, 0);
+		std::shared_ptr<RendererPlatformData> *retInst = new std::shared_ptr<RendererPlatformData>;
+		*retInst = std::make_shared<RendererPlatformData>();
+		*(*retInst) = (*inst)->depthBufferPlatformData;
+		duk_push_pointer(context, (void*)retInst);
+		return 1;
+	}
+
+	duk_ret_t Polycode_RenderBuffer__set_depthBufferPlatformData(duk_context *context) {
+		RenderBuffer *inst = (RenderBuffer*)duk_to_pointer(context, 0);
+		inst->depthBufferPlatformData = *(RendererPlatformData*)duk_to_pointer(context, 1);
+		return 0;
+	}
+
 	duk_ret_t Polycode_RenderBuffer__delete(duk_context *context) {
 		std::shared_ptr<RenderBuffer> *inst = (std::shared_ptr<RenderBuffer>*)duk_to_pointer(context, 0);
 		delete inst;
@@ -11212,12 +11167,6 @@ namespace Polycode {
 		return 0;
 	}
 
-	duk_ret_t Polycode_Texture_reloadResource(duk_context *context) {
-		std::shared_ptr<Texture> *inst = (std::shared_ptr<Texture>*)duk_to_pointer(context, 0);
-		(*inst)->reloadResource();
-		return 0;
-	}
-
 	duk_ret_t Polycode_Texture_getWidth(duk_context *context) {
 		std::shared_ptr<Texture> *inst = (std::shared_ptr<Texture>*)duk_to_pointer(context, 0);
 		duk_push_int(context, (*inst)->getWidth());
@@ -11243,72 +11192,6 @@ namespace Polycode {
 		return 1;
 	}
 
-	duk_ret_t Polycode_Timer(duk_context *context) {
-		bool triggerMode = duk_to_boolean(context, 0);
-		int msecs = duk_to_int(context, 1);
-		std::shared_ptr<Timer> *inst = new std::shared_ptr<Timer>;
-		(*inst) = std::make_shared<Timer>(triggerMode,msecs);
-		duk_push_pointer(context, (void*)inst);
-		return 1;
-	}
-
-	duk_ret_t Polycode_Timer__delete(duk_context *context) {
-		std::shared_ptr<Timer> *inst = (std::shared_ptr<Timer>*)duk_to_pointer(context, 0);
-		delete inst;
-		return 0;
-	}
-
-	duk_ret_t Polycode_Timer_Pause(duk_context *context) {
-		std::shared_ptr<Timer> *inst = (std::shared_ptr<Timer>*)duk_to_pointer(context, 0);
-		bool paused = duk_to_boolean(context, 1);
-		(*inst)->Pause(paused);
-		return 0;
-	}
-
-	duk_ret_t Polycode_Timer_isPaused(duk_context *context) {
-		std::shared_ptr<Timer> *inst = (std::shared_ptr<Timer>*)duk_to_pointer(context, 0);
-		duk_push_boolean(context, (*inst)->isPaused());
-		return 1;
-	}
-
-	duk_ret_t Polycode_Timer_getTicks(duk_context *context) {
-		std::shared_ptr<Timer> *inst = (std::shared_ptr<Timer>*)duk_to_pointer(context, 0);
-		duk_push_int(context, (*inst)->getTicks());
-		return 1;
-	}
-
-	duk_ret_t Polycode_Timer_Update(duk_context *context) {
-		std::shared_ptr<Timer> *inst = (std::shared_ptr<Timer>*)duk_to_pointer(context, 0);
-		int ticks = duk_to_int(context, 1);
-		(*inst)->Update(ticks);
-		return 0;
-	}
-
-	duk_ret_t Polycode_Timer_Reset(duk_context *context) {
-		std::shared_ptr<Timer> *inst = (std::shared_ptr<Timer>*)duk_to_pointer(context, 0);
-		(*inst)->Reset();
-		return 0;
-	}
-
-	duk_ret_t Polycode_Timer_hasElapsed(duk_context *context) {
-		std::shared_ptr<Timer> *inst = (std::shared_ptr<Timer>*)duk_to_pointer(context, 0);
-		duk_push_boolean(context, (*inst)->hasElapsed());
-		return 1;
-	}
-
-	duk_ret_t Polycode_Timer_getElapsedf(duk_context *context) {
-		std::shared_ptr<Timer> *inst = (std::shared_ptr<Timer>*)duk_to_pointer(context, 0);
-		duk_push_number(context, (*inst)->getElapsedf());
-		return 1;
-	}
-
-	duk_ret_t Polycode_Timer_setTimerInterval(duk_context *context) {
-		std::shared_ptr<Timer> *inst = (std::shared_ptr<Timer>*)duk_to_pointer(context, 0);
-		int msecs = duk_to_int(context, 1);
-		(*inst)->setTimerInterval(msecs);
-		return 0;
-	}
-
 	duk_ret_t Polycode_Vector2(duk_context *context) {
 		Number x = duk_to_number(context, 0);
 		Number y = duk_to_number(context, 1);

+ 219 - 389
include/polycode/bindings/lua/PolycodeLuaWrappers.h

@@ -16,7 +16,6 @@ extern "C" {
 #include "polycode/core/PolyCore.h"
 #include "polycode/core/PolyCoreFileProvider.h"
 #include "polycode/core/PolyCoreInput.h"
-#include "polycode/core/PolyCoreServices.h"
 #include "polycode/core/PolyCubemap.h"
 #include "polycode/core/PolyData.h"
 #include "polycode/core/PolyEntity.h"
@@ -45,6 +44,7 @@ extern "C" {
 #include "polycode/core/PolyRectangle.h"
 #include "polycode/core/PolyRenderDataArray.h"
 #include "polycode/core/PolyRenderer.h"
+#include "polycode/core/PolyRendererPlatformData.h"
 #include "polycode/core/PolyResource.h"
 #include "polycode/core/PolyResourceManager.h"
 #include "polycode/core/PolyScene.h"
@@ -64,8 +64,6 @@ extern "C" {
 #include "polycode/core/PolySoundManager.h"
 #include "polycode/core/PolyString.h"
 #include "polycode/core/PolyTexture.h"
-#include "polycode/core/PolyTimer.h"
-#include "polycode/core/PolyTimerManager.h"
 #include "polycode/core/PolyVector2.h"
 #include "polycode/core/PolyVector3.h"
 #include "polycode/core/PolyVector4.h"
@@ -905,14 +903,6 @@ static int Polycode_Camera_set_cameraShift(lua_State *L) {
 		inst->setPostFilter(material);
 		return 0;
 	}
-	static int Polycode_Camera_setPostFilterByName(lua_State *L) {
-		luaL_checktype(L, 1, LUA_TUSERDATA);
-		Camera *inst = (Camera*) *((PolyBase**)lua_touserdata(L, 1));
-		luaL_checktype(L, 2, LUA_TSTRING);
-		String shaderName = String(lua_tostring(L, 2));
-		inst->setPostFilterByName(shaderName);
-		return 0;
-	}
 	static int Polycode_Camera_removePostFilter(lua_State *L) {
 		luaL_checktype(L, 1, LUA_TUSERDATA);
 		Camera *inst = (Camera*) *((PolyBase**)lua_touserdata(L, 1));
@@ -1966,6 +1956,17 @@ static int Polycode_Core_set_deviceAttitude(lua_State *L) {
 		inst->makeApplicationMain();
 		return 0;
 	}
+	static int Polycode_Core_getConfig(lua_State *L) {
+		luaL_checktype(L, 1, LUA_TUSERDATA);
+		Core *inst = (Core*) *((PolyBase**)lua_touserdata(L, 1));
+		ConfigRef *retInst = new ConfigRef();
+		*retInst = inst->getConfig();
+		PolyBase **userdataPtr = (PolyBase**)lua_newuserdata(L, sizeof(PolyBase*));
+		luaL_getmetatable(L, "Polycode.ConfigRef");
+		lua_setmetatable(L, -2);
+		*userdataPtr = (PolyBase*)retInst;
+		return 1;
+	}
 	static int Polycode_delete_Core(lua_State *L) {
 		luaL_checktype(L, 1, LUA_TUSERDATA);
 		PolyBase **inst = (PolyBase**)lua_touserdata(L, 1);
@@ -2619,13 +2620,6 @@ static int Polycode_CoreInput_get_simulateMouseWithTouch(lua_State *L) {
 	return 1;
 }
 
-static int Polycode_CoreInput_get_ignoreOffScreenTouch(lua_State *L) {
-	luaL_checktype(L, 1, LUA_TUSERDATA);
-	CoreInput *inst = (CoreInput*) *((PolyBase**)lua_touserdata(L, 1));
-	lua_pushboolean(L, inst->ignoreOffScreenTouch);
-	return 1;
-}
-
 static int Polycode_CoreInput_get_keyRepeat(lua_State *L) {
 	luaL_checktype(L, 1, LUA_TUSERDATA);
 	CoreInput *inst = (CoreInput*) *((PolyBase**)lua_touserdata(L, 1));
@@ -2673,14 +2667,6 @@ static int Polycode_CoreInput_set_simulateMouseWithTouch(lua_State *L) {
 	return 0;
 }
 
-static int Polycode_CoreInput_set_ignoreOffScreenTouch(lua_State *L) {
-	luaL_checktype(L, 1, LUA_TUSERDATA);
-	CoreInput *inst = (CoreInput*) *((PolyBase**)lua_touserdata(L, 1));
-	bool param = lua_toboolean(L, 2) != 0;
-	inst->ignoreOffScreenTouch = param;
-	return 0;
-}
-
 static int Polycode_CoreInput_set_keyRepeat(lua_State *L) {
 	luaL_checktype(L, 1, LUA_TUSERDATA);
 	CoreInput *inst = (CoreInput*) *((PolyBase**)lua_touserdata(L, 1));
@@ -2993,32 +2979,6 @@ static int Polycode_JoystickInfo_set_deviceIndex(lua_State *L) {
 		return 0;
 	}
 
-	static int Polycode_CoreServices_createInstance(lua_State *L) {
-		CoreServices::createInstance();
-		return 0;
-	}
-	static int Polycode_CoreServices_Update(lua_State *L) {
-		luaL_checktype(L, 1, LUA_TUSERDATA);
-		CoreServices *inst = (CoreServices*) *((PolyBase**)lua_touserdata(L, 1));
-		luaL_checktype(L, 2, LUA_TNUMBER);
-		int elapsed = lua_tointeger(L, 2);
-		inst->Update(elapsed);
-		return 0;
-	}
-	static int Polycode_CoreServices_fixedUpdate(lua_State *L) {
-		luaL_checktype(L, 1, LUA_TUSERDATA);
-		CoreServices *inst = (CoreServices*) *((PolyBase**)lua_touserdata(L, 1));
-		inst->fixedUpdate();
-		return 0;
-	}
-	static int Polycode_delete_CoreServices(lua_State *L) {
-		luaL_checktype(L, 1, LUA_TUSERDATA);
-		PolyBase **inst = (PolyBase**)lua_touserdata(L, 1);
-		delete ((CoreServices*) *inst);
-		*inst = NULL;
-		return 0;
-	}
-
 	static int Polycode_Data(lua_State *L) {
 		Data *inst = new Data();
 		PolyBase **userdataPtr = (PolyBase**)lua_newuserdata(L, sizeof(PolyBase*));
@@ -3027,14 +2987,6 @@ static int Polycode_JoystickInfo_set_deviceIndex(lua_State *L) {
 		lua_setmetatable(L, -2);
 		return 1;
 	}
-	static int Polycode_Data_loadFromFile(lua_State *L) {
-		luaL_checktype(L, 1, LUA_TUSERDATA);
-		Data *inst = (Data*) *((PolyBase**)lua_touserdata(L, 1));
-		luaL_checktype(L, 2, LUA_TSTRING);
-		String fileName = String(lua_tostring(L, 2));
-		lua_pushboolean(L, inst->loadFromFile(fileName));
-		return 1;
-	}
 	static int Polycode_Data_getAsString(lua_State *L) {
 		luaL_checktype(L, 1, LUA_TUSERDATA);
 		Data *inst = (Data*) *((PolyBase**)lua_touserdata(L, 1));
@@ -3053,14 +3005,6 @@ static int Polycode_JoystickInfo_set_deviceIndex(lua_State *L) {
 		inst->setFromString(str, encoding);
 		return 0;
 	}
-	static int Polycode_Data_saveToFile(lua_State *L) {
-		luaL_checktype(L, 1, LUA_TUSERDATA);
-		Data *inst = (Data*) *((PolyBase**)lua_touserdata(L, 1));
-		luaL_checktype(L, 2, LUA_TSTRING);
-		String fileName = String(lua_tostring(L, 2));
-		lua_pushboolean(L, inst->saveToFile(fileName));
-		return 1;
-	}
 	static int Polycode_delete_Data(lua_State *L) {
 		luaL_checktype(L, 1, LUA_TUSERDATA);
 		PolyBase **inst = (PolyBase**)lua_touserdata(L, 1);
@@ -3588,7 +3532,9 @@ static int Polycode_Entity_set_layerID(lua_State *L) {
 	static int Polycode_Entity_Update(lua_State *L) {
 		luaL_checktype(L, 1, LUA_TUSERDATA);
 		Entity *inst = (Entity*) *((PolyBase**)lua_touserdata(L, 1));
-		inst->Update();
+		luaL_checktype(L, 2, LUA_TNUMBER);
+		Number elapsed = lua_tonumber(L, 2);
+		inst->Update(elapsed);
 		return 0;
 	}
 	static int Polycode_Entity_fixedUpdate(lua_State *L) {
@@ -4270,7 +4216,9 @@ static int Polycode_Entity_set_layerID(lua_State *L) {
 	static int Polycode_Entity_doUpdates(lua_State *L) {
 		luaL_checktype(L, 1, LUA_TUSERDATA);
 		Entity *inst = (Entity*) *((PolyBase**)lua_touserdata(L, 1));
-		inst->doUpdates();
+		luaL_checktype(L, 2, LUA_TNUMBER);
+		Number elapsed = lua_tonumber(L, 2);
+		inst->doUpdates(elapsed);
 		return 0;
 	}
 	static int Polycode_Entity_doFixedUpdates(lua_State *L) {
@@ -4567,11 +4515,7 @@ static int Polycode_Font_set_loaded(lua_State *L) {
 }
 
 	static int Polycode_Font(lua_State *L) {
-		luaL_checktype(L, 1, LUA_TSTRING);
-		String fileName = String(lua_tostring(L, 1));
-		luaL_checktype(L, 2, LUA_TUSERDATA);
-		FT_Library FTLibrary = *(FT_Library*) *((PolyBase**)lua_touserdata(L, 2));
-		Font *inst = new Font(fileName, FTLibrary);
+		Font *inst = new Font();
 		PolyBase **userdataPtr = (PolyBase**)lua_newuserdata(L, sizeof(PolyBase*));
 		*userdataPtr = (PolyBase*)inst;
 		luaL_getmetatable(L, "Polycode.Font");
@@ -5218,32 +5162,6 @@ static int Polycode_GPUDrawBuffer_set_viewport(lua_State *L) {
 		return 0;
 	}
 
-	static int Polycode_Image(lua_State *L) {
-		luaL_checktype(L, 1, LUA_TSTRING);
-		String fileName = String(lua_tostring(L, 1));
-		Image *inst = new Image(fileName);
-		PolyBase **userdataPtr = (PolyBase**)lua_newuserdata(L, sizeof(PolyBase*));
-		*userdataPtr = (PolyBase*)inst;
-		luaL_getmetatable(L, "Polycode.Image");
-		lua_setmetatable(L, -2);
-		return 1;
-	}
-	static int Polycode_Image_loadImage(lua_State *L) {
-		luaL_checktype(L, 1, LUA_TUSERDATA);
-		Image *inst = (Image*) *((PolyBase**)lua_touserdata(L, 1));
-		luaL_checktype(L, 2, LUA_TSTRING);
-		String fileName = String(lua_tostring(L, 2));
-		lua_pushboolean(L, inst->loadImage(fileName));
-		return 1;
-	}
-	static int Polycode_Image_saveImage(lua_State *L) {
-		luaL_checktype(L, 1, LUA_TUSERDATA);
-		Image *inst = (Image*) *((PolyBase**)lua_touserdata(L, 1));
-		luaL_checktype(L, 2, LUA_TSTRING);
-		String fileName = String(lua_tostring(L, 2));
-		lua_pushboolean(L, inst->saveImage(fileName));
-		return 1;
-	}
 	static int Polycode_Image_createEmpty(lua_State *L) {
 		luaL_checktype(L, 1, LUA_TUSERDATA);
 		Image *inst = (Image*) *((PolyBase**)lua_touserdata(L, 1));
@@ -5437,14 +5355,6 @@ static int Polycode_GPUDrawBuffer_set_viewport(lua_State *L) {
 		inst->premultiplyAlpha();
 		return 0;
 	}
-	static int Polycode_Image_savePNG(lua_State *L) {
-		luaL_checktype(L, 1, LUA_TUSERDATA);
-		Image *inst = (Image*) *((PolyBase**)lua_touserdata(L, 1));
-		luaL_checktype(L, 2, LUA_TSTRING);
-		String fileName = String(lua_tostring(L, 2));
-		lua_pushboolean(L, inst->savePNG(fileName));
-		return 1;
-	}
 	static int Polycode_delete_Image(lua_State *L) {
 		luaL_checktype(L, 1, LUA_TUSERDATA);
 		PolyBase **inst = (PolyBase**)lua_touserdata(L, 1);
@@ -6215,7 +6125,9 @@ static int Polycode_Material_set_screenMaterial(lua_State *L) {
 	static int Polycode_Material_recreateRenderTargets(lua_State *L) {
 		luaL_checktype(L, 1, LUA_TUSERDATA);
 		Material *inst = (Material*) *((PolyBase**)lua_touserdata(L, 1));
-		inst->recreateRenderTargets();
+		luaL_checktype(L, 2, LUA_TUSERDATA);
+		Vector2 screenSize = *(Vector2*) *((PolyBase**)lua_touserdata(L, 2));
+		inst->recreateRenderTargets(screenSize);
 		return 0;
 	}
 	static int Polycode_Material_getName(lua_State *L) {
@@ -6564,58 +6476,6 @@ static int Polycode_ShaderPass_set_blendingMode(lua_State *L) {
 		lua_setmetatable(L, -2);
 		return 1;
 	}
-	static int Polycode_Mesh_loadMesh(lua_State *L) {
-		luaL_checktype(L, 1, LUA_TUSERDATA);
-		Mesh *inst = (Mesh*) *((PolyBase**)lua_touserdata(L, 1));
-		luaL_checktype(L, 2, LUA_TSTRING);
-		String fileName = String(lua_tostring(L, 2));
-		inst->loadMesh(fileName);
-		return 0;
-	}
-	static int Polycode_Mesh_saveToFile(lua_State *L) {
-		luaL_checktype(L, 1, LUA_TUSERDATA);
-		Mesh *inst = (Mesh*) *((PolyBase**)lua_touserdata(L, 1));
-		luaL_checktype(L, 2, LUA_TSTRING);
-		String fileName = String(lua_tostring(L, 2));
-		bool writeNormals;
-		if(lua_isboolean(L, 3)) {
-			writeNormals = lua_toboolean(L, 3) != 0;
-		} else {
-			writeNormals = true;
-		}
-		bool writeTangents;
-		if(lua_isboolean(L, 4)) {
-			writeTangents = lua_toboolean(L, 4) != 0;
-		} else {
-			writeTangents = true;
-		}
-		bool writeColors;
-		if(lua_isboolean(L, 5)) {
-			writeColors = lua_toboolean(L, 5) != 0;
-		} else {
-			writeColors = true;
-		}
-		bool writeBoneWeights;
-		if(lua_isboolean(L, 6)) {
-			writeBoneWeights = lua_toboolean(L, 6) != 0;
-		} else {
-			writeBoneWeights = true;
-		}
-		bool writeUVs;
-		if(lua_isboolean(L, 7)) {
-			writeUVs = lua_toboolean(L, 7) != 0;
-		} else {
-			writeUVs = true;
-		}
-		bool writeSecondaryUVs;
-		if(lua_isboolean(L, 8)) {
-			writeSecondaryUVs = lua_toboolean(L, 8) != 0;
-		} else {
-			writeSecondaryUVs = false;
-		}
-		inst->saveToFile(fileName, writeNormals, writeTangents, writeColors, writeBoneWeights, writeUVs, writeSecondaryUVs);
-		return 0;
-	}
 	static int Polycode_Mesh_addSubmesh(lua_State *L) {
 		luaL_checktype(L, 1, LUA_TUSERDATA);
 		Mesh *inst = (Mesh*) *((PolyBase**)lua_touserdata(L, 1));
@@ -7900,7 +7760,9 @@ static int Polycode_SceneParticleEmitter_set_colorDeviation(lua_State *L) {
 	static int Polycode_SceneParticleEmitter_updateParticles(lua_State *L) {
 		luaL_checktype(L, 1, LUA_TUSERDATA);
 		SceneParticleEmitter *inst = (SceneParticleEmitter*) *((PolyBase**)lua_touserdata(L, 1));
-		inst->updateParticles();
+		luaL_checktype(L, 2, LUA_TNUMBER);
+		Number elapsed = lua_tonumber(L, 2);
+		inst->updateParticles(elapsed);
 		return 0;
 	}
 	static int Polycode_SceneParticleEmitter_triggerParticles(lua_State *L) {
@@ -8847,6 +8709,14 @@ static int Polycode_RenderDataArray_get_customArrayName(lua_State *L) {
 	return 1;
 }
 
+static int Polycode_RenderDataArray_get_platformData(lua_State *L) {
+	luaL_checktype(L, 1, LUA_TUSERDATA);
+	RenderDataArray *inst = (RenderDataArray*) *((PolyBase**)lua_touserdata(L, 1));
+	PolyBase **userdataPtr = (PolyBase**)lua_newuserdata(L, sizeof(PolyBase*));
+	*userdataPtr = (PolyBase*)&inst->platformData;
+	return 1;
+}
+
 static int Polycode_RenderDataArray_set_type(lua_State *L) {
 	luaL_checktype(L, 1, LUA_TUSERDATA);
 	RenderDataArray *inst = (RenderDataArray*) *((PolyBase**)lua_touserdata(L, 1));
@@ -8863,6 +8733,15 @@ static int Polycode_RenderDataArray_set_customArrayName(lua_State *L) {
 	return 0;
 }
 
+static int Polycode_RenderDataArray_set_platformData(lua_State *L) {
+	luaL_checktype(L, 1, LUA_TUSERDATA);
+	RenderDataArray *inst = (RenderDataArray*) *((PolyBase**)lua_touserdata(L, 1));
+	luaL_checktype(L, 2, LUA_TUSERDATA);
+	RendererPlatformData *argInst = (RendererPlatformData*) *((PolyBase**)lua_touserdata(L, 2));
+	inst->platformData = *argInst;
+	return 0;
+}
+
 	static int Polycode_RenderDataArray(lua_State *L) {
 		luaL_checktype(L, 1, LUA_TNUMBER);
 		int type = lua_tointeger(L, 1);
@@ -9175,6 +9054,37 @@ static int Polycode_RenderThreadDebugInfo_set_timeTaken(lua_State *L) {
 		return 0;
 	}
 
+static int Polycode_RendererPlatformData_get_type(lua_State *L) {
+	luaL_checktype(L, 1, LUA_TUSERDATA);
+	RendererPlatformData *inst = (RendererPlatformData*) *((PolyBase**)lua_touserdata(L, 1));
+	lua_pushinteger(L, inst->type);
+	return 1;
+}
+
+static int Polycode_RendererPlatformData_set_type(lua_State *L) {
+	luaL_checktype(L, 1, LUA_TUSERDATA);
+	RendererPlatformData *inst = (RendererPlatformData*) *((PolyBase**)lua_touserdata(L, 1));
+	int param = lua_tointeger(L, 2);
+	inst->type = param;
+	return 0;
+}
+
+	static int Polycode_RendererPlatformData(lua_State *L) {
+		RendererPlatformData *inst = new RendererPlatformData();
+		PolyBase **userdataPtr = (PolyBase**)lua_newuserdata(L, sizeof(PolyBase*));
+		*userdataPtr = (PolyBase*)inst;
+		luaL_getmetatable(L, "Polycode.RendererPlatformData");
+		lua_setmetatable(L, -2);
+		return 1;
+	}
+	static int Polycode_delete_RendererPlatformData(lua_State *L) {
+		luaL_checktype(L, 1, LUA_TUSERDATA);
+		PolyBase **inst = (PolyBase**)lua_touserdata(L, 1);
+		delete ((RendererPlatformData*) *inst);
+		*inst = NULL;
+		return 0;
+	}
+
 static int Polycode_Resource_get_reloadOnFileModify(lua_State *L) {
 	luaL_checktype(L, 1, LUA_TUSERDATA);
 	Resource *inst = (Resource*) *((PolyBase**)lua_touserdata(L, 1));
@@ -9190,6 +9100,14 @@ static int Polycode_Resource_get_resourceFileTime(lua_State *L) {
 	return 1;
 }
 
+static int Polycode_Resource_get_platformData(lua_State *L) {
+	luaL_checktype(L, 1, LUA_TUSERDATA);
+	Resource *inst = (Resource*) *((PolyBase**)lua_touserdata(L, 1));
+	PolyBase **userdataPtr = (PolyBase**)lua_newuserdata(L, sizeof(PolyBase*));
+	*userdataPtr = (PolyBase*)&inst->platformData;
+	return 1;
+}
+
 static int Polycode_Resource_set_reloadOnFileModify(lua_State *L) {
 	luaL_checktype(L, 1, LUA_TUSERDATA);
 	Resource *inst = (Resource*) *((PolyBase**)lua_touserdata(L, 1));
@@ -9207,6 +9125,15 @@ static int Polycode_Resource_set_resourceFileTime(lua_State *L) {
 	return 0;
 }
 
+static int Polycode_Resource_set_platformData(lua_State *L) {
+	luaL_checktype(L, 1, LUA_TUSERDATA);
+	Resource *inst = (Resource*) *((PolyBase**)lua_touserdata(L, 1));
+	luaL_checktype(L, 2, LUA_TUSERDATA);
+	RendererPlatformData *argInst = (RendererPlatformData*) *((PolyBase**)lua_touserdata(L, 2));
+	inst->platformData = *argInst;
+	return 0;
+}
+
 	static int Polycode_Resource(lua_State *L) {
 		luaL_checktype(L, 1, LUA_TNUMBER);
 		int type = lua_tointeger(L, 1);
@@ -9217,12 +9144,6 @@ static int Polycode_Resource_set_resourceFileTime(lua_State *L) {
 		lua_setmetatable(L, -2);
 		return 1;
 	}
-	static int Polycode_Resource_reloadResource(lua_State *L) {
-		luaL_checktype(L, 1, LUA_TUSERDATA);
-		Resource *inst = (Resource*) *((PolyBase**)lua_touserdata(L, 1));
-		inst->reloadResource();
-		return 0;
-	}
 	static int Polycode_Resource_getResourceName(lua_State *L) {
 		luaL_checktype(L, 1, LUA_TUSERDATA);
 		Resource *inst = (Resource*) *((PolyBase**)lua_touserdata(L, 1));
@@ -9434,6 +9355,71 @@ static int Polycode_ResourcePool_set_deleteOnUnsubscribe(lua_State *L) {
 		*userdataPtr = (PolyBase*)retInst;
 		return 1;
 	}
+	static int Polycode_ResourcePool_getFont(lua_State *L) {
+		luaL_checktype(L, 1, LUA_TUSERDATA);
+		ResourcePool *inst = (ResourcePool*) *((PolyBase**)lua_touserdata(L, 1));
+		luaL_checktype(L, 2, LUA_TSTRING);
+		String name = String(lua_tostring(L, 2));
+		shared_ptr<Font> *retInst = new shared_ptr<Font>();
+		*retInst = inst->getFont(name);
+		PolyBase **userdataPtr = (PolyBase**)lua_newuserdata(L, sizeof(PolyBase*));
+		luaL_getmetatable(L, "Polycode.shared_ptr<Font>");
+		lua_setmetatable(L, -2);
+		*userdataPtr = (PolyBase*)retInst;
+		return 1;
+	}
+	static int Polycode_ResourcePool_getMaterial(lua_State *L) {
+		luaL_checktype(L, 1, LUA_TUSERDATA);
+		ResourcePool *inst = (ResourcePool*) *((PolyBase**)lua_touserdata(L, 1));
+		luaL_checktype(L, 2, LUA_TSTRING);
+		String name = String(lua_tostring(L, 2));
+		shared_ptr<Material> *retInst = new shared_ptr<Material>();
+		*retInst = inst->getMaterial(name);
+		PolyBase **userdataPtr = (PolyBase**)lua_newuserdata(L, sizeof(PolyBase*));
+		luaL_getmetatable(L, "Polycode.shared_ptr<Material>");
+		lua_setmetatable(L, -2);
+		*userdataPtr = (PolyBase*)retInst;
+		return 1;
+	}
+	static int Polycode_ResourcePool_getShader(lua_State *L) {
+		luaL_checktype(L, 1, LUA_TUSERDATA);
+		ResourcePool *inst = (ResourcePool*) *((PolyBase**)lua_touserdata(L, 1));
+		luaL_checktype(L, 2, LUA_TSTRING);
+		String name = String(lua_tostring(L, 2));
+		shared_ptr<Shader> *retInst = new shared_ptr<Shader>();
+		*retInst = inst->getShader(name);
+		PolyBase **userdataPtr = (PolyBase**)lua_newuserdata(L, sizeof(PolyBase*));
+		luaL_getmetatable(L, "Polycode.shared_ptr<Shader>");
+		lua_setmetatable(L, -2);
+		*userdataPtr = (PolyBase*)retInst;
+		return 1;
+	}
+	static int Polycode_ResourcePool_loadTexture(lua_State *L) {
+		luaL_checktype(L, 1, LUA_TUSERDATA);
+		ResourcePool *inst = (ResourcePool*) *((PolyBase**)lua_touserdata(L, 1));
+		luaL_checktype(L, 2, LUA_TSTRING);
+		String name = String(lua_tostring(L, 2));
+		shared_ptr<Texture> *retInst = new shared_ptr<Texture>();
+		*retInst = inst->loadTexture(name);
+		PolyBase **userdataPtr = (PolyBase**)lua_newuserdata(L, sizeof(PolyBase*));
+		luaL_getmetatable(L, "Polycode.shared_ptr<Texture>");
+		lua_setmetatable(L, -2);
+		*userdataPtr = (PolyBase*)retInst;
+		return 1;
+	}
+	static int Polycode_ResourcePool_loadMesh(lua_State *L) {
+		luaL_checktype(L, 1, LUA_TUSERDATA);
+		ResourcePool *inst = (ResourcePool*) *((PolyBase**)lua_touserdata(L, 1));
+		luaL_checktype(L, 2, LUA_TSTRING);
+		String name = String(lua_tostring(L, 2));
+		shared_ptr<Mesh> *retInst = new shared_ptr<Mesh>();
+		*retInst = inst->loadMesh(name);
+		PolyBase **userdataPtr = (PolyBase**)lua_newuserdata(L, sizeof(PolyBase*));
+		luaL_getmetatable(L, "Polycode.shared_ptr<Mesh>");
+		lua_setmetatable(L, -2);
+		*userdataPtr = (PolyBase*)retInst;
+		return 1;
+	}
 	static int Polycode_ResourcePool_getName(lua_State *L) {
 		luaL_checktype(L, 1, LUA_TUSERDATA);
 		ResourcePool *inst = (ResourcePool*) *((PolyBase**)lua_touserdata(L, 1));
@@ -9844,9 +9830,7 @@ static int Polycode_Scene_set_constrainPickingToViewport(lua_State *L) {
 }
 
 	static int Polycode_Scene(lua_State *L) {
-		luaL_checktype(L, 1, LUA_TNUMBER);
-		int sceneType = lua_tointeger(L, 1);
-		Scene *inst = new Scene(sceneType);
+		Scene *inst = new Scene();
 		PolyBase **userdataPtr = (PolyBase**)lua_newuserdata(L, sizeof(PolyBase*));
 		*userdataPtr = (PolyBase*)inst;
 		luaL_getmetatable(L, "Polycode.Scene");
@@ -9894,7 +9878,9 @@ static int Polycode_Scene_set_constrainPickingToViewport(lua_State *L) {
 	static int Polycode_Scene_Update(lua_State *L) {
 		luaL_checktype(L, 1, LUA_TUSERDATA);
 		Scene *inst = (Scene*) *((PolyBase**)lua_touserdata(L, 1));
-		inst->Update();
+		luaL_checktype(L, 2, LUA_TNUMBER);
+		Number elapsed = lua_tonumber(L, 2);
+		inst->Update(elapsed);
 		return 0;
 	}
 	static int Polycode_Scene_isEnabled(lua_State *L) {
@@ -9955,12 +9941,6 @@ static int Polycode_Scene_set_constrainPickingToViewport(lua_State *L) {
 		lua_setmetatable(L, -2);
 		return 1;
 	}
-	static int Polycode_SceneEntityInstanceResourceEntry_reloadResource(lua_State *L) {
-		luaL_checktype(L, 1, LUA_TUSERDATA);
-		SceneEntityInstanceResourceEntry *inst = (SceneEntityInstanceResourceEntry*) *((PolyBase**)lua_touserdata(L, 1));
-		inst->reloadResource();
-		return 0;
-	}
 	static int Polycode_delete_SceneEntityInstanceResourceEntry(lua_State *L) {
 		luaL_checktype(L, 1, LUA_TUSERDATA);
 		PolyBase **inst = (PolyBase**)lua_touserdata(L, 1);
@@ -9999,16 +9979,6 @@ static int Polycode_SceneEntityInstance_set_fileName(lua_State *L) {
 	return 0;
 }
 
-	static int Polycode_SceneEntityInstance(lua_State *L) {
-		luaL_checktype(L, 1, LUA_TSTRING);
-		String fileName = String(lua_tostring(L, 1));
-		SceneEntityInstance *inst = new SceneEntityInstance(fileName);
-		PolyBase **userdataPtr = (PolyBase**)lua_newuserdata(L, sizeof(PolyBase*));
-		*userdataPtr = (PolyBase*)inst;
-		luaL_getmetatable(L, "Polycode.SceneEntityInstance");
-		lua_setmetatable(L, -2);
-		return 1;
-	}
 	static int Polycode_SceneEntityInstance_reloadEntityInstance(lua_State *L) {
 		luaL_checktype(L, 1, LUA_TUSERDATA);
 		SceneEntityInstance *inst = (SceneEntityInstance*) *((PolyBase**)lua_touserdata(L, 1));
@@ -10161,25 +10131,27 @@ static int Polycode_SceneLabel_set_positionAtBaseline(lua_State *L) {
 }
 
 	static int Polycode_SceneLabel(lua_State *L) {
-		luaL_checktype(L, 1, LUA_TSTRING);
-		String text = String(lua_tostring(L, 1));
-		luaL_checktype(L, 2, LUA_TNUMBER);
-		int size = lua_tointeger(L, 2);
-		luaL_checktype(L, 3, LUA_TSTRING);
-		String fontName = String(lua_tostring(L, 3));
+		luaL_checktype(L, 1, LUA_TUSERDATA);
+		shared_ptr<Material> material = *(shared_ptr<Material>*) *((PolyBase**)lua_touserdata(L, 1));
+		luaL_checktype(L, 2, LUA_TSTRING);
+		String text = String(lua_tostring(L, 2));
+		luaL_checktype(L, 3, LUA_TNUMBER);
+		int size = lua_tointeger(L, 3);
+		luaL_checktype(L, 4, LUA_TUSERDATA);
+		shared_ptr<Font> font = *(shared_ptr<Font>*) *((PolyBase**)lua_touserdata(L, 4));
 		int amode;
-		if(lua_isnumber(L, 4)) {
-			amode = lua_tointeger(L, 4);
+		if(lua_isnumber(L, 5)) {
+			amode = lua_tointeger(L, 5);
 		} else {
 			amode = 0;
 		}
 		Number actualHeight;
-		if(lua_isnumber(L, 5)) {
-			actualHeight = lua_tonumber(L, 5);
+		if(lua_isnumber(L, 6)) {
+			actualHeight = lua_tonumber(L, 6);
 		} else {
 			actualHeight = 0.0;
 		}
-		SceneLabel *inst = new SceneLabel(text, size, fontName, amode, actualHeight);
+		SceneLabel *inst = new SceneLabel(material, text, size, font, amode, actualHeight);
 		PolyBase **userdataPtr = (PolyBase**)lua_newuserdata(L, sizeof(PolyBase*));
 		*userdataPtr = (PolyBase*)inst;
 		luaL_getmetatable(L, "Polycode.SceneLabel");
@@ -10259,7 +10231,9 @@ static int Polycode_SceneLabel_set_positionAtBaseline(lua_State *L) {
 		} else {
 			quadraticAttenuation = 1;
 		}
-		SceneLight *inst = new SceneLight(type, intensity, constantAttenuation, linearAttenuation, quadraticAttenuation);
+		luaL_checktype(L, 6, LUA_TUSERDATA);
+		shared_ptr<Material> depthMapMaterial = *(shared_ptr<Material>*) *((PolyBase**)lua_touserdata(L, 6));
+		SceneLight *inst = new SceneLight(type, intensity, constantAttenuation, linearAttenuation, quadraticAttenuation, depthMapMaterial);
 		PolyBase **userdataPtr = (PolyBase**)lua_newuserdata(L, sizeof(PolyBase*));
 		*userdataPtr = (PolyBase*)inst;
 		luaL_getmetatable(L, "Polycode.SceneLight");
@@ -10699,9 +10673,7 @@ static int Polycode_SceneMesh_set_sendBoneMatricesToMaterial(lua_State *L) {
 }
 
 	static int Polycode_SceneMesh(lua_State *L) {
-		luaL_checktype(L, 1, LUA_TSTRING);
-		String fileName = String(lua_tostring(L, 1));
-		SceneMesh *inst = new SceneMesh(fileName);
+		SceneMesh *inst = new SceneMesh();
 		PolyBase **userdataPtr = (PolyBase**)lua_newuserdata(L, sizeof(PolyBase*));
 		*userdataPtr = (PolyBase*)inst;
 		luaL_getmetatable(L, "Polycode.SceneMesh");
@@ -10765,19 +10737,6 @@ static int Polycode_SceneMesh_set_sendBoneMatricesToMaterial(lua_State *L) {
 		*userdataPtr = (PolyBase*)retInst;
 		return 1;
 	}
-	static int Polycode_SceneMesh_loadSkeleton(lua_State *L) {
-		luaL_checktype(L, 1, LUA_TUSERDATA);
-		SceneMesh *inst = (SceneMesh*) *((PolyBase**)lua_touserdata(L, 1));
-		luaL_checktype(L, 2, LUA_TSTRING);
-		String fileName = String(lua_tostring(L, 2));
-		shared_ptr<Skeleton> *retInst = new shared_ptr<Skeleton>();
-		*retInst = inst->loadSkeleton(fileName);
-		PolyBase **userdataPtr = (PolyBase**)lua_newuserdata(L, sizeof(PolyBase*));
-		luaL_getmetatable(L, "Polycode.shared_ptr<Skeleton>");
-		lua_setmetatable(L, -2);
-		*userdataPtr = (PolyBase*)retInst;
-		return 1;
-	}
 	static int Polycode_SceneMesh_clearMaterial(lua_State *L) {
 		luaL_checktype(L, 1, LUA_TUSERDATA);
 		SceneMesh *inst = (SceneMesh*) *((PolyBase**)lua_touserdata(L, 1));
@@ -10841,14 +10800,6 @@ static int Polycode_SceneMesh_set_sendBoneMatricesToMaterial(lua_State *L) {
 		inst->setFilename(fileName);
 		return 0;
 	}
-	static int Polycode_SceneMesh_loadFromFile(lua_State *L) {
-		luaL_checktype(L, 1, LUA_TUSERDATA);
-		SceneMesh *inst = (SceneMesh*) *((PolyBase**)lua_touserdata(L, 1));
-		luaL_checktype(L, 2, LUA_TSTRING);
-		String fileName = String(lua_tostring(L, 2));
-		inst->loadFromFile(fileName);
-		return 0;
-	}
 	static int Polycode_SceneMesh_customHitDetection(lua_State *L) {
 		luaL_checktype(L, 1, LUA_TUSERDATA);
 		SceneMesh *inst = (SceneMesh*) *((PolyBase**)lua_touserdata(L, 1));
@@ -11066,19 +11017,7 @@ static int Polycode_SceneRenderTexture_set_enabled(lua_State *L) {
 	}
 
 	static int Polycode_SceneSound(lua_State *L) {
-		luaL_checktype(L, 1, LUA_TSTRING);
-		String fileName = String(lua_tostring(L, 1));
-		luaL_checktype(L, 2, LUA_TNUMBER);
-		Number referenceDistance = lua_tonumber(L, 2);
-		luaL_checktype(L, 3, LUA_TNUMBER);
-		Number maxDistance = lua_tonumber(L, 3);
-		bool directionalSound;
-		if(lua_isboolean(L, 4)) {
-			directionalSound = lua_toboolean(L, 4) != 0;
-		} else {
-			directionalSound = false;
-		}
-		SceneSound *inst = new SceneSound(fileName, referenceDistance, maxDistance, directionalSound);
+		SceneSound *inst = new SceneSound();
 		PolyBase **userdataPtr = (PolyBase**)lua_newuserdata(L, sizeof(PolyBase*));
 		*userdataPtr = (PolyBase*)inst;
 		luaL_getmetatable(L, "Polycode.SceneSound");
@@ -12343,12 +12282,6 @@ static int Polycode_ShaderProgram_set_type(lua_State *L) {
 		inst->reloadProgram();
 		return 0;
 	}
-	static int Polycode_ShaderProgram_reloadResource(lua_State *L) {
-		luaL_checktype(L, 1, LUA_TUSERDATA);
-		ShaderProgram *inst = (ShaderProgram*) *((PolyBase**)lua_touserdata(L, 1));
-		inst->reloadResource();
-		return 0;
-	}
 	static int Polycode_delete_ShaderProgram(lua_State *L) {
 		luaL_checktype(L, 1, LUA_TUSERDATA);
 		PolyBase **inst = (PolyBase**)lua_touserdata(L, 1);
@@ -12481,21 +12414,6 @@ static int Polycode_AttributeBinding_set_enabled(lua_State *L) {
 		inst->removeParam(name);
 		return 0;
 	}
-	static int Polycode_ShaderBinding_loadTextureForParam(lua_State *L) {
-		luaL_checktype(L, 1, LUA_TUSERDATA);
-		ShaderBinding *inst = (ShaderBinding*) *((PolyBase**)lua_touserdata(L, 1));
-		luaL_checktype(L, 2, LUA_TSTRING);
-		String paramName = String(lua_tostring(L, 2));
-		luaL_checktype(L, 3, LUA_TSTRING);
-		String fileName = String(lua_tostring(L, 3));
-		shared_ptr<Texture> *retInst = new shared_ptr<Texture>();
-		*retInst = inst->loadTextureForParam(paramName, fileName);
-		PolyBase **userdataPtr = (PolyBase**)lua_newuserdata(L, sizeof(PolyBase*));
-		luaL_getmetatable(L, "Polycode.shared_ptr<Texture>");
-		lua_setmetatable(L, -2);
-		*userdataPtr = (PolyBase*)retInst;
-		return 1;
-	}
 	static int Polycode_ShaderBinding_setTextureForParam(lua_State *L) {
 		luaL_checktype(L, 1, LUA_TUSERDATA);
 		ShaderBinding *inst = (ShaderBinding*) *((PolyBase**)lua_touserdata(L, 1));
@@ -12601,7 +12519,9 @@ static int Polycode_AttributeBinding_set_enabled(lua_State *L) {
 	static int Polycode_SkeletonAnimation_Update(lua_State *L) {
 		luaL_checktype(L, 1, LUA_TUSERDATA);
 		SkeletonAnimation *inst = (SkeletonAnimation*) *((PolyBase**)lua_touserdata(L, 1));
-		inst->Update();
+		luaL_checktype(L, 2, LUA_TNUMBER);
+		Number elapsed = lua_tonumber(L, 2);
+		inst->Update(elapsed);
 		return 0;
 	}
 	static int Polycode_SkeletonAnimation_setSpeed(lua_State *L) {
@@ -12641,23 +12561,13 @@ static int Polycode_AttributeBinding_set_enabled(lua_State *L) {
 	}
 
 	static int Polycode_Skeleton(lua_State *L) {
-		luaL_checktype(L, 1, LUA_TSTRING);
-		String fileName = String(lua_tostring(L, 1));
-		Skeleton *inst = new Skeleton(fileName);
+		Skeleton *inst = new Skeleton();
 		PolyBase **userdataPtr = (PolyBase**)lua_newuserdata(L, sizeof(PolyBase*));
 		*userdataPtr = (PolyBase*)inst;
 		luaL_getmetatable(L, "Polycode.Skeleton");
 		lua_setmetatable(L, -2);
 		return 1;
 	}
-	static int Polycode_Skeleton_loadSkeleton(lua_State *L) {
-		luaL_checktype(L, 1, LUA_TUSERDATA);
-		Skeleton *inst = (Skeleton*) *((PolyBase**)lua_touserdata(L, 1));
-		luaL_checktype(L, 2, LUA_TSTRING);
-		String fileName = String(lua_tostring(L, 2));
-		inst->loadSkeleton(fileName);
-		return 0;
-	}
 	static int Polycode_Skeleton_playAnimationByName(lua_State *L) {
 		luaL_checktype(L, 1, LUA_TUSERDATA);
 		Skeleton *inst = (Skeleton*) *((PolyBase**)lua_touserdata(L, 1));
@@ -12698,16 +12608,6 @@ static int Polycode_AttributeBinding_set_enabled(lua_State *L) {
 		inst->stopAllAnimations();
 		return 0;
 	}
-	static int Polycode_Skeleton_addAnimation(lua_State *L) {
-		luaL_checktype(L, 1, LUA_TUSERDATA);
-		Skeleton *inst = (Skeleton*) *((PolyBase**)lua_touserdata(L, 1));
-		luaL_checktype(L, 2, LUA_TSTRING);
-		String name = String(lua_tostring(L, 2));
-		luaL_checktype(L, 3, LUA_TSTRING);
-		String fileName = String(lua_tostring(L, 3));
-		inst->addAnimation(name, fileName);
-		return 0;
-	}
 	static int Polycode_Skeleton_stopAnimationByName(lua_State *L) {
 		luaL_checktype(L, 1, LUA_TUSERDATA);
 		Skeleton *inst = (Skeleton*) *((PolyBase**)lua_touserdata(L, 1));
@@ -12719,7 +12619,9 @@ static int Polycode_AttributeBinding_set_enabled(lua_State *L) {
 	static int Polycode_Skeleton_Update(lua_State *L) {
 		luaL_checktype(L, 1, LUA_TUSERDATA);
 		Skeleton *inst = (Skeleton*) *((PolyBase**)lua_touserdata(L, 1));
-		inst->Update();
+		luaL_checktype(L, 2, LUA_TNUMBER);
+		Number elapsed = lua_tonumber(L, 2);
+		inst->Update(elapsed);
 		return 0;
 	}
 	static int Polycode_Skeleton_getBoneByName(lua_State *L) {
@@ -12921,9 +12823,7 @@ static int Polycode_BoneTrack_set_weight(lua_State *L) {
 	}
 
 	static int Polycode_Sound(lua_State *L) {
-		luaL_checktype(L, 1, LUA_TSTRING);
-		String fileName = String(lua_tostring(L, 1));
-		Sound *inst = new Sound(fileName);
+		Sound *inst = new Sound();
 		PolyBase **userdataPtr = (PolyBase**)lua_newuserdata(L, sizeof(PolyBase*));
 		*userdataPtr = (PolyBase*)inst;
 		luaL_getmetatable(L, "Polycode.Sound");
@@ -12944,14 +12844,6 @@ static int Polycode_BoneTrack_set_weight(lua_State *L) {
 		lua_pushnumber(L, inst->getSampleAsNumber(offset, channel, position, orientation));
 		return 1;
 	}
-	static int Polycode_Sound_loadFile(lua_State *L) {
-		luaL_checktype(L, 1, LUA_TUSERDATA);
-		Sound *inst = (Sound*) *((PolyBase**)lua_touserdata(L, 1));
-		luaL_checktype(L, 2, LUA_TSTRING);
-		String fileName = String(lua_tostring(L, 2));
-		inst->loadFile(fileName);
-		return 0;
-	}
 	static int Polycode_Sound_Play(lua_State *L) {
 		luaL_checktype(L, 1, LUA_TUSERDATA);
 		Sound *inst = (Sound*) *((PolyBase**)lua_touserdata(L, 1));
@@ -13138,22 +13030,6 @@ static int Polycode_BoneTrack_set_weight(lua_State *L) {
 		lua_pushnumber(L, inst->getMaxDistance());
 		return 1;
 	}
-	static int Polycode_Sound_loadWAV(lua_State *L) {
-		luaL_checktype(L, 1, LUA_TUSERDATA);
-		Sound *inst = (Sound*) *((PolyBase**)lua_touserdata(L, 1));
-		luaL_checktype(L, 2, LUA_TSTRING);
-		String fileName = String(lua_tostring(L, 2));
-		lua_pushboolean(L, inst->loadWAV(fileName));
-		return 1;
-	}
-	static int Polycode_Sound_loadOGG(lua_State *L) {
-		luaL_checktype(L, 1, LUA_TUSERDATA);
-		Sound *inst = (Sound*) *((PolyBase**)lua_touserdata(L, 1));
-		luaL_checktype(L, 2, LUA_TSTRING);
-		String fileName = String(lua_tostring(L, 2));
-		lua_pushboolean(L, inst->loadOGG(fileName));
-		return 1;
-	}
 	static int Polycode_Sound_soundCheck(lua_State *L) {
 		luaL_checktype(L, 1, LUA_TUSERDATA);
 		Sound *inst = (Sound*) *((PolyBase**)lua_touserdata(L, 1));
@@ -13582,6 +13458,40 @@ static int Polycode_String_set_w_contents(lua_State *L) {
 		return 0;
 	}
 
+static int Polycode_RenderBuffer_get_platformData(lua_State *L) {
+	luaL_checktype(L, 1, LUA_TUSERDATA);
+	RenderBuffer *inst = (RenderBuffer*) *((PolyBase**)lua_touserdata(L, 1));
+	PolyBase **userdataPtr = (PolyBase**)lua_newuserdata(L, sizeof(PolyBase*));
+	*userdataPtr = (PolyBase*)&inst->platformData;
+	return 1;
+}
+
+static int Polycode_RenderBuffer_get_depthBufferPlatformData(lua_State *L) {
+	luaL_checktype(L, 1, LUA_TUSERDATA);
+	RenderBuffer *inst = (RenderBuffer*) *((PolyBase**)lua_touserdata(L, 1));
+	PolyBase **userdataPtr = (PolyBase**)lua_newuserdata(L, sizeof(PolyBase*));
+	*userdataPtr = (PolyBase*)&inst->depthBufferPlatformData;
+	return 1;
+}
+
+static int Polycode_RenderBuffer_set_platformData(lua_State *L) {
+	luaL_checktype(L, 1, LUA_TUSERDATA);
+	RenderBuffer *inst = (RenderBuffer*) *((PolyBase**)lua_touserdata(L, 1));
+	luaL_checktype(L, 2, LUA_TUSERDATA);
+	RendererPlatformData *argInst = (RendererPlatformData*) *((PolyBase**)lua_touserdata(L, 2));
+	inst->platformData = *argInst;
+	return 0;
+}
+
+static int Polycode_RenderBuffer_set_depthBufferPlatformData(lua_State *L) {
+	luaL_checktype(L, 1, LUA_TUSERDATA);
+	RenderBuffer *inst = (RenderBuffer*) *((PolyBase**)lua_touserdata(L, 1));
+	luaL_checktype(L, 2, LUA_TUSERDATA);
+	RendererPlatformData *argInst = (RendererPlatformData*) *((PolyBase**)lua_touserdata(L, 2));
+	inst->depthBufferPlatformData = *argInst;
+	return 0;
+}
+
 	static int Polycode_RenderBuffer(lua_State *L) {
 		luaL_checktype(L, 1, LUA_TNUMBER);
 		int width = lua_tointeger(L, 1);
@@ -13723,12 +13633,6 @@ static int Polycode_Texture_set_depthTexture(lua_State *L) {
 	return 0;
 }
 
-	static int Polycode_Texture_reloadResource(lua_State *L) {
-		luaL_checktype(L, 1, LUA_TUSERDATA);
-		Texture *inst = (Texture*) *((PolyBase**)lua_touserdata(L, 1));
-		inst->reloadResource();
-		return 0;
-	}
 	static int Polycode_Texture_getWidth(lua_State *L) {
 		luaL_checktype(L, 1, LUA_TUSERDATA);
 		Texture *inst = (Texture*) *((PolyBase**)lua_touserdata(L, 1));
@@ -13763,80 +13667,6 @@ static int Polycode_Texture_set_depthTexture(lua_State *L) {
 		return 0;
 	}
 
-	static int Polycode_Timer(lua_State *L) {
-		luaL_checktype(L, 1, LUA_TBOOLEAN);
-		bool triggerMode = lua_toboolean(L, 1) != 0;
-		luaL_checktype(L, 2, LUA_TNUMBER);
-		int msecs = lua_tointeger(L, 2);
-		Timer *inst = new Timer(triggerMode, msecs);
-		PolyBase **userdataPtr = (PolyBase**)lua_newuserdata(L, sizeof(PolyBase*));
-		*userdataPtr = (PolyBase*)inst;
-		luaL_getmetatable(L, "Polycode.Timer");
-		lua_setmetatable(L, -2);
-		return 1;
-	}
-	static int Polycode_Timer_Pause(lua_State *L) {
-		luaL_checktype(L, 1, LUA_TUSERDATA);
-		Timer *inst = (Timer*) *((PolyBase**)lua_touserdata(L, 1));
-		luaL_checktype(L, 2, LUA_TBOOLEAN);
-		bool paused = lua_toboolean(L, 2) != 0;
-		inst->Pause(paused);
-		return 0;
-	}
-	static int Polycode_Timer_isPaused(lua_State *L) {
-		luaL_checktype(L, 1, LUA_TUSERDATA);
-		Timer *inst = (Timer*) *((PolyBase**)lua_touserdata(L, 1));
-		lua_pushboolean(L, inst->isPaused());
-		return 1;
-	}
-	static int Polycode_Timer_getTicks(lua_State *L) {
-		luaL_checktype(L, 1, LUA_TUSERDATA);
-		Timer *inst = (Timer*) *((PolyBase**)lua_touserdata(L, 1));
-		lua_pushinteger(L, inst->getTicks());
-		return 1;
-	}
-	static int Polycode_Timer_Update(lua_State *L) {
-		luaL_checktype(L, 1, LUA_TUSERDATA);
-		Timer *inst = (Timer*) *((PolyBase**)lua_touserdata(L, 1));
-		luaL_checktype(L, 2, LUA_TNUMBER);
-		int ticks = lua_tointeger(L, 2);
-		inst->Update(ticks);
-		return 0;
-	}
-	static int Polycode_Timer_Reset(lua_State *L) {
-		luaL_checktype(L, 1, LUA_TUSERDATA);
-		Timer *inst = (Timer*) *((PolyBase**)lua_touserdata(L, 1));
-		inst->Reset();
-		return 0;
-	}
-	static int Polycode_Timer_hasElapsed(lua_State *L) {
-		luaL_checktype(L, 1, LUA_TUSERDATA);
-		Timer *inst = (Timer*) *((PolyBase**)lua_touserdata(L, 1));
-		lua_pushboolean(L, inst->hasElapsed());
-		return 1;
-	}
-	static int Polycode_Timer_getElapsedf(lua_State *L) {
-		luaL_checktype(L, 1, LUA_TUSERDATA);
-		Timer *inst = (Timer*) *((PolyBase**)lua_touserdata(L, 1));
-		lua_pushnumber(L, inst->getElapsedf());
-		return 1;
-	}
-	static int Polycode_Timer_setTimerInterval(lua_State *L) {
-		luaL_checktype(L, 1, LUA_TUSERDATA);
-		Timer *inst = (Timer*) *((PolyBase**)lua_touserdata(L, 1));
-		luaL_checktype(L, 2, LUA_TNUMBER);
-		int msecs = lua_tointeger(L, 2);
-		inst->setTimerInterval(msecs);
-		return 0;
-	}
-	static int Polycode_delete_Timer(lua_State *L) {
-		luaL_checktype(L, 1, LUA_TUSERDATA);
-		PolyBase **inst = (PolyBase**)lua_touserdata(L, 1);
-		delete ((Timer*) *inst);
-		*inst = NULL;
-		return 0;
-	}
-
 static int Polycode_Vector2_get_x(lua_State *L) {
 	luaL_checktype(L, 1, LUA_TUSERDATA);
 	Vector2 *inst = (Vector2*) *((PolyBase**)lua_touserdata(L, 1));

+ 1 - 6
include/polycode/core/PolyCamera.h

@@ -184,12 +184,6 @@ namespace Polycode {
 			*/
 			void setPostFilter(std::shared_ptr<Material> material);
 			
-			/**
-			* Sets the post-processing shader for the camera by name. The material needs have been added as a resource.
-			* @param materialName The material name of the post-processing filter.
-			*/												
-			void setPostFilterByName(const String& shaderName);
-			
 			/**
 			* Removes the currently assigned post filter.
 			*/
@@ -274,6 +268,7 @@ namespace Polycode {
 		
 			Mesh *screenQuadMesh;
 
+            void rebuildMaterialBindings();
 			void setOrthoMatrix(Matrix4 &matrix, Number xSize, Number ySize, Number _near, Number _far, bool centered);
 		
 			int projectionMode;		   

+ 3 - 9
include/polycode/core/PolyClient.h

@@ -24,7 +24,6 @@ THE SOFTWARE.
 #include "polycode/core/PolyLogger.h"
 #include "polycode/core/PolyGlobals.h"
 #include "polycode/core/PolyPeer.h"
-#include "polycode/core/PolyTimer.h"
 #include "polycode/core/PolyEvent.h"
 
 namespace Polycode {
@@ -50,25 +49,20 @@ namespace Polycode {
 	
 	class _PolyExport Client : public Peer {
 	public:
-		Client(unsigned int port, int rate);
+		Client(Core *core, unsigned int port, int rate);
 		~Client();
 		
-		void updatePeer();
+		void updateClient();
 		void Connect(std::string ipAddress, unsigned int port);
 		void Disconnect();
-		void setPersistentData(void *data, unsigned int size);
-		
+		void sendClientData(char *data, uint32_t datasize);
 		unsigned int getClientID();
-		
 		void sendReliableDataToServer(char *data, unsigned int size, unsigned short type);
-		
 		void handlePacket(Packet *packet, PeerConnection *connection);
 		
-		void handleEvent(Event *event);
 	private:
 		
 		int clientID;
-		
 		void *data;
 		unsigned int dataSize;
 		Timer *rateTimer;

+ 0 - 9
include/polycode/core/PolyCocoaCore.h

@@ -46,13 +46,6 @@ using std::vector;
 
 namespace Polycode {
 	
-	class _PolyExport PosixMutex : public CoreMutex {
-	public:
-		void lock();
-		void unlock();
-		pthread_mutex_t pMutex;
-	};
-	
 	class CocoaEvent {
 	public:
 		int eventGroup;
@@ -149,8 +142,6 @@ namespace Polycode {
 		
 		void makeApplicationMain();
 		
-		CoreMutex *createMutex();		
-		
 		void checkEvents();		
 		
 		int lastMouseY;

+ 14 - 7
include/polycode/core/PolyConfig.h

@@ -25,6 +25,8 @@ THE SOFTWARE.
 #include "polycode/core/PolyString.h"
 
 namespace Polycode {
+    
+    class Core;
 
 	class ConfigEntry : public PolyBase {
 	public:
@@ -42,8 +44,9 @@ namespace Polycode {
 	public:
 		/**
 		* Default constructor.
-		*/ 
-		Config();
+		*/
+		Config(){}
+		Config(Core *core);
 		~Config();		
 
 		/**
@@ -58,9 +61,10 @@ namespace Polycode {
 		* @param configNamespace Namespace of the config to save data from.
 		* @param fileName Path to the file to save data to.
 		*/		
-		void saveConfig(const String& configNamespace, const String& fileName);
+		void saveConfig(const String& configNamespace, const String& fileName)  const;
 
-		ConfigEntry *getEntry(const String& configNamespace, const String& key);
+		ConfigEntry *getEntry(const String& configNamespace, const String& key) const;
+		ConfigEntry *getEntryOrAdd(const String& configNamespace, const String& key);
 
 		/**
 		* Sets a string value into the specified config namespace.
@@ -83,14 +87,14 @@ namespace Polycode {
 		* @param configNamespace Namespace to get the value from.
 		* @param key String key of the value.
 		*/				
-		Number getNumericValue(const String& configNamespace, const String& key);
+		Number getNumericValue(const String& configNamespace, const String& key) const;
 		
 		/**
 		* Returns a string value by a string key.
 		* @param configNamespace Namespace to get the value from.
 		* @param key String key of the value.
 		*/						
-		const String& getStringValue(const String& configNamespace, const String& key);
+		const String& getStringValue(const String& configNamespace, const String& key) const;
 
 		/**
 		* Sets a string value that represents boolean (true|false) key.
@@ -105,11 +109,14 @@ namespace Polycode {
 		* @param configNamespace Namespace to get the value from.
 		* @param key String key of the value.
 		*/
-		bool getBoolValue(const String& configNamespace, const String& key);
+		bool getBoolValue(const String& configNamespace, const String& key) const;
 		
 	private:
 		
+		Core *core;
 		std::vector<ConfigEntry*> entries;
 		
 	};
+	
+	typedef std::shared_ptr<Config> ConfigRef;
 }

+ 19 - 42
include/polycode/core/PolyCore.h

@@ -27,7 +27,7 @@ THE SOFTWARE.
 #include "polycode/core/PolyVector2.h"
 #include "polycode/core/PolyEventDispatcher.h"
 #include "polycode/core/PolyCoreInput.h"
-#include "polycode/core/PolyCoreServices.h"
+#include "polycode/core/PolyConfig.h"
 #include "polycode/core/PolyThreaded.h"
 #include "polycode/core/PolyQuaternion.h"
 #include "polycode/core/PolyCoreFileProvider.h"
@@ -37,16 +37,9 @@ long getThreadID();
 namespace Polycode {
 
 	class Renderer;
-		  
-	class _PolyExport CoreMutex : public PolyBase {
-	public:
-		virtual ~CoreMutex(){}
-
-		virtual void lock() = 0;
-		virtual void unlock() = 0;
-
-		int mutexID;
-	};
+    class ResourceManager;
+    class SoundManager;
+    class Logger;
 	
 	class _PolyExport CoreFileExtension : public PolyBase {
 	public:
@@ -162,24 +155,6 @@ namespace Polycode {
 		* @see Threaded
 		*/		
 		virtual void createThread(Threaded *target);
-
-		/**
-		* Locks a mutex. Legacy method. Use the "lock" method of CoreMutex!
-		* @param mutex Mutex to lock.
-		*/
-		void lockMutex(CoreMutex *mutex);
-		
-		/**
-		* Unlocks a mutex.	Legacy method. Use the "unlock" method of CoreMutex!
-		* @param mutex Mutex to lock.
-		*/		
-		void unlockMutex(CoreMutex *mutex);
-		
-		/**
-		* Creates a mutex
-		* @return Newly created mutex.
-		*/				
-		virtual CoreMutex *createMutex() = 0;
 		
 		/**
 		* Copies the specified string to system clipboard.
@@ -193,12 +168,6 @@ namespace Polycode {
 		*/		
 		virtual String getClipboardString() = 0;
 		
-		/**
-		* Returns the core services. See CoreServices for a detailed explanation of services.
-		* @return Core services.
-		@see CoreServices
-		*/
-		CoreServices *getServices();
 		
 		/**
 		* Returns the current average frames per second.
@@ -415,8 +384,13 @@ namespace Polycode {
 		*/
 		virtual void makeApplicationMain() {}
 		
-		CoreMutex *getEventMutex();
-		CoreMutex *eventMutex;
+		ConfigRef getConfig();
+		
+        ResourceManager *getResourceManager();
+        SoundManager *getSoundManager();
+        Logger *getLogger();
+        
+        std::mutex POLYIGNORE eventMutex;
 		
 		void removeThread(Threaded *thread);
 		
@@ -442,9 +416,15 @@ namespace Polycode {
 		int defaultScreenHeight;
 		
 		Quaternion deviceAttitude;
-				
+        static double fixedTimestep;
+        
 	protected:	
 	
+        ResourceManager *resourceManager;
+        SoundManager *soundManager;
+        Logger *logger;
+		ConfigRef config;
+		
 		virtual bool checkSpecialKeyEvents(PolyKEY key) { return false; }
 		
 		std::vector<CoreFileProvider*> fileProviders;
@@ -476,7 +456,6 @@ namespace Polycode {
 		unsigned int elapsed;
 		
 		double fixedElapsed;
-		double fixedTimestep;
 		double timeLeftOver;
 		double maxFixedElapsed;
 		
@@ -486,7 +465,7 @@ namespace Polycode {
 		unsigned int lastSleepFrameTicks;
 		
 		std::vector<Threaded*> threads;
-		CoreMutex *threadedEventMutex;
+        std::mutex threadedEventMutex;
 		
 		int xRes;
 		int yRes;
@@ -500,7 +479,6 @@ namespace Polycode {
 		
 		CoreInput *input;
 		Renderer *renderer;
-		CoreServices *services;
 	};
 	
 	class _PolyExport DummyCore : public Core {
@@ -512,7 +490,6 @@ namespace Polycode {
 		bool systemUpdate();
 		void setCursor(int cursorType);
 		void createThread(Threaded *target);
-		CoreMutex *createMutex();
 		void copyStringToClipboard(const String& str);
 		String getClipboardString();
 		void createFolder(const String& folderPath);

+ 1 - 5
include/polycode/core/PolyCoreInput.h

@@ -182,11 +182,7 @@ namespace Polycode {
 		 * If set to true, will fire mouse events on touch input. Defaults to false.
 		 */
 		bool simulateMouseWithTouch;
-		
-		/**
-		 * If set to true, will not send touch events outside of the screen as define by current core resolution. Defaults to false.
-		 */
-		bool ignoreOffScreenTouch;	
+
 		
 		void clearInput();
 		

+ 0 - 157
include/polycode/core/PolyCoreServices.h

@@ -1,157 +0,0 @@
-/*
-Copyright (C) 2011 by Ivan Safrin
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
-*/
- 
-#pragma once
-#include "polycode/core/PolyGlobals.h"
-#include "polycode/core/PolyString.h"
-#include "polycode/core/PolyRectangle.h"
-#include "polycode/core/PolyEventDispatcher.h"
-#include <map>
-
-namespace Polycode {
-
-	class PolycodeModule;
-	class Renderer;
-	class Config;
-	class TimerManager;
-	class TweenManager;
-	class ResourceManager;
-	class SoundManager;
-	class Core;
-	class CoreInput;
-	class CoreMutex;
-	class Logger;
-	
-	/**
-	* Global services singleton. CoreServices instantiates and provides global Singleton access to all of the main manager classes in Polycode as well as the Renderer and Config classes.
-	*/
-	class _PolyExport CoreServices : public EventDispatcher {
-		public:
-		
-			/**
-			* Returns the singleton instance. NOTE: The singleton instance is unique to each thread and currently Polycode does not support multithreaded access to the core services. The reason for this is being able to run multiple cores in the same application and still have global singleton access to these services.
-			*/ 
-			static CoreServices *getInstance();		
-			static void setInstance(CoreServices *_instance);
-			static CoreMutex *getRenderMutex();
-			
-			static void createInstance();
-		
-			void setRenderer(Renderer *renderer);
-
-			/**
-			* Returns the main renderer.
-			* @return The main renderer.
-			* @see Renderer
-			*/			
-			Renderer *getRenderer();
-			
-			void Update(int elapsed);
-			void fixedUpdate();
-			
-			void setCore(Core *core);
-		
-			/**
-			* Returns the core. 
-			* @return The core.
-			* @see Core
-			*/																														
-			Core *getCore();
-		
-			/**
-			 * Returns the core input.
-			 * @return Core input.
-			 * @see CoreInput
-			 */
-			CoreInput *getInput();
-			
-			void handleEvent(Event *event);		
-		
-			/**
-			* Returns the timer manager. The timer manager is responsible for updating timers in the framework.
-			* @return Timer Manager
-			* @see TimerManager
-			*/									
-			TimerManager *getTimerManager();
-			
-			/**
-			* Returns the tween manager. The tween manager is responsible for updating animated tweens in the framework.
-			* @return Tween Manager
-			* @see TweenManager
-			*/												
-			TweenManager *getTweenManager();
-			
-			/**
-			* Returns the resource manager. The resource manager is responsible for loading and unloading resources.
-			* @return Resource Manager
-			* @see ResourceManager
-			*/																					
-			ResourceManager *getResourceManager();
-			
-			/**
-			* Returns the sound manager. The sound manager is responsible for loading and playing sounds.
-			* @return Sound Manager
-			* @see SoundManager
-			*/																								
-			SoundManager *getSoundManager();
-
-			/**
-			* Returns the logger. It can log messages and broadcast them to listeners.
-			*/
-			Logger *getLogger();
-
-			/**
-			* Returns the config. The config loads and saves data to disk.
-			* @return Config manager.
-			* @see Config
-			*/														
-						
-			Config *getConfig();
-
-					
-			~CoreServices();		
-			
-		protected:
-		
-			CoreServices();
-					
-		private:
-		
-			
-			static CoreServices* overrideInstance;
-			static std::map <long, CoreServices*> instanceMap;
-			static CoreMutex *renderMutex;
-					
-			Core *core;
-			Config *config;
-			Logger *logger;
-			TimerManager *timerManager;
-			TweenManager *tweenManager;
-			ResourceManager *resourceManager;
-			SoundManager *soundManager;
-			Renderer *renderer;
-	};
-	
-
-	_PolyExport CoreServices *Services();
-	
-}

+ 4 - 2
include/polycode/core/PolyData.h

@@ -25,6 +25,8 @@
 #include "polycode/core/PolyString.h"
 
 namespace Polycode {
+    
+    class Core;
 
 	/**
 	* Stores, saves and loads data. This class can save and load arbitrary data to and from disk and convert it to strings.
@@ -42,7 +44,7 @@ namespace Polycode {
 		* @param fileName Path to the file to load data from.
 		* @return True if susccessful, false if not
 		*/						
-		bool loadFromFile(const String& fileName);
+		bool loadFromFile(Core *core, const String& fileName);
 		
 		/**
 		* Retuns data as a string with the specified encoding.
@@ -63,7 +65,7 @@ namespace Polycode {
 		* @param fileName Path to the file to save data to.
 		* @return Returns true if successful or false if otherwise.
 		*/								
-		bool saveToFile(const String& fileName) const;
+		bool saveToFile(Core *core, const String& fileName) const;
 		
 		/**
 		* Returns pointer to the data.

+ 2 - 6
include/polycode/core/PolyEntity.h

@@ -35,7 +35,6 @@
 
 namespace Polycode {
 
-	class Renderer;
 	class Scene;
 	class Script;
 	class ScriptInstance;
@@ -96,7 +95,7 @@ namespace Polycode {
 			/**
 			* Main update method. Override this to do your updates before the render cycle.
 			*/			
-			virtual void Update();
+			virtual void Update(Number elapsed);
 		
 			virtual void fixedUpdate(){};
 		
@@ -733,10 +732,9 @@ namespace Polycode {
 			 */
 			bool getInverseY();
 			
-			void doUpdates();
+			void doUpdates(Number elapsed);
 			void doFixedUpdates();
 			virtual Matrix4 buildPositionMatrix();
-			void setRenderer(Renderer *renderer);
 			
 			/**
 			 * Implement this method to do custom ray hit detection beyond a bounding box check. Always returns true by default.
@@ -923,8 +921,6 @@ namespace Polycode {
 		
 			Matrix4 transformMatrix;
 			Entity *parentEntity;
-		
-			Renderer *renderer;
 	};
 	
 	typedef Entity SceneEntity;

+ 2 - 1
include/polycode/core/PolyEvent.h

@@ -90,7 +90,8 @@ namespace Polycode {
 			static const int SELECT_EVENT = EVENTBASE_EVENT+6;
 			static const int REMOVE_EVENT = EVENTBASE_EVENT+7;
 			static const int RESOURCE_CHANGE_EVENT = EVENTBASE_EVENT+8;
-																		
+			static const int RESOURCE_DESTROY_EVENT = EVENTBASE_EVENT+9;
+		
 			static const int EVENTBASE_NONPOLYCODE = 0x10000;
 		
 			bool deleteOnDispatch;

+ 3 - 1
include/polycode/core/PolyFont.h

@@ -32,10 +32,12 @@ THE SOFTWARE.
 namespace Polycode {
 	
 	class String;
+    class Core;
 
 	class _PolyExport Font : public Resource {
 		public:
-			Font(const String& fileName, FT_Library FTLibrary);
+            Font();
+			Font(Core *core, const String& fileName, FT_Library FTLibrary);
 			virtual ~Font();
 			
 			FT_Face getFace();

+ 1 - 0
include/polycode/core/PolyGPUDrawBuffer.h

@@ -71,6 +71,7 @@ namespace Polycode {
 	
 	class _PolyExport GPUDrawCall {
 	public:
+		
 		std::shared_ptr<MeshGeometry> submesh;
 		GPUDrawOptions options;
 		Matrix4 modelMatrix;

+ 3 - 3
include/polycode/core/PolyGlobals.h

@@ -27,7 +27,9 @@ THE SOFTWARE.
 // Compile support for lua bindings.
 //#define _COMPILE_LUA
 
-#define POLYCODE_VERSION_STRING "0.8.4"
+#define POLYCODE_VERSION_STRING "0.8.5_dev"
+
+#define USE_POSIX_MUTEX 1
 
 #define COMPILE_GL_RENDERER
 typedef float PolyRendererVertexType;
@@ -63,8 +65,6 @@ typedef unsigned int PolyRendererIndexType;
 #define TODEGREES 57.2957795
 #define TORADIANS 0.0174532925
 
-//#define COMPILE_SDL_CORE		1
-
 #define PLATFORM_WINDOWS  1
 #define PLATFORM_MAC	  2
 #define PLATFORM_UNIX	  3

+ 8 - 7
include/polycode/core/PolyImage.h

@@ -29,7 +29,8 @@ THE SOFTWARE.
 namespace Polycode {
 
 	class String;
-	
+    class Core;
+    
 	#define HALF_FLOAT_MIN_BIASED_EXP_AS_SINGLE_FP_EXP 0x38000000
 	#define HALF_FLOAT_MAX_BIASED_EXP_AS_SINGLE_FP_EXP 0x47800000
 	#define FLOAT_MAX_BIASED_EXP (0xFF << 23)
@@ -52,7 +53,7 @@ namespace Polycode {
 			* Create image from file name.
 			* @param fileName Path to image file to load.
 			*/ 
-			explicit Image(const String& fileName);
+			explicit Image(Core *core, const String& fileName);
 			
 			/**
 			* Create a blank image of specified size and type.
@@ -92,7 +93,7 @@ namespace Polycode {
 			* @param fileName Path to image file to load.
 			* @return True if successfully loaded, false otherwise.
 			*/			
-			bool loadImage(const String& fileName);
+			bool loadImage(Core *core, const String& fileName);
 
 			bool POLYIGNORE loadFromMemory(const unsigned char *buffer, unsigned int length);
 
@@ -106,7 +107,7 @@ namespace Polycode {
 			* @param fileName Path to image file to load.	
 			* @return True if successfully loaded, false otherwise. 
 			*/
-			bool saveImage(const String &fileName);
+			bool saveImage(Core *core, const String &fileName);
 			
 			/**
 			* Pastes another image into the image using a blending mode
@@ -271,7 +272,7 @@ namespace Polycode {
 			 */
 			void premultiplyAlpha();
 		
-			bool savePNG(const String &fileName);
+			bool savePNG(Core *core, const String &fileName);
 		
 			static const int IMAGE_RGB = 0;
 			static const int IMAGE_RGBA = 1;
@@ -281,8 +282,8 @@ namespace Polycode {
 			
 		protected:
 		
-			bool loadHDR(const String &fileName);
-			bool loadSTB(const String &fileName);
+			bool loadHDR(Core *core, const String &fileName);
+			bool loadSTB(Core *core, const String &fileName);
 		
 		
 			static inline hfloat convertFloatToHFloat(float f);

+ 2 - 2
include/polycode/core/PolyMaterial.h

@@ -68,8 +68,8 @@ namespace Polycode {
 			int getNumShaderRenderTargets();
 			ShaderRenderTarget *getShaderRenderTarget(unsigned int index);
 			void removeShaderRenderTarget(int index);
-			void recreateRenderTarget(ShaderRenderTarget *renderTarget);
-			void recreateRenderTargets();
+			void recreateRenderTarget(ShaderRenderTarget *renderTarget, const Vector2 &screenSize);
+			void recreateRenderTargets(const Vector2 &screenSize);
 						
 			const String& getName() const;
 			ShaderPass getShaderPass(unsigned int index) const;

+ 4 - 4
include/polycode/core/PolyMesh.h

@@ -352,7 +352,7 @@ namespace Polycode {
 			 * Construct from a mesh loaded from a file.
 			 * @param fileName Path to mesh file.
 			 */
-			explicit Mesh(const String& fileName);
+			explicit Mesh(Core *core, const String& fileName);
 		
 			~Mesh();
 		
@@ -360,7 +360,7 @@ namespace Polycode {
 			 * Construct from a mesh loaded from a file.
 			 * @param fileName Path to mesh file.
 			 */
-			static Mesh *MeshFromFileName(String& fileName);
+			static Mesh *MeshFromFileName(Core *core, String& fileName);
 		
 		
 			Mesh *Copy() const;
@@ -369,12 +369,12 @@ namespace Polycode {
 			 * Loads a mesh from a file.
 			 * @param fileName Path to mesh file.
 			 */
-			void loadMesh(const String& fileName);
+			void loadMesh(Core *core, const String& fileName);
 			/**
 			 * Saves mesh to a file.
 			 * @param fileName Path to file to save to.
 			 */
-			void saveToFile(const String& fileName, bool writeNormals = true, bool writeTangents = true, bool writeColors = true, bool writeBoneWeights = true, bool writeUVs = true, bool writeSecondaryUVs = false);
+			void saveToFile(Core *core, const String& fileName, bool writeNormals = true, bool writeTangents = true, bool writeColors = true, bool writeBoneWeights = true, bool writeUVs = true, bool writeSecondaryUVs = false);
 			
 			void loadFromFile(CoreFile *inFile);
 		

+ 8 - 6
include/polycode/core/PolyObject.h

@@ -29,6 +29,8 @@ class TiXmlElement;
 
 namespace Polycode {
 
+    class Core;
+    
 	/**
 	* Single entry in an Object. Object entries can be accessed as dictionaries or arrays.
 	*/
@@ -316,7 +318,7 @@ namespace Polycode {
 		* @param fileName Path to the XML file to load.
 		* @return Returns true is succesful, false if otherwise.
 		*/		
-		bool loadFromXML(const String& fileName);
+		bool loadFromXML(Polycode::Core *core, const String& fileName);
 
 		/**
 		* Loads data from XML string into the object. 
@@ -329,7 +331,7 @@ namespace Polycode {
 		* Saves the object to an XML file.
 		* @param fileName Path to the XML file to save to.
 		*/				
-		void saveToXML(const String& fileName);
+		void saveToXML(Polycode::Core *core, const String& fileName);
 
 		String saveToXMLString();
 
@@ -337,14 +339,14 @@ namespace Polycode {
 		* Saves the object to an optimized binary file
 		* @param fileName Path to the file to save to.
 		*/				
-		void saveToBinary(const String& fileName);
+		void saveToBinary(Core *core, const String& fileName);
 
 		/**
 		* Loads data from a binary file into the object. 
 		* @param fileName Path to the binary file to load.
 		* @return Returns true is succesful, false if otherwise.
 		*/		
-		bool loadFromBinary(const String& fileName);
+		bool loadFromBinary(Core *core, const String& fileName);
 
 		
 		void createFromXMLElement(TiXmlElement *element, ObjectEntry *entry);
@@ -359,7 +361,7 @@ namespace Polycode {
 
 	class _PolyExport BinaryObjectReader : public PolyBase {
 		public:
-			BinaryObjectReader(const String& fileName, Object *object);
+			BinaryObjectReader(Core *core, const String& fileName, Object *object);
 			~BinaryObjectReader();			
 			
 			bool success;				
@@ -387,7 +389,7 @@ namespace Polycode {
 			unsigned int addKey(const String &key);			
 			unsigned int getKeyIndex(const String &key);
 			
-			bool writeToFile(const String& fileName);			
+			bool writeToFile(Core *core, const String& fileName);
 			
 		protected:
 			Polycode::CoreFile *outFile;

+ 3 - 1
include/polycode/core/PolyOpenGLGraphicsInterface.h

@@ -28,6 +28,7 @@ THE SOFTWARE.
 #include "polycode/core/PolyRenderer.h"
 #include "polycode/core/PolyTexture.h"
 #include "polycode/core/PolyMesh.h"
+#include "polycode/core/PolyCore.h"
 
 #if PLATFORM == PLATFORM_MAC
 	
@@ -84,7 +85,7 @@ namespace Polycode {
 	class _PolyExport OpenGLGraphicsInterface : public GraphicsInterface {
 	public:
 		
-		OpenGLGraphicsInterface();
+		OpenGLGraphicsInterface(Core *core);
 		~OpenGLGraphicsInterface();
 
 		// implementation
@@ -134,6 +135,7 @@ namespace Polycode {
 		
 	protected:
 		
+        Core *core;
 		GLuint currentShaderID;
 		int textureIndex;
 		

+ 1 - 2
include/polycode/core/PolyParticleEmitter.h

@@ -64,7 +64,7 @@ namespace Polycode {
 		
 			void fixedUpdate();
 			void Render(GPUDrawBuffer *buffer);
-			void updateParticles();
+			void updateParticles(Number elapsed);
 			void rebuildParticles(GPUDrawBuffer *buffer);
 		
 			void triggerParticles(bool allAtOnce);
@@ -151,7 +151,6 @@ namespace Polycode {
 			void resetParticle(unsigned int index);
 		
 			bool systemEnabled;
-			Core *core;
 			unsigned int particleCount;
 			std::vector<SceneParticle> particles;
 			Number particleSpeed;

+ 2 - 8
include/polycode/core/PolyPeer.h

@@ -23,7 +23,6 @@ THE SOFTWARE.
 #pragma once
 
 #include "polycode/core/PolyGlobals.h"
-#include "polycode/core/PolyCoreServices.h"
 #include "polycode/core/PolyThreaded.h"
 #include "polycode/core/PolySocket.h"
 
@@ -79,11 +78,7 @@ namespace Polycode {
 	*
 	* @see PeerConnection
 	*/
-#if USE_THREADED_SOCKETS == 1		
 	class _PolyExport Peer : public Threaded {
-#else
-	class _PolyExport Peer : public EventDispatcher {
-#endif
 		public:
 			/**
 			* Create a peer. The peer will immediately start listening on the given 
@@ -93,7 +88,7 @@ namespace Polycode {
 			*			  this will be the actual port this peer will use to send
 			*			  and receive packets.
 			*/
-			Peer(unsigned int port);
+			Peer(Core *core, unsigned int port);
 			~Peer();
 
 			void handleEvent(Event *event);
@@ -159,8 +154,7 @@ namespace Polycode {
 		protected:
 		
 			int reliableRetransmissionInverval;
-		
-			Timer *updateTimer;
+            Core *core;
 			std::vector<PeerConnection*> peerConnections;
 			Socket *socket;
 	};

+ 4 - 1
include/polycode/core/PolyRenderDataArray.h

@@ -23,10 +23,13 @@
 #pragma once
 #include "polycode/core/PolyGlobals.h"
 #include "polycode/core/PolyString.h"
+#include "polycode/core/PolyRendererPlatformData.h"
 #include <vector>
 
 namespace Polycode {
 	
+	class RendererPlatformData;
+	
 	class RenderDataArray : public PolyBase {
 	public:
 		
@@ -39,7 +42,7 @@ namespace Polycode {
 		virtual unsigned int getDataSize() const;
 		
 		String customArrayName;
-		void *platformData;
+		RendererPlatformData platformData;
 		
 		/**
 		 * Vertex position array.

+ 7 - 5
include/polycode/core/PolyRenderer.h

@@ -33,7 +33,8 @@ THE SOFTWARE.
 #include "polycode/core/PolyThreaded.h"
 #include "polycode/core/PolyGPUDrawBuffer.h"
 #include <stack>
-#include <queue>  
+#include <queue> 
+#include <mutex>
 
 #define RENDERER_MAX_LIGHTS 8
 #define RENDERER_MAX_LIGHT_SHADOWS 2
@@ -168,7 +169,7 @@ namespace Polycode {
 			static const int JOB_DESTROY_RENDER_BUFFER = 13;
 		
 		protected:
-		
+        
 			unsigned int frameStart;
 			RenderThreadDebugInfo lastFrameDebugInfo;
 			RenderThreadDebugInfo currentDebugFrameInfo;
@@ -176,8 +177,8 @@ namespace Polycode {
 			std::vector<RenderFrame*> framesToDelete;
 		
 			Core *core;
-			CoreMutex *jobQueueMutex;
-			CoreMutex *renderMutex;
+            std::mutex jobQueueMutex;
+			std::mutex renderMutex;
 		
 			std::queue<RendererThreadJob> jobQueue;
 			std::queue<RenderFrame*> frameQueue;
@@ -195,7 +196,7 @@ namespace Polycode {
 	class _PolyExport Renderer : public PolyBase {
 	public:
 		
-	Renderer(RenderThread *customThread=NULL);
+	Renderer(Core *core, RenderThread *customThread=NULL);
 	virtual ~Renderer();
 		void setGraphicsInterface(Core *core, GraphicsInterface *graphicsInterface);
 		
@@ -244,4 +245,5 @@ namespace Polycode {
 		RenderThread *renderThread;
 
 	};
+
 }

+ 27 - 37
src/core/PolyTimerManager.cpp → include/polycode/core/PolyRendererPlatformData.h

@@ -1,10 +1,10 @@
 /*
- Copyright (C) 2011 by Ivan Safrin
+ Copyright (C) 2016 by Ivan Safrin
  
  Permission is hereby granted, free of charge, to any person obtaining a copy
  of this software and associated documentation files (the "Software"), to deal
  in the Software without restriction, including without limitation the rights
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or se ll
  copies of the Software, and to permit persons to whom the Software is
  furnished to do so, subject to the following conditions:
  
@@ -18,38 +18,28 @@
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  THE SOFTWARE.
-*/
-
-#include "polycode/core/PolyTimerManager.h"
-#include "polycode/core/PolyCoreServices.h"
-#include "polycode/core/PolyCore.h"
-#include "polycode/core/PolyTimer.h"
-
-using namespace Polycode;
-
-TimerManager::TimerManager() {
-
-}
-
-TimerManager::~TimerManager() {
-
-}
-
-void TimerManager::removeTimer(Timer *timer) {
-	for(int i=0;i<timers.size();i++) {
-		if(timers[i] == timer) {
-			timers.erase(timers.begin()+i);
-		}
-	}	
-}
-
-void TimerManager::addTimer(Timer *timer) {
-	timers.push_back(timer);		
-}
-
-void TimerManager::Update() {
-	int ticks = CoreServices::getInstance()->getCore()->getTicks();
-	for(int i=0;i<timers.size();i++) {
-		timers[i]->Update(ticks);
-	}
-}
+ */
+
+#pragma once
+
+namespace Polycode {
+
+	class Renderer;
+	
+	class RendererPlatformData {
+	public:
+		RendererPlatformData();
+		~RendererPlatformData();
+		
+		static const int PLATFORM_DATA_NONE = 0;
+		static const int PLATFORM_DATA_TEXTURE = 1;
+		static const int PLATFORM_DATA_RENDER_BUFFER = 2;
+		static const int PLATFORM_DATA_PROGRAM = 3;
+		static const int PLATFORM_DATA_SHADER = 4;
+		static const int PLATFORM_DATA_SUBMESH = 5;
+		
+		int type;
+		Renderer *renderer;
+		void *data;
+	};
+}

+ 5 - 3
include/polycode/core/PolyResource.h

@@ -25,9 +25,12 @@ THE SOFTWARE.
 #include "polycode/core/PolyString.h"
 #include "polycode/core/PolyGlobals.h"
 #include "polycode/core/PolyEventDispatcher.h"
+#include "polycode/core/PolyRendererPlatformData.h"
 
 namespace Polycode {
 
+    class Core;
+	
 	/**
 	* Base class for resources. All resources that are managed by the ResourceManager subclass this.
 	*/
@@ -43,7 +46,7 @@ namespace Polycode {
 			Resource(int type);
 			virtual ~Resource();
 			
-			virtual void reloadResource();
+			virtual void reloadResource(Core *core);
 			
 			const String& getResourceName() const;
 			int getResourceType() const;
@@ -70,11 +73,10 @@ namespace Polycode {
 						
 			//@}
 			
-			void *platformData;
+			RendererPlatformData platformData;
 		
 		protected:
 
-			
 			int type;
 			String resourcePath;
 			String name;

+ 25 - 11
include/polycode/core/PolyResourceManager.h

@@ -52,12 +52,15 @@ namespace Polycode {
 	class Shader;
 	class Cubemap;
 	class Material;
+	class Texture;
     class Font;
+	class Mesh;
 	
 	class _PolyExport ResourcePool : public EventDispatcher {
 		public:
-			ResourcePool();
-			ResourcePool(const String &name, ResourcePool *fallbackPool);
+            ResourcePool(){}
+			ResourcePool(Core *core);
+			ResourcePool(Core *core, const String &name, ResourcePool *fallbackPool);
 			~ResourcePool();
 		
 			void setFallbackPool(ResourcePool *pool);
@@ -72,6 +75,15 @@ namespace Polycode {
 			std::shared_ptr<Resource> loadResource(const String &path);
 			std::shared_ptr<Resource> loadResourceWithName(const String &path, const String &name);
 			std::shared_ptr<Resource> getResource(int resourceType, const String& resourceName) const;
+        
+            std::shared_ptr<Font> getFont(const String &name);
+            std::shared_ptr<Material> getMaterial(const String &name);
+			std::shared_ptr<Shader> getShader(const String &name);
+		
+			std::shared_ptr<Texture> loadTexture(const String &name);
+			std::shared_ptr<Mesh> loadMesh(const String &name);
+		
+		
 			String getName();
 			void setName(const String &name);
 		
@@ -92,8 +104,9 @@ namespace Polycode {
 		
 			static bool defaultReloadResourcesOnModify;
 		
-		private:
+		protected:
 		
+            Core *core;
 			void loadResourcesFromFolderWithLoader(const String &folder, bool recursive, ResourceLoader *loader, const String &containingFolder);
 		
 			void loadShadersFromFile(const String &fileName);
@@ -114,33 +127,33 @@ namespace Polycode {
 		public:
 			virtual ~ResourceLoader() {}
 			bool canHandleExtension(const String &extension);
-			virtual std::shared_ptr<Resource> loadResource(const String &path, ResourcePool *targetPool) = 0;
+			virtual std::shared_ptr<Resource> loadResource(Core *core, const String &path, ResourcePool *targetPool) = 0;
 			std::vector<String> extensions;
 	};
 	
 	class _PolyExport TextureResourceLoader : public ResourceLoader {
 		public:
 			TextureResourceLoader();
-			std::shared_ptr<Resource> loadResource(const String &path, ResourcePool *targetPool);
+			std::shared_ptr<Resource> loadResource(Core *core, const String &path, ResourcePool *targetPool);
 	};
 	
 	class _PolyExport ProgramResourceLoader : public ResourceLoader {
 	public:
 		ProgramResourceLoader();
-		std::shared_ptr<Resource> loadResource(const String &path, ResourcePool *targetPool);
+		std::shared_ptr<Resource> loadResource(Core *core, const String &path, ResourcePool *targetPool);
 	};
 
 	class _PolyExport MaterialResourceLoader : public ResourceLoader {
 	public:
 			MaterialResourceLoader();
-			std::shared_ptr<Resource> loadResource(const String &path, ResourcePool *targetPool);
+			std::shared_ptr<Resource> loadResource(Core *core, const String &path, ResourcePool *targetPool);
 	};
 	
 	class _PolyExport FontResourceLoader : public ResourceLoader {
 	public:
 		FontResourceLoader();
 		~FontResourceLoader();
-		std::shared_ptr<Resource> loadResource(const String &path, ResourcePool *targetPool);
+		std::shared_ptr<Resource> loadResource(Core *core, const String &path, ResourcePool *targetPool);
 	private:
 		FT_Library FTLibrary;
 	};
@@ -155,7 +168,7 @@ namespace Polycode {
 	public:
 		ScriptResourceLoader();
 		~ScriptResourceLoader();
-		std::shared_ptr<Resource> loadResource(const String &path, ResourcePool *targetPool);
+		std::shared_ptr<Resource> loadResource(Core *core, const String &path, ResourcePool *targetPool);
 	private:
 		
 		void initJavascript();
@@ -170,7 +183,7 @@ namespace Polycode {
 	class _PolyExport MeshResourceLoader : public ResourceLoader {
 	public:
 		MeshResourceLoader();
-		std::shared_ptr<Resource> loadResource(const String &path, ResourcePool *targetPool);
+		std::shared_ptr<Resource> loadResource(Core *core, const String &path, ResourcePool *targetPool);
 	};
 	
 	/**
@@ -178,7 +191,8 @@ namespace Polycode {
 	*/ 
 	class _PolyExport ResourceManager : public EventDispatcher {
 		public:
-			ResourceManager();
+            ResourceManager(){}
+			ResourceManager(Core *core);
 			~ResourceManager();
 		
 			ResourcePool *getGlobalPool();

+ 5 - 5
include/polycode/core/PolyScene.h

@@ -49,16 +49,17 @@ namespace Polycode {
 	class _PolyExport Scene : public EventDispatcher {
 	public:
 
+        Scene(){}
 		/**
 		* Default constructor with options. 
 		* @param sceneType Type of scene to create. Can be Scene::SCENE_2D, Scene::SCENE_3D or Scene::SCENE_2D_TOPLEFT
 		*/		
-		Scene(int sceneType);
+		Scene(Core *core, int sceneType);
 				
 		/**
 		* Default constructor. Defaults to type Scene::SCENE_3D
 		*/
-		Scene();
+		Scene(Core *core);
 		
 		virtual ~Scene();
 		
@@ -117,7 +118,7 @@ namespace Polycode {
 		void setSceneType(int newType);
 
 		virtual void fixedUpdate();
-		virtual void Update();
+		virtual void Update(Number elapsed);
 	
 		bool isEnabled();		
 		void setEnabled(bool enabled);
@@ -205,8 +206,7 @@ namespace Polycode {
 		
 		bool hasLightmaps;
 		bool _doVisibilityChecking;
-		
-		Renderer *renderer;
+
 		std::vector <SceneLight*> lights;
 		
 		Camera *defaultCamera;

+ 6 - 3
include/polycode/core/PolySceneEntityInstance.h

@@ -42,7 +42,8 @@ class SceneEntityInstanceResourceEntry;
 class SceneEntityInstance : public Entity {
 	public:
 	
-		SceneEntityInstance(const String& fileName);
+		SceneEntityInstance(Core *core, const String& fileName);
+		SceneEntityInstance(Core *core);
 		explicit SceneEntityInstance();
 		
 		static SceneEntityInstance *BlankSceneEntityInstance();
@@ -86,7 +87,9 @@ class SceneEntityInstance : public Entity {
 		
 	protected:
 		
-		std::vector<SceneEntityInstanceLayer*> layers;	
+        Core *core;
+    
+		std::vector<SceneEntityInstanceLayer*> layers;
 		void rebuildResourceLinks();
 	
 		ResourcePool *topLevelResourcePool;
@@ -116,7 +119,7 @@ class SceneEntityInstanceResourceEntry : public Resource {
 		virtual ~SceneEntityInstanceResourceEntry();
 		
 		SceneEntityInstance *getInstance();
-		void reloadResource();
+		void reloadResource(Core *core);
 		
 	protected:
 		SceneEntityInstance* instance;

+ 2 - 2
include/polycode/core/PolySceneLabel.h

@@ -39,9 +39,9 @@ namespace Polycode {
 	class _PolyExport SceneLabel : public ScenePrimitive {
 		public:
 		
-			SceneLabel(const String& text, int size, const String& fontName, int amode = 0, Number actualHeight = 0.0);
+			SceneLabel(std::shared_ptr<Material> material, const String& text, int size, std::shared_ptr<Font> font, int amode = 0, Number actualHeight = 0.0);
 			
-			SceneLabel(const String& text, int size, const String& fontName, int amode, Number actualHeight, bool premultiplyAlpha, const Color &backgroundColor, const Color &foregroundColor);
+			SceneLabel(std::shared_ptr<Material> material, const String& text, int size, std::shared_ptr<Font> font, int amode, Number actualHeight, bool premultiplyAlpha, const Color &backgroundColor, const Color &foregroundColor);
 			
 			String getText();
 		

+ 2 - 2
include/polycode/core/PolySceneLight.h

@@ -49,7 +49,7 @@ namespace Polycode {
 			* @param linearAttenuation Linear falloff attenuation value 
 			* @param quadraticAttenuation Quadratic falloff attenuation value				
 			*/ 
-			SceneLight(int type, Number intensity, Number constantAttenuation=1, Number linearAttenuation=1, Number quadraticAttenuation=1);
+			SceneLight(int type, Number intensity, Number constantAttenuation=1, Number linearAttenuation=1, Number quadraticAttenuation=1, std::shared_ptr<Material> depthMapMaterial = nullptr);
 			virtual ~SceneLight();
 		
 			/*
@@ -189,7 +189,7 @@ namespace Polycode {
 			LightInfo lightInfo;
 
 			std::shared_ptr<RenderBuffer> shadowMapRenderBuffer;
-			std::shared_ptr<Material> unlitMaterial;
+			std::shared_ptr<Material> depthMapMaterial;
 			Camera *spotCamera;		
 			unsigned int shadowMapRes;
 			Number shadowMapFOV;

+ 0 - 1
include/polycode/core/PolySceneLine.h

@@ -25,7 +25,6 @@ THE SOFTWARE.
 #include "polycode/core/PolyGlobals.h"
 #include "polycode/core/PolySceneMesh.h"
 #include "polycode/core/PolyBezierCurve.h"
-#include "polycode/core/PolyCoreServices.h"
 #include "polycode/core/PolyMesh.h"
 
 namespace Polycode {

+ 7 - 11
include/polycode/core/PolySceneMesh.h

@@ -43,18 +43,20 @@ namespace Polycode {
 	class _PolyExport SceneMesh : public Entity {
 		public:
 		
+        
+            SceneMesh();
+        
 			/**
 			* Construct a scene mesh from a mesh file.
 			* @param fileName Path to mesh file to load.
 			*/
-			explicit SceneMesh(const String& fileName);
+			explicit SceneMesh(ResourcePool *pool, const String& fileName);
 			
 			/**
 			* Construct scene mesh from an existing Mesh instance.
 			*/
 			explicit SceneMesh(std::shared_ptr<Mesh> mesh);
-		
-			SceneMesh();
+
 			
 			/**
 			* Construct scene mesh from an existing Mesh instance.
@@ -85,7 +87,7 @@ namespace Polycode {
 			* Loads a skeleton from a file and applies it to the scene mesh.
 			* @param fileName Filename to load the skeleton from.
 			*/
-			std::shared_ptr<Skeleton> loadSkeleton(const String& fileName);
+			std::shared_ptr<Skeleton> loadSkeleton(Core *core, const String& fileName);
 
 			/**
 			* Clears the currently applied material
@@ -98,12 +100,6 @@ namespace Polycode {
 			*/												
 			void setMaterial(std::shared_ptr<Material> material);
 			
-			/**
-			* Set material by name. You can create materials in material files and name them there, then use this to set a material by name to a scene mesh.
-			* @param materialName Name of material to apply.
-			*/									
-			void setMaterialByName(const String& materialName, ResourcePool *resourcePool = NULL);
-			
 			/**
 			* Set the mesh this scene mesh renders.
 			* @param mesh Set a new mesh to render.
@@ -139,7 +135,7 @@ namespace Polycode {
 			/**
 			 * Loads mesh from file. Deletes current mesh if ownsMesh is set to true.
 			 */
-			void loadFromFile(const String &fileName);
+			void loadFromFile(ResourcePool *pool, const String &fileName);
 		
 			/**
 			 * Line width for line-based meshes.

+ 0 - 1
include/polycode/core/PolySceneRenderTexture.h

@@ -75,7 +75,6 @@ namespace Polycode {
 			
 		protected:		
 			bool floatingPoint;
-			Renderer *renderer;
 			std::shared_ptr<RenderBuffer> targetFramebuffer;
 	};
 }

+ 11 - 4
include/polycode/core/PolySceneSound.h

@@ -27,15 +27,20 @@ THE SOFTWARE.
 namespace Polycode {
 
 	class Sound;
-
+    class SoundManager;
+    
 	/**
 	* Creates a positional 3D sound listener. There can be only one listener active at any one time.
 	*/	
 	class _PolyExport SceneSoundListener : public Entity {
-		public:
-			SceneSoundListener();
+		public:        
+			SceneSoundListener() {}
+			SceneSoundListener(SoundManager *soundManager);
 			virtual ~SceneSoundListener();			
 			void Update();
+        
+        protected:
+            SoundManager *soundManager;
 	};
 
 
@@ -44,7 +49,8 @@ namespace Polycode {
 	*/	
 	class _PolyExport SceneSound : public Entity {
 		public:
-			SceneSound(const String& fileName, Number referenceDistance, Number maxDistance, bool directionalSound = false);
+            SceneSound(){}
+			SceneSound(Core *core, const String& fileName, Number referenceDistance, Number maxDistance, bool directionalSound = false);
 			virtual ~SceneSound();			
 			void Update();
 		
@@ -64,6 +70,7 @@ namespace Polycode {
 			
 		protected:
 		
+            Core *core;
 			bool loopOnLoad;
 			bool directionalSound;
 			Sound *sound;

+ 3 - 2
include/polycode/core/PolySceneSprite.h

@@ -120,8 +120,9 @@ namespace Polycode {
 	
 	class SpriteSet : public ResourcePool {
 	public:
-		SpriteSet(){}
-		SpriteSet(const String &fileName, ResourcePool *parentPool = CoreServices::getInstance()->getResourceManager()->getGlobalPool());
+        SpriteSet(){}
+        SpriteSet(Core *core);
+		SpriteSet(Core *core, const String &fileName, ResourcePool *parentPool);
 		~SpriteSet();
 		
 		void setTexture(std::shared_ptr<Texture> texture);

+ 5 - 5
include/polycode/core/PolyServer.h

@@ -33,6 +33,7 @@ namespace Polycode {
 
 	class ServerClient;
 	class ServerWorld;
+    class Core;
 
 	class _PolyExport ServerClientEvent : public Event {
 	public:
@@ -92,14 +93,12 @@ namespace Polycode {
 			/**
 			* Constructor.
 			* @param port The local port to listen for client connections on.
-			* @param rate How many times per second to send out server data to clients.
 			* @param world An instance of the server data provider. @see ServerWorld
 			*/
-			Server(unsigned int port, unsigned int rate, ServerWorld *world = NULL);
+			Server(Core *core, unsigned int port, ServerWorld *world = NULL);
 			~Server();
 		
-			void handlePacket(Packet *packet, PeerConnection *connection);
-			void handleEvent(Event *event); 
+			void handlePacket(Packet *packet, PeerConnection *connection); 
 			void handlePeerConnection(PeerConnection *connection);
 			void DisconnectClient(ServerClient *client);
 
@@ -119,6 +118,8 @@ namespace Polycode {
 			* @see Peer::sendReliableData
 			*/
 			void sendReliableDataToClient(ServerClient *client, char *data, unsigned int size, unsigned short type);
+        
+            void updateServer(Number elapsed);
 
 			/**
 			* @see Peer::sendReliableDataToAll
@@ -127,7 +128,6 @@ namespace Polycode {
 		
 	protected:
 		
-		Timer *rateTimer;
 		ServerWorld *world;
 		vector<ServerClient*> clients;
 	};

+ 7 - 8
include/polycode/core/PolyShader.h

@@ -30,6 +30,7 @@ THE SOFTWARE.
 #include "polycode/core/PolyResource.h"
 #include <string.h>
 #include <memory>
+#include <mutex>
 
 namespace Polycode {
 
@@ -39,7 +40,7 @@ namespace Polycode {
 	class VertexDataArray;
 	class LocalShaderParam;
 	class RenderBuffer;
-	class CoreMutex;
+    class Core;
 	
 	class _PolyExport ProgramParam {
 		public:
@@ -92,7 +93,7 @@ namespace Polycode {
 			static const int TYPE_VERT = 0;
 			static const int TYPE_FRAG = 1;
 			int type;
-			void reloadResource();
+			void reloadResource(Core *core);
 	};
 
 	class _PolyExport Shader : public Resource {
@@ -181,7 +182,7 @@ namespace Polycode {
 		
 			void setParamValueFromString(int type, String pvalue);
         
-            CoreMutex *accessMutex;
+            std::mutex POLYIGNORE accessMutex;
 	};
 	
 	class AttributeBinding : public PolyBase {
@@ -222,8 +223,7 @@ namespace Polycode {
 			std::shared_ptr<LocalShaderParam> getLocalParamByName(const String& name);
 		
 			void removeParam(const String &name);
-		
-			std::shared_ptr<Texture> loadTextureForParam(const String &paramName, const String &fileName);
+	
 			void setTextureForParam(const String &paramName, std::shared_ptr<Texture> texture);
 			void setCubemapForParam(const String &paramName, std::shared_ptr<Cubemap> cubemap);
 		
@@ -260,9 +260,8 @@ namespace Polycode {
 			std::vector<RenderTargetBinding*> colorTargetBindings;
 			std::vector<RenderTargetBinding*> depthTargetBindings;
 		
-			std::shared_ptr<Shader> targetShader;
-		
-			CoreMutex *accessMutex;
+			std::shared_ptr<Shader> targetShader;		
+            std::mutex POLYIGNORE accessMutex;
 	};
 
 }

Неке датотеке нису приказане због велике количине промена