Просмотр исходного кода

Converted string to store as UTF-8 since the majority of the time this is how it's used. Now strings can be passed as const reference parameters which greatly reduces the amount of string copying being performed.

Cameron Hart 14 лет назад
Родитель
Сommit
d2fde9fc99
100 измененных файлов с 709 добавлено и 740 удалено
  1. 9 2
      Bindings/Contents/LUA/API/Polycode/Bone.lua
  2. 1 1
      Bindings/Contents/LUA/API/Polycode/Camera.lua
  3. 15 8
      Bindings/Contents/LUA/API/Polycode/Config.lua
  4. 5 5
      Bindings/Contents/LUA/API/Polycode/Core.lua
  5. 3 3
      Bindings/Contents/LUA/API/Polycode/Data.lua
  6. 3 3
      Bindings/Contents/LUA/API/Polycode/FixedShaderBinding.lua
  7. 2 2
      Bindings/Contents/LUA/API/Polycode/FontManager.lua
  8. 3 3
      Bindings/Contents/LUA/API/Polycode/Image.lua
  9. 11 4
      Bindings/Contents/LUA/API/Polycode/Label.lua
  10. 9 2
      Bindings/Contents/LUA/API/Polycode/Material.lua
  11. 1 1
      Bindings/Contents/LUA/API/Polycode/MaterialManager.lua
  12. 2 2
      Bindings/Contents/LUA/API/Polycode/Mesh.lua
  13. 4 4
      Bindings/Contents/LUA/API/Polycode/OSBasics.lua
  14. 1 1
      Bindings/Contents/LUA/API/Polycode/ObjectEntry.lua
  15. 18 4
      Bindings/Contents/LUA/API/Polycode/Resource.lua
  16. 10 10
      Bindings/Contents/LUA/API/Polycode/ResourceManager.lua
  17. 4 4
      Bindings/Contents/LUA/API/Polycode/Scene.lua
  18. 1 1
      Bindings/Contents/LUA/API/Polycode/SceneLabel.lua
  19. 3 3
      Bindings/Contents/LUA/API/Polycode/SceneMesh.lua
  20. 1 1
      Bindings/Contents/LUA/API/Polycode/Screen.lua
  21. 9 2
      Bindings/Contents/LUA/API/Polycode/ScreenLabel.lua
  22. 1 1
      Bindings/Contents/LUA/API/Polycode/ScreenMesh.lua
  23. 2 2
      Bindings/Contents/LUA/API/Polycode/ScreenSprite.lua
  24. 9 2
      Bindings/Contents/LUA/API/Polycode/Shader.lua
  25. 6 6
      Bindings/Contents/LUA/API/Polycode/ShaderBinding.lua
  26. 6 6
      Bindings/Contents/LUA/API/Polycode/Skeleton.lua
  27. 8 1
      Bindings/Contents/LUA/API/Polycode/SkeletonAnimation.lua
  28. 5 5
      Bindings/Contents/LUA/API/Polycode/Sound.lua
  29. 0 45
      Bindings/Contents/LUA/API/Polycode/String.lua
  30. 9 2
      Bindings/Contents/LUA/API/Polycode/Texture.lua
  31. 201 231
      Bindings/Contents/LUA/Include/PolycodeLUAWrappers.h
  32. 0 4
      Bindings/Contents/LUA/Source/PolycodeLUA.cpp
  33. 7 7
      Core/Contents/Include/OSBasics.h
  34. 4 4
      Core/Contents/Include/PolyBone.h
  35. 2 2
      Core/Contents/Include/PolyCamera.h
  36. 6 6
      Core/Contents/Include/PolyCocoaCore.h
  37. 8 8
      Core/Contents/Include/PolyConfig.h
  38. 6 6
      Core/Contents/Include/PolyCore.h
  39. 6 6
      Core/Contents/Include/PolyData.h
  40. 4 4
      Core/Contents/Include/PolyFixedShader.h
  41. 3 3
      Core/Contents/Include/PolyFont.h
  42. 3 3
      Core/Contents/Include/PolyFontManager.h
  43. 2 2
      Core/Contents/Include/PolyGLSLProgram.h
  44. 4 4
      Core/Contents/Include/PolyGLSLShader.h
  45. 4 4
      Core/Contents/Include/PolyGLSLShaderModule.h
  46. 10 10
      Core/Contents/Include/PolyImage.h
  47. 9 9
      Core/Contents/Include/PolyLabel.h
  48. 7 7
      Core/Contents/Include/PolyMaterial.h
  49. 2 2
      Core/Contents/Include/PolyMaterialManager.h
  50. 5 5
      Core/Contents/Include/PolyMesh.h
  51. 3 3
      Core/Contents/Include/PolyModule.h
  52. 9 9
      Core/Contents/Include/PolyObject.h
  53. 4 4
      Core/Contents/Include/PolyParticleEmitter.h
  54. 6 6
      Core/Contents/Include/PolyResource.h
  55. 11 11
      Core/Contents/Include/PolyResourceManager.h
  56. 5 5
      Core/Contents/Include/PolySDLCore.h
  57. 6 6
      Core/Contents/Include/PolyScene.h
  58. 3 3
      Core/Contents/Include/PolySceneLabel.h
  59. 5 5
      Core/Contents/Include/PolySceneMesh.h
  60. 1 1
      Core/Contents/Include/PolySceneSound.h
  61. 2 2
      Core/Contents/Include/PolyScreen.h
  62. 4 4
      Core/Contents/Include/PolyScreenImage.h
  63. 5 5
      Core/Contents/Include/PolyScreenLabel.h
  64. 5 5
      Core/Contents/Include/PolyScreenMesh.h
  65. 2 2
      Core/Contents/Include/PolyScreenSound.h
  66. 3 3
      Core/Contents/Include/PolyScreenSprite.h
  67. 10 10
      Core/Contents/Include/PolyShader.h
  68. 13 13
      Core/Contents/Include/PolySkeleton.h
  69. 6 6
      Core/Contents/Include/PolySound.h
  70. 9 31
      Core/Contents/Include/PolyString.h
  71. 8 8
      Core/Contents/Include/PolyTexture.h
  72. 6 6
      Core/Contents/Include/PolyWinCore.h
  73. 7 7
      Core/Contents/Source/OSBasics.cpp
  74. 3 3
      Core/Contents/Source/PolyBone.cpp
  75. 2 2
      Core/Contents/Source/PolyCamera.cpp
  76. 7 7
      Core/Contents/Source/PolyCocoaCore.mm
  77. 7 7
      Core/Contents/Source/PolyConfig.cpp
  78. 4 4
      Core/Contents/Source/PolyData.cpp
  79. 4 4
      Core/Contents/Source/PolyFixedShader.cpp
  80. 3 3
      Core/Contents/Source/PolyFont.cpp
  81. 2 2
      Core/Contents/Source/PolyFontManager.cpp
  82. 3 3
      Core/Contents/Source/PolyGLSLProgram.cpp
  83. 5 5
      Core/Contents/Source/PolyGLSLShader.cpp
  84. 4 4
      Core/Contents/Source/PolyGLSLShaderModule.cpp
  85. 9 9
      Core/Contents/Source/PolyImage.cpp
  86. 8 8
      Core/Contents/Source/PolyLabel.cpp
  87. 7 7
      Core/Contents/Source/PolyMaterial.cpp
  88. 2 2
      Core/Contents/Source/PolyMaterialManager.cpp
  89. 6 6
      Core/Contents/Source/PolyMesh.cpp
  90. 3 3
      Core/Contents/Source/PolyObject.cpp
  91. 4 4
      Core/Contents/Source/PolyParticleEmitter.cpp
  92. 5 5
      Core/Contents/Source/PolyResource.cpp
  93. 10 10
      Core/Contents/Source/PolyResourceManager.cpp
  94. 5 5
      Core/Contents/Source/PolySDLCore.cpp
  95. 5 5
      Core/Contents/Source/PolyScene.cpp
  96. 2 2
      Core/Contents/Source/PolySceneLabel.cpp
  97. 5 5
      Core/Contents/Source/PolySceneMesh.cpp
  98. 2 2
      Core/Contents/Source/PolySceneSound.cpp
  99. 1 1
      Core/Contents/Source/PolyScreen.cpp
  100. 4 4
      Core/Contents/Source/PolyScreenImage.cpp

+ 9 - 2
Bindings/Contents/LUA/API/Polycode/Bone.lua

@@ -68,12 +68,19 @@ function Bone:Bone(...)
 end
 
 function Bone:enableBoneLabel(labelFont, size, scale, labelColor)
-	local retVal = Polycore.Bone_enableBoneLabel(self.__ptr, labelFont, size, scale, labelColor.__ptr)
+	local retVal = Polycore.Bone_enableBoneLabel(self.__ptr, labelFont.__ptr, size, scale, labelColor.__ptr)
 end
 
 function Bone:getName()
 	local retVal =  Polycore.Bone_getName(self.__ptr)
-	return retVal
+	if retVal == nil then return nil end
+	if Polycore.__ptr_lookup[retVal] ~= nil then
+		return Polycore.__ptr_lookup[retVal]
+	else
+		Polycore.__ptr_lookup[retVal] = String("__skip_ptr__")
+		Polycore.__ptr_lookup[retVal].__ptr = retVal
+		return Polycore.__ptr_lookup[retVal]
+	end
 end
 
 function Bone:Render()

+ 1 - 1
Bindings/Contents/LUA/API/Polycode/Camera.lua

@@ -95,7 +95,7 @@ function Camera:createPostFilter(shaderMaterial)
 end
 
 function Camera:setPostFilter(shaderName)
-	local retVal = Polycore.Camera_setPostFilter(self.__ptr, shaderName)
+	local retVal = Polycore.Camera_setPostFilter(self.__ptr, shaderName.__ptr)
 end
 
 function Camera:removePostFilter()

+ 15 - 8
Bindings/Contents/LUA/API/Polycode/Config.lua

@@ -21,15 +21,15 @@ function Config:Config(...)
 end
 
 function Config:loadConfig(configNamespace, fileName)
-	local retVal = Polycore.Config_loadConfig(self.__ptr, configNamespace, fileName)
+	local retVal = Polycore.Config_loadConfig(self.__ptr, configNamespace.__ptr, fileName.__ptr)
 end
 
 function Config:saveConfig(configNamespace, fileName)
-	local retVal = Polycore.Config_saveConfig(self.__ptr, configNamespace, fileName)
+	local retVal = Polycore.Config_saveConfig(self.__ptr, configNamespace.__ptr, fileName.__ptr)
 end
 
 function Config:getEntry(configNamespace, key)
-	local retVal = Polycore.Config_getEntry(self.__ptr, configNamespace, key)
+	local retVal = Polycore.Config_getEntry(self.__ptr, configNamespace.__ptr, key.__ptr)
 	if retVal == nil then return nil end
 	if Polycore.__ptr_lookup[retVal] ~= nil then
 		return Polycore.__ptr_lookup[retVal]
@@ -41,21 +41,28 @@ function Config:getEntry(configNamespace, key)
 end
 
 function Config:setStringValue(configNamespace, key, value)
-	local retVal = Polycore.Config_setStringValue(self.__ptr, configNamespace, key, value)
+	local retVal = Polycore.Config_setStringValue(self.__ptr, configNamespace.__ptr, key.__ptr, value.__ptr)
 end
 
 function Config:setNumericValue(configNamespace, key, value)
-	local retVal = Polycore.Config_setNumericValue(self.__ptr, configNamespace, key, value)
+	local retVal = Polycore.Config_setNumericValue(self.__ptr, configNamespace.__ptr, key.__ptr, value)
 end
 
 function Config:getNumericValue(configNamespace, key)
-	local retVal = Polycore.Config_getNumericValue(self.__ptr, configNamespace, key)
+	local retVal = Polycore.Config_getNumericValue(self.__ptr, configNamespace.__ptr, key.__ptr)
 	return retVal
 end
 
 function Config:getStringValue(configNamespace, key)
-	local retVal = Polycore.Config_getStringValue(self.__ptr, configNamespace, key)
-	return retVal
+	local retVal = Polycore.Config_getStringValue(self.__ptr, configNamespace.__ptr, key.__ptr)
+	if retVal == nil then return nil end
+	if Polycore.__ptr_lookup[retVal] ~= nil then
+		return Polycore.__ptr_lookup[retVal]
+	else
+		Polycore.__ptr_lookup[retVal] = String("__skip_ptr__")
+		Polycore.__ptr_lookup[retVal].__ptr = retVal
+		return Polycore.__ptr_lookup[retVal]
+	end
 end
 
 

+ 5 - 5
Bindings/Contents/LUA/API/Polycode/Core.lua

@@ -47,7 +47,7 @@ function Core:createMutex()
 end
 
 function Core:copyStringToClipboard(str)
-	local retVal = Polycore.Core_copyStringToClipboard(self.__ptr, str)
+	local retVal = Polycore.Core_copyStringToClipboard(self.__ptr, str.__ptr)
 end
 
 function Core:getClipboardString()
@@ -121,19 +121,19 @@ function Core:getNumVideoModes()
 end
 
 function Core:createFolder(folderPath)
-	local retVal = Polycore.Core_createFolder(self.__ptr, folderPath)
+	local retVal = Polycore.Core_createFolder(self.__ptr, folderPath.__ptr)
 end
 
 function Core:copyDiskItem(itemPath, destItemPath)
-	local retVal = Polycore.Core_copyDiskItem(self.__ptr, itemPath, destItemPath)
+	local retVal = Polycore.Core_copyDiskItem(self.__ptr, itemPath.__ptr, destItemPath.__ptr)
 end
 
 function Core:moveDiskItem(itemPath, destItemPath)
-	local retVal = Polycore.Core_moveDiskItem(self.__ptr, itemPath, destItemPath)
+	local retVal = Polycore.Core_moveDiskItem(self.__ptr, itemPath.__ptr, destItemPath.__ptr)
 end
 
 function Core:removeDiskItem(itemPath)
-	local retVal = Polycore.Core_removeDiskItem(self.__ptr, itemPath)
+	local retVal = Polycore.Core_removeDiskItem(self.__ptr, itemPath.__ptr)
 end
 
 function Core:openFolderPicker()

+ 3 - 3
Bindings/Contents/LUA/API/Polycode/Data.lua

@@ -21,7 +21,7 @@ function Data:Data(...)
 end
 
 function Data:loadFromFile(fileName)
-	local retVal = Polycore.Data_loadFromFile(self.__ptr, fileName)
+	local retVal = Polycore.Data_loadFromFile(self.__ptr, fileName.__ptr)
 end
 
 function Data:getAsString(encoding)
@@ -30,11 +30,11 @@ function Data:getAsString(encoding)
 end
 
 function Data:setFromString(str, encoding)
-	local retVal = Polycore.Data_setFromString(self.__ptr, str, encoding)
+	local retVal = Polycore.Data_setFromString(self.__ptr, str.__ptr, encoding)
 end
 
 function Data:saveToFile(fileName)
-	local retVal = Polycore.Data_saveToFile(self.__ptr, fileName)
+	local retVal = Polycore.Data_saveToFile(self.__ptr, fileName.__ptr)
 	return retVal
 end
 

+ 3 - 3
Bindings/Contents/LUA/API/Polycode/FixedShaderBinding.lua

@@ -29,15 +29,15 @@ function FixedShaderBinding:FixedShaderBinding(...)
 end
 
 function FixedShaderBinding:addTexture(name, texture)
-	local retVal = Polycore.FixedShaderBinding_addTexture(self.__ptr, name, texture.__ptr)
+	local retVal = Polycore.FixedShaderBinding_addTexture(self.__ptr, name.__ptr, texture.__ptr)
 end
 
 function FixedShaderBinding:addCubemap(name, cubemap)
-	local retVal = Polycore.FixedShaderBinding_addCubemap(self.__ptr, name, cubemap.__ptr)
+	local retVal = Polycore.FixedShaderBinding_addCubemap(self.__ptr, name.__ptr, cubemap.__ptr)
 end
 
 function FixedShaderBinding:addParam(type, name, value)
-	local retVal = Polycore.FixedShaderBinding_addParam(self.__ptr, type, name, value)
+	local retVal = Polycore.FixedShaderBinding_addParam(self.__ptr, type.__ptr, name.__ptr, value.__ptr)
 end
 
 function FixedShaderBinding:getDiffuseTexture()

+ 2 - 2
Bindings/Contents/LUA/API/Polycode/FontManager.lua

@@ -21,11 +21,11 @@ function FontManager:FontManager(...)
 end
 
 function FontManager:registerFont(fontName, fontPath)
-	local retVal = Polycore.FontManager_registerFont(self.__ptr, fontName, fontPath)
+	local retVal = Polycore.FontManager_registerFont(self.__ptr, fontName.__ptr, fontPath.__ptr)
 end
 
 function FontManager:getFontByName(fontName)
-	local retVal = Polycore.FontManager_getFontByName(self.__ptr, fontName)
+	local retVal = Polycore.FontManager_getFontByName(self.__ptr, fontName.__ptr)
 	if retVal == nil then return nil end
 	if Polycore.__ptr_lookup[retVal] ~= nil then
 		return Polycore.__ptr_lookup[retVal]

+ 3 - 3
Bindings/Contents/LUA/API/Polycode/Image.lua

@@ -23,12 +23,12 @@ function Image:Image(...)
 end
 
 function Image:loadImage(fileName)
-	local retVal = Polycore.Image_loadImage(self.__ptr, fileName)
+	local retVal = Polycore.Image_loadImage(self.__ptr, fileName.__ptr)
 	return retVal
 end
 
 function Image:loadPNG(fileName)
-	local retVal = Polycore.Image_loadPNG(self.__ptr, fileName)
+	local retVal = Polycore.Image_loadPNG(self.__ptr, fileName.__ptr)
 	return retVal
 end
 
