Browse Source

Cleaned up includes by removing duplicate and C-style includes and only including c++ headers.
Added common includes to Base.h in gameplay-encoder and now all source files include Base.h.
Added using clauses for commonly used C functions (i.e. math functions, memcpy, etc).

Steve Grenier 14 years ago
parent
commit
1ac77cd499
95 changed files with 241 additions and 308 deletions
  1. 0 1
      gameplay-encoder/gameplay-encoder.vcxproj
  2. 2 7
      gameplay-encoder/gameplay-encoder.vcxproj.filters
  3. 1 0
      gameplay-encoder/src/Animation.cpp
  4. 2 0
      gameplay-encoder/src/Animation.h
  5. 2 1
      gameplay-encoder/src/AnimationChannel.cpp
  6. 2 3
      gameplay-encoder/src/AnimationChannel.h
  7. 1 0
      gameplay-encoder/src/Animations.cpp
  8. 1 0
      gameplay-encoder/src/Animations.h
  9. 21 8
      gameplay-encoder/src/Base.h
  10. 1 0
      gameplay-encoder/src/BoundingVolume.cpp
  11. 1 1
      gameplay-encoder/src/Camera.cpp
  12. 1 0
      gameplay-encoder/src/Camera.h
  13. 2 1
      gameplay-encoder/src/CameraInstance.cpp
  14. 3 0
      gameplay-encoder/src/CameraInstance.h
  15. 2 2
      gameplay-encoder/src/DAEChannelTarget.cpp
  16. 0 12
      gameplay-encoder/src/DAEChannelTarget.h
  17. 7 4
      gameplay-encoder/src/DAEOptimizer.cpp
  18. 5 11
      gameplay-encoder/src/DAEOptimizer.h
  19. 10 12
      gameplay-encoder/src/DAESceneEncoder.cpp
  20. 4 20
      gameplay-encoder/src/DAESceneEncoder.h
  21. 6 1
      gameplay-encoder/src/DAEUtil.cpp
  22. 4 19
      gameplay-encoder/src/DAEUtil.h
  23. 4 1
      gameplay-encoder/src/Effect.cpp
  24. 1 2
      gameplay-encoder/src/Effect.h
  25. 6 1
      gameplay-encoder/src/EncoderArguments.cpp
  26. 4 2
      gameplay-encoder/src/EncoderArguments.h
  27. 2 2
      gameplay-encoder/src/FileIO.cpp
  28. 1 3
      gameplay-encoder/src/FileIO.h
  29. 2 1
      gameplay-encoder/src/Font.cpp
  30. 1 2
      gameplay-encoder/src/Font.h
  31. 2 1
      gameplay-encoder/src/GPBDecoder.cpp
  32. 1 8
      gameplay-encoder/src/GPBDecoder.h
  33. 2 2
      gameplay-encoder/src/GPBFile.cpp
  34. 7 13
      gameplay-encoder/src/GPBFile.h
  35. 5 3
      gameplay-encoder/src/Glyph.cpp
  36. 1 0
      gameplay-encoder/src/Glyph.h
  37. 2 1
      gameplay-encoder/src/Light.cpp
  38. 1 3
      gameplay-encoder/src/Light.h
  39. 2 2
      gameplay-encoder/src/LightInstance.cpp
  40. 3 1
      gameplay-encoder/src/LightInstance.h
  41. 2 1
      gameplay-encoder/src/Material.cpp
  42. 1 2
      gameplay-encoder/src/Material.h
  43. 2 1
      gameplay-encoder/src/MaterialParameter.cpp
  44. 1 2
      gameplay-encoder/src/MaterialParameter.h
  45. 1 1
      gameplay-encoder/src/Matrix.cpp
  46. 1 1
      gameplay-encoder/src/Matrix.h
  47. 1 0
      gameplay-encoder/src/Mesh.cpp
  48. 1 0
      gameplay-encoder/src/Mesh.h
  49. 2 1
      gameplay-encoder/src/MeshPart.cpp
  50. 1 5
      gameplay-encoder/src/MeshPart.h
  51. 3 2
      gameplay-encoder/src/MeshSkin.cpp
  52. 0 2
      gameplay-encoder/src/MeshSkin.h
  53. 1 0
      gameplay-encoder/src/Model.cpp
  54. 0 2
      gameplay-encoder/src/Model.h
  55. 2 1
      gameplay-encoder/src/Node.cpp
  56. 1 4
      gameplay-encoder/src/Node.h
  57. 2 1
      gameplay-encoder/src/Object.cpp
  58. 2 2
      gameplay-encoder/src/Object.h
  59. 0 4
      gameplay-encoder/src/Quaternion.cpp
  60. 2 5
      gameplay-encoder/src/Quaternion.h
  61. 2 1
      gameplay-encoder/src/Reference.cpp
  62. 1 0
      gameplay-encoder/src/Reference.h
  63. 2 1
      gameplay-encoder/src/ReferenceTable.cpp
  64. 1 3
      gameplay-encoder/src/ReferenceTable.h
  65. 3 3
      gameplay-encoder/src/Scene.cpp
  66. 1 0
      gameplay-encoder/src/Scene.h
  67. 2 3
      gameplay-encoder/src/StringUtil.cpp
  68. 1 2
      gameplay-encoder/src/StringUtil.h
  69. 7 1
      gameplay-encoder/src/TTFFontEncoder.cpp
  70. 5 7
      gameplay-encoder/src/TTFFontEncoder.h
  71. 2 0
      gameplay-encoder/src/Transform.cpp
  72. 0 6
      gameplay-encoder/src/Vector2.cpp
  73. 1 5
      gameplay-encoder/src/Vector2.h
  74. 0 4
      gameplay-encoder/src/Vector3.cpp
  75. 0 6
      gameplay-encoder/src/Vector3.h
  76. 0 4
      gameplay-encoder/src/Vector4.cpp
  77. 1 5
      gameplay-encoder/src/Vector4.h
  78. 2 1
      gameplay-encoder/src/Vertex.cpp
  79. 1 0
      gameplay-encoder/src/Vertex.h
  80. 2 1
      gameplay-encoder/src/VertexElement.cpp
  81. 1 0
      gameplay-encoder/src/VertexElement.h
  82. 1 3
      gameplay-encoder/src/main.cpp
  83. 0 24
      gameplay.sln
  84. 2 3
      gameplay/src/Animation.cpp
  85. 0 1
      gameplay/src/AnimationTarget.cpp
  86. 23 13
      gameplay/src/Base.h
  87. 7 3
      gameplay/src/Curve.cpp
  88. 7 7
      gameplay/src/DebugNew.cpp
  89. 6 6
      gameplay/src/DebugNew.h
  90. 1 1
      gameplay/src/FileSystem.cpp
  91. 2 2
      gameplay/src/Font.cpp
  92. 3 1
      gameplay/src/Material.cpp
  93. 1 1
      gameplay/src/PhysicsRigidBody.h
  94. 1 1
      gameplay/src/Texture.cpp
  95. 1 1
      gameplay/src/VertexFormat.cpp

+ 0 - 1
gameplay-encoder/gameplay-encoder.vcxproj

@@ -81,7 +81,6 @@
     <ClInclude Include="src\MaterialParameter.h" />
     <ClInclude Include="src\Matrix.h" />
     <ClInclude Include="src\Mesh.h" />
-    <ClInclude Include="src\Miniball.h" />
     <ClInclude Include="src\Model.h" />
     <ClInclude Include="src\MeshPart.h" />
     <ClInclude Include="src\MeshSkin.h" />

+ 2 - 7
gameplay-encoder/gameplay-encoder.vcxproj.filters

@@ -62,9 +62,6 @@
     </ClCompile>
     <ClCompile Include="src\GPBFile.cpp" />
     <ClCompile Include="src\DAEChannelTarget.cpp" />
-    <ClCompile Include="src\Base.cpp">
-      <Filter>Objects</Filter>
-    </ClCompile>
     <ClCompile Include="src\FileIO.cpp" />
     <ClCompile Include="src\StringUtil.cpp" />
     <ClCompile Include="src\Effect.cpp">
@@ -100,6 +97,7 @@
     <ClCompile Include="src\BoundingVolume.cpp">
       <Filter>Math</Filter>
     </ClCompile>
+    <ClCompile Include="src\Base.cpp" />
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="src\DAESceneEncoder.h" />
@@ -162,9 +160,6 @@
     </ClInclude>
     <ClInclude Include="src\GPBFile.h" />
     <ClInclude Include="src\DAEChannelTarget.h" />
-    <ClInclude Include="src\Base.h">
-      <Filter>Objects</Filter>
-    </ClInclude>
     <ClInclude Include="src\FileIO.h" />
     <ClInclude Include="src\StringUtil.h" />
     <ClInclude Include="src\Effect.h">
@@ -197,10 +192,10 @@
       <Filter>Objects\Animation</Filter>
     </ClInclude>
     <ClInclude Include="..\gameplay\src\Curve.h" />
-    <ClInclude Include="src\Miniball.h" />
     <ClInclude Include="src\BoundingVolume.h">
       <Filter>Math</Filter>
     </ClInclude>
+    <ClInclude Include="src\Base.h" />
   </ItemGroup>
   <ItemGroup>
     <Filter Include="Objects">

+ 1 - 0
gameplay-encoder/src/Animation.cpp

@@ -1,3 +1,4 @@
+#include "Base.h"
 #include "Animation.h"
 
 namespace gameplay

+ 2 - 0
gameplay-encoder/src/Animation.h

@@ -41,8 +41,10 @@ public:
     AnimationChannel* getAnimationChannel(unsigned int index) const;
 
 private:
+
     std::vector<AnimationChannel*> _channels;
 };
 
 }
+
 #endif

+ 2 - 1
gameplay-encoder/src/AnimationChannel.cpp

@@ -1,3 +1,4 @@
+#include "Base.h"
 #include "AnimationChannel.h"
 
 namespace gameplay
@@ -86,7 +87,7 @@ const std::vector<unsigned int>& AnimationChannel::getInterpolationTypes() const
     return _interpolations;
 }
 
-void AnimationChannel::setTargetId(const std::string str)
+void AnimationChannel::setTargetId(const std::string& str)
 {
     _targetId = str;
 }

+ 2 - 3
gameplay-encoder/src/AnimationChannel.h

@@ -36,7 +36,7 @@ public:
     virtual void writeText(FILE* file);
 
     const std::string& getTargetId() const;
-    void setTargetId(const std::string str);
+    void setTargetId(const std::string& str);
     void setTargetAttribute(unsigned int attrib);
 
     void setKeyTimes(const std::vector<float>& values);
@@ -73,7 +73,6 @@ private:
     std::vector<unsigned int> _interpolations;
 };
 
-
 }
-#endif
 
+#endif

+ 1 - 0
gameplay-encoder/src/Animations.cpp

@@ -1,3 +1,4 @@
+#include "Base.h"
 #include "Animations.h"
 
 namespace gameplay

+ 1 - 0
gameplay-encoder/src/Animations.h

@@ -39,4 +39,5 @@ private:
 };
 
 }
+
 #endif

+ 21 - 8
gameplay-encoder/src/Base.h

@@ -1,22 +1,34 @@
 #ifndef BASE_H_
 #define BASE_H_
 
+// C++ includes
 #include <cmath>
+#include <cstdio>
+#include <cstdlib>
+#include <cassert>
+#include <cmath>
+#include <cfloat>
+#include <ctime>
 #include <iostream>
+#include <fstream>
 #include <string>
 #include <vector>
 #include <list>
 #include <map>
-#include <stdio.h>
-#include <stdlib.h>
-#include <iostream>
-#include <string>
+#include <algorithm>
 #include <sys/stat.h>
-#include <vector>
-#include <assert.h>
-#include <math.h>
-#include <float.h>
 
+// Collada includes
+#include <dae.h>
+#include <dae/daeSIDResolver.h>
+#include <dae/domAny.h>
+#include <dom/domCOLLADA.h>
+#include <dom/domConstants.h>
+#include <dom/domElements.h>
+#include <dom/domCamera.h>
+#include <dom/domProfile_COMMON.h>
+
+// Defines
 #ifndef M_1_PI        
 #define M_1_PI                      0.31830988618379067154
 #endif
@@ -70,4 +82,5 @@ void setIdentityMatrix(float values[]);
 #endif
 
 }
+
 #endif

+ 1 - 0
gameplay-encoder/src/BoundingVolume.cpp

@@ -1,3 +1,4 @@
+#include "Base.h"
 #include "BoundingVolume.h"
 
 namespace gameplay

+ 1 - 1
gameplay-encoder/src/Camera.cpp

@@ -1,4 +1,4 @@
-#include <assert.h>
+#include "Base.h"
 #include "Camera.h"
 
 namespace gameplay

+ 1 - 0
gameplay-encoder/src/Camera.h

@@ -54,4 +54,5 @@ private:
 };
 
 }
+
 #endif

+ 2 - 1
gameplay-encoder/src/CameraInstance.cpp

@@ -1,3 +1,4 @@
+#include "Base.h"
 #include "CameraInstance.h"
 
 namespace gameplay
@@ -50,4 +51,4 @@ void CameraInstance::setCamera(Camera* camera)
     _ref = camera;
 }
 
-}
+}

+ 3 - 0
gameplay-encoder/src/CameraInstance.h

@@ -28,9 +28,12 @@ public:
 
     Camera* getCamera();
     void setCamera(Camera* camera);
+
 private:
+
     Camera* _ref;
 };
 
 }
+
 #endif

+ 2 - 2
gameplay-encoder/src/DAEChannelTarget.cpp

@@ -1,4 +1,4 @@
-
+#include "Base.h"
 #include "DAEChannelTarget.h"
 
 
@@ -98,4 +98,4 @@ void DAEChannelTarget::getPropertyName(size_t index, std::string* str)
     str->clear();
 }
 