@@ -129,7 +129,7 @@ function Image:getType()
 end
 
 function Image:writeBMP(fileName)
-	local retVal = Polycore.Image_writeBMP(self.__ptr, fileName)
+	local retVal = Polycore.Image_writeBMP(self.__ptr, fileName.__ptr)
 end
 
 function Image:getWidth()

+ 11 - 4
Bindings/Contents/LUA/API/Polycode/Label.lua

@@ -31,21 +31,28 @@ function Label:Label(...)
 end
 
 function Label:setText(text)
-	local retVal = Polycore.Label_setText(self.__ptr, text)
+	local retVal = Polycore.Label_setText(self.__ptr, text.__ptr)
 end
 
 function Label:getText()
 	local retVal =  Polycore.Label_getText(self.__ptr)
-	return retVal
+	if retVal == nil then return nil end
+	if Polycore.__ptr_lookup[retVal] ~= nil then
+		return Polycore.__ptr_lookup[retVal]
+	else
+		Polycore.__ptr_lookup[retVal] = String("__skip_ptr__")
+		Polycore.__ptr_lookup[retVal].__ptr = retVal
+		return Polycore.__ptr_lookup[retVal]
+	end
 end
 
 function Label:getTextWidth(font, text, size)
-	local retVal = Polycore.Label_getTextWidth(self.__ptr, font.__ptr, text, size)
+	local retVal = Polycore.Label_getTextWidth(self.__ptr, font.__ptr, text.__ptr, size)
 	return retVal
 end
 
 function Label:getTextHeight(font, text, size)
-	local retVal = Polycore.Label_getTextHeight(self.__ptr, font.__ptr, text, size)
+	local retVal = Polycore.Label_getTextHeight(self.__ptr, font.__ptr, text.__ptr, size)
 	return retVal
 end
 

+ 9 - 2
Bindings/Contents/LUA/API/Polycode/Material.lua

@@ -90,7 +90,14 @@ end
 
 function Material:getName()
 	local retVal =  Polycore.Material_getName(self.__ptr)
-	return retVal
+	if retVal == nil then return nil end
+	if Polycore.__ptr_lookup[retVal] ~= nil then
+		return Polycore.__ptr_lookup[retVal]
+	else
+		Polycore.__ptr_lookup[retVal] = String("__skip_ptr__")
+		Polycore.__ptr_lookup[retVal].__ptr = retVal
+		return Polycore.__ptr_lookup[retVal]
+	end
 end
 
 function Material:getShader(index)
@@ -118,7 +125,7 @@ function Material:getShaderBinding(index)
 end
 
 function Material:loadMaterial(fileName)
-	local retVal = Polycore.Material_loadMaterial(self.__ptr, fileName)
+	local retVal = Polycore.Material_loadMaterial(self.__ptr, fileName.__ptr)
 end
 
 

+ 1 - 1
Bindings/Contents/LUA/API/Polycode/MaterialManager.lua

@@ -105,7 +105,7 @@ function MaterialManager:addShaderModule(module)
 end
 
 function MaterialManager:getTextureByResourcePath(resourcePath)
-	local retVal = Polycore.MaterialManager_getTextureByResourcePath(self.__ptr, resourcePath)
+	local retVal = Polycore.MaterialManager_getTextureByResourcePath(self.__ptr, resourcePath.__ptr)
 	if retVal == nil then return nil end
 	if Polycore.__ptr_lookup[retVal] ~= nil then
 		return Polycore.__ptr_lookup[retVal]

+ 2 - 2
Bindings/Contents/LUA/API/Polycode/Mesh.lua

@@ -43,11 +43,11 @@ function Mesh:addPolygon(newPolygon)
 end
 
 function Mesh:loadMesh(fileName)
-	local retVal = Polycore.Mesh_loadMesh(self.__ptr, fileName)
+	local retVal = Polycore.Mesh_loadMesh(self.__ptr, fileName.__ptr)
 end
 
 function Mesh:saveToFile(fileName)
-	local retVal = Polycore.Mesh_saveToFile(self.__ptr, fileName)
+	local retVal = Polycore.Mesh_saveToFile(self.__ptr, fileName.__ptr)
 end
 
 function Mesh:loadFromFile(inFile)

+ 4 - 4
Bindings/Contents/LUA/API/Polycode/OSBasics.lua

@@ -7,7 +7,7 @@ class "OSBasics"
 
 
 function OSBasics:open(filename, opts)
-	local retVal = Polycore.OSBasics_open(filename, opts)
+	local retVal = Polycore.OSBasics_open(filename.__ptr, opts.__ptr)
 	if retVal == nil then return nil end
 	if Polycore.__ptr_lookup[retVal] ~= nil then
 		return Polycore.__ptr_lookup[retVal]
@@ -44,16 +44,16 @@ function OSBasics:tell(stream)
 end
 
 function OSBasics:isFolder(pathString)
-	local retVal = Polycore.OSBasics_isFolder(pathString)
+	local retVal = Polycore.OSBasics_isFolder(pathString.__ptr)
 	return retVal
 end
 
 function OSBasics:createFolder(pathString)
-	local retVal = Polycore.OSBasics_createFolder(pathString)
+	local retVal = Polycore.OSBasics_createFolder(pathString.__ptr)
 end
 
 function OSBasics:removeItem(pathString)
-	local retVal = Polycore.OSBasics_removeItem(pathString)
+	local retVal = Polycore.OSBasics_removeItem(pathString.__ptr)
 end
 
 

+ 1 - 1
Bindings/Contents/LUA/API/Polycode/ObjectEntry.lua

@@ -69,7 +69,7 @@ function ObjectEntry:ObjectEntry(...)
 end
 
 function ObjectEntry:addChild(name)
-	local retVal = Polycore.ObjectEntry_addChild(self.__ptr, name)
+	local retVal = Polycore.ObjectEntry_addChild(self.__ptr, name.__ptr)
 	if retVal == nil then return nil end
 	if Polycore.__ptr_lookup[retVal] ~= nil then
 		return Polycore.__ptr_lookup[retVal]

+ 18 - 4
Bindings/Contents/LUA/API/Polycode/Resource.lua

@@ -28,7 +28,14 @@ end
 
 function Resource:getResourceName()
 	local retVal =  Polycore.Resource_getResourceName(self.__ptr)
-	return retVal
+	if retVal == nil then return nil end
+	if Polycore.__ptr_lookup[retVal] ~= nil then
+		return Polycore.__ptr_lookup[retVal]
+	else
+		Polycore.__ptr_lookup[retVal] = String("__skip_ptr__")
+		Polycore.__ptr_lookup[retVal].__ptr = retVal
+		return Polycore.__ptr_lookup[retVal]
+	end
 end
 
 function Resource:getResourceType()
@@ -37,16 +44,23 @@ function Resource:getResourceType()
 end
 
 function Resource:setResourceName(newName)
-	local retVal = Polycore.Resource_setResourceName(self.__ptr, newName)
+	local retVal = Polycore.Resource_setResourceName(self.__ptr, newName.__ptr)
 end
 
 function Resource:setResourcePath(path)
-	local retVal = Polycore.Resource_setResourcePath(self.__ptr, path)
+	local retVal = Polycore.Resource_setResourcePath(self.__ptr, path.__ptr)
 end
 
 function Resource:getResourcePath()
 	local retVal =  Polycore.Resource_getResourcePath(self.__ptr)
-	return retVal
+	if retVal == nil then return nil end
+	if Polycore.__ptr_lookup[retVal] ~= nil then
+		return Polycore.__ptr_lookup[retVal]
+	else
+		Polycore.__ptr_lookup[retVal] = String("__skip_ptr__")
+		Polycore.__ptr_lookup[retVal].__ptr = retVal
+		return Polycore.__ptr_lookup[retVal]
+	end
 end
 
 

+ 10 - 10
Bindings/Contents/LUA/API/Polycode/ResourceManager.lua

@@ -25,44 +25,44 @@ function ResourceManager:addResource(resource)
 end
 
 function ResourceManager:addDirResource(dirPath, recursive)
-	local retVal = Polycore.ResourceManager_addDirResource(self.__ptr, dirPath, recursive)
+	local retVal = Polycore.ResourceManager_addDirResource(self.__ptr, dirPath.__ptr, recursive)
 end
 
 function ResourceManager:addArchive(zipPath)
-	local retVal = Polycore.ResourceManager_addArchive(self.__ptr, zipPath)
+	local retVal = Polycore.ResourceManager_addArchive(self.__ptr, zipPath.__ptr)
 end
 
 function ResourceManager:readFile(fileName)
-	local retVal = Polycore.ResourceManager_readFile(self.__ptr, fileName)
+	local retVal = Polycore.ResourceManager_readFile(self.__ptr, fileName.__ptr)
 	return retVal
 end
 
 function ResourceManager:parseTextures(dirPath, recursive)
-	local retVal = Polycore.ResourceManager_parseTextures(self.__ptr, dirPath, recursive)
+	local retVal = Polycore.ResourceManager_parseTextures(self.__ptr, dirPath.__ptr, recursive)
 end
 
 function ResourceManager:parseMaterials(dirPath, recursive)
-	local retVal = Polycore.ResourceManager_parseMaterials(self.__ptr, dirPath, recursive)
+	local retVal = Polycore.ResourceManager_parseMaterials(self.__ptr, dirPath.__ptr, recursive)
 end
 
 function ResourceManager:parseShaders(dirPath, recursive)
-	local retVal = Polycore.ResourceManager_parseShaders(self.__ptr, dirPath, recursive)
+	local retVal = Polycore.ResourceManager_parseShaders(self.__ptr, dirPath.__ptr, recursive)
 end
 
 function ResourceManager:parsePrograms(dirPath, recursive)
-	local retVal = Polycore.ResourceManager_parsePrograms(self.__ptr, dirPath, recursive)
+	local retVal = Polycore.ResourceManager_parsePrograms(self.__ptr, dirPath.__ptr, recursive)
 end
 
 function ResourceManager:parseCubemaps(dirPath, recursive)
-	local retVal = Polycore.ResourceManager_parseCubemaps(self.__ptr, dirPath, recursive)
+	local retVal = Polycore.ResourceManager_parseCubemaps(self.__ptr, dirPath.__ptr, recursive)
 end
 
 function ResourceManager:parseOthers(dirPath, recursive)
-	local retVal = Polycore.ResourceManager_parseOthers(self.__ptr, dirPath, recursive)
+	local retVal = Polycore.ResourceManager_parseOthers(self.__ptr, dirPath.__ptr, recursive)
 end
 
 function ResourceManager:getResource(resourceType, resourceName)
-	local retVal = Polycore.ResourceManager_getResource(self.__ptr, resourceType, resourceName)
+	local retVal = Polycore.ResourceManager_getResource(self.__ptr, resourceType, resourceName.__ptr)
 	if retVal == nil then return nil end
 	if Polycore.__ptr_lookup[retVal] ~= nil then
 		return Polycore.__ptr_lookup[retVal]

+ 4 - 4
Bindings/Contents/LUA/API/Polycode/Scene.lua

@@ -174,7 +174,7 @@ function Scene:readString(inFile)
 end
 
 function Scene:loadScene(fileName)
-	local retVal = Polycore.Scene_loadScene(self.__ptr, fileName)
+	local retVal = Polycore.Scene_loadScene(self.__ptr, fileName.__ptr)
 end
 
 function Scene:generateLightmaps(lightMapRes, lightMapQuality, numRadPasses)
@@ -202,11 +202,11 @@ function Scene:writeEntityMatrix(entity, outFile)
 end
 
 function Scene:writeString(str, outFile)
-	local retVal = Polycore.Scene_writeString(self.__ptr, str, outFile.__ptr)
+	local retVal = Polycore.Scene_writeString(self.__ptr, str.__ptr, outFile.__ptr)
 end
 
 function Scene:saveScene(fileName)
-	local retVal = Polycore.Scene_saveScene(self.__ptr, fileName)
+	local retVal = Polycore.Scene_saveScene(self.__ptr, fileName.__ptr)
 end
 
 function Scene:getNumStaticGeometry()
@@ -248,7 +248,7 @@ function Scene:getLight(index)
 end
 
 function Scene:getCustomEntityByType(type)
-	local retVal = Polycore.Scene_getCustomEntityByType(self.__ptr, type)
+	local retVal = Polycore.Scene_getCustomEntityByType(self.__ptr, type.__ptr)
 	if retVal == nil then return nil end
 	if Polycore.__ptr_lookup[retVal] ~= nil then
 		return Polycore.__ptr_lookup[retVal]

+ 1 - 1
Bindings/Contents/LUA/API/Polycode/SceneLabel.lua

@@ -34,7 +34,7 @@ function SceneLabel:testMouseCollision(x, y)
 end
 
 function SceneLabel:setText(newText)
-	local retVal = Polycore.SceneLabel_setText(self.__ptr, newText)
+	local retVal = Polycore.SceneLabel_setText(self.__ptr, newText.__ptr)
 end
 
 function SceneLabel:getLabel()

+ 3 - 3
Bindings/Contents/LUA/API/Polycode/SceneMesh.lua

@@ -102,11 +102,11 @@ function SceneMesh:getMaterial()
 end
 
 function SceneMesh:loadTexture(fileName, clamp)
-	local retVal = Polycore.SceneMesh_loadTexture(self.__ptr, fileName, clamp)
+	local retVal = Polycore.SceneMesh_loadTexture(self.__ptr, fileName.__ptr, clamp)
 end
 
 function SceneMesh:loadSkeleton(fileName)
-	local retVal = Polycore.SceneMesh_loadSkeleton(self.__ptr, fileName)
+	local retVal = Polycore.SceneMesh_loadSkeleton(self.__ptr, fileName.__ptr)
 end
 
 function SceneMesh:setTexture(texture)
@@ -118,7 +118,7 @@ function SceneMesh:setMaterial(material)
 end
 
 function SceneMesh:setMaterialByName(materialName)
-	local retVal = Polycore.SceneMesh_setMaterialByName(self.__ptr, materialName)
+	local retVal = Polycore.SceneMesh_setMaterialByName(self.__ptr, materialName.__ptr)
 end
 
 function SceneMesh:setMesh(mesh)

+ 1 - 1
Bindings/Contents/LUA/API/Polycode/Screen.lua

@@ -113,7 +113,7 @@ function Screen:setNormalizedCoordinates(newVal, yCoordinateSize)
 end
 
 function Screen:setScreenShader(shaderName)
-	local retVal = Polycore.Screen_setScreenShader(self.__ptr, shaderName)
+	local retVal = Polycore.Screen_setScreenShader(self.__ptr, shaderName.__ptr)
 end
 
 function Screen:clearScreenShader()

+ 9 - 2
Bindings/Contents/LUA/API/Polycode/ScreenLabel.lua

@@ -33,12 +33,19 @@ function ScreenLabel:addDropShadow(color, size, offsetX, offsetY)
 end
 
 function ScreenLabel:setText(newText)
-	local retVal = Polycore.ScreenLabel_setText(self.__ptr, newText)
+	local retVal = Polycore.ScreenLabel_setText(self.__ptr, newText.__ptr)
 end
 
 function ScreenLabel:getText()
 	local retVal =  Polycore.ScreenLabel_getText(self.__ptr)
-	return retVal
+	if retVal == nil then return nil end
+	if Polycore.__ptr_lookup[retVal] ~= nil then
+		return Polycore.__ptr_lookup[retVal]
+	else
+		Polycore.__ptr_lookup[retVal] = String("__skip_ptr__")
+		Polycore.__ptr_lookup[retVal].__ptr = retVal
+		return Polycore.__ptr_lookup[retVal]
+	end
 end
 
 function ScreenLabel:getLabel()

+ 1 - 1
Bindings/Contents/LUA/API/Polycode/ScreenMesh.lua

@@ -57,7 +57,7 @@ function ScreenMesh:getTexture()
 end
 
 function ScreenMesh:loadTexture(fileName)
-	local retVal = Polycore.ScreenMesh_loadTexture(self.__ptr, fileName)
+	local retVal = Polycore.ScreenMesh_loadTexture(self.__ptr, fileName.__ptr)
 end
 
 function ScreenMesh:setTexture(texture)

+ 2 - 2
Bindings/Contents/LUA/API/Polycode/ScreenSprite.lua

@@ -29,11 +29,11 @@ function ScreenSprite:ScreenSprite(...)
 end
 
 function ScreenSprite:addAnimation(name, frames, speed)
-	local retVal = Polycore.ScreenSprite_addAnimation(self.__ptr, name, frames, speed)
+	local retVal = Polycore.ScreenSprite_addAnimation(self.__ptr, name.__ptr, frames.__ptr, speed)
 end
 
 function ScreenSprite:playAnimation(name, startFrame, once)
-	local retVal = Polycore.ScreenSprite_playAnimation(self.__ptr, name, startFrame, once)
+	local retVal = Polycore.ScreenSprite_playAnimation(self.__ptr, name.__ptr, startFrame, once)
 end
 
 function ScreenSprite:Update()

+ 9 - 2
Bindings/Contents/LUA/API/Polycode/Shader.lua

@@ -33,12 +33,19 @@ function Shader:getType()
 end
 
 function Shader:setName(name)
-	local retVal = Polycore.Shader_setName(self.__ptr, name)
+	local retVal = Polycore.Shader_setName(self.__ptr, name.__ptr)
 end
 
 function Shader:getName()
 	local retVal =  Polycore.Shader_getName(self.__ptr)
-	return retVal
+	if retVal == nil then return nil end
+	if Polycore.__ptr_lookup[retVal] ~= nil then
+		return Polycore.__ptr_lookup[retVal]
+	else
+		Polycore.__ptr_lookup[retVal] = String("__skip_ptr__")
+		Polycore.__ptr_lookup[retVal].__ptr = retVal
+		return Polycore.__ptr_lookup[retVal]
+	end
 end
 
 function Shader:createBinding()