-}
+}

+ 0 - 12
gameplay-encoder/src/DAEChannelTarget.h

@@ -1,18 +1,6 @@
 #ifndef DAECHANNELTARGET_H_
 #define DAECHANNELTARGET_H_
 
-#include <dae.h>
-#include <dae/daeSIDResolver.h>
-#include <dae/domAny.h>
-#include <dom/domCOLLADA.h>
-#include <dom/domConstants.h>
-#include <dom/domElements.h>
-#include <dom/domProfile_COMMON.h>
-
-#include <vector>
-
-#include "Base.h"
-
 namespace gameplay
 {
 

+ 7 - 4
gameplay-encoder/src/DAEOptimizer.cpp

@@ -1,9 +1,10 @@
+#include "Base.h"
 #include "DAEOptimizer.h"
-
-#include <algorithm>
-
 #include "StringUtil.h"
 
+namespace gameplay
+{
+
 DAEOptimizer::DAEOptimizer(domCOLLADA* dom)
 {
     _dom = dom;
@@ -122,4 +123,6 @@ void DAEOptimizer::deleteEmptyAnimations()
     {
         daeElement::removeFromParent(*i);
     }
-}
+}
+
+}

+ 5 - 11
gameplay-encoder/src/DAEOptimizer.h

@@ -1,19 +1,11 @@
 #ifndef DAEOPTIMIZER_H_
 #define DAEOPTIMIZER_H_
 
-#include <dae.h>
-#include <dae/daeSIDResolver.h>
-#include <dae/domAny.h>
-#include <dom/domCOLLADA.h>
-#include <dom/domConstants.h>
-#include <dom/domElements.h>
-#include <dom/domProfile_COMMON.h>
-
-#include <vector>
-
-#include "Base.h"
 #include "DAEUtil.h"
 
+namespace gameplay
+{
+
 /**
  * The DAEOptimizer optimizes a COLLADA dom.
  */
@@ -60,4 +52,6 @@ private:
     std::string _inputPath;
 };
 
+}
+
 #endif

+ 10 - 12
gameplay-encoder/src/DAESceneEncoder.cpp

@@ -1,15 +1,11 @@
-/*
- * DAESceneEncoder.h
- */
-
-#include <algorithm>
-
+#include "Base.h"
 #include "DAESceneEncoder.h"
 #include "DAEOptimizer.h"
 
 //#define ENCODER_PRINT_TIME 1
 
-using namespace gameplay;
+namespace gameplay
+{
 
 DAESceneEncoder::DAESceneEncoder()
     : _collada(NULL), _dom(NULL), file(NULL), _vertexBlendWeights(NULL), _vertexBlendIndices(NULL)
@@ -243,7 +239,7 @@ void DAESceneEncoder::createTrianglesFromPolylist(domMesh* domMesh, domPolylist*
 
 void DAESceneEncoder::write(const std::string& filepath, const EncoderArguments& arguments)
 {
-    _begin = std::clock();
+    _begin = clock();
     const char* nodeId = arguments.getNodeId();
     bool text = arguments.textOutputEnabled();
 
@@ -663,14 +659,14 @@ bool DAESceneEncoder::loadTarget(const domChannelRef& channelRef, AnimationChann
 void DAESceneEncoder::begin()
 {
     #ifdef ENCODER_PRINT_TIME
-    _begin = std::clock();
+    _begin = clock();
     #endif
 }
 
 void DAESceneEncoder::end(const char* str)
 {
     #ifdef ENCODER_PRINT_TIME
-    clock_t time = std::clock() - _begin;
+    clock_t time = clock() - _begin;
     fprintf(stderr,"%5d %s\n", time, str);
     #endif
 }
@@ -1672,7 +1668,7 @@ Mesh* DAESceneEncoder::loadMesh(const domMesh* meshElement, const std::string& g
         domTriangles* triangles = daeSafeCast<domTriangles>(trianglesArray.get(i));
 
         // Parse the material for this subset
-        //std::string materialName = triangles->getMaterial() == NULL ? _T("") : triangles->getMaterial();
+        //string materialName = triangles->getMaterial() == NULL ? _T("") : triangles->getMaterial();
         //if (materialName.size() > 0)
         ///    subset->material = ParseMaterial(bindMaterial, materialName);
 
@@ -1924,4 +1920,6 @@ DAESceneEncoder::DAEPolygonInput::DAEPolygonInput(void) :
 
 DAESceneEncoder::DAEPolygonInput::~DAEPolygonInput(void)
 {
-}
+}
+
+}

+ 4 - 20
gameplay-encoder/src/DAESceneEncoder.h

@@ -1,25 +1,6 @@
-/*
- * DAESceneEncoder.h
- */
-
 #ifndef DAESCENEEENCODER_H_
 #define DAESCENEEENCODER_H_
 
-#include <iostream>
-#include <list>
-#include <vector>
-#include <ctime>
-
-#include <dae.h>
-#include <dae/daeSIDResolver.h>
-#include <dae/domAny.h>
-#include <dom/domCOLLADA.h>
-#include <dom/domConstants.h>
-#include <dom/domElements.h>
-#include <dom/domProfile_COMMON.h>
-#include <dom/domCamera.h>
-
-#include "Base.h"
 #include "StringUtil.h"
 #include "Object.h"
 #include "Node.h"
@@ -42,7 +23,8 @@
 #include "DAEUtil.h"
 #include "EncoderArguments.h"
 
-using namespace gameplay;
+namespace gameplay
+{
 
 /**
  * Class for binary encoding a Collada (DAE) file.
@@ -223,4 +205,6 @@ private:
     clock_t _begin;
 };
 
+}
+
 #endif

+ 6 - 1
gameplay-encoder/src/DAEUtil.cpp

@@ -1,6 +1,9 @@
-
+#include "Base.h"
 #include "DAEUtil.h"
 
+namespace gameplay
+{
+
 /**
  * Returns the index of the skeleton in skeletonArray that points to the given node.
  * 
@@ -301,3 +304,5 @@ int getIndex(const domInstance_controller::domSkeleton_Array& skeletonArray, con
     }
     return -1;
 }
+
+}

+ 4 - 19
gameplay-encoder/src/DAEUtil.h

@@ -1,25 +1,8 @@
-/*
- * DAEUtil.h
- */
-
 #ifndef DAEUTIL_H_
 #define DAEUTIL_H_
 
-#include <iostream>
-#include <list>
-#include <vector>
-
-#include <dae.h>
-#include <dae/daeSIDResolver.h>
-#include <dae/domAny.h>
-#include <dom/domCOLLADA.h>
-#include <dom/domConstants.h>
-#include <dom/domElements.h>
-#include <dom/domProfile_COMMON.h>
-
-#include "Base.h"
-
-using namespace gameplay;
+namespace gameplay
+{
 
 /**
  * Gets the joint names for the given source and appends them to the given list.
@@ -123,4 +106,6 @@ void moveChannelAndSouresToAnimation(domChannelRef& channel, domAnimationRef& an
  */
 bool isEmptyAnimation(domAnimationRef& animation);
 
+}
+
 #endif

+ 4 - 1
gameplay-encoder/src/Effect.cpp

@@ -1,3 +1,4 @@
+#include "Base.h"
 #include "Effect.h"
 
 namespace gameplay
@@ -15,6 +16,7 @@ unsigned int Effect::getTypeId(void) const
 {
     return EFFECT_ID;
 }
+
 const char* Effect::getElementName(void) const
 {
     return "Effect";
@@ -26,6 +28,7 @@ void Effect::writeBinary(FILE* file)
     write(_vertexShader, file);
     write(_fragmentShader, file);
 }
+
 void Effect::writeText(FILE* file)
 {
     fprintElementStart(file);
@@ -34,4 +37,4 @@ void Effect::writeText(FILE* file)
     fprintElementEnd(file);
 }
 
-}
+}

+ 1 - 2
gameplay-encoder/src/Effect.h

@@ -33,7 +33,6 @@ private:
     std::string _fragmentShader;
 };
 
-
 }