+ 6 - 6
Bindings/Contents/LUA/API/Polycode/ShaderBinding.lua

@@ -21,19 +21,19 @@ function ShaderBinding:ShaderBinding(...)
 end
 
 function ShaderBinding:clearTexture(name)
-	local retVal = Polycore.ShaderBinding_clearTexture(self.__ptr, name)
+	local retVal = Polycore.ShaderBinding_clearTexture(self.__ptr, name.__ptr)
 end
 
 function ShaderBinding:addTexture(name, texture)
-	local retVal = Polycore.ShaderBinding_addTexture(self.__ptr, name, texture.__ptr)
+	local retVal = Polycore.ShaderBinding_addTexture(self.__ptr, name.__ptr, texture.__ptr)
 end
 
 function ShaderBinding:addParam(type, name, value)
-	local retVal = Polycore.ShaderBinding_addParam(self.__ptr, type, name, value)
+	local retVal = Polycore.ShaderBinding_addParam(self.__ptr, type.__ptr, name.__ptr, value.__ptr)
 end
 
 function ShaderBinding:addCubemap(name, cubemap)
-	local retVal = Polycore.ShaderBinding_addCubemap(self.__ptr, name, cubemap.__ptr)
+	local retVal = Polycore.ShaderBinding_addCubemap(self.__ptr, name.__ptr, cubemap.__ptr)
 end
 
 function ShaderBinding:getNumLocalParams()
@@ -54,7 +54,7 @@ function ShaderBinding:getLocalParam(index)
 end
 
 function ShaderBinding:getLocalParamByName(name)
-	local retVal = Polycore.ShaderBinding_getLocalParamByName(self.__ptr, name)
+	local retVal = Polycore.ShaderBinding_getLocalParamByName(self.__ptr, name.__ptr)
 	if retVal == nil then return nil end
 	if Polycore.__ptr_lookup[retVal] ~= nil then
 		return Polycore.__ptr_lookup[retVal]
@@ -121,7 +121,7 @@ function ShaderBinding:getOutTargetBinding(index)
 end
 
 function ShaderBinding:addLocalParam(name, ptr)
-	local retVal = Polycore.ShaderBinding_addLocalParam(self.__ptr, name, ptr.__ptr)
+	local retVal = Polycore.ShaderBinding_addLocalParam(self.__ptr, name.__ptr, ptr.__ptr)
 end
 
 

+ 6 - 6
Bindings/Contents/LUA/API/Polycode/Skeleton.lua

@@ -29,11 +29,11 @@ function Skeleton:Skeleton(...)
 end
 
 function Skeleton:loadSkeleton(fileName)
-	local retVal = Polycore.Skeleton_loadSkeleton(self.__ptr, fileName)
+	local retVal = Polycore.Skeleton_loadSkeleton(self.__ptr, fileName.__ptr)
 end
 
 function Skeleton:playAnimation(animName)
-	local retVal = Polycore.Skeleton_playAnimation(self.__ptr, animName)
+	local retVal = Polycore.Skeleton_playAnimation(self.__ptr, animName.__ptr)
 end
 
 function Skeleton:playAnimationByIndex(index)
@@ -41,11 +41,11 @@ function Skeleton:playAnimationByIndex(index)
 end
 
 function Skeleton:addAnimation(name, fileName)
-	local retVal = Polycore.Skeleton_addAnimation(self.__ptr, name, fileName)
+	local retVal = Polycore.Skeleton_addAnimation(self.__ptr, name.__ptr, fileName.__ptr)
 end
 
 function Skeleton:getAnimation(name)
-	local retVal = Polycore.Skeleton_getAnimation(self.__ptr, name)
+	local retVal = Polycore.Skeleton_getAnimation(self.__ptr, name.__ptr)
 	if retVal == nil then return nil end
 	if Polycore.__ptr_lookup[retVal] ~= nil then
 		return Polycore.__ptr_lookup[retVal]
@@ -61,7 +61,7 @@ function Skeleton:Update()
 end
 
 function Skeleton:getBoneByName(name)
-	local retVal = Polycore.Skeleton_getBoneByName(self.__ptr, name)
+	local retVal = Polycore.Skeleton_getBoneByName(self.__ptr, name.__ptr)
 	if retVal == nil then return nil end
 	if Polycore.__ptr_lookup[retVal] ~= nil then
 		return Polycore.__ptr_lookup[retVal]
@@ -77,7 +77,7 @@ function Skeleton:bonesVisible(val)
 end
 
 function Skeleton:enableBoneLabels(labelFont, size, scale, labelColor)
-	local retVal = Polycore.Skeleton_enableBoneLabels(self.__ptr, labelFont, size, scale, labelColor.__ptr)
+	local retVal = Polycore.Skeleton_enableBoneLabels(self.__ptr, labelFont.__ptr, size, scale, labelColor.__ptr)
 end
 
 function Skeleton:getNumBones()

+ 8 - 1
Bindings/Contents/LUA/API/Polycode/SkeletonAnimation.lua

@@ -26,7 +26,14 @@ end
 
 function SkeletonAnimation:getName()
 	local retVal =  Polycore.SkeletonAnimation_getName(self.__ptr)
-	return retVal
+	if retVal == nil then return nil end
+	if Polycore.__ptr_lookup[retVal] ~= nil then
+		return Polycore.__ptr_lookup[retVal]
+	else
+		Polycore.__ptr_lookup[retVal] = String("__skip_ptr__")
+		Polycore.__ptr_lookup[retVal].__ptr = retVal
+		return Polycore.__ptr_lookup[retVal]
+	end
 end
 
 function SkeletonAnimation:Play()

+ 5 - 5
Bindings/Contents/LUA/API/Polycode/Sound.lua

@@ -57,7 +57,7 @@ function Sound:setPositionalProperties(referenceDistance, maxDistance)
 end
 
 function Sound:loadWAV(fileName)
-	local retVal = Polycore.Sound_loadWAV(self.__ptr, fileName)
+	local retVal = Polycore.Sound_loadWAV(self.__ptr, fileName.__ptr)
 	if retVal == nil then return nil end
 	if Polycore.__ptr_lookup[retVal] ~= nil then
 		return Polycore.__ptr_lookup[retVal]
@@ -69,7 +69,7 @@ function Sound:loadWAV(fileName)
 end
 
 function Sound:loadOGG(fileName)
-	local retVal = Polycore.Sound_loadOGG(self.__ptr, fileName)
+	local retVal = Polycore.Sound_loadOGG(self.__ptr, fileName.__ptr)
 	if retVal == nil then return nil end
 	if Polycore.__ptr_lookup[retVal] ~= nil then
 		return Polycore.__ptr_lookup[retVal]
@@ -93,15 +93,15 @@ function Sound:GenSource(buffer)
 end
 
 function Sound:checkALError(operation)
-	local retVal = Polycore.Sound_checkALError(self.__ptr, operation)
+	local retVal = Polycore.Sound_checkALError(self.__ptr, operation.__ptr)
 end
 
 function Sound:soundError(err)
-	local retVal = Polycore.Sound_soundError(self.__ptr, err)
+	local retVal = Polycore.Sound_soundError(self.__ptr, err.__ptr)
 end
 
 function Sound:soundCheck(result, err)
-	local retVal = Polycore.Sound_soundCheck(self.__ptr, result, err)
+	local retVal = Polycore.Sound_soundCheck(self.__ptr, result, err.__ptr)
 end
 
 

+ 0 - 45
Bindings/Contents/LUA/API/Polycode/String.lua

@@ -6,15 +6,6 @@ ENCODING_UTF8 = 0
 function String:__index__(name)
 	if name == "contents" then
 		retVal = Polycore.String_get_contents(self.__ptr)
-		if Polycore.__ptr_lookup[retVal] ~= nil then
-			return Polycore.__ptr_lookup[retVal]
-		else
-			Polycore.__ptr_lookup[retVal] = wstring("__skip_ptr__")
-			Polycore.__ptr_lookup[retVal].__ptr = retVal
-			return Polycore.__ptr_lookup[retVal]
-		end
-	elseif name == "s_contents" then
-		retVal = Polycore.String_get_s_contents(self.__ptr)
 		if Polycore.__ptr_lookup[retVal] ~= nil then
 			return Polycore.__ptr_lookup[retVal]
 		else
@@ -67,18 +58,6 @@ function String:getSTLString()
 	end
 end
 
-function String:getSTLWString()
-	local retVal =  Polycore.String_getSTLWString(self.__ptr)
-	if retVal == nil then return nil end
-	if Polycore.__ptr_lookup[retVal] ~= nil then
-		return Polycore.__ptr_lookup[retVal]
-	else
-		Polycore.__ptr_lookup[retVal] = wstring("__skip_ptr__")
-		Polycore.__ptr_lookup[retVal].__ptr = retVal
-		return Polycore.__ptr_lookup[retVal]
-	end
-end
-
 function String:substr(pos, n)
 	local retVal = Polycore.String_substr(self.__ptr, pos.__ptr, n.__ptr)
 	return retVal
@@ -131,30 +110,6 @@ function String:c_str()
 	end
 end
 
-function String:wc_str()
-	local retVal =  Polycore.String_wc_str(self.__ptr)
-	if retVal == nil then return nil end
-	if Polycore.__ptr_lookup[retVal] ~= nil then
-		return Polycore.__ptr_lookup[retVal]
-	else
-		Polycore.__ptr_lookup[retVal] = wchar_t("__skip_ptr__")
-		Polycore.__ptr_lookup[retVal].__ptr = retVal
-		return Polycore.__ptr_lookup[retVal]
-	end
-end
-
-function String:data()
-	local retVal =  Polycore.String_data(self.__ptr)
-	if retVal == nil then return nil end
-	if Polycore.__ptr_lookup[retVal] ~= nil then
-		return Polycore.__ptr_lookup[retVal]
-	else
-		Polycore.__ptr_lookup[retVal] = wchar_t("__skip_ptr__")
-		Polycore.__ptr_lookup[retVal].__ptr = retVal
-		return Polycore.__ptr_lookup[retVal]
-	end
-end
-
 function String:getDataWithEncoding(encoding)
 	local retVal = Polycore.String_getDataWithEncoding(self.__ptr, encoding)
 	if retVal == nil then return nil end

+ 9 - 2
Bindings/Contents/LUA/API/Polycode/Texture.lua

@@ -57,12 +57,19 @@ function Texture:updateScroll(elapsed)
 end
 
 function Texture:setResourcePath(newPath)
-	local retVal = Polycore.Texture_setResourcePath(self.__ptr, newPath)
+	local retVal = Polycore.Texture_setResourcePath(self.__ptr, newPath.__ptr)
 end
 
 function Texture:getResourcePath()
 	local retVal =  Polycore.Texture_getResourcePath(self.__ptr)
-	return retVal
+	if retVal == nil then return nil end
+	if Polycore.__ptr_lookup[retVal] ~= nil then
+		return Polycore.__ptr_lookup[retVal]
+	else
+		Polycore.__ptr_lookup[retVal] = String("__skip_ptr__")
+		Polycore.__ptr_lookup[retVal].__ptr = retVal
+		return Polycore.__ptr_lookup[retVal]
+	end
 end
 
 function Texture:getTextureData()

Разница между файлами не показана из-за своего большого размера
+ 201 - 231
Bindings/Contents/LUA/Include/PolycodeLUAWrappers.h


+ 0 - 4
Bindings/Contents/LUA/Source/PolycodeLUA.cpp

@@ -602,12 +602,10 @@ int luaopen_Polycode(lua_State *L) {
 		{"ScreenSound_getSound", Polycore_ScreenSound_getSound},
 		{"delete_ScreenSound", Polycore_delete_ScreenSound},
 		{"String_get_contents", Polycore_String_get_contents},
-		{"String_get_s_contents", Polycore_String_get_s_contents},
 		{"String", Polycore_String},
 		{"String_size", Polycore_String_size},
 		{"String_length", Polycore_String_length},
 		{"String_getSTLString", Polycore_String_getSTLString},
-		{"String_getSTLWString", Polycore_String_getSTLWString},
 		{"String_substr", Polycore_String_substr},
 		{"String_rfind", Polycore_String_rfind},
 		{"String_find", Polycore_String_find},
@@ -617,8 +615,6 @@ int luaopen_Polycode(lua_State *L) {
 		{"String_replace", Polycore_String_replace},
 		{"String_NumberToString", Polycore_String_NumberToString},
 		{"String_c_str", Polycore_String_c_str},
-		{"String_wc_str", Polycore_String_wc_str},
-		{"String_data", Polycore_String_data},
 		{"String_getDataWithEncoding", Polycore_String_getDataWithEncoding},
 		{"String_getDataSizeWithEncoding", Polycore_String_getDataSizeWithEncoding},
 		{"String_setDataWithEncoding", Polycore_String_setDataWithEncoding},

+ 7 - 7
Core/Contents/Include/OSBasics.h

@@ -44,7 +44,7 @@ using namespace Polycode;
 class _PolyExport OSFileEntry {
 	public:
 		OSFileEntry() {};
-		OSFileEntry(String path, String name, int type);
+		OSFileEntry(const String& path, const String& name, int type);
 		
 		String name;
 		String extension;
@@ -73,18 +73,18 @@ public:
 class _PolyExport OSBasics {
 	public:
 	
-		static OSFILE *open(String filename, String opts);
+		static OSFILE *open(const String& filename, const String& opts);
 		static int close(OSFILE *file);
 		static size_t read( void * ptr, size_t size, size_t count, OSFILE * stream );	
 		static size_t write( const void * ptr, size_t size, size_t count, OSFILE * stream );
 		static int seek(OSFILE * stream, long int offset, int origin );
 		static long tell(OSFILE * stream);
 	
-		static vector<OSFileEntry> parsePhysFSFolder(String pathString, bool showHidden);
-		static vector<OSFileEntry> parseFolder(String pathString, bool showHidden);
-		static bool isFolder(String pathString);
-		static void createFolder(String pathString);
-		static void removeItem(String pathString);
+		static vector<OSFileEntry> parsePhysFSFolder(const String& pathString, bool showHidden);
+		static vector<OSFileEntry> parseFolder(const String& pathString, bool showHidden);
+		static bool isFolder(const String& pathString);
+		static void createFolder(const String& pathString);
+		static void removeItem(const String& pathString);
 		
 	private:
 	

+ 4 - 4
Core/Contents/Include/PolyBone.h

@@ -42,16 +42,16 @@ namespace Polycode {
 			* Constructor.
 			* @param boneName Name of the bone.
 			*/				
-			Bone(String boneName);
+			Bone(const String& boneName);
 			~Bone();
 			
-			void enableBoneLabel(String labelFont, Number size, Number scale, Color labelColor);
+			void enableBoneLabel(const String& labelFont, Number size, Number scale, Color labelColor);
 			
 			/**
 			* Returns the name of the bone.
 			* @return Name of the bone.
 			*/
-			String getName();
+			const String& getName() const;
 			void Render();
 
 			/**
@@ -163,4 +163,4 @@ namespace Polycode {
 			String boneName;
 	};
 
-}
+}

+ 2 - 2
Core/Contents/Include/PolyCamera.h

@@ -104,7 +104,7 @@ namespace Polycode {
 			* Sets the post-processing shader for the camera.
 			* @param shaderName The shader name of the post-processing filter.
 			*/												
-			void setPostFilter(String shaderName);
+			void setPostFilter(const String& shaderName);
 			
 			/**
 			* Removes the currently assigned post filter.
@@ -138,4 +138,4 @@ namespace Polycode {
 			vector<ShaderBinding*> localShaderOptions;
 			bool _hasFilterShader;
 	};	
-}
+}

+ 6 - 6
Core/Contents/Include/PolyCocoaCore.h

@@ -76,16 +76,16 @@ namespace Polycode {
 		void resizeTo(int xRes, int yRes);
 		void createThread(Threaded *target);		
 		
-		void createFolder(String folderPath);
-		void copyDiskItem(String itemPath, String destItemPath);
-		void moveDiskItem(String itemPath, String destItemPath);		
-		void removeDiskItem(String itemPath);		
+		void createFolder(const String& folderPath);
+		void copyDiskItem(const String& itemPath, const String& destItemPath);
+		void moveDiskItem(const String& itemPath, const String& destItemPath);
+		void removeDiskItem(const String& itemPath);
 		String openFolderPicker();
 		vector<string> openFilePicker(vector<CoreFileExtension> extensions, bool allowMultiple);
 		
 		void setCursor(int cursorType);
 		
-		void copyStringToClipboard(String str);
+		void copyStringToClipboard(const String& str);
 		String getClipboardString();		
 		
 //		static pascal OSStatus coreEventHandler (EventHandlerCallRef next, EventRef event, void *data);	
@@ -113,4 +113,4 @@ namespace Polycode {
 		uint64_t initTime;		
 				
 	};
-}
+}

+ 8 - 8
Core/Contents/Include/PolyConfig.h

@@ -57,16 +57,16 @@ namespace Polycode {
 		* @param configNamespace Namespace of the config to load data into.
 		* @param fileName Path to the file to load.
 		*/
-		void loadConfig(String configNamespace, String fileName);	
+		void loadConfig(const String& configNamespace, const String& fileName);
 		
 		/**
 		* Save config to a specified file from the specified namespace.
 		* @param configNamespace Namespace of the config to save data from.
 		* @param fileName Path to the file to save data to.
 		*/		
-		void saveConfig(String configNamespace, String fileName);
+		void saveConfig(const String& configNamespace, const String& fileName);
 
-		ConfigEntry *getEntry(String configNamespace, String key);
+		ConfigEntry *getEntry(const String& configNamespace, const String& key);
 
 		/**
 		* Sets a string value into the specified config namespace.
@@ -74,7 +74,7 @@ namespace Polycode {
 		* @param key String key of the value.
 		* @param value The string value to save.
 		*/
-		void setStringValue(String configNamespace, String key, String value);
+		void setStringValue(const String& configNamespace, const String& key, const String& value);
 		
 		/**
 		* Sets a numeric value into the specified config namespace.
@@ -82,25 +82,25 @@ namespace Polycode {
 		* @param key String key of the value.
 		* @param value The numeric value to save.
 		*/		
-		void setNumericValue(String configNamespace, String key, Number value);		
+		void setNumericValue(const String& configNamespace, const String& key, Number value);
 		
 		/**
 		* Returns a numeric value by a string key.
 		* @param configNamespace Namespace to get the value from.
 		* @param key String key of the value.
 		*/				
-		Number getNumericValue(String configNamespace, String key);
+		Number getNumericValue(const String& configNamespace, const String& key);
 		
 		/**
 		* Returns a string value by a string key.
 		* @param configNamespace Namespace to get the value from.
 		* @param key String key of the value.
 		*/						
-		String getStringValue(String configNamespace, String key);
+		const String& getStringValue(const String& configNamespace, const String& key);
 		
 	private:
 		
 		vector<ConfigEntry*> entries;
 		
 	};
-}
+}

+ 6 - 6
Core/Contents/Include/PolyCore.h

@@ -130,7 +130,7 @@ namespace Polycode {
 		* Copies the specified string to system clipboard.
 		* @param str String to copy to clipboard.
 		*/
-		virtual void copyStringToClipboard(String str) = 0;
+		virtual void copyStringToClipboard(const String& str) = 0;
 		
 		/**
 		* Returns the system clipboard as a string.
@@ -200,27 +200,27 @@ namespace Polycode {
 		* Creates a folder on disk with the specified path.
 		* @param folderPath Path to create the folder in.
 		*/																			
-		virtual void createFolder(String folderPath) = 0;
+		virtual void createFolder(const String& folderPath) = 0;
 		
 		/**
 		* Copies a disk item from one path to another
 		* @param itemPath Path to the item to copy.
 		* @param destItemPath Destination path to copy to.
 		*/																					
-		virtual void copyDiskItem(String itemPath, String destItemPath) = 0;		
+		virtual void copyDiskItem(const String& itemPath, const String& destItemPath) = 0;
 		
 		/**
 		* Moves a disk item from one path to another
 		* @param itemPath Path to the item to move.
 		* @param destItemPath Destination path to move to.
 		*/																							
-		virtual void moveDiskItem(String itemPath, String destItemPath) = 0;		
+		virtual void moveDiskItem(const String& itemPath, const String& destItemPath) = 0;
 		
 		/**
 		* Removes a disk item.
 		* @param itemPath Path to the item to remove.
 		*/																							
-		virtual void removeDiskItem(String itemPath) = 0;
+		virtual void removeDiskItem(const String& itemPath) = 0;
 
 		/**
 		* Opens a system folder picker and suspends operation.
@@ -314,4 +314,4 @@ namespace Polycode {
 		CoreServices *services;
 	};
 	
-}
+}

+ 6 - 6
Core/Contents/Include/PolyData.h

@@ -41,34 +41,34 @@ namespace Polycode {
 		* Loads data from a file.
 		* @param fileName Path to the file to load data from.
 		*/						
-		void loadFromFile(String fileName);
+		void loadFromFile(const String& fileName);
 		
 		/**
 		* Retuns data as a string with the specified encoding.
 		* @param encoding The encoding to use. Currently only supports String::ENCODING_UTF8
 		* @return String of the specified encoding.
 		*/						
-		String getAsString(int encoding);
+		String getAsString(int encoding) const;
 
 		/**
 		* Sets the data from a string with the specified encoding.
 		* @param str The string to create the data from.
 		* @param encoding The encoding to use. Currently only supports String::ENCODING_UTF8
 		*/								
-		void setFromString(String str, int encoding);
+		void setFromString(const String& str, int encoding);
 		
 		/**
 		* Saves the data to a file.
 		* @param fileName Path to the file to save data to.
 		* @return Returns true if successful or false if otherwise.
 		*/								
-		bool saveToFile(String fileName);
+		bool saveToFile(const String& fileName) const;
 		
 		/**
 		* Returns pointer to the data.
 		* @return Pointer to the data buffer.
 		*/										
-		char *getData() { return data; }
+		char *getData() const { return data; }
 				
 		protected:
 
@@ -77,4 +77,4 @@ namespace Polycode {
 		
 	};
 
-}
+}

+ 4 - 4
Core/Contents/Include/PolyFixedShader.h

@@ -45,9 +45,9 @@ namespace Polycode {
 			FixedShaderBinding(FixedShader *shader);
 			~FixedShaderBinding();
 			
-			void addTexture(String name, Texture *texture); 
-			void addCubemap(String name, Cubemap *cubemap);		
-			void addParam(String type, String name, String value);
+			void addTexture(const String& name, Texture *texture);
+			void addCubemap(const String& name, Cubemap *cubemap);
+			void addParam(const String& type, const String& name, const String& value);
 			
 			Texture *getDiffuseTexture();
 			
@@ -58,4 +58,4 @@ namespace Polycode {
 			FixedShader *fixedShader;
 	};
 
-}
+}