-#endif
 
+#endif

+ 6 - 1
gameplay-encoder/src/EncoderArguments.cpp

@@ -1,5 +1,5 @@
+#include "Base.h"
 #include "EncoderArguments.h"
-
 #include "StringUtil.h"
 
 #ifdef WIN32
@@ -7,6 +7,9 @@
     #define realpath(A,B)    _fullpath(B,A,PATH_MAX)
 #endif
 
+namespace gameplay
+{
+
 EncoderArguments::EncoderArguments(size_t argc, const char** argv) :
     _fontSize(0),
     _parseError(false),
@@ -273,3 +276,5 @@ void EncoderArguments::replace_char(char* str, char oldChar, char newChar)
         }
     }
 }
+
+}

+ 4 - 2
gameplay-encoder/src/EncoderArguments.h

@@ -1,8 +1,8 @@
 #ifndef ENCODERARGUMENTS_H_
 #define ENCODERARGUMENTS_H_
 
-
-#include "Base.h"
+namespace gameplay
+{
 
 /**
  * EncoderArguments handles parsing the command line arguments for the GamePlay Encoder.
@@ -111,4 +111,6 @@ private:
     std::vector<std::string> _groupAnimationAnimationId;
 };
 
+}
+
 #endif

+ 2 - 2
gameplay-encoder/src/FileIO.cpp

@@ -1,9 +1,9 @@
+#include "Base.h"
 #include "FileIO.h"
 
 namespace gameplay
 {
 
-
 // Writing out a binary file //
 
 void write(unsigned char value, FILE* file)
@@ -144,4 +144,4 @@ void skipUint(FILE* file)
     fseek(file, sizeof(unsigned int), SEEK_CUR);
 }
 
-}
+}

+ 1 - 3
gameplay-encoder/src/FileIO.h

@@ -1,8 +1,6 @@
 #ifndef FILEIO_H_
 #define FILEIO_H_
 
-#include "Base.h"
-
 namespace gameplay
 {
 
@@ -114,5 +112,5 @@ void skipString(FILE* file);
 void skipUint(FILE* file);
 
 }
-#endif
 
+#endif

+ 2 - 1
gameplay-encoder/src/Font.cpp

@@ -1,3 +1,4 @@
+#include "Base.h"
 #include "Font.h"
 
 namespace gameplay
@@ -50,4 +51,4 @@ void Font::writeText(FILE* file)
     fprintElementEnd(file);
 }
 
-}
+}

+ 1 - 2
gameplay-encoder/src/Font.h

@@ -44,7 +44,6 @@ public:
     };
 };
 
-
 }
-#endif
 
+#endif

+ 2 - 1
gameplay-encoder/src/GPBDecoder.cpp

@@ -1,3 +1,4 @@
+#include "Base.h"
 #include "GPBDecoder.h"
 
 namespace gameplay
@@ -113,4 +114,4 @@ std::string GPBDecoder::readString(FILE* fp)
     return result;
 }
 
-};
+}

+ 1 - 8
gameplay-encoder/src/GPBDecoder.h

@@ -1,14 +1,6 @@
-/*
- * GamePlayFile.h
- */
-
 #ifndef GPBDECODER_H_
 #define GPBDECODER_H_
 
-#include <iostream>
-#include <list>
-#include <assert.h>
-
 #include "FileIO.h"
 
 namespace gameplay
@@ -40,6 +32,7 @@ public:
     std::string readString(FILE* fp);
 
 private:
+
     FILE* _file;
     FILE* _outFile;
 };

+ 2 - 2
gameplay-encoder/src/GPBFile.cpp

@@ -1,3 +1,4 @@
+#include "Base.h"
 #include "GPBFile.h"
 
 namespace gameplay
@@ -240,5 +241,4 @@ void GPBFile::adjust()
     //   This can be merged into one animation. Same for scale animations.
 }
 
-
-}
+}

+ 7 - 13
gameplay-encoder/src/GPBFile.h

@@ -1,14 +1,6 @@
-/*
- * GPBFile.h
- */
-
 #ifndef GPBFILE_H_
 #define GPBFILE_H_
 
-#include <iostream>
-#include <list>
-#include <algorithm>
-
 #include "FileIO.h"
 #include "Object.h"
 #include "Scene.h"
@@ -24,11 +16,12 @@
 
 namespace gameplay
 {
-    /**
-     * Increment the version number when making a change that break binary compatibility.
-     * [0] is major, [1] is minor.
-     */
-    const unsigned char VERSION[2] = {1, 1};
+
+/**
+ * Increment the version number when making a change that break binary compatibility.
+ * [0] is major, [1] is minor.
+ */
+const unsigned char VERSION[2] = {1, 1};
 
 /**
  * The GamePlay Binary file class handles writing the GamePlay Binary file.
@@ -116,4 +109,5 @@ private:
 };
 
 }
+
 #endif

+ 5 - 3
gameplay-encoder/src/Glyph.cpp

@@ -1,3 +1,4 @@
+#include "Base.h"
 #include "Glyph.h"
 
 namespace gameplay
@@ -10,10 +11,10 @@ Glyph::Glyph(void) :
     fillArray(uvCoords, 0.0f, 4);
 }
 
-
-Glyph::~Glyph(void)
+    Glyph::~Glyph(void)
 {
 }
+
 const char* Glyph::getElementName(void) const
 {
     return "Glyph";
@@ -28,6 +29,7 @@ void Glyph::writeBinary(FILE* file)
     write(uvCoords, 4, file);
 
 }
+
 void Glyph::writeText(FILE* file)
 {
     fprintElementStart(file);
@@ -37,4 +39,4 @@ void Glyph::writeText(FILE* file)
     fprintElementEnd(file);
 }
 
-}
+}

+ 1 - 0
gameplay-encoder/src/Glyph.h

@@ -30,4 +30,5 @@ public:
 };
 
 }
+
 #endif

+ 2 - 1
gameplay-encoder/src/Light.cpp

@@ -1,3 +1,4 @@
+#include "Base.h"
 #include "Light.h"
 #include "DAESceneEncoder.h"
 
@@ -227,4 +228,4 @@ void Light::setFalloffExponent(float value)
     }
 }
 
-}
+}

+ 1 - 3
gameplay-encoder/src/Light.h

@@ -77,8 +77,6 @@ private:
     float _outerAngle;
 };
 
-
-
 }
-#endif
 
+#endif

+ 2 - 2
gameplay-encoder/src/LightInstance.cpp

@@ -1,5 +1,5 @@
+#include "Base.h"
 #include "LightInstance.h"
-#include "assert.h"
 
 namespace gameplay
 {
@@ -52,4 +52,4 @@ bool LightInstance::isAmbient() const
     return _ref != NULL && _ref->isAmbient();
 }
 
-}
+}

+ 3 - 1
gameplay-encoder/src/LightInstance.h

@@ -32,9 +32,11 @@ public:
     bool isAmbient() const;
 
 private:
+
     Light* _ref;
+
 };
 
 }
-#endif
 
+#endif

+ 2 - 1
gameplay-encoder/src/Material.cpp

@@ -1,3 +1,4 @@
+#include "Base.h"
 #include "Material.h"
 
 namespace gameplay
@@ -35,4 +36,4 @@ void Material::writeText(FILE* file)
     fprintElementEnd(file);
 }
 
-}
+}

+ 1 - 2
gameplay-encoder/src/Material.h

@@ -32,7 +32,6 @@ private:
     Effect* _effect;
 };
 
-
 }
-#endif
 
+#endif

+ 2 - 1
gameplay-encoder/src/MaterialParameter.cpp

@@ -1,3 +1,4 @@
+#include "Base.h"
 #include "MaterialParameter.h"
 
 namespace gameplay
@@ -35,4 +36,4 @@ void MaterialParameter::writeText(FILE* file)
     fprintElementEnd(file);
 }
 
-}
+}

+ 1 - 2
gameplay-encoder/src/MaterialParameter.h

@@ -30,7 +30,6 @@ private:
     unsigned int _type;
 };
 
-
 }
-#endif
 
+#endif

+ 1 - 1
gameplay-encoder/src/Matrix.cpp

@@ -1,9 +1,9 @@
+#include "Base.h"
 #include "Matrix.h"
 
 namespace gameplay
 {
 
-
 Matrix::Matrix(void)
 {
     setIdentity(m);

+ 1 - 1
gameplay-encoder/src/Matrix.h

@@ -12,7 +12,6 @@
 #define TORADIANS(degrees) (degrees * (PI / 180.0f))
 #define TODEGREES(radians) (radians * (180.0f / PI))
 
-
 namespace gameplay
 {
 
@@ -166,4 +165,5 @@ public:
 };
 
 }
+
 #endif

+ 1 - 0
gameplay-encoder/src/Mesh.cpp

@@ -1,3 +1,4 @@
+#include "Base.h"
 #include "Mesh.h"
 #include "Model.h"
 

+ 1 - 0
gameplay-encoder/src/Mesh.h

@@ -76,4 +76,5 @@ private:
 };
 
 }
+
 #endif

+ 2 - 1
gameplay-encoder/src/MeshPart.cpp

@@ -1,3 +1,4 @@
+#include "Base.h"
 #include "MeshPart.h"
 
 namespace gameplay
@@ -104,4 +105,4 @@ void MeshPart::updateIndexFormat(unsigned int newIndex)
     }
 }
 
-}
+}

+ 1 - 5
gameplay-encoder/src/MeshPart.h

@@ -1,8 +1,6 @@
 #ifndef MESHPART_H_
 #define MESHPART_H_
 
-#include <vector>
-
 #include "Base.h"
 #include "Object.h"
 #include "Vertex.h"
@@ -85,8 +83,6 @@ private:
     std::vector<unsigned int> _indices;
 };
 
-
-
 }
-#endif
 
+#endif

+ 3 - 2
gameplay-encoder/src/MeshSkin.cpp

@@ -1,3 +1,4 @@
+#include "Base.h"
 #include "MeshSkin.h"
 #include "Node.h"
 #include "StringUtil.h"
@@ -167,7 +168,7 @@ void MeshSkin::computeBounds()
     {
         // Is this parent in the list of joints that form the skeleton?
         // If not, then it's simply a parent node to the root joint
-        if (std::find(_joints.begin(), _joints.end(), parent) != _joints.end())
+        if (find(_joints.begin(), _joints.end(), parent) != _joints.end())
         {
             rootJoint = parent;
         }
@@ -210,7 +211,7 @@ void MeshSkin::computeBounds()
                 AnimationChannel* channel = animation->getAnimationChannel(k);
                 if (channel->getTargetId() == joint->getId())
                 {
-                    if (std::find(channels.begin(), channels.end(), channel) == channels.end())
+                    if (find(channels.begin(), channels.end(), channel) == channels.end())
                     {
                         channels.push_back(channel);
                         channelTargets.push_back(joint);

+ 0 - 2
gameplay-encoder/src/MeshSkin.h

@@ -1,8 +1,6 @@
 #ifndef MESHSKIN_H_
 #define MESHSKIN_H_
 
-#include <vector>
-
 #include "Base.h"
 #include "Object.h"
 #include "Matrix.h"

+ 1 - 0
gameplay-encoder/src/Model.cpp

@@ -1,3 +1,4 @@
+#include "Base.h"
 #include "Model.h"
 
 namespace gameplay

+ 0 - 2
gameplay-encoder/src/Model.h

@@ -1,8 +1,6 @@
 #ifndef MODEL_H_
 #define MODEL_H_
 
-#include <list>
-
 #include "Object.h"
 #include "Mesh.h"
 #include "MeshSkin.h"

+ 2 - 1
gameplay-encoder/src/Node.cpp

@@ -1,3 +1,4 @@
+#include "Base.h"
 #include "Node.h"
 
 #define NODE 1
@@ -320,4 +321,4 @@ bool Node::hasLight() const
     return _light != NULL;
 }
 
-}
+}

+ 1 - 4
gameplay-encoder/src/Node.h

@@ -1,8 +1,6 @@
 #ifndef NODE_H_
 #define NODE_H_
 
-#include <list>
-
 #include "Object.h"
 #include "CameraInstance.h"
 #include "LightInstance.h"
@@ -185,7 +183,6 @@ private:
     bool _joint;
 };
 
-
 }
-#endif
 
+#endif

+ 2 - 1
gameplay-encoder/src/Object.cpp

@@ -1,3 +1,4 @@
+#include "Base.h"
 #include "Object.h"
 
 namespace gameplay
@@ -76,4 +77,4 @@ void Object::writeBinaryXref(FILE* file)
     write(xref, file);
 }
 
-}
+}

+ 2 - 2
gameplay-encoder/src/Object.h

@@ -1,11 +1,11 @@
 #ifndef OBJ_H_
 #define OBJ_H_
 
-#include "Base.h"
 #include "FileIO.h"
 
 namespace gameplay
 {
+
 /**
  * Object is the abstract base class of all the objects that can be written in the GamePlay Binary file.
  */
@@ -35,7 +35,6 @@ public:
         FONT_ID = 128,
     };
 