+ 3 - 3
Core/Contents/Include/PolyFont.h

@@ -35,11 +35,11 @@ namespace Polycode {
 	
 	class _PolyExport Font {
 		public:
-			Font(String fileName);
+			Font(const String& fileName);
 			~Font();
 			
 			FT_Face getFace();
-			bool isValid();
+			bool isValid() const;
 			
 			bool loaded;
 		protected:
@@ -47,4 +47,4 @@ namespace Polycode {
 			bool valid;
 			FT_Face ftFace;
 	};
-}
+}

+ 3 - 3
Core/Contents/Include/PolyFontManager.h

@@ -52,14 +52,14 @@ namespace Polycode {
 		* @param fontName Name to register the font as.
 		* @param fontPath Filename of the font to load.
 		*/
-		void registerFont(String fontName, String fontPath);		
+		void registerFont(const String& fontName, const String& fontPath);
 		
 		/**
 		* Retuns a font based on the registerd font name.
 		* @param fontName Name of registered font name.
 		* @return The font instance associated with the font name or NULL if one doesn't exist.
 		*/		
-		Font *getFontByName(String fontName);		
+		Font *getFontByName(const String& fontName);
 		
 	private:
 		
@@ -67,4 +67,4 @@ namespace Polycode {
 		
 	};
 	
-}
+}

+ 2 - 2
Core/Contents/Include/PolyGLSLProgram.h