-
     /**
      * Constructor.
      */
@@ -137,6 +136,7 @@ public:
     }
 
 private:
+
     /**
      * Saves where this object was written to in the binary file.
      */

+ 0 - 4
gameplay-encoder/src/Quaternion.cpp

@@ -1,7 +1,3 @@
-/*
- * Quaternion.cpp
- */
-
 #include "Base.h"
 #include "Quaternion.h"
 

+ 2 - 5
gameplay-encoder/src/Quaternion.h

@@ -1,7 +1,3 @@
-/*
- * Quaternion.h
- */
-
 #ifndef QUATERNION_H_
 #define QUATERNION_H_
 
@@ -308,4 +304,5 @@ private:
 };
 
 }
-#endif /* QUATERNION_H_ */
+
+#endif

+ 2 - 1
gameplay-encoder/src/Reference.cpp

@@ -1,3 +1,4 @@
+#include "Base.h"
 #include "Reference.h"
 
 namespace gameplay
@@ -83,4 +84,4 @@ Object* Reference::getObj()
     return _ref;
 }
 
-}
+}

+ 1 - 0
gameplay-encoder/src/Reference.h

@@ -53,4 +53,5 @@ private:
 };
 
 }
+
 #endif

+ 2 - 1
gameplay-encoder/src/ReferenceTable.cpp

@@ -1,3 +1,4 @@
+#include "Base.h"
 #include "ReferenceTable.h"
 
 namespace gameplay
@@ -65,4 +66,4 @@ std::map<std::string, Reference>::iterator ReferenceTable::end()
     return _table.end();
 }
 
-}
+}

+ 1 - 3
gameplay-encoder/src/ReferenceTable.h

@@ -1,8 +1,6 @@
 #ifndef REFTABLE_H_
 #define REFTABLE_H_
 
-#include <map>
-
 #include "FileIO.h"
 #include "Reference.h"
 #include "Object.h"
@@ -56,5 +54,5 @@ private:
 };
 
 }
-#endif
 
+#endif

+ 3 - 3
gameplay-encoder/src/Scene.cpp

@@ -1,5 +1,4 @@
-#include <algorithm>
-
+#include "Base.h"
 #include "Scene.h"
 
 namespace gameplay
@@ -40,6 +39,7 @@ void Scene::writeBinary(FILE* file)
     }
     write(_ambientColor, Light::COLOR_SIZE, file);
 }
+
 void Scene::writeText(FILE* file)
 {
     fprintElementStart(file);
@@ -113,4 +113,4 @@ void Scene::calcAmbientColor(const Node* node, float* values) const
     }
 }
 
-}
+}

+ 1 - 0
gameplay-encoder/src/Scene.h

@@ -68,4 +68,5 @@ private:
 };
 
 }
+
 #endif

+ 2 - 3
gameplay-encoder/src/StringUtil.cpp

@@ -1,7 +1,6 @@
+#include "Base.h"
 #include "StringUtil.h"
 
-#include <string>
-
 namespace gameplay
 {
 
@@ -100,4 +99,4 @@ bool equalsIgnoreCase(const std::string& a, const char* b)
     return true;
 }
 
-}
+}

+ 1 - 2
gameplay-encoder/src/StringUtil.h

@@ -1,8 +1,6 @@
 #ifndef STRINGUTIL_H_
 #define STRINGUTIL_H_
 
-#include <string>
-
 namespace gameplay
 {
 
@@ -20,4 +18,5 @@ bool equals(const std::string& a, const char* b);
 bool equalsIgnoreCase(const std::string& a, const char* b);
 
 }
+
 #endif

+ 7 - 1
gameplay-encoder/src/TTFFontEncoder.cpp

@@ -1,6 +1,10 @@
+#include "Base.h"
 #include "TTFFontEncoder.h"
 #include "GPBFile.h"
 
+namespace gameplay
+{
+
 void drawBitmap(unsigned char* dstBitmap, int x, int y, int dstWidth, unsigned char* srcBitmap, int srcWidth, int srcHeight)
 {
     // offset dst bitmap by x,y.
@@ -325,4 +329,6 @@ int writeFont(const char* filename, unsigned int fontSize, const char* id, bool
     FT_Done_Face(face);
     FT_Done_FreeType(library);
     return 0;
-}
+}
+
+}

+ 5 - 7
gameplay-encoder/src/TTFFontEncoder.h

@@ -1,9 +1,4 @@
-#include <stdio.h>
 #include <ft2build.h>
-#include "string.h"
-#include <fstream>
-#include <math.h>
-
 #include FT_FREETYPE_H
 
 #define START_INDEX     32
@@ -11,6 +6,8 @@
 
 #define GLYPH_PADDING   4
 
+namespace gameplay
+{
 
 // Structure of Glyph.
 class Glyph
@@ -21,7 +18,6 @@ public:
     float uvCoords[4];
 };
 
-
 void drawBitmap(unsigned char* dstBitmap, int x, int y, int dstWidth, unsigned char* srcBitmap, int srcWidth, int srcHeight);
 
 void writeUint(FILE* fp, unsigned int i);
@@ -30,4 +26,6 @@ void writeFloat(FILE* fp, float f);
 
 void writeString(FILE* fp, const char* str);
 
-int writeFont(const char* filename, unsigned int fontSize, const char* id, bool fontpreview);
+int writeFont(const char* filename, unsigned int fontSize, const char* id, bool fontpreview);
+
+}

+ 2 - 0
gameplay-encoder/src/Transform.cpp

@@ -0,0 +1,2 @@
+#include "Base.h"
+#include "Transform.h"

+ 0 - 6
gameplay-encoder/src/Vector2.cpp

@@ -1,7 +1,3 @@
-/*
- * Vector2.cpp
- */
-
 #include "Base.h"
 #include "Vector2.h"
 #include "FileIO.h"
@@ -319,5 +315,3 @@ void Vector2::writeText(FILE* file) const
 }
 
 }
-
-

+ 1 - 5
gameplay-encoder/src/Vector2.h

@@ -1,13 +1,9 @@
-/*
- * Vector2.h
- */
-
 #ifndef VECTOR2_H_
 #define VECTOR2_H_
 
-
 namespace gameplay
 {
+
 // Forward declare
 class Matrix;
 

+ 0 - 4
gameplay-encoder/src/Vector3.cpp

@@ -1,7 +1,3 @@
-/*
- * Vector3.cpp
- */
-
 #include "Base.h"
 #include "Vector3.h"
 #include "FileIO.h"

+ 0 - 6
gameplay-encoder/src/Vector3.h

@@ -1,12 +1,6 @@
-/*
- * Vector3.h
- */
-
 #ifndef VECTOR3_H_
 #define VECTOR3_H_
 
-#include <cstdio>
-
 namespace gameplay
 {
 

+ 0 - 4
gameplay-encoder/src/Vector4.cpp

@@ -1,7 +1,3 @@
-/*
- * Vector4.cpp
- */
-
 #include "Base.h"
 #include "Vector4.h"
 #include "FileIO.h"

+ 1 - 5
gameplay-encoder/src/Vector4.h

@@ -1,7 +1,3 @@
-/*
- * Vector4.h
- */
-
 #ifndef VECTOR4_H_
 #define VECTOR4_H_
 
@@ -367,4 +363,4 @@ public:
 
 }
 
-#endif
+#endif

+ 2 - 1
gameplay-encoder/src/Vertex.cpp

@@ -1,3 +1,4 @@
+#include "Base.h"
 #include "Vertex.h"
 
 namespace gameplay
@@ -102,4 +103,4 @@ void Vertex::writeText(FILE* file) const
     }
 }
 
-}
+}

+ 1 - 0
gameplay-encoder/src/Vertex.h

@@ -92,4 +92,5 @@ public:
 };
 
 }
+
 #endif

+ 2 - 1
gameplay-encoder/src/VertexElement.cpp

@@ -1,3 +1,4 @@
+#include "Base.h"
 #include "VertexElement.h"
 
 namespace gameplay
@@ -72,4 +73,4 @@ const char* VertexElement::usageStr(unsigned int usage)
     }
 }
 
-}
+}

+ 1 - 0
gameplay-encoder/src/VertexElement.h

@@ -31,4 +31,5 @@ public:
 };
 
 }
+
 #endif

+ 1 - 3
gameplay-encoder/src/main.cpp

@@ -1,5 +1,4 @@
-#include <string>
-
+#include "Base.h"
 #include "DAESceneEncoder.h"
 #include "TTFFontEncoder.h"
 #include "GPBDecoder.h"
@@ -83,4 +82,3 @@ int main(int argc, const char** argv)
 
     return 0;
 }
-

+ 0 - 24
gameplay.sln

@@ -25,18 +25,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sample03-character", "gamep
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gameplay-encoder", "gameplay-encoder\gameplay-encoder.vcxproj", "{9D69B743-4872-4DD1-8E30-0087C64298D7}"
 EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{D3CA8AE2-3ED6-458B-963A-EDA671E6F51C}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sample04-sandbox", "gameplay-samples\sample04-sandbox\sample04-sandbox.vcxproj", "{FA260001-5B2E-41B7-86DD-C7F26DF3A485}"
-	ProjectSection(ProjectDependencies) = postProject
-		{1032BA4B-57EB-4348-9E03-29DD63E80E4A} = {1032BA4B-57EB-4348-9E03-29DD63E80E4A}
-	EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "demo00-dragon", "gameplay-demos\demo00-dragon\demo00-dragon.vcxproj", "{D20F2DDA-9825-4B10-BF8E-5ED10BD7C047}"
-	ProjectSection(ProjectDependencies) = postProject
-		{1032BA4B-57EB-4348-9E03-29DD63E80E4A} = {1032BA4B-57EB-4348-9E03-29DD63E80E4A}
-	EndProjectSection
-EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
 		Debug|Win32 = Debug|Win32
@@ -80,18 +68,6 @@ Global
 		{9D69B743-4872-4DD1-8E30-0087C64298D7}.DebugMem|Win32.Build.0 = Debug|Win32
 		{9D69B743-4872-4DD1-8E30-0087C64298D7}.Release|Win32.ActiveCfg = Release|Win32
 		{9D69B743-4872-4DD1-8E30-0087C64298D7}.Release|Win32.Build.0 = Release|Win32
-		{FA260001-5B2E-41B7-86DD-C7F26DF3A485}.Debug|Win32.ActiveCfg = Debug|Win32
-		{FA260001-5B2E-41B7-86DD-C7F26DF3A485}.Debug|Win32.Build.0 = Debug|Win32
-		{FA260001-5B2E-41B7-86DD-C7F26DF3A485}.DebugMem|Win32.ActiveCfg = DebugMem|Win32
-		{FA260001-5B2E-41B7-86DD-C7F26DF3A485}.DebugMem|Win32.Build.0 = DebugMem|Win32
-		{FA260001-5B2E-41B7-86DD-C7F26DF3A485}.Release|Win32.ActiveCfg = Release|Win32
-		{FA260001-5B2E-41B7-86DD-C7F26DF3A485}.Release|Win32.Build.0 = Release|Win32
-		{D20F2DDA-9825-4B10-BF8E-5ED10BD7C047}.Debug|Win32.ActiveCfg = Debug|Win32
-		{D20F2DDA-9825-4B10-BF8E-5ED10BD7C047}.Debug|Win32.Build.0 = Debug|Win32
-		{D20F2DDA-9825-4B10-BF8E-5ED10BD7C047}.DebugMem|Win32.ActiveCfg = DebugMem|Win32
-		{D20F2DDA-9825-4B10-BF8E-5ED10BD7C047}.DebugMem|Win32.Build.0 = DebugMem|Win32
-		{D20F2DDA-9825-4B10-BF8E-5ED10BD7C047}.Release|Win32.ActiveCfg = Release|Win32
-		{D20F2DDA-9825-4B10-BF8E-5ED10BD7C047}.Release|Win32.Build.0 = Release|Win32
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE

+ 2 - 3
gameplay/src/Animation.cpp

@@ -5,7 +5,6 @@
 #include "AnimationTarget.h"
 #include "Game.h"
 #include "Transform.h"
-#include <string.h>
 #include "Properties.h"
 
 #define ANIMATION_DEFAULT_CLIP_SUFFIX "__default__clip"
@@ -48,7 +47,7 @@ Animation::~Animation()
 
     SAFE_DELETE(_defaultClip);
 