@@ -57,7 +57,7 @@ class _PolyExport GLSLProgramParam {
 	void *defaultData;
 	int paramType;
 	
-	static void *createParamData(int *retType, String type, String value);
+	static void *createParamData(int *retType, const String& type, const String& value);
 	
 	static const int POLY_MODELVIEWPROJ_MATRIX = 0;
 	static const int POLY_MODELVIEW_MATRIX = 2;
@@ -113,7 +113,7 @@ class _PolyExport GLSLProgramParam {
 			GLSLProgram(int type);
 			~GLSLProgram();
 			
-			void addParam(String name, bool isAuto, int autoID, int paramType, void *defaultData);
+			void addParam(const String& name, bool isAuto, int autoID, int paramType, void *defaultData);
 		
 			unsigned int program;
 //			GLSLparameter modelViewProjection;

+ 4 - 4
Core/Contents/Include/PolyGLSLShader.h

@@ -80,10 +80,10 @@ namespace Polycode {
 			GLSLShaderBinding(GLSLShader *shader);
 			virtual ~GLSLShaderBinding();
 			
-			void addTexture(String name, Texture *texture); 
-			void addCubemap(String name, Cubemap *cubemap);				
-			void clearTexture(String name);			
-			void addParam(String type, String name, String value);
+			void addTexture(const String& name, Texture *texture);
+			void addCubemap(const String& name, Cubemap *cubemap);
+			void clearTexture(const String& name);
+			void addParam(const String& type, const String& name, const String& value);
 			
 			vector<GLSLTextureBinding> textures;
 			vector<GLSLCubemapBinding> cubemaps;		

+ 4 - 4
Core/Contents/Include/PolyGLSLShaderModule.h

@@ -51,8 +51,8 @@ namespace Polycode {
 			GLSLShaderModule();
 			virtual ~GLSLShaderModule();
 		
-			bool acceptsExtension(String extension);
-			Resource* createProgramFromFile(String extension, String fullPath);	
+			bool acceptsExtension(const String& extension);
+			Resource* createProgramFromFile(const String& extension, const String& fullPath);
 			void reloadPrograms();
 			String getShaderType();
 			Shader *createShader(TiXmlNode *node);
@@ -62,8 +62,8 @@ namespace Polycode {
 	protected:
 
 		void addParamToProgram(GLSLProgram *program,TiXmlNode *node);		
-		void recreateGLSLProgram(GLSLProgram *prog, String fileName, int type);
-		GLSLProgram *createGLSLProgram(String fileName, int type);		
+		void recreateGLSLProgram(GLSLProgram *prog, const String& fileName, int type);
+		GLSLProgram *createGLSLProgram(const String& fileName, int type);
 		void updateGLSLParam(Renderer *renderer, GLSLShader *glslShader, GLSLProgramParam &param, ShaderBinding *materialOptions, ShaderBinding *localOptions);		
 			
 		void setGLSLAreaLightPositionParameter(Renderer *renderer, GLSLProgramParam &param, int lightIndex);

+ 10 - 10
Core/Contents/Include/PolyImage.h

@@ -43,7 +43,7 @@ namespace Polycode {
 			* Create image from file name.
 			* @param fileName Path to image file to load.
 			*/ 
-			Image(String fileName);
+			Image(const String& fileName);
 			
 			/**
 			* Create a blank image of specified size and type.
@@ -75,8 +75,8 @@ namespace Polycode {
 			* @param fileName Path to image file to load.
 			* @return True if successfully loaded, false otherwise.
 			*/ 			
-			bool loadImage(String fileName);
-			bool loadPNG(String fileName);		
+			bool loadImage(const String& fileName);
+			bool loadPNG(const String& fileName);
 			
 			/**
 			* Recreate the image as an empty image of specified size. The image type stays the same.
@@ -188,28 +188,28 @@ namespace Polycode {
 			/**
 			* Returns the x position of the brush.
 			*/
-			int getBrushX();
+			int getBrushX() const;
 			
 			/**
 			* Returns the y position of the brush.
 			*/			
-			int getBrushY();
+			int getBrushY() const;
 		
-			bool isLoaded();
+			bool isLoaded() const;
 		
-			int getType() { return imageType; }
+			int getType() const { return imageType; }
 			
-			void writeBMP(String fileName);
+			void writeBMP(const String& fileName) const;
 			
 			/**
 			* Returns the width of the image.
 			*/			
-			unsigned int getWidth();
+			unsigned int getWidth() const;
 			
 			/**
 			* Returns the height of the image.
 			*/						
-			unsigned int getHeight();
+			unsigned int getHeight() const;
 			
 			/**
 			* Returns the raw image data

+ 9 - 9
Core/Contents/Include/PolyLabel.h

@@ -38,17 +38,17 @@ namespace Polycode {
 	class _PolyExport Label : public Image {
 		public:
 			
-			Label(Font *font, String text, int size, int antiAliasMode);
+			Label(Font *font, const String& text, int size, int antiAliasMode);
 			~Label();
-			void setText(String text);
-			String getText();
-			int getTextWidth(Font *font, String text, int size);
-			int getTextHeight(Font *font, String text, int size);
+			void setText(const String& text);
+			const String& getText() const;
+			int getTextWidth(Font *font, const String& text, int size) const;
+			int getTextHeight(Font *font, const String& text, int size) const;
 					
-			Number getTextWidth();		
-			Number getTextHeight();
+			Number getTextWidth() const;
+			Number getTextHeight() const;
 		
-			Font *getFont();
+			Font *getFont() const;
 					
 			static const int ANTIALIAS_FULL = 0;
 			static const int ANTIALIAS_NONE = 1;
@@ -63,4 +63,4 @@ namespace Polycode {
 			Font *font;
 	};
 
-}
+}

+ 7 - 7
Core/Contents/Include/PolyMaterial.h

@@ -37,20 +37,20 @@ namespace Polycode {
 	
 	class _PolyExport Material : public Resource {
 		public:
-			Material(String name);
+			Material(const String& name);
 			virtual ~Material();
 			
 			void addShader(Shader *shader,ShaderBinding *shaderBinding);
-			unsigned int getNumShaders();
+			unsigned int getNumShaders() const;
 			
 			void addShaderRenderTarget(ShaderRenderTarget *newTarget);
 			int getNumShaderRenderTargets();
 			ShaderRenderTarget *getShaderRenderTarget(unsigned int index);
 				
-			String getName();
-			Shader *getShader(unsigned int index);
-			ShaderBinding *getShaderBinding(unsigned int index);
-			void loadMaterial(String fileName);
+			const String& getName() const;
+			Shader *getShader(unsigned int index) const;
+			ShaderBinding *getShaderBinding(unsigned int index) const;
+			void loadMaterial(const String& fileName);
 			
 			Number specularValue;
 			Color specularColor;
@@ -65,4 +65,4 @@ namespace Polycode {
 			String name;
 		
 	};
-}
+}

+ 2 - 2
Core/Contents/Include/PolyMaterialManager.h

@@ -69,7 +69,7 @@ namespace Polycode {
 			void addShaderModule(PolycodeShaderModule *module);		
 		
 			//SceneRenderTexture *createRenderTexture(Scene *targetScene, Camera *targetCamera, int renderWidth,int renderHeight);
-			Texture *getTextureByResourcePath(String resourcePath);
+			Texture *getTextureByResourcePath(const String& resourcePath) const;
 			
 			// cubemaps
 		
@@ -87,4 +87,4 @@ namespace Polycode {
 		
 			vector <PolycodeShaderModule*> shaderModules;
 	};
-};
+};

+ 5 - 5
Core/Contents/Include/PolyMesh.h

@@ -45,7 +45,7 @@ namespace Polycode {
 			VertexBuffer(){}
 			virtual ~VertexBuffer(){}
 		
-			int getVertexCount() { return vertexCount;}
+			int getVertexCount() const { return vertexCount;}
 		
 			int verticesPerFace;
 			int meshType;
@@ -123,7 +123,7 @@ namespace Polycode {
 			* Construct from a mesh loaded from a file.
 			* @param fileName Path to mesh file.
 			*/
-			Mesh(String fileName);
+			Mesh(const String& fileName);
 
 			~Mesh();
 			
@@ -137,13 +137,13 @@ namespace Polycode {
 			* Loads a mesh from a file.
 			* @param fileName Path to mesh file.
 			*/			
-			void loadMesh(String fileName);
+			void loadMesh(const String& fileName);
 
 			/**
 			* Saves mesh to a file.
 			* @param fileName Path to file to save to.
 			*/			
-			void saveToFile(String fileName);
+			void saveToFile(const String& fileName);
 
 			void loadFromFile(OSFILE *inFile);
 			void saveToFile(OSFILE *outFile);
@@ -337,4 +337,4 @@ namespace Polycode {
 		int meshType;
 		vector <Polygon*> polygons;
 	};
-}
+}

+ 3 - 3
Core/Contents/Include/PolyModule.h

@@ -36,8 +36,8 @@ namespace Polycode {
 		PolycodeShaderModule();
 		virtual ~PolycodeShaderModule();
 		
-		virtual bool acceptsExtension(String extension) = 0;
-		virtual Resource* createProgramFromFile(String extension, String fullPath) = 0;
+		virtual bool acceptsExtension(const String& extension) = 0;
+		virtual Resource* createProgramFromFile(const String& extension, const String& fullPath) = 0;
 		virtual String getShaderType() = 0;
 		virtual Shader *createShader(TiXmlNode *node) = 0;
 	
@@ -49,4 +49,4 @@ namespace Polycode {
 		vector<Shader*> shaders;
 	};
 	
-}
+}

+ 9 - 9
Core/Contents/Include/PolyObject.h

@@ -78,7 +78,7 @@ namespace Polycode {
 		* @param name Lookup key for the object entry.
 		* @return The added object entry.
 		*/				
-		ObjectEntry *addChild(String name) {
+		ObjectEntry *addChild(const String& name) {
 			ObjectEntry *entry = new ObjectEntry();
 			entry->type = ObjectEntry::CONTAINER_ENTRY;			
 			entry->name = name;
@@ -93,7 +93,7 @@ namespace Polycode {
 		* @param val Number to set as value in the object entry.
 		* @return The added object entry.
 		*/						
-		ObjectEntry *addChild(String name, Number val) {
+		ObjectEntry *addChild(const String& name, Number val) {
 			ObjectEntry *entry = new ObjectEntry();
 			entry->type = ObjectEntry::FLOAT_ENTRY;			
 			entry->NumberVal = val;
@@ -110,7 +110,7 @@ namespace Polycode {
 		* @return The added object entry.
 		*/						
 
-		ObjectEntry *addChild(String name, int val) {
+		ObjectEntry *addChild(const String& name, int val) {
 			ObjectEntry *entry = new ObjectEntry();
 			entry->type = ObjectEntry::INT_ENTRY;
 			entry->intVal = val;
@@ -126,7 +126,7 @@ namespace Polycode {
 		* @param val String to set as value in the object entry.
 		* @return The added object entry.
 		*/						
-		ObjectEntry *addChild(String name, String val) {
+		ObjectEntry *addChild(const String& name, const String& val) {
 			ObjectEntry *entry = new ObjectEntry();
 			entry->type = ObjectEntry::STRING_ENTRY;
 			entry->stringVal = val;
@@ -143,7 +143,7 @@ namespace Polycode {
 		* @param val Boolean to set as value in the object entry.
 		* @return The added object entry.
 		*/								
-		ObjectEntry *addChild(String name, bool val) {
+		ObjectEntry *addChild(const String& name, bool val) {
 			ObjectEntry *entry = new ObjectEntry();
 			entry->type = ObjectEntry::BOOL_ENTRY;			
 			entry->boolVal = val;
@@ -179,7 +179,7 @@ namespace Polycode {
 		* @param key Lookup key to return value for.
 		* @return Object entry corresponding to the string value or NULL if one doesn't exist.
 		*/
-		inline ObjectEntry *operator [] ( String key) { for(int i=0; i < children.size(); i++) { if(children[i]->name == key) { return children[i]; } } return NULL; }		
+		inline ObjectEntry *operator [] ( const String& key) { for(int i=0; i < children.size(); i++) { if(children[i]->name == key) { return children[i]; } } return NULL; }
 		
 		vector<ObjectEntry*> children;		
 	};
@@ -201,13 +201,13 @@ namespace Polycode {
 		* @param fileName Path to the XML file to load.
 		* @return Returns true is succesful, false if otherwise.
 		*/		
-		bool loadFromXML(String fileName);
+		bool loadFromXML(const String& fileName);
 		
 		/**
 		* Saves the object to an XML file.
 		* @param fileName Path to the XML file to save to.
 		*/				
-		void saveToXML(String fileName);
+		void saveToXML(const String& fileName);
 		
 		void createFromXMLElement(TiXmlElement *element, ObjectEntry *entry);
 		TiXmlElement *createElementFromObjectEntry(ObjectEntry *entry);
@@ -219,4 +219,4 @@ namespace Polycode {
 		
 	};
 	
-}
+}

+ 4 - 4
Core/Contents/Include/PolyParticleEmitter.h

@@ -39,7 +39,7 @@ namespace Polycode {
 	*/
 	class _PolyExport ParticleEmitter {
 		public:
-			ParticleEmitter(String imageFile, Mesh *particleMesh, int particleType, int emitterType, Number lifespan, unsigned int numParticles, Vector3 direction, Vector3 gravity, Vector3 deviation);
+			ParticleEmitter(const String& imageFile, Mesh *particleMesh, int particleType, int emitterType, Number lifespan, unsigned int numParticles, Vector3 direction, Vector3 gravity, Vector3 deviation);
 			virtual ~ParticleEmitter();
 		
 			void createParticles();
@@ -246,7 +246,7 @@ namespace Polycode {
 		* @param particleMesh If particle type is Particle::MESH_PARTICLE, this must be set to the mesh to use for each particle
 		* @param emitter If this is specified, particles will be emitted from this meshe's vertices.
 		*/
-		SceneParticleEmitter(String materialName, Scene *particleParentScene, int particleType, int emitterType, Number lifespan, unsigned int numParticles, Vector3 direction, Vector3 gravity, Vector3 deviation, Mesh *particleMesh = NULL, SceneMesh *emitter = NULL);
+		SceneParticleEmitter(const String& materialName, Scene *particleParentScene, int particleType, int emitterType, Number lifespan, unsigned int numParticles, Vector3 direction, Vector3 gravity, Vector3 deviation, Mesh *particleMesh = NULL, SceneMesh *emitter = NULL);
 		~SceneParticleEmitter();		
 		
 		/**
@@ -268,7 +268,7 @@ namespace Polycode {
 	*/
 	class _PolyExport ScreenParticleEmitter : public ScreenEntity, public ParticleEmitter {
 	public:
-		ScreenParticleEmitter(String imageFile, Screen *particleParentScreen, int particleType, int emitterType, Number lifespan, unsigned int numParticles, Vector3 direction, Vector3 gravity, Vector3 deviation, Mesh *particleMesh = NULL, ScreenMesh *emitter = NULL);
+		ScreenParticleEmitter(const String& imageFile, Screen *particleParentScreen, int particleType, int emitterType, Number lifespan, unsigned int numParticles, Vector3 direction, Vector3 gravity, Vector3 deviation, Mesh *particleMesh = NULL, ScreenMesh *emitter = NULL);
 		~ScreenParticleEmitter();		
 		
 		/**
@@ -284,4 +284,4 @@ namespace Polycode {
 		ScreenMesh *emitterMesh;		
 		Screen *particleParentScreen;
 	};		
-}
+}

+ 6 - 6
Core/Contents/Include/PolyResource.h

@@ -48,11 +48,11 @@ namespace Polycode {
 			virtual ~Resource();
 			
 			
-			String getResourceName();
-			int getResourceType();
-			void setResourceName(String newName);
-			void setResourcePath(String path);
-			String getResourcePath();		
+			const String& getResourceName() const;
+			int getResourceType() const;
+			void setResourceName(const String& newName);
+			void setResourcePath(const String& path);
+			const String& getResourcePath() const;
 
 			static const int RESOURCE_TEXTURE = 0;
 			static const int RESOURCE_MATERIAL = 1;
@@ -71,4 +71,4 @@ namespace Polycode {
 	
 					
 	};
-}
+}

+ 11 - 11
Core/Contents/Include/PolyResourceManager.h

@@ -59,28 +59,28 @@ namespace Polycode {
 			* @param dirPath Path to directory to load resources from.
 			* @param recursive If true, will recurse into subdirectories.
 			*/
-			void addDirResource(String dirPath, bool recursive=true);
+			void addDirResource(const String& dirPath, bool recursive=true);
 			
 			/**
 			* Adds a zip as a readable source. This doesn't actually load resources from it, just mounts it as a readable source, so you can call addDirResource on the folders inside of it like you would on regular folders. Most other disk IO in the engine (loading images, etc.) will actually check mounted archive files as well.
 			*/
-			void addArchive(String zipPath);
+			void addArchive(const String& zipPath);
 		
-			bool readFile(String fileName){ return false;}
+			bool readFile(const String& fileName) { return false;}
 		
-			void parseTextures(String dirPath, bool recursive);
-			void parseMaterials(String dirPath, bool recursive);
-			void parseShaders(String dirPath, bool recursive);
-			void parsePrograms(String dirPath, bool recursive);
-			void parseCubemaps(String dirPath, bool recursive);
-			void parseOthers(String dirPath, bool recursive);	
+			void parseTextures(const String& dirPath, bool recursive);
+			void parseMaterials(const String& dirPath, bool recursive);
+			void parseShaders(const String& dirPath, bool recursive);
+			void parsePrograms(const String& dirPath, bool recursive);
+			void parseCubemaps(const String& dirPath, bool recursive);
+			void parseOthers(const String& dirPath, bool recursive);
 		
 			/**
 			* Request a loaded resource. You need to manually cast it to its subclass based on its type.
 			* @param resourceType Type of resource. See Resource for available resource types.
 			* @param resourceName Name of the resource to request.
 			*/
-			Resource *getResource(int resourceType, String resourceName);
+			Resource *getResource(int resourceType, const String& resourceName) const;
 		
 			void addShaderModule(PolycodeShaderModule *module);
 		
@@ -89,4 +89,4 @@ namespace Polycode {
 			vector <Resource*> resources;
 			vector <PolycodeShaderModule*> shaderModules;
 	};
-}
+}

+ 5 - 5
Core/Contents/Include/PolySDLCore.h

@@ -58,12 +58,12 @@ namespace Polycode {
 		void lockMutex(CoreMutex *mutex);
 		void unlockMutex(CoreMutex *mutex);
 		CoreMutex *createMutex();
-		void copyStringToClipboard(String str);
+		void copyStringToClipboard(const String& str);
 		String getClipboardString();
-		void createFolder(String folderPath);
-		void copyDiskItem(String itemPath, String destItemPath);		
-		void moveDiskItem(String itemPath, String destItemPath);		
-		void removeDiskItem(String itemPath);
+		void createFolder(const String& folderPath);
+		void copyDiskItem(const String& itemPath, const String& destItemPath);
+		void moveDiskItem(const String& itemPath, const String& destItemPath);
+		void removeDiskItem(const String& itemPath);
 		String openFolderPicker();
 		vector<string> openFilePicker(vector<CoreFileExtension> extensions, bool allowMultiple);
 		void resizeTo(int xRes, int yRes);

+ 6 - 6
Core/Contents/Include/PolyScene.h

@@ -117,7 +117,7 @@ namespace Polycode {
 		void RenderDepthOnly(Camera *targetCamera);
 		
 		static String readString(OSFILE *inFile);
-		void loadScene(String fileName);
+		void loadScene(const String& fileName);
 		void generateLightmaps(Number lightMapRes, Number lightMapQuality, int numRadPasses);
 		
 		/**
@@ -128,8 +128,8 @@ namespace Polycode {
 		SceneLight *getNearestLight(Vector3 pos);
 		
 		void writeEntityMatrix(SceneEntity *entity, OSFILE *outFile);
-		void writeString(String str, OSFILE *outFile);
-		void saveScene(String fileName);
+		void writeString(const String& str, OSFILE *outFile);
+		void saveScene(const String& fileName);
 		
 		int getNumStaticGeometry();
 		SceneMesh *getStaticGeometry(int index);
@@ -139,8 +139,8 @@ namespace Polycode {
 		int getNumLights();
 		SceneLight *getLight(int index);
 		
-		SceneEntity *getCustomEntityByType(String type);
-		vector<SceneEntity*> getCustomEntitiesByType(String type);		
+		SceneEntity *getCustomEntityByType(const String& type) const;
+		vector<SceneEntity*> getCustomEntitiesByType(const String& type) const;
 		
 		static const unsigned int ENTITY_MESH = 0;
 		static const unsigned int ENTITY_LIGHT = 1;			
@@ -196,4 +196,4 @@ namespace Polycode {
 		Number fogEndDepth;
 		
 	};
-}
+}

+ 3 - 3
Core/Contents/Include/PolySceneLabel.h

@@ -50,7 +50,7 @@ namespace Polycode {
 			* @param scale Scale to multiply pixel size by for the actual world size of the label.
 			* @param Anti-aliasing mode. Can be Label::ANTIALIAS_FULL or Label::ANTIALIAS_NONE.
 			*/			
-			SceneLabel(String fontName, String text, int size, Number scale, int amode);
+			SceneLabel(const String& fontName, const String& text, int size, Number scale, int amode);
 			~SceneLabel();			
 		
 			bool testMouseCollision(Number x, Number y);
@@ -59,7 +59,7 @@ namespace Polycode {
 			* Sets new text for the labe.
 			* @param newText New text to display.
 			*/ 
-			void setText(String newText);
+			void setText(const String& newText);
 			
 			Label *getLabel();
 			void Render();
@@ -72,4 +72,4 @@ namespace Polycode {
 			Number scale;
 			Label *label;
 	};
-}
+}

+ 5 - 5
Core/Contents/Include/PolySceneMesh.h

@@ -48,7 +48,7 @@ namespace Polycode {
 			* Construct a scene mesh from a mesh file.
 			* @param fileName Path to mesh file to load.
 			*/
-			SceneMesh(String fileName);
+			SceneMesh(const String& fileName);
 			
 			/**
 			* Construct an empty scene mesh with the specified type.
@@ -86,13 +86,13 @@ namespace Polycode {
 			* @param fileName Filename to load the mesh from.
 			* @param clamp If true, clamps the texture to edges. See Texture for details on that.
 			*/
-			void loadTexture(String fileName, bool clamp=true);
+			void loadTexture(const String& fileName, bool clamp=true);
 			
 			/**
 			* Loads a skeleton from a file and applies it to the scene mesh.
 			* @param fileName Filename to load the skeleton from.
 			*/
-			void loadSkeleton(String fileName);
+			void loadSkeleton(const String& fileName);
 			
 			/**
 			* Sets the texture from an existing Texture instance.
@@ -110,7 +110,7 @@ namespace Polycode {
 			* 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(String materialName);
+			void setMaterialByName(const String& materialName);
 			
 			/**
 			* Set the mesh this scene mesh renders.
@@ -150,4 +150,4 @@ namespace Polycode {
 			Skeleton *skeleton;
 			ShaderBinding *localShaderOptions;
 	};
-}
+}

+ 1 - 1
Core/Contents/Include/PolySceneSound.h

@@ -44,7 +44,7 @@ namespace Polycode {
 	*/	
 	class _PolyExport SceneSound : public SceneEntity {
 		public:
-			SceneSound(String fileName, Number referenceDistance, Number maxDistance);
+			SceneSound(const String& fileName, Number referenceDistance, Number maxDistance);
 			virtual ~SceneSound();			
 			void Update();
 			

+ 2 - 2
Core/Contents/Include/PolyScreen.h

@@ -97,7 +97,7 @@ namespace Polycode {
 		* Sets the shader material to use for post processing on this screen.
 		* @param shaderName Name of the shader material to use.
 		*/				
-		void setScreenShader(String shaderName);
+		void setScreenShader(const String& shaderName);
 		
 		/**
 		* Removes the current screen shader for this screen.
@@ -164,4 +164,4 @@ namespace Polycode {
 		vector<ShaderBinding*> localShaderOptions;
 		bool _hasFilterShader;
 	};
-}
+}

+ 4 - 4
Core/Contents/Include/PolyScreenImage.h

@@ -45,7 +45,7 @@ namespace Polycode {
 		* Create screen image from file.
 		* @param fileName 
 		*/
-		ScreenImage(String fileName);
+		ScreenImage(const String& fileName);
 		
 		/**
 		* Create screen image from Image.
@@ -66,12 +66,12 @@ namespace Polycode {
 		/**
 		* Returns the image width.
 		*/ 
-		Number getImageWidth();
+		Number getImageWidth() const;
 		
 		/**
 		* Returns the image height.
 		*/ 		
-		Number getImageHeight();
+		Number getImageHeight() const;
 		
 		protected:
 
@@ -80,4 +80,4 @@ namespace Polycode {
 		
 	};
 
-}
+}

+ 5 - 5
Core/Contents/Include/PolyScreenLabel.h

@@ -51,7 +51,7 @@ namespace Polycode {
 			* @param size Size in pixels.
 			* @param Anti-aliasing mode.
 			*/
-			ScreenLabel(String text, int size, String fontName = "sans", int amode = 0);
+			ScreenLabel(const String& text, int size, const String& fontName = "sans", int amode = 0);
 			~ScreenLabel();		
 		
 			/**
@@ -67,19 +67,19 @@ namespace Polycode {
 			* Sets a new text to the screen label.
 			* @param newText Text to set.
 			*/
-			void setText(String newText);
+			void setText(const String& newText);
 			
 			/**
 			* Returns the label's text as a string.
 			* @return The label's text.
 			*/
-			String getText();
+			const String& getText() const;
 		
-			Label *getLabel();
+			Label *getLabel() const;
 			
 		protected:
 			
 			Label *label;
 			ScreenImage *dropShadowImage;
 	};
-}
+}

+ 5 - 5
Core/Contents/Include/PolyScreenMesh.h

@@ -43,7 +43,7 @@ namespace Polycode {
 			/**
 			* Creates the screen mesh and loads a mesh from a file name.
 			*/
-			ScreenMesh(String fileName);
+			ScreenMesh(const String& fileName);
 			
 			/**
 			* Create an empty screen mesh of specified type. See Mesh for available mesh types.
@@ -57,18 +57,18 @@ namespace Polycode {
 			* Returns the mesh for this screen mesh.
 			* @return The mesh.
 			*/
-			Mesh *getMesh();
+			Mesh *getMesh() const;
 			
 			/**
 			* Returns the texture associated with the mesh.
 			*/
-			Texture *getTexture();
+			Texture *getTexture() const;
 			
 			/**
 			* Loads a texture from an image file.
 			* @param fileName Path to the image file.
 			*/
-			void loadTexture(String fileName);
+			void loadTexture(const String& fileName);
 			
 			/**
 			* Loads a texture from an image instance.
@@ -87,4 +87,4 @@ namespace Polycode {
 			Mesh *mesh;
 			Texture *texture;
 	};
-}
+}

+ 2 - 2
Core/Contents/Include/PolyScreenSound.h

@@ -43,14 +43,14 @@ namespace Polycode {
 	*/	
 	class _PolyExport ScreenSound : public ScreenEntity {
 		public:
-			ScreenSound(String fileName, Number referenceDistance, Number maxDistance);
+			ScreenSound(const String& fileName, Number referenceDistance, Number maxDistance);
 			virtual ~ScreenSound();			
 			void Update();
 			
 			/**
 			* Returns the sound object associated with this positional sound.
 			*/			
-			Sound *getSound();
+			Sound *getSound() const;
 			
 		protected:
 			Sound *sound;

+ 3 - 3
Core/Contents/Include/PolyScreenSprite.h

@@ -51,7 +51,7 @@ class _PolyExport ScreenSprite : public ScreenShape
 		* @param spriteWidth Pixel width of each sprite cell.
 		* @param spriteWidth Pixel height of each sprite cell.		
 		*/
-		ScreenSprite(String fileName, Number spriteWidth, Number spriteHeight);
+		ScreenSprite(const String& fileName, Number spriteWidth, Number spriteHeight);
 		~ScreenSprite();
 		
 		/**
@@ -60,7 +60,7 @@ class _PolyExport ScreenSprite : public ScreenShape
 		* @param frames A comma separated list of frames indexes to include in the animation.
 		* @speed Speed at which to play back the animation.
 		*/
-		void addAnimation(String name, String frames, Number speed);
+		void addAnimation(const String& name, const String& frames, Number speed);
 		
 		/**
 		* Play back a previously created animation by name.
@@ -68,7 +68,7 @@ class _PolyExport ScreenSprite : public ScreenShape
 		* @param startFrame Starting frame for playback.
 		* @param once If true, only plays once, otherwise loops.
 		*/
-		void playAnimation(String name, int startFrame, bool once);
+		void playAnimation(const String& name, int startFrame, bool once);
 		void Update();
 		
 	protected:

+ 10 - 10
Core/Contents/Include/PolyShader.h

@@ -35,9 +35,9 @@ namespace Polycode {
 			Shader(int type);
 			virtual ~Shader();
 
-			int getType();
-			void setName(String name);
-			String getName();
+			int getType() const;
+			void setName(const String& name);
+			const String& getName() const;
 			
 			virtual ShaderBinding *createBinding() = 0;
 
@@ -87,14 +87,14 @@ namespace Polycode {
 			ShaderBinding(Shader *shader);
 			virtual ~ShaderBinding();
 			
-			virtual void clearTexture(String name){};
-			virtual void addTexture(String name, Texture *texture)  {};
-			virtual void addParam(String type, String name, String value) {};
-			virtual void addCubemap(String name, Cubemap *cubemap) {};
+			virtual void clearTexture(const String& name){};
+			virtual void addTexture(const String& name, Texture *texture)  {};
+			virtual void addParam(const String& type, const String& name, const String& value) {};
+			virtual void addCubemap(const String& name, Cubemap *cubemap) {};
 		
 			unsigned int getNumLocalParams();
 			LocalShaderParam *getLocalParam(unsigned int index);
-			LocalShaderParam *getLocalParamByName(String name);
+			LocalShaderParam *getLocalParamByName(const String& name);
 			
 			void addRenderTargetBinding(RenderTargetBinding *binding);
 
@@ -107,7 +107,7 @@ namespace Polycode {
 			unsigned int getNumOutTargetBindings();
 			RenderTargetBinding *getOutTargetBinding(unsigned int index);
 			
-			void addLocalParam(String name, void *ptr);
+			void addLocalParam(const String& name, void *ptr);
 			
 			Shader* shader;
 			vector<LocalShaderParam*> localParams;
@@ -116,4 +116,4 @@ namespace Polycode {
 			vector<RenderTargetBinding*> outTargetBindings;
 	};
 
-}
+}

+ 13 - 13
Core/Contents/Include/PolySkeleton.h

@@ -94,7 +94,7 @@ namespace Polycode {
 	class _PolyExport SkeletonAnimation {
 		public:
 		
-			SkeletonAnimation(String name, Number duration);
+			SkeletonAnimation(const String& name, Number duration);
 			~SkeletonAnimation();		
 			
 			/**
@@ -106,7 +106,7 @@ namespace Polycode {
 			/**
 			* Returns the animation name.
 			*/
-			String getName();
+			const String& getName() const;
 			
 			/**
 			* Plays the animation.
@@ -141,14 +141,14 @@ namespace Polycode {
 			* Construct skeleton from a skeleton file.
 			* @param fileName Skeleton file to load.
 			*/
-			Skeleton(String fileName);
+			Skeleton(const String& fileName);
 			Skeleton();
 			
 			/**
 			* Loads a new skeleton from file.
 			* @param fileName Skeleton file to load.
 			*/ 
-			void loadSkeleton(String fileName);
+			void loadSkeleton(const String& fileName);
 			
 			~Skeleton();
 		
@@ -156,7 +156,7 @@ namespace Polycode {
 			* Play back a loaded animation.
 			* @param animName Name of animation to play.
 			*/
-			void playAnimation(String animName);
+			void playAnimation(const String& animName);
 						
 			void playAnimationByIndex(int index);		
 			
@@ -165,20 +165,20 @@ namespace Polycode {
 			* @param name Name of the new animation.
 			* @param fileName File to load animation from.
 			*/			
-			void addAnimation(String name, String fileName);
+			void addAnimation(const String& name, const String& fileName);
 			
 			/**
 			* Returns a SkeletonAnimation by its name.
 			* @param Name of animation to return.
 			*/
-			SkeletonAnimation *getAnimation(String name);
+			SkeletonAnimation *getAnimation(const String& name) const;
 			void Update();
 			
 			/**
 			* Get bone instance by its name
 			* @param name Name of the bone.
 			*/
-			Bone *getBoneByName(String name);
+			Bone *getBoneByName(const String& name) const;
 			
 			/**
 			* Toggles bone visibility on and off.
@@ -193,23 +193,23 @@ namespace Polycode {
 			* @param scale Scale of font.
 			* @param labelColor Color of the label.
 			*/
-			void enableBoneLabels(String labelFont, Number size, Number scale, Color labelColor);
+			void enableBoneLabels(const String& labelFont, Number size, Number scale, Color labelColor);
 					
 			/**
 			* Returns the number of bones in the skeleton
 			*/
-			int getNumBones();
+			int getNumBones() const;
 			
 			/**
 			* Returns a bone at the specified index.
 			* @param index Bone index.
 			*/
-			Bone *getBone(int index);
+			Bone *getBone(int index) const;
 		
 			/**
 			* Returns the current animation.
 			*/
-			SkeletonAnimation *getCurrentAnimation() { return currentAnimation; }
+			SkeletonAnimation *getCurrentAnimation() const { return currentAnimation; }
 		
 		protected:
 		
@@ -220,4 +220,4 @@ namespace Polycode {
 			vector<SkeletonAnimation*> animations;
 	};
 
-}
+}

+ 6 - 6
Core/Contents/Include/PolySound.h

@@ -57,7 +57,7 @@ namespace Polycode {
 		* Constructor.
 		* @param fileName Path to an OGG or WAV file to load.
 		*/ 
-		Sound(String fileName);
+		Sound(const String& fileName);
 		~Sound();
 		
 		/**
@@ -91,15 +91,15 @@ namespace Polycode {
 		
 		void setPositionalProperties(Number referenceDistance, Number maxDistance);
 		
-		ALuint loadWAV(String fileName);
-		ALuint loadOGG(String fileName);
+		ALuint loadWAV(const String& fileName);
+		ALuint loadOGG(const String& fileName);
 		
 		ALuint GenSource(ALuint buffer);
 		ALuint GenSource();
 	
-		void checkALError(String operation);
-		void soundError(String err);
-		void soundCheck(bool result, String err);
+		void checkALError(const String& operation);
+		void soundError(const String& err);
+		void soundCheck(bool result, const String& err);
 		static unsigned long readByte32(const unsigned char buffer[4]);		
 		static unsigned short readByte16(const unsigned char buffer[2]);
 

+ 9 - 31
Core/Contents/Include/PolyString.h

@@ -56,9 +56,9 @@ namespace Polycode {
 			String(const wchar_t *str);
 			
 			/**
-			* Initializes the string from a pointer to wide character buffer of a certain size.
+			* Initializes the string from a pointer to regular character buffer of a certain size.
 			*/						
-			String(const wchar_t *str, size_t n);		
+			String(const char *str, size_t n);
 			
 			/**
 			* Initializes the string from a regular character buffer.
@@ -90,13 +90,8 @@ namespace Polycode {
 			/**
 			* Return the string and an STL string.
 			*/		
-			const string& getSTLString();
-			
-			/**
-			* Return the string and an STL wstring.
-			*/			
-			const wstring& getSTLWString() const;
-		
+			const string& getSTLString() const;
+					
 			/**
 			* Returns the substring of the string.
 			* @param pos Position of a character in the current string object to be used as starting character for the substring.
@@ -175,20 +170,8 @@ namespace Polycode {
 			* Pointer to char data.
 			* @return A pointer to char data.
 			*/																												
-			const char *c_str();
+			const char *c_str() const;
 			
-			/**
-			* Pointer to wchar data.
-			* @return A pointer to wchar data.
-			*/																															
-			const wchar_t *wc_str() const;
-
-			/**
-			* Pointer to wchar data.
-			* @return A pointer to wchar data.
-			*/																																	
-			const wchar_t *data() const { return contents.data(); }
-
 			/**
 			* Returns data with the specified encoding. Currently the only supported encoding is String::ENCODING_UTF8
 			* @param encoding The encoding to use.
@@ -213,16 +196,11 @@ namespace Polycode {
 			*/																																		
 			void setDataWithEncoding(char *data, int encoding);
 			
-			/**
-			* STL wstring version of the string.
-			*/																																					
-			wstring contents;	
-			
 			/**
 			* STL string version of the string.
-			*/																																								
-			string s_contents;
-			
+			*/																																					
+			string contents;
+						
 			/**
 			* UTF-8 encoding.
 			*/																																							
@@ -235,5 +213,5 @@ namespace Polycode {
 
 	static inline String operator+ (const char *str, const String &rstr) { return String(String(str).contents + rstr.contents); }
 	static inline String operator+ (const wchar_t *str, const String &rstr) { return String(String(str).contents + rstr.contents); }	
-	static inline String operator+ (const wchar_t str, const String &rstr) { wstring tmp=L" "; tmp[0] = str; return String(tmp + rstr.contents); }		
+	static inline String operator+ (const wchar_t str, const String &rstr) { wstring tmp=L" "; tmp[0] = str; return tmp.c_str() + rstr; }
 }

+ 8 - 8
Core/Contents/Include/PolyTexture.h

@@ -41,19 +41,19 @@ namespace Polycode {
 
 			virtual void recreateFromImageData() = 0;
 
-			Number getScrollOffsetX();
-			Number getScrollOffsetY();
+			Number getScrollOffsetX() const;
+			Number getScrollOffsetY() const;
 			
 			void setImageData(Image *data);
 		
 			void updateScroll(int elapsed);
-			void setResourcePath(String newPath);
-			String getResourcePath();
+			void setResourcePath(const String& newPath);
+			const String& getResourcePath() const;
 		
-			char *getTextureData() { return textureData;}
+			char *getTextureData() const { return textureData;}
 			
-			int getWidth();
-			int getHeight();
+			int getWidth() const;
+			int getHeight() const;
 		
 			bool clamp;
 		
@@ -69,4 +69,4 @@ namespace Polycode {
 			Number scrollOffsetX;
 			Number scrollOffsetY;
 	};
-}
+}

+ 6 - 6
Core/Contents/Include/PolyWinCore.h

@@ -153,14 +153,14 @@ namespace Polycode {
 		// NEED TO IMPLEMENT:
 
 		void setCursor(int cursorType){ }
-		void copyStringToClipboard(String str) { }
+		void copyStringToClipboard(const String& str) { }
 		String getClipboardString() { return ""; }
 
-		void createFolder(String folderPath) {}
-		void copyDiskItem(String itemPath, String destItemPath) {}
-		void moveDiskItem(String itemPath, String destItemPath) {}
+		void createFolder(const String& folderPath) {}
+		void copyDiskItem(const String& itemPath, const String& destItemPath) {}
+		void moveDiskItem(const String& itemPath, const String& destItemPath) {}
 		String openFolderPicker()  { return "";}
-		void removeDiskItem(String itemPath)  {}
+		void removeDiskItem(const String& itemPath)  {}
 		vector<string> openFilePicker(vector<CoreFileExtension> extensions, bool allowMultiple) { vector<string> ret; return ret;}
 		void resizeTo(int xRes, int yRes) { }
 		
@@ -188,4 +188,4 @@ namespace Polycode {
 		
 
 	};
-}
+}

+ 7 - 7
Core/Contents/Source/OSBasics.cpp

@@ -44,7 +44,7 @@ void ctow(WCHAR* Dest, const char* Source)
 
 #endif
 
-OSFileEntry::OSFileEntry(String path, String name, int type) {
+OSFileEntry::OSFileEntry(const String& path, const String& name, int type) {
 	this->basePath = path;
 	this->fullPath = path + "/" + name;
 	this->name = name;
@@ -73,7 +73,7 @@ void OSFILE::debugDump() {
 	OSBasics::seek(this, tellval, SEEK_SET);
 }
 
-OSFILE *OSBasics::open(String filename, String opts) {
+OSFILE *OSBasics::open(const String& filename, const String& opts) {
 	OSFILE *retFile = NULL;
 	if(PHYSFS_exists(filename.c_str())) {
 		if(!PHYSFS_isDirectory(filename.c_str())) {
@@ -189,7 +189,7 @@ int OSBasics::seek(OSFILE * stream, long int offset, int origin ) {
 	return 0;	
 }
 
-vector<OSFileEntry> OSBasics::parsePhysFSFolder(String pathString, bool showHidden) {
+vector<OSFileEntry> OSBasics::parsePhysFSFolder(const String& pathString, bool showHidden) {
 	vector<OSFileEntry> returnVector;
 	
 	char **rc = PHYSFS_enumerateFiles(pathString.c_str());
@@ -212,7 +212,7 @@ vector<OSFileEntry> OSBasics::parsePhysFSFolder(String pathString, bool showHidd
 	return returnVector;
 }
 
-vector<OSFileEntry> OSBasics::parseFolder(String pathString, bool showHidden) {
+vector<OSFileEntry> OSBasics::parseFolder(const String& pathString, bool showHidden) {
 	vector<OSFileEntry> returnVector;
 	
 	if(pathString.size() < 128) {
@@ -281,21 +281,21 @@ vector<OSFileEntry> OSBasics::parseFolder(String pathString, bool showHidden) {
 	return returnVector;
 }
 
-void OSBasics::removeItem(String pathString) {
+void OSBasics::removeItem(const String& pathString) {
 #ifdef _WINDOWS
 #else
 	remove(pathString.c_str());
 #endif	
 }
 
-void OSBasics::createFolder(String pathString) {
+void OSBasics::createFolder(const String& pathString) {
 #ifdef _WINDOWS
 #else
 	mkdir(pathString.c_str(),  S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
 #endif
 }
 
-bool OSBasics::isFolder(String pathString) {
+bool OSBasics::isFolder(const String& pathString) {
 	bool retVal = false;
 #ifdef _WINDOWS
 #else

+ 3 - 3
Core/Contents/Source/PolyBone.cpp

@@ -24,7 +24,7 @@
 
 using namespace Polycode;
 
-Bone::Bone(String boneName) : SceneEntity() {
+Bone::Bone(const String& boneName) : SceneEntity() {
 	this->boneName = boneName;
 //	boneMesh = new ScenePrimitive(ScenePrimitive::TYPE_BOX, 0.1, 0.1, 0.1);
 	this->depthTest = false;
@@ -126,11 +126,11 @@ void Bone::setRestMatrix(Matrix4 matrix) {
 	restMatrix = matrix;
 }
 
-String Bone::getName() {
+const String& Bone::getName() const {
 	return boneName;
 }
 
-void Bone::enableBoneLabel(String fontLabel, Number size, Number scale, Color labelColor) {
+void Bone::enableBoneLabel(const String& fontLabel, Number size, Number scale, Color labelColor) {
 	SceneLabel *label = new SceneLabel(fontLabel, boneName, size, scale, Label::ANTIALIAS_FULL);
 	label->setColor(labelColor);
 	label->billboardMode = true;

+ 2 - 2
Core/Contents/Source/PolyCamera.cpp

@@ -232,7 +232,7 @@ void Camera::setParentScene(Scene *parentScene) {
 	this->parentScene = parentScene;
 }
 
-void Camera::setPostFilter(String shaderName) {
+void Camera::setPostFilter(const String& shaderName) {
 	Material *shaderMaterial = (Material*) CoreServices::getInstance()->getResourceManager()->getResource(Resource::RESOURCE_MATERIAL, shaderName);
 	if(shaderMaterial)
 		createPostFilter(shaderMaterial);
@@ -331,4 +331,4 @@ void Camera::doCameraTransform() {
 	CoreServices::getInstance()->getRenderer()->setCameraMatrix(camMatrix);	
 	camMatrix = camMatrix.inverse();
 	CoreServices::getInstance()->getRenderer()->multModelviewMatrix(camMatrix);		
-}
+}

+ 7 - 7
Core/Contents/Source/PolyCocoaCore.mm

@@ -148,7 +148,7 @@ CocoaCore::CocoaCore(PolycodeView *view, int xRes, int yRes, bool fullScreen,int
 
 }
 
-void CocoaCore::copyStringToClipboard(String str) {
+void CocoaCore::copyStringToClipboard(const String& str) {
 	NSPasteboard *pb = [NSPasteboard generalPasteboard];
     NSArray *types = [NSArray arrayWithObjects:NSStringPboardType, nil];
     [pb declareTypes:types owner:glView];
@@ -156,7 +156,7 @@ void CocoaCore::copyStringToClipboard(String str) {
 	//NSString *nsstr = [NSString stringWithCharacters: (unichar*) str.c_str() length: str.length()];
 	
 	char* data = (char*)str.data();
-	unsigned size = str.size() * sizeof(wchar_t);
+	unsigned size = str.size() * sizeof(wchar);
 	
 	NSString* nsstr = [[[NSString alloc] initWithBytes:data length:size encoding:NSUTF32LittleEndianStringEncoding] autorelease];
     [pb setString: nsstr forType:NSStringPboardType];	
@@ -344,19 +344,19 @@ void CocoaCore::checkEvents() {
 	unlockMutex(eventMutex);		
 }
 
-void CocoaCore::createFolder(String folderPath) {
+void CocoaCore::createFolder(const String& folderPath) {
 	[[NSFileManager defaultManager] createDirectoryAtPath:[NSString stringWithUTF8String: folderPath.c_str()] withIntermediateDirectories:YES attributes:nil error:nil];
 }
 
-void CocoaCore::copyDiskItem(String itemPath, String destItemPath) {
+void CocoaCore::copyDiskItem(const String& itemPath, const String& destItemPath) {
 	[[NSFileManager defaultManager] copyItemAtPath: [NSString stringWithUTF8String: itemPath.c_str()] toPath: [NSString stringWithUTF8String: destItemPath.c_str()] error: nil];	
 }
 
-void CocoaCore::moveDiskItem(String itemPath, String destItemPath) {
+void CocoaCore::moveDiskItem(const String& itemPath, const String& destItemPath) {
 	[[NSFileManager defaultManager] moveItemAtPath: [NSString stringWithUTF8String: itemPath.c_str()] toPath: [NSString stringWithUTF8String: destItemPath.c_str()] error: nil];		
 }
 
-void CocoaCore::removeDiskItem(String itemPath) {
+void CocoaCore::removeDiskItem(const String& itemPath) {
 	[[NSFileManager defaultManager] removeItemAtPath: [NSString stringWithUTF8String: itemPath.c_str()] error:nil];
 }
 	
@@ -419,4 +419,4 @@ bool CocoaCore::Update() {
 	unlockMutex(CoreServices::getRenderMutex());	
 	doSleep();	
 	return running;
-}
+}

+ 7 - 7
Core/Contents/Source/PolyConfig.cpp

@@ -31,7 +31,7 @@ Config::~Config() {
 	
 }
 
-void Config::loadConfig(String configNamespace, String fileName) {
+void Config::loadConfig(const String& configNamespace, const String& fileName) {
 	TiXmlDocument doc(fileName.c_str());
 	
 	Logger::log("Loading config: %s\n", fileName.c_str());
@@ -56,7 +56,7 @@ void Config::loadConfig(String configNamespace, String fileName) {
 	
 }
 
-void Config::saveConfig(String configNamespace, String fileName) {
+void Config::saveConfig(const String& configNamespace, const String& fileName) {
 
 	TiXmlDocument doc;  
 	TiXmlElement* node;  
@@ -81,7 +81,7 @@ void Config::saveConfig(String configNamespace, String fileName) {
 	doc.SaveFile(fileName.c_str());  	
 }
 
-ConfigEntry *Config::getEntry(String configNamespace, String key) {
+ConfigEntry *Config::getEntry(const String& configNamespace, const String& key) {
 	
 	for(int i=0; i < entries.size(); i++) {
 		ConfigEntry *entry = entries[i];
@@ -98,22 +98,22 @@ ConfigEntry *Config::getEntry(String configNamespace, String key) {
 	return newEntry;
 }
 
-void Config::setStringValue(String configNamespace, String key, String value) {
+void Config::setStringValue(const String& configNamespace, const String& key, const String& value) {
 	getEntry(configNamespace, key)->stringVal = value;
 	getEntry(configNamespace, key)->isString = true;	
 }
 
-void Config::setNumericValue(String configNamespace, String key, Number value) {
+void Config::setNumericValue(const String& configNamespace, const String& key, Number value) {
 	getEntry(configNamespace, key)->numVal = value;	
 	getEntry(configNamespace, key)->isString = false;		
 }
 
 
-Number Config::getNumericValue(String configNamespace, String key) {
+Number Config::getNumericValue(const String& configNamespace, const String& key) {
 	return getEntry(configNamespace, key)->numVal;
 }
 
-String Config::getStringValue(String configNamespace, String key) {
+const String& Config::getStringValue(const String& configNamespace, const String& key) {
 	return getEntry(configNamespace, key)->stringVal;	
 }
 

+ 4 - 4
Core/Contents/Source/PolyData.cpp

@@ -35,7 +35,7 @@ Data::~Data() {
 		free(data);
 }
 
-void Data::setFromString(String str, int encoding) {
+void Data::setFromString(const String& str, int encoding) {
 	if(data)
 		free(data);
 
@@ -44,7 +44,7 @@ void Data::setFromString(String str, int encoding) {
 	memcpy(data, str.getDataWithEncoding(encoding), dataSize);
 }
 
-bool Data::saveToFile(String fileName) {
+bool Data::saveToFile(const String& fileName) const {
 	
 	OSFILE *file = OSBasics::open(fileName, "wb");
 	
@@ -59,7 +59,7 @@ bool Data::saveToFile(String fileName) {
 	return true;
 }
 
-void Data::loadFromFile(String fileName) {
+void Data::loadFromFile(const String& fileName) {
 	OSFILE *file = OSBasics::open(fileName, "rb");
 	
 	OSBasics::seek(file, 0L, SEEK_END);
@@ -80,7 +80,7 @@ void Data::loadFromFile(String fileName) {
 		
 }
 
-String Data::getAsString(int encoding) {
+String Data::getAsString(int encoding) const {
 	String str;
 	
 	char *strData = (char*)malloc(dataSize+1);

+ 4 - 4
Core/Contents/Source/PolyFixedShader.cpp

@@ -33,11 +33,11 @@ FixedShaderBinding::~FixedShaderBinding() {
 }
 
 
-void FixedShaderBinding::addCubemap(String name, Cubemap *cubemap) {
+void FixedShaderBinding::addCubemap(const String& name, Cubemap *cubemap) {
 	cubemaps.push_back(cubemap);
 }
 
-void FixedShaderBinding::addTexture(String name, Texture *texture) {
+void FixedShaderBinding::addTexture(const String& name, Texture *texture) {
 	textures.push_back(texture);
 }
 
@@ -45,7 +45,7 @@ Texture *FixedShaderBinding::getDiffuseTexture() {
 	return textures[0];
 }
 
-void FixedShaderBinding::addParam(String type, String name, String value) {
+void FixedShaderBinding::addParam(const String& type, const String& name, const String& value) {
 
 }
 
@@ -58,4 +58,4 @@ FixedShader::~FixedShader() {
 
 ShaderBinding *FixedShader::createBinding() {
 	return new FixedShaderBinding(this);
-}
+}

+ 3 - 3
Core/Contents/Source/PolyFont.cpp

@@ -24,7 +24,7 @@
 
 using namespace Polycode;
 
-Font::Font(String fileName) {
+Font::Font(const String& fileName) {
 	FT_Library FTLibrary;
 	FT_Init_FreeType(&FTLibrary);
 	
@@ -52,7 +52,7 @@ Font::Font(String fileName) {
 	}
 }
 
-bool Font::isValid() {
+bool Font::isValid() const {
 	return valid;
 }
 
@@ -64,4 +64,4 @@ Font::~Font() {
 
 FT_Face Font::getFace() {
 	return ftFace;
-}
+}

+ 2 - 2
Core/Contents/Source/PolyFontManager.cpp

@@ -36,7 +36,7 @@ FontManager::~FontManager() {
 	fonts.clear();
 }
 
-void FontManager::registerFont(String fontName, String fontPath) {
+void FontManager::registerFont(const String& fontName, const String& fontPath) {
 	Font *font = new Font(fontPath);
 	if(font->loaded) {
 		FontEntry newEntry;
@@ -48,7 +48,7 @@ void FontManager::registerFont(String fontName, String fontPath) {
 	}
 }
 
-Font *FontManager::getFontByName(String fontName) {
+Font *FontManager::getFontByName(const String& fontName) {
 	for(int i=0; i < fonts.size(); i++) {
 		FontEntry entry = fonts[i];
 		if(entry.fontName == fontName)

+ 3 - 3
Core/Contents/Source/PolyGLSLProgram.cpp

@@ -49,7 +49,7 @@ GLSLProgram::~GLSLProgram() {
 	glDeleteShader(program);
 }
 
-void GLSLProgram::addParam(String name, bool isAuto, int autoID, int paramType, void *defaultData) {
+void GLSLProgram::addParam(const String& name, bool isAuto, int autoID, int paramType, void *defaultData) {
 	GLSLProgramParam newParam;
 	newParam.name = name;
 	newParam.paramType = paramType;
@@ -60,7 +60,7 @@ void GLSLProgram::addParam(String name, bool isAuto, int autoID, int paramType,
 	params.push_back(newParam);
 }
 
-void *GLSLProgramParam::createParamData(int *retType, String type, String value) {
+void *GLSLProgramParam::createParamData(int *retType, const String& type, const String& value) {
 		void *defaultData;
 		if(type == "Number") {
 			*retType = GLSLProgramParam::PARAM_Number;
@@ -84,4 +84,4 @@ void *GLSLProgramParam::createParamData(int *retType, String type, String value)
 			return NULL;
 		}
 
-}
+}

+ 5 - 5
Core/Contents/Source/PolyGLSLShader.cpp

@@ -50,7 +50,7 @@ GLSLShaderBinding::~GLSLShaderBinding() {
 }
 
 
-void GLSLShaderBinding::addTexture(String name, Texture *texture) {
+void GLSLShaderBinding::addTexture(const String& name, Texture *texture) {
 	GLSLTextureBinding binding;
 	binding.name = name;
 	binding.texture = texture;
@@ -58,7 +58,7 @@ void GLSLShaderBinding::addTexture(String name, Texture *texture) {
 	textures.push_back(binding);
 }
 
-void GLSLShaderBinding::addCubemap(String name, Cubemap *cubemap) {
+void GLSLShaderBinding::addCubemap(const String& name, Cubemap *cubemap) {
 	GLSLCubemapBinding binding;
 	binding.cubemap = cubemap;
 	binding.name = name;
@@ -66,7 +66,7 @@ void GLSLShaderBinding::addCubemap(String name, Cubemap *cubemap) {
 	cubemaps.push_back(binding);
 }
 
-void GLSLShaderBinding::clearTexture(String name) {
+void GLSLShaderBinding::clearTexture(const String& name) {
 	for(int i=0; i < textures.size(); i++) {
 		if(textures[i].name == name) {
 			textures.erase(textures.begin()+i);
@@ -76,7 +76,7 @@ void GLSLShaderBinding::clearTexture(String name) {
 }
 
 
-void GLSLShaderBinding::addParam(String type, String name, String value) {
+void GLSLShaderBinding::addParam(const String& type, const String& name, const String& value) {
 	int paramType;
 	void *defaultData = GLSLProgramParam::createParamData(&paramType, type, value);
 	LocalShaderParam *newParam = new LocalShaderParam;
@@ -103,4 +103,4 @@ GLSLShader::~GLSLShader() {
 
 ShaderBinding *GLSLShader::createBinding() {
 	return new GLSLShaderBinding(this);
-}
+}

+ 4 - 4
Core/Contents/Source/PolyGLSLShaderModule.cpp

@@ -73,7 +73,7 @@ GLSLShaderModule::~GLSLShaderModule() {
 
 }
 
-bool GLSLShaderModule::acceptsExtension(String extension) {
+bool GLSLShaderModule::acceptsExtension(const String& extension) {
 	if(extension == "vert" || extension == "frag") {
 		return true;
 	} else {
@@ -771,7 +771,7 @@ void GLSLShaderModule::reloadPrograms() {
 	}	
 }
 
-void GLSLShaderModule::recreateGLSLProgram(GLSLProgram *prog, String fileName, int type) {
+void GLSLShaderModule::recreateGLSLProgram(GLSLProgram *prog, const String& fileName, int type) {
 	
 	OSFILE *file = OSBasics::open(fileName, "r");
 	OSBasics::seek(file, 0, SEEK_END);	
@@ -807,14 +807,14 @@ void GLSLShaderModule::recreateGLSLProgram(GLSLProgram *prog, String fileName, i
 	
 }
 
-GLSLProgram *GLSLShaderModule::createGLSLProgram(String fileName, int type) {
+GLSLProgram *GLSLShaderModule::createGLSLProgram(const String& fileName, int type) {
 	GLSLProgram *prog = new GLSLProgram(type);	
 	recreateGLSLProgram(prog, fileName, type);	
 	programs.push_back(prog);
 	return prog;
 }
 
-Resource* GLSLShaderModule::createProgramFromFile(String extension, String fullPath) {
+Resource* GLSLShaderModule::createProgramFromFile(const String& extension, const String& fullPath) {
 	if(extension == "vert") {
 		Logger::log("Adding GLSL vertex program %s\n", fullPath.c_str());				
 		return createGLSLProgram(fullPath, GLSLProgram::TYPE_VERT);

+ 9 - 9
Core/Contents/Source/PolyImage.cpp

@@ -31,7 +31,7 @@ void user_read_data(png_structp png_ptr, png_bytep data, png_size_t length) {
 	OSBasics::read(data, length, 1, file);
 }
 
-Image::Image(String fileName) : imageData(NULL) {
+Image::Image(const String& fileName) : imageData(NULL) {
 	setPixelType(IMAGE_RGBA);
 	loaded = false;
 	if(!loadImage(fileName)) {
@@ -57,7 +57,7 @@ void Image::setPixelType(int type) {
 	}
 }
 
-bool Image::isLoaded() {
+bool Image::isLoaded() const {
 	return loaded;
 }
 
@@ -102,11 +102,11 @@ Color Image::getPixel(int x, int y) {
 	return Color(imageData32[x+(y*width)]);
 }
 
-unsigned int Image::getWidth() {
+unsigned int Image::getWidth() const {
 	return width;
 }
 
-unsigned int Image::getHeight() {
+unsigned int Image::getHeight() const {
 	return height;
 }
 
@@ -137,7 +137,7 @@ void Image::perlinNoise(int seed, bool alpha) {
 	}
 }
 
-void Image::writeBMP(String fileName) {
+void Image::writeBMP(const String& fileName) const {
 //	SDL_Surface *image;
 //	image = SDL_CreateRGBSurface(SDL_SWSURFACE, width, height, 32, 0x0000FF, 0x00FF00, 0xFF0000, 0x000000);
 //	memcpy(image->pixels,imageData,width * height * 4);
@@ -172,11 +172,11 @@ void Image::moveTo(int x, int y) {
 }
 
 
-int Image::getBrushX() {
+int Image::getBrushX() const {
 	return brushPosX;
 }
 
-int Image::getBrushY() {
+int Image::getBrushY() const {
 	return brushPosY;
 }
 
@@ -450,11 +450,11 @@ void Image::fill(Number r, Number g, Number b, Number a) {
 	}
 }
 
-bool Image::loadImage(String fileName) {
+bool Image::loadImage(const String& fileName) {
 	return loadPNG(fileName);
 }
 
-bool Image::loadPNG(String fileName) {
+bool Image::loadPNG(const String& fileName) {
 	OSFILE         *infile;
 	
 	png_structp   png_ptr;

+ 8 - 8
Core/Contents/Source/PolyLabel.cpp

@@ -27,7 +27,7 @@ using namespace Polycode;
 #define NORMAL_FT_FLAGS FT_LOAD_TARGET_LIGHT
 
 
-Label::Label(Font *font, String text, int size, int antiAliasMode) : Image() {
+Label::Label(Font *font, const String& text, int size, int antiAliasMode) : Image() {
 		setPixelType(Image::IMAGE_RGBA);
 		this->font = font;
 		this->size = size;
@@ -42,7 +42,7 @@ Label::~Label() {
 
 }
 
-int Label::getTextWidth(Font *font, String text, int size) {
+int Label::getTextWidth(Font *font, const String& text, int size) const {
 	FT_Vector delta;
 	FT_UInt previous = 0;
 	FT_UInt glyph_index;
@@ -86,7 +86,7 @@ int Label::getTextWidth(Font *font, String text, int size) {
 	return width+5;
 }
 
-int Label::getTextHeight(Font *font, String text, int size) {
+int Label::getTextHeight(Font *font, const String& text, int size) const {
 	
 	String actualString = text; //StringUtil::replace(text, "\t", TAB_REPLACE);
 	
@@ -117,23 +117,23 @@ int Label::getTextHeight(Font *font, String text, int size) {
 	return height;
 }
 
-Number Label::getTextWidth() {
+Number Label::getTextWidth() const {
 	return currentTextWidth;
 }
 
-Number Label::getTextHeight() {
+Number Label::getTextHeight() const {
 	return currentTextHeight;
 }
 
-Font *Label::getFont() {
+Font *Label::getFont() const {
 	return font;
 }
 
-String Label::getText() {
+const String& Label::getText() const {
 	return text;
 }
 
-void Label::setText(String text) {
+void Label::setText(const String& text) {
 //	Logger::logw((char*)text.c_str());
 	
 	this->text = text;

+ 7 - 7
Core/Contents/Source/PolyMaterial.cpp

@@ -24,7 +24,7 @@
 
 using namespace Polycode;
 
-Material::Material(String name) : Resource(Resource::RESOURCE_MATERIAL) {
+Material::Material(const String& name) : Resource(Resource::RESOURCE_MATERIAL) {
 	this->name = name;
 	specularValue = 75.0;
 }
@@ -55,23 +55,23 @@ void Material::addShader(Shader *shader,ShaderBinding *shaderBinding) {
 }
 
 
-unsigned int Material::getNumShaders() {
+unsigned int Material::getNumShaders() const {
 	return materialShaders.size();
 }
 
-String Material::getName() {
+const String& Material::getName() const {
 	return name;
 }
 
-Shader *Material::getShader(unsigned int index) {
+Shader *Material::getShader(unsigned int index) const {
 	return materialShaders[index];
 }
 
-ShaderBinding *Material::getShaderBinding(unsigned int index) {
+ShaderBinding *Material::getShaderBinding(unsigned int index) const {
 	return shaderBindings[index];
 }
 
-void Material::loadMaterial(String fileName) {
+void Material::loadMaterial(const String& fileName) {
 
 }
 
@@ -85,4 +85,4 @@ int Material::getNumShaderRenderTargets() {
 
 ShaderRenderTarget *Material::getShaderRenderTarget(unsigned int index) {
 	return renderTargets[index];
-}
+}

+ 2 - 2
Core/Contents/Source/PolyMaterialManager.cpp

@@ -38,7 +38,7 @@ void MaterialManager::Update(int elapsed) {
 	}
 }
 
-Texture *MaterialManager::getTextureByResourcePath(String resourcePath) {
+Texture *MaterialManager::getTextureByResourcePath(const String& resourcePath) const {
 	for(int i=0;i < textures.size(); i++) {
 		if(textures[i]->getResourcePath() == resourcePath)
 			return textures[i];
@@ -387,4 +387,4 @@ Material *MaterialManager::materialFromXMLNode(TiXmlNode *node) {
 	}
 	
 	return newMaterial;
-}
+}

+ 6 - 6
Core/Contents/Source/PolyMesh.cpp

@@ -24,7 +24,7 @@
 
 namespace Polycode {
 
-	Mesh::Mesh(String fileName) {
+	Mesh::Mesh(const String& fileName) {
 		
 		for(int i=0; i < 16; i++) {
 			arrayDirtyMap[i] = false;
@@ -204,8 +204,8 @@ namespace Polycode {
 		arrayDirtyMap[RenderDataArray::NORMAL_DATA_ARRAY] = true;							
 	}
 	
-	void Mesh::saveToFile(String fileName) {
-		OSFILE *outFile = OSBasics::open(fileName.c_str(), "wb");
+	void Mesh::saveToFile(const String& fileName) {
+		OSFILE *outFile = OSBasics::open(fileName, "wb");
 		if(!outFile) {
 			Logger::log("Error opening mesh file for saving: %s", fileName.c_str());
 		}
@@ -214,8 +214,8 @@ namespace Polycode {
 	
 	}
 	
-	void Mesh::loadMesh(String fileName) {
-		OSFILE *inFile = OSBasics::open(fileName.c_str(), "rb");
+	void Mesh::loadMesh(const String& fileName) {
+		OSFILE *inFile = OSBasics::open(fileName, "rb");
 		if(!inFile) {
 			Logger::log("Error opening mesh file %s", fileName.c_str());
 		}
@@ -750,4 +750,4 @@ namespace Polycode {
 	Polygon *Mesh::getPolygon(unsigned int index) {
 		return polygons[index];
 	}
-}
+}

+ 3 - 3
Core/Contents/Source/PolyObject.cpp

@@ -33,7 +33,7 @@ Object::~Object() {
 	
 }
 
-void Object::saveToXML(String fileName) {
+void Object::saveToXML(const String& fileName) {
 	TiXmlDocument doc;  	
 	TiXmlDeclaration* decl = new TiXmlDeclaration( "1.0", "", "" );  
 	doc.LinkEndChild( decl ); 
@@ -85,7 +85,7 @@ TiXmlElement *Object::createElementFromObjectEntry(ObjectEntry *entry) {
 	return newElement;
 }
 
-bool Object::loadFromXML(String fileName) {
+bool Object::loadFromXML(const String& fileName) {
 
 	TiXmlDocument doc(fileName.c_str());
 	doc.LoadFile();
@@ -184,4 +184,4 @@ void Object::createFromXMLElement(TiXmlElement *element, ObjectEntry *entry) {
 	
 	entry->length = count;
 
-}
+}

+ 4 - 4
Core/Contents/Source/PolyParticleEmitter.cpp

@@ -24,7 +24,7 @@
 
 using namespace Polycode;
 
-SceneParticleEmitter::SceneParticleEmitter(String materialName, Scene *particleParentScene, int particleType, int emitterType, Number lifespan, unsigned int numParticles, Vector3 direction, Vector3 gravity, Vector3 deviation, Mesh *particleMesh, SceneMesh *emitter)
+SceneParticleEmitter::SceneParticleEmitter(const String& materialName, Scene *particleParentScene, int particleType, int emitterType, Number lifespan, unsigned int numParticles, Vector3 direction, Vector3 gravity, Vector3 deviation, Mesh *particleMesh, SceneMesh *emitter)
 : ParticleEmitter(materialName, particleMesh, particleType, emitterType, lifespan, numParticles,  direction, gravity, deviation),
 SceneEntity()
 {
@@ -51,7 +51,7 @@ void SceneParticleEmitter::Update() {
 }
 
 
-ScreenParticleEmitter::ScreenParticleEmitter(String imageFile, Screen *particleParentScreen, int particleType, int emitterType, Number lifespan, unsigned int numParticles, Vector3 direction, Vector3 gravity, Vector3 deviation, Mesh *particleMesh, ScreenMesh *emitter)
+ScreenParticleEmitter::ScreenParticleEmitter(const String& imageFile, Screen *particleParentScreen, int particleType, int emitterType, Number lifespan, unsigned int numParticles, Vector3 direction, Vector3 gravity, Vector3 deviation, Mesh *particleMesh, ScreenMesh *emitter)
 		: ParticleEmitter(imageFile, particleMesh, particleType, emitterType, lifespan, numParticles,  direction, gravity, deviation),
 ScreenEntity()
 {
@@ -77,7 +77,7 @@ Matrix4 ScreenParticleEmitter::getBaseMatrix() {
 	return getConcatenatedMatrix();
 }
 
-ParticleEmitter::ParticleEmitter(String imageFile, Mesh *particleMesh, int particleType, int emitterType, Number lifespan, unsigned int numParticles,  Vector3 direction, Vector3 gravity, Vector3 deviation)  {
+ParticleEmitter::ParticleEmitter(const String& imageFile, Mesh *particleMesh, int particleType, int emitterType, Number lifespan, unsigned int numParticles,  Vector3 direction, Vector3 gravity, Vector3 deviation)  {
 	
 	isScreenEmitter = false;
 	dirVector = direction;
@@ -358,4 +358,4 @@ void ParticleEmitter::updateEmitter() {
 			}
 		}
 	}
-}
+}

+ 5 - 5
Core/Contents/Source/PolyResource.cpp

@@ -32,22 +32,22 @@ Resource::~Resource() {
 
 }
 
-String Resource::getResourceName() {
+const String& Resource::getResourceName() const {
 	return name;
 }
 
-int Resource::getResourceType() {
+int Resource::getResourceType() const {
 	return type;
 }
 
-void Resource::setResourceName(String newName) {
+void Resource::setResourceName(const String& newName) {
 	name = newName;
 }
 
-void Resource::setResourcePath(String path) {
+void Resource::setResourcePath(const String& path) {
 	resourcePath = path;
 }
 
-String Resource::getResourcePath() {
+const String& Resource::getResourcePath() const {
 	return resourcePath;
 }

+ 10 - 10
Core/Contents/Source/PolyResourceManager.cpp

@@ -37,7 +37,7 @@ ResourceManager::~ResourceManager() {
 		resources.clear();
 }
 
-void ResourceManager::parseShaders(String dirPath, bool recursive) {
+void ResourceManager::parseShaders(const String& dirPath, bool recursive) {
 	vector<OSFileEntry> resourceDir;
 	resourceDir = OSBasics::parseFolder(dirPath, false);
 	
@@ -76,7 +76,7 @@ void ResourceManager::addShaderModule(PolycodeShaderModule *module) {
 	shaderModules.push_back(module);
 }
 
-void ResourceManager::parsePrograms(String dirPath, bool recursive) {
+void ResourceManager::parsePrograms(const String& dirPath, bool recursive) {
 	vector<OSFileEntry> resourceDir;
 	resourceDir = OSBasics::parseFolder(dirPath, false);
 	for(int i=0; i < resourceDir.size(); i++) {	
@@ -99,7 +99,7 @@ void ResourceManager::parsePrograms(String dirPath, bool recursive) {
 	}	
 }
 
-void ResourceManager::parseMaterials(String dirPath, bool recursive) {
+void ResourceManager::parseMaterials(const String& dirPath, bool recursive) {
 	vector<OSFileEntry> resourceDir;
 	resourceDir = OSBasics::parseFolder(dirPath, false);
 	
@@ -130,7 +130,7 @@ void ResourceManager::parseMaterials(String dirPath, bool recursive) {
 	}
 }
 
-void ResourceManager::parseCubemaps(String dirPath, bool recursive) {
+void ResourceManager::parseCubemaps(const String& dirPath, bool recursive) {
 	vector<OSFileEntry> resourceDir;
 	resourceDir = OSBasics::parseFolder(dirPath, false);
 	
@@ -167,7 +167,7 @@ void ResourceManager::addResource(Resource *resource) {
 	resources.push_back(resource);
 }
 
-void ResourceManager::parseTextures(String dirPath, bool recursive) {
+void ResourceManager::parseTextures(const String& dirPath, bool recursive) {
 	vector<OSFileEntry> resourceDir;
 	resourceDir = OSBasics::parseFolder(dirPath, false);
 	for(int i=0; i < resourceDir.size(); i++) {	
@@ -187,7 +187,7 @@ void ResourceManager::parseTextures(String dirPath, bool recursive) {
 	}
 }
 
-void ResourceManager::parseOthers(String dirPath, bool recursive) {
+void ResourceManager::parseOthers(const String& dirPath, bool recursive) {
 	vector<OSFileEntry> resourceDir;
 	resourceDir = OSBasics::parseFolder(dirPath, false);
 	for(int i=0; i < resourceDir.size(); i++) {	
@@ -204,7 +204,7 @@ void ResourceManager::parseOthers(String dirPath, bool recursive) {
 }
 
 
-void ResourceManager::addArchive(String zipPath) {
+void ResourceManager::addArchive(const String& zipPath) {
 //	if(PHYSFS_addToSearchPath(zipPath.c_str(), 1, getThreadID()) == 0) {
 	if(PHYSFS_addToSearchPath(zipPath.c_str(), 1) == 0) {	
 		Logger::log("Error adding archive to resource manager... %s\n", PHYSFS_getLastError());
@@ -213,7 +213,7 @@ void ResourceManager::addArchive(String zipPath) {
 	}
 }
 
-void ResourceManager::addDirResource(String dirPath, bool recursive) {
+void ResourceManager::addDirResource(const String& dirPath, bool recursive) {
 	parseTextures(dirPath, recursive);
 	parsePrograms(dirPath, recursive);
 	parseShaders(dirPath, recursive);
@@ -222,7 +222,7 @@ void ResourceManager::addDirResource(String dirPath, bool recursive) {
 	parseOthers(dirPath, recursive);	
 }
 
-Resource *ResourceManager::getResource(int resourceType, String resourceName) {
+Resource *ResourceManager::getResource(int resourceType, const String& resourceName) const {
 	Logger::log("requested %s\n", resourceName.c_str());
 	for(int i =0; i < resources.size(); i++) {
 //		Logger::log("is it %s?\n", resources[i]->getResourceName().c_str());		
@@ -233,4 +233,4 @@ Resource *ResourceManager::getResource(int resourceType, String resourceName) {
 	Logger::log("return NULL\n");
 	// need to add some sort of default resource for each type
 	return NULL;
-}
+}

+ 5 - 5
Core/Contents/Source/PolySDLCore.cpp

@@ -196,7 +196,7 @@ CoreMutex *SDLCore::createMutex() {
 	return mutex;	
 }
 
-void SDLCore::copyStringToClipboard(String str) {
+void SDLCore::copyStringToClipboard(const String& str) {
 
 }
 
@@ -204,19 +204,19 @@ String SDLCore::getClipboardString() {
 
 }
 
-void SDLCore::createFolder(String folderPath) {
+void SDLCore::createFolder(const String& folderPath) {
 
 }
 
-void SDLCore::copyDiskItem(String itemPath, String destItemPath) {
+void SDLCore::copyDiskItem(const String& itemPath, const String& destItemPath) {
 
 }
 
-void SDLCore::moveDiskItem(String itemPath, String destItemPath) {
+void SDLCore::moveDiskItem(const String& itemPath, const String& destItemPath) {
 
 }
 
-void SDLCore::removeDiskItem(String itemPath) {
+void SDLCore::removeDiskItem(const String& itemPath) {
 }
 
 String SDLCore::openFolderPicker() {

+ 5 - 5
Core/Contents/Source/PolyScene.cpp

@@ -284,7 +284,7 @@ String Scene::readString(OSFILE *inFile) {
 	
 }
 
-void Scene::loadScene(String fileName) {
+void Scene::loadScene(const String& fileName) {
 	OSFILE *inFile = OSBasics::open(fileName.c_str(), "rb");
 	if(!inFile) {
 		Logger::log("Error opening scene file\n");
@@ -491,7 +491,7 @@ void Scene::loadScene(String fileName) {
 	OSBasics::close(inFile);
 }
 
-vector<SceneEntity*> Scene::getCustomEntitiesByType(String type) {
+vector<SceneEntity*> Scene::getCustomEntitiesByType(const String& type) const {
 	vector<SceneEntity*> retVector;
 	for(int i=0; i < customEntities.size(); i++) {
 		if(customEntities[i]->custEntityType == type) {
@@ -501,7 +501,7 @@ vector<SceneEntity*> Scene::getCustomEntitiesByType(String type) {
 	return retVector;	
 }
 
-SceneEntity *Scene::getCustomEntityByType(String type) {
+SceneEntity *Scene::getCustomEntityByType(const String& type) const {
 	for(int i=0; i < customEntities.size(); i++) {
 		if(customEntities[i]->custEntityType == type) {
 			return customEntities[i];
@@ -527,7 +527,7 @@ void Scene::writeEntityMatrix(SceneEntity *entity, OSFILE *outFile) {
 	
 }
 
-void Scene::saveScene(String fileName) {
+void Scene::saveScene(const String& fileName) {
 	OSFILE *outFile = OSBasics::open(fileName.c_str(), "wb");
 	if(!outFile) {
 		Logger::log("Error opening scene file for writing\n");
@@ -658,7 +658,7 @@ void Scene::saveScene(String fileName) {
 	OSBasics::close(outFile);
 }
 
-void Scene::writeString(String str, OSFILE *outFile) {
+void Scene::writeString(const String& str, OSFILE *outFile) {
 	unsigned int stLen = str.length();
 	OSBasics::write(&stLen, sizeof(unsigned int), 1, outFile);
 	OSBasics::write(str.c_str(), 1, stLen, outFile);

+ 2 - 2
Core/Contents/Source/PolySceneLabel.cpp

@@ -24,7 +24,7 @@
 
 using namespace Polycode;
 
-SceneLabel::SceneLabel(String fontName, String text, int size, Number scale, int amode) : SceneEntity() {
+SceneLabel::SceneLabel(const String& fontName, const String& text, int size, Number scale, int amode) : SceneEntity() {
 	label = new Label(CoreServices::getInstance()->getFontManager()->getFontByName(fontName), text, size, amode);
 	this->scale = scale;
 	setText(text);
@@ -73,7 +73,7 @@ bool SceneLabel::testMouseCollision(Number x, Number y) {
 	return false; //CoreServices::getInstance()->getRenderer()->test2DCoordinate(x, y, imagePolygon, fullMatrix, billboardRoll);
 }
 
-void SceneLabel::setText(String newText) {
+void SceneLabel::setText(const String& newText) {
 	if(texture)
 		CoreServices::getInstance()->getMaterialManager()->deleteTexture(texture);
 		

+ 5 - 5
Core/Contents/Source/PolySceneMesh.cpp

@@ -24,7 +24,7 @@
 
 using namespace Polycode;
 
-SceneMesh::SceneMesh(String fileName) : SceneEntity(), texture(NULL), material(NULL) {
+SceneMesh::SceneMesh(const String& fileName) : SceneEntity(), texture(NULL), material(NULL) {
 	mesh = new Mesh(fileName);
 	bBoxRadius = mesh->getRadius();
 	bBox = mesh->calculateBBox();
@@ -79,7 +79,7 @@ void SceneMesh::setMaterial(Material *material) {
 	localShaderOptions = material->getShader(0)->createBinding();
 }
 
-void SceneMesh::setMaterialByName(String materialName) {
+void SceneMesh::setMaterialByName(const String& materialName) {
 	Material *material =  (Material*)CoreServices::getInstance()->getResourceManager()->getResource(Resource::RESOURCE_MATERIAL, materialName);
 	if(!material)
 		return;
@@ -91,7 +91,7 @@ Texture *SceneMesh::getTexture() {
 }
 
 
-void SceneMesh::loadTexture(String fileName,bool clamp) {
+void SceneMesh::loadTexture(const String& fileName, bool clamp) {
 	texture = CoreServices::getInstance()->getMaterialManager()->createTextureFromFile(fileName, clamp);
 }
 
@@ -99,7 +99,7 @@ ShaderBinding *SceneMesh::getLocalShaderOptions() {
 	return localShaderOptions;
 }
 
-void SceneMesh::loadSkeleton(String fileName) {
+void SceneMesh::loadSkeleton(const String& fileName) {
 	skeleton = new Skeleton(fileName);
 	addEntity(skeleton);
 	
@@ -237,4 +237,4 @@ void SceneMesh::Render() {
 		}
 		 */
 	}	
-}
+}

+ 2 - 2
Core/Contents/Source/PolySceneSound.cpp

@@ -45,7 +45,7 @@ void SceneSoundListener::Update() {
 }
 
 
-SceneSound::SceneSound(String fileName, Number referenceDistance, Number maxDistance) : SceneEntity() {
+SceneSound::SceneSound(const String& fileName, Number referenceDistance, Number maxDistance) : SceneEntity() {
 	sound = new Sound(fileName);
 	sound->setIsPositional(true);
 	sound->setPositionalProperties(referenceDistance, maxDistance);
@@ -70,4 +70,4 @@ void SceneSound::Update() {
 
 Sound *SceneSound::getSound() {
 	return sound;
-}
+}

+ 1 - 1
Core/Contents/Source/PolyScreen.cpp

@@ -148,7 +148,7 @@ void Screen::handleEvent(Event *event) {
 	}
 }
 
-void Screen::setScreenShader(String shaderName) {
+void Screen::setScreenShader(const String& shaderName) {
 	filterShaderMaterial = (Material*)CoreServices::getInstance()->getResourceManager()->getResource(Resource::RESOURCE_MATERIAL, shaderName);
 	if(!filterShaderMaterial)
 		return;

+ 4 - 4
Core/Contents/Source/PolyScreenImage.cpp

@@ -24,7 +24,7 @@
 
 using namespace Polycode;
 
-ScreenImage::ScreenImage(String fileName) : ScreenShape(ScreenShape::SHAPE_RECT,1,1) {
+ScreenImage::ScreenImage(const String& fileName) : ScreenShape(ScreenShape::SHAPE_RECT,1,1) {
 	loadTexture(fileName);
 	
 	imageWidth = texture->getWidth();
@@ -95,10 +95,10 @@ void ScreenImage::setImageCoordinates(Number x, Number y, Number width, Number h
 	
 }
 
-Number ScreenImage::getImageWidth() {
+Number ScreenImage::getImageWidth() const {
 	return imageWidth;
 }
 
-Number ScreenImage::getImageHeight() {
+Number ScreenImage::getImageHeight() const {
 	return imageHeight;	
-}
+}

Некоторые файлы не были показаны из-за большого количества измененных файлов