-    /*std::vector<Channel*>::iterator channelIter = _channels.begin();
+    /*vector<Channel*>::iterator channelIter = _channels.begin();
     while (channelIter != _channels.end())
     {
         Animation::Channel* channel = *channelIter;
@@ -108,7 +107,7 @@ void Animation::createClips(const char* animationFile)
         const char* repeat = pClip->getString("repeatCount");
         if (repeat)
         {
-            if (((std::string)repeat).compare(ANIMATION_INDEFINITE_STR) == 0)
+            if (strcmp(repeat, ANIMATION_INDEFINITE_STR) == 0)
             {
                 clip->setRepeatCount(AnimationClip::REPEAT_INDEFINITE);
             }

+ 0 - 1
gameplay/src/AnimationTarget.cpp

@@ -2,7 +2,6 @@
 #include "AnimationTarget.h"
 #include "Animation.h"
 #include "Game.h"
-#include <string.h>
 #include "Transform.h"
 
 namespace gameplay

+ 23 - 13
gameplay/src/Base.h

@@ -3,32 +3,42 @@
 
 // C/C++
 #include <new>
+#include <memory>
 #include <cstdio>
+#include <cstdlib>
+#include <cstdint>
 #include <cassert>
-#include <memory>
-#include <iostream>
-#include <string>
 #include <cwchar>
 #include <cwctype>
 #include <cctype>
 #include <cmath>
+#include <cstdarg>
+#include <ctime>
+#include <iostream>
+#include <string>
 #include <vector>
 #include <list>
 #include <stack>
 #include <map>
 #include <algorithm>
-#include <ctime>
 #include <limits>
 #include <functional>
-#include <assert.h>
-#include <string.h>
-#include <ctype.h>
-#include <stdint.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <time.h>
-#include <math.h>
-#include <cstdarg>
+
+// Bring common functions from C into global namespace
+using std::memcpy;
+using std::fabs;
+using std::sqrt;
+using std::sqrtf;
+using std::cos;
+using std::cosf;
+using std::sin;
+using std::sinf;
+using std::tan;
+using std::tanf;
+using std::isspace;
+using std::isdigit;
+using std::toupper;
+using std::tolower;
 
 // Common
 #ifndef NULL

+ 7 - 3
gameplay/src/Curve.cpp

@@ -1,9 +1,13 @@
 // Purposely not including Base.h here, or any other gameplay dependencies
 // so this class can be reused between gameplay and gameplay-encoder.
 #include "Curve.h"
-#include <assert.h>
-#include <math.h>
-#include <memory.h>
+#include <cassert>
+#include <cmath>
+#include <memory>
+
+using std::memcpy;
+using std::fabs;
+using std::sqrtf;
 
 #ifndef NULL
 #define NULL 0

+ 7 - 7
gameplay/src/DebugNew.cpp

@@ -18,39 +18,39 @@ struct MemoryAllocationRecord
 MemoryAllocationRecord* __memoryAllocations = 0;
 int __memoryAllocationCount = 0;
 
-void* debugAlloc(std::size_t size, const char* file, int line);
+void* debugAlloc(size_t size, const char* file, int line);
 void debugFree(void* p);
 
 #ifdef _MSC_VER
 #pragma warning( disable : 4290 )
 #endif
 
-void* operator new (std::size_t size, const char* file, int line)
+void* operator new (size_t size, const char* file, int line)
 {
     return debugAlloc(size, file, line);
 }
 
-void* operator new[] (std::size_t size, const char* file, int line)
+void* operator new[] (size_t size, const char* file, int line)
 {
     return operator new (size, file, line);
 }
 
-void* operator new (std::size_t size) throw(std::bad_alloc)
+void* operator new (size_t size) throw(bad_alloc)
 {
     return operator new (size, "", 0);
 }
 
-void* operator new[] (std::size_t size) throw(std::bad_alloc)
+void* operator new[] (size_t size) throw(bad_alloc)
 {
     return operator new (size, "", 0);
 }
 
-void* operator new (std::size_t size, const std::nothrow_t&) throw()
+void* operator new (size_t size, const nothrow_t&) throw()
 {
     return operator new (size, "", 0);
 }
 
-void* operator new[] (std::size_t size, const std::nothrow_t&) throw()
+void* operator new[] (size_t size, const nothrow_t&) throw()
 {
     return operator new (size, "", 0);
 }

+ 6 - 6
gameplay/src/DebugNew.h

@@ -18,12 +18,12 @@ extern void printMemoryLeaks();
 #ifdef _MSC_VER
 #pragma warning( disable : 4290 ) // C++ exception specification ignored.
 #endif
-void* operator new (std::size_t size, const char* file, int line);
-void* operator new[] (std::size_t size, const char* file, int line);
-void* operator new (std::size_t size) throw(std::bad_alloc);
-void* operator new[] (std::size_t size) throw(std::bad_alloc);
-void* operator new (std::size_t size, const std::nothrow_t&) throw();
-void* operator new[] (std::size_t size, const std::nothrow_t&) throw();
+void* operator new (size_t size, const char* file, int line);
+void* operator new[] (size_t size, const char* file, int line);
+void* operator new (size_t size) throw(bad_alloc);
+void* operator new[] (size_t size) throw(bad_alloc);
+void* operator new (size_t size, const nothrow_t&) throw();
+void* operator new[] (size_t size, const nothrow_t&) throw();
 void operator delete (void* p) throw();
 void operator delete[] (void* p) throw();
 void operator delete (void* p, const char* file, int line) throw();

+ 1 - 1
gameplay/src/FileSystem.cpp

@@ -30,7 +30,7 @@ FILE* FileSystem::openFile(const char* path, const char* mode)
     fullPath += path;
 
     FILE* fp = fopen(fullPath.c_str(), mode);
-    
+
 // Win32 doesnt support a asset or bundle definitions.
 #ifdef WIN32
     if (fp == NULL)

+ 2 - 2
gameplay/src/Font.cpp

@@ -992,8 +992,8 @@ void Font::reverseLines(char* text)
 
         unsigned int textLength = strcspn(text, "\n");
 
-        std::string line = std::string(text, textLength);
-        std::string reversedLine = std::string(line.rbegin(), line.rend());
+        std::string line(text, textLength);
+        std::string reversedLine(line.rbegin(), line.rend());
         memcpy(text, reversedLine.c_str(), textLength);
 
         text += textLength;

+ 3 - 1
gameplay/src/Material.cpp

@@ -230,7 +230,9 @@ bool Material::loadPass(Technique* technique, Properties* passProperties)
         char* token = strtok((char*)defines, ";");
         while (token)
         {
-            define += "#define " + std::string(token) + "\n";
+            define += "#define ";
+            define += token;
+            define += "\n";
             token = strtok(NULL, ";");
         }
     }

+ 1 - 1
gameplay/src/PhysicsRigidBody.h

@@ -51,7 +51,7 @@ public:
         CollisionPair(PhysicsRigidBody* rbA, PhysicsRigidBody* rbB);
 
         /**
-         * Less than operator (needed for use as a key in std::map).
+         * Less than operator (needed for use as a key in map).
          * 
          * @param cp The collision pair to compare.
          * @return True if this pair is "less than" the given pair; false otherwise.

+ 1 - 1
gameplay/src/Texture.cpp

@@ -26,7 +26,7 @@ Texture::~Texture()
     // Remove ourself from the texture cache.
     if (_cached)
     {
-        std::vector<Texture*>::iterator itr = std::find(__textureCache.begin(), __textureCache.end(), this);
+        std::vector<Texture*>::iterator itr = find(__textureCache.begin(), __textureCache.end(), this);
         if (itr != __textureCache.end())
         {
             __textureCache.erase(itr);

+ 1 - 1
gameplay/src/VertexFormat.cpp

@@ -14,7 +14,7 @@ VertexFormat::VertexFormat() :
 VertexFormat::~VertexFormat()
 {
     // Remove from the vertex format cache.
-    std::vector<VertexFormat*>::iterator itr = std::find(__vertexFormatCache.begin(), __vertexFormatCache.end(), this);
+    std::vector<VertexFormat*>::iterator itr = find(__vertexFormatCache.begin(), __vertexFormatCache.end(), this);
     if (itr != __vertexFormatCache.end())
     {
         __vertexFormatCache.erase(itr);