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

Merge branch 'next' of https://github.com/blackberry-gaming/GamePlay into next-sgrenier

Conflicts:
	gameplay/gameplay.vcxproj.filters
	gameplay/src/Game.cpp
	gameplay/src/Game.inl
Steve Grenier пре 13 година
родитељ
комит
c35b92df90
100 измењених фајлова са 11282 додато и 387 уклоњено
  1. 98 67
      .gitignore
  2. 59 0
      gameplay-luagen/README.md
  3. 15 0
      gameplay-luagen/gameplay-api/xml/combine.xslt
  4. 832 0
      gameplay-luagen/gameplay-api/xml/compound.xsd
  5. 3 0
      gameplay-luagen/gameplay-api/xml/index.xml
  6. 66 0
      gameplay-luagen/gameplay-api/xml/index.xsd
  7. 1794 0
      gameplay-luagen/gameplay-luagen.doxyfile
  8. 20 0
      gameplay-luagen/gameplay-luagen.sln
  9. 108 0
      gameplay-luagen/gameplay-luagen.vcxproj
  10. 48 0
      gameplay-luagen/gameplay-luagen.vcxproj.filters
  11. 11 0
      gameplay-luagen/gameplay-luagen.vcxproj.user
  12. 258 0
      gameplay-luagen/gameplay-luagen.xcodeproj/project.pbxproj
  13. 113 0
      gameplay-luagen/gameplay-luagen.xcodeproj/xcshareddata/xcschemes/gameplay-luagen.xcscheme
  14. 2 0
      gameplay-luagen/generate-doxygen-xml.bat
  15. 87 0
      gameplay-luagen/src/Base.h
  16. 299 0
      gameplay-luagen/src/ClassBinding.cpp
  17. 51 0
      gameplay-luagen/src/ClassBinding.h
  18. 302 0
      gameplay-luagen/src/DebugNew.cpp
  19. 50 0
      gameplay-luagen/src/DebugNew.h
  20. 16 0
      gameplay-luagen/src/EnumBinding.h
  21. 988 0
      gameplay-luagen/src/FunctionBinding.cpp
  22. 165 0
      gameplay-luagen/src/FunctionBinding.h
  23. 1870 0
      gameplay-luagen/src/Generator.cpp
  24. 204 0
      gameplay-luagen/src/Generator.h
  25. 16 0
      gameplay-luagen/src/TypedefBinding.h
  26. 40 0
      gameplay-luagen/src/main.cpp
  27. 10 2
      gameplay-template/android/jni/template.Android.mk
  28. 9 9
      gameplay-template/gameplay-template.vcxproj
  29. 50 8
      gameplay-template/template.cproject
  30. 17 25
      gameplay.doxyfile
  31. 3 0
      gameplay.xcworkspace/contents.xcworkspacedata
  32. 38 4
      gameplay/.cproject
  33. 243 2
      gameplay/android/jni/Android.mk
  34. 309 4
      gameplay/gameplay.vcxproj
  35. 955 40
      gameplay/gameplay.vcxproj.filters
  36. 1237 8
      gameplay/gameplay.xcodeproj/project.pbxproj
  37. 3 3
      gameplay/res/shaders/colored-unlit.frag
  38. 1 1
      gameplay/res/shaders/textured.frag
  39. 41 1
      gameplay/src/AnimationClip.cpp
  40. 38 0
      gameplay/src/AnimationClip.h
  41. 1 0
      gameplay/src/AudioListener.h
  42. 11 1
      gameplay/src/Base.h
  43. 1 1
      gameplay/src/BoundingBox.cpp
  44. 0 8
      gameplay/src/BoundingSphere.h
  45. 2 2
      gameplay/src/Bundle.cpp
  46. 1 1
      gameplay/src/Bundle.h
  47. 14 5
      gameplay/src/Container.cpp
  48. 31 14
      gameplay/src/Container.h
  49. 29 16
      gameplay/src/Control.cpp
  50. 30 13
      gameplay/src/Control.h
  51. 29 0
      gameplay/src/Curve.cpp
  52. 0 14
      gameplay/src/Curve.h
  53. 0 36
      gameplay/src/Curve.inl
  54. 3 3
      gameplay/src/Effect.cpp
  55. 1 0
      gameplay/src/FileSystem.cpp
  56. 2 0
      gameplay/src/FileSystem.h
  57. 4 4
      gameplay/src/Font.cpp
  58. 4 4
      gameplay/src/Font.h
  59. 3 3
      gameplay/src/Form.cpp
  60. 1 1
      gameplay/src/Form.h
  61. 104 7
      gameplay/src/Game.cpp
  62. 37 1
      gameplay/src/Game.h
  63. 10 4
      gameplay/src/Game.inl
  64. 3 2
      gameplay/src/Gamepad.cpp
  65. 5 3
      gameplay/src/Gamepad.h
  66. 1 0
      gameplay/src/Image.h
  67. 2 2
      gameplay/src/Joystick.cpp
  68. 2 2
      gameplay/src/Joystick.h
  69. 2 2
      gameplay/src/Label.cpp
  70. 3 0
      gameplay/src/Light.h
  71. 3 3
      gameplay/src/Material.cpp
  72. 91 0
      gameplay/src/MaterialParameter.cpp
  73. 41 3
      gameplay/src/MaterialParameter.h
  74. 1 1
      gameplay/src/Mesh.cpp
  75. 1 1
      gameplay/src/Mesh.h
  76. 3 3
      gameplay/src/MeshBatch.cpp
  77. 4 4
      gameplay/src/MeshBatch.h
  78. 1 0
      gameplay/src/MeshPart.h
  79. 1 0
      gameplay/src/Node.cpp
  80. 4 1
      gameplay/src/Node.h
  81. 7 2
      gameplay/src/ParticleEmitter.cpp
  82. 1 0
      gameplay/src/Pass.h
  83. 6 3
      gameplay/src/PhysicsCharacter.cpp
  84. 3 1
      gameplay/src/PhysicsCharacter.h
  85. 42 2
      gameplay/src/PhysicsCollisionObject.cpp
  86. 29 3
      gameplay/src/PhysicsCollisionObject.h
  87. 1 0
      gameplay/src/PhysicsCollisionShape.cpp
  88. 12 3
      gameplay/src/PhysicsCollisionShape.h
  89. 128 18
      gameplay/src/PhysicsController.cpp
  90. 29 4
      gameplay/src/PhysicsController.h
  91. 1 1
      gameplay/src/PhysicsGhostObject.cpp
  92. 1 1
      gameplay/src/PhysicsGhostObject.h
  93. 11 3
      gameplay/src/PhysicsRigidBody.cpp
  94. 15 3
      gameplay/src/PhysicsRigidBody.h
  95. 1 0
      gameplay/src/Plane.cpp
  96. 1 1
      gameplay/src/Plane.h
  97. 3 0
      gameplay/src/Platform.h
  98. 12 1
      gameplay/src/PlatformAndroid.cpp
  99. 12 1
      gameplay/src/PlatformMacOSX.mm
  100. 12 1
      gameplay/src/PlatformQNX.cpp

+ 98 - 67
.gitignore

@@ -16,8 +16,8 @@ Thumbs.db
 /Device-Debug
 /Device-Coverage
 /Device-Profile
-/Device-Release
-/gameplay.xcworkspace/xcuserdata
+/Device-Release
+
 /gameplay/Debug
 /gameplay/DebugMem
 /gameplay/Release
@@ -27,12 +27,27 @@ Thumbs.db
 /gameplay/Device-Debug
 /gameplay/Device-Coverage
 /gameplay/Device-Profile
-/gameplay/Device-Release
-/gameplay/gameplay.xcodeproj/xcuserdata
+/gameplay/Device-Release
+/gameplay.xcworkspace/xcuserdata
+/gameplay/gameplay.xcodeproj/xcuserdata
+/gameplay/android/NUL
+/gameplay/android/proguard.cfg
+/gameplay/android/local.properties
+/gameplay/android/project.properties
+/gameplay/android/obj
+
+/gameplay-api/xml
+
 /gameplay-encoder/Debug
 /gameplay-encoder/Release
-/gameplay-encoder/gameplay-encoder.xcodeproj/xcuserdata
-/gameplay-internal
+/gameplay-encoder/gameplay-encoder.xcodeproj/xcuserdata
+
+/gameplay-luagen/Release
+/gameplay-luagen/Debug
+/gameplay-luagen/doxygen_entrydb_680.tmp
+/gameplay-luagen/doxygen_objdb_680.tmp
+/gameplay-luagen/xml
+
 /gameplay-samples/sample00-mesh/Debug
 /gameplay-samples/sample00-mesh/DebugMem
 /gameplay-samples/sample00-mesh/Release
@@ -45,7 +60,18 @@ Thumbs.db
 /gameplay-samples/sample00-mesh/Device-Release
 /gameplay-samples/sample00-mesh/res/shaders
 /gameplay-samples/sample00-mesh/res/logo_powered_white.png
-/gameplay-samples/sample00-mesh/sample00-mesh.xcodeproj/xcuserdata
+/gameplay-samples/sample00-mesh/sample00-mesh.xcodeproj/xcuserdata
+/gameplay-samples/sample00-mesh/android/src
+/gameplay-samples/sample00-mesh/android/assets
+/gameplay-samples/sample00-mesh/android/bin
+/gameplay-samples/sample00-mesh/android/gen
+/gameplay-samples/sample00-mesh/android/libs
+/gameplay-samples/sample00-mesh/android/obj
+/gameplay-samples/sample00-mesh/android/NUL
+/gameplay-samples/sample00-mesh/android/local.properties
+/gameplay-samples/sample00-mesh/android/proguard.cfg
+/gameplay-samples/sample00-mesh/android/project.properties
+
 /gameplay-samples/sample01-longboard/Debug
 /gameplay-samples/sample01-longboard/DebugMem
 /gameplay-samples/sample01-longboard/Release
@@ -58,7 +84,19 @@ Thumbs.db
 /gameplay-samples/sample01-longboard/Device-Release
 /gameplay-samples/sample01-longboard/res/shaders
 /gameplay-samples/sample01-longboard/res/logo_powered_white.png
-/gameplay-samples/sample01-longboard/sample01-longboard.xcodeproj/xcuserdata
+/gameplay-samples/sample01-longboard/sample01-longboard.xcodeproj/xcuserdata
+/gameplay-samples/sample01-longboard/NUL
+/gameplay-samples/sample01-longboard/android/NUL
+/gameplay-samples/sample01-longboard/android/src
+/gameplay-samples/sample01-longboard/android/assets
+/gameplay-samples/sample01-longboard/android/bin
+/gameplay-samples/sample01-longboard/android/gen
+/gameplay-samples/sample01-longboard/android/libs
+/gameplay-samples/sample01-longboard/android/obj
+/gameplay-samples/sample01-longboard/android/proguard.cfg
+/gameplay-samples/sample01-longboard/android/project.properties
+/gameplay-samples/sample01-longboard/android/local.properties
+
 /gameplay-samples/sample02-spaceship/Debug
 /gameplay-samples/sample02-spaceship/DebugMem
 /gameplay-samples/sample02-spaceship/Release
@@ -71,7 +109,18 @@ Thumbs.db
 /gameplay-samples/sample02-spaceship/Device-Release
 /gameplay-samples/sample02-spaceship/res/shaders
 /gameplay-samples/sample02-spaceship/res/logo_powered_white.png
-/gameplay-samples/sample02-spaceship/sample02-spaceship.xcodeproj/xcuserdata
+/gameplay-samples/sample02-spaceship/sample02-spaceship.xcodeproj/xcuserdata
+/gameplay-samples/sample02-spaceship/android/NUL
+/gameplay-samples/sample02-spaceship/android/project.properties
+/gameplay-samples/sample02-spaceship/android/assets
+/gameplay-samples/sample02-spaceship/android/bin
+/gameplay-samples/sample02-spaceship/android/gen
+/gameplay-samples/sample02-spaceship/android/libs
+/gameplay-samples/sample02-spaceship/android/obj
+/gameplay-samples/sample02-spaceship/android/src
+/gameplay-samples/sample02-spaceship/android/proguard.cfg
+/gameplay-samples/sample02-spaceship/android/local.properties
+
 /gameplay-samples/sample03-character/Debug
 /gameplay-samples/sample03-character/DebugMem
 /gameplay-samples/sample03-character/Release
@@ -84,7 +133,19 @@ Thumbs.db
 /gameplay-samples/sample03-character/Device-Release
 /gameplay-samples/sample03-character/res/shaders
 /gameplay-samples/sample03-character/res/logo_powered_white.png
-/gameplay-samples/sample03-character/sample03-character.xcodeproj/xcuserdata
+/gameplay-samples/sample03-character/sample03-character.xcodeproj/xcuserdata
+/gameplay-samples/sample03-character/android/project.properties
+/gameplay-samples/sample03-character/android/proguard.cfg
+/gameplay-samples/sample03-character/android/local.properties
+/gameplay-samples/sample03-character/android/src
+/gameplay-samples/sample03-character/android/assets
+/gameplay-samples/sample03-character/android/bin
+/gameplay-samples/sample03-character/android/gen
+/gameplay-samples/sample03-character/android/libs
+/gameplay-samples/sample03-character/android/obj
+/gameplay-samples/sample03-character/android/NUL
+/gameplay-samples/sample03-character/res/gamepad.xcf
+
 /gameplay-samples/sample04-particles/Debug
 /gameplay-samples/sample04-particles/DebugMem
 /gameplay-samples/sample04-particles/Release
@@ -98,65 +159,9 @@ Thumbs.db
 /gameplay-samples/sample04-particles/res/shaders
 /gameplay-samples/sample04-particles/res/logo_powered_white.png
 /gameplay-samples/sample04-particles/sample04-particles.xcodeproj/xcuserdata
-
-/gameplay-android/obj
-/gameplay-android/NUL
-/gameplay/android/NUL
-/gameplay/android/proguard.cfg
-/gameplay/android/local.properties
-/gameplay/android/project.properties
-/gameplay/android/obj
-/gameplay-samples/sample00-mesh/android/src
-/gameplay-samples/sample00-mesh/android/assets
-/gameplay-samples/sample00-mesh/android/bin
-/gameplay-samples/sample00-mesh/android/gen
-/gameplay-samples/sample00-mesh/android/libs
-/gameplay-samples/sample00-mesh/android/obj
-/gameplay-android/local.properties
-/gameplay-android/proguard.cfg
-/gameplay-android/project.properties
-/gameplay-samples/sample00-mesh/android/NUL
-/gameplay-samples/sample00-mesh/android/local.properties
-/gameplay-samples/sample00-mesh/android/proguard.cfg
-/gameplay-samples/sample00-mesh/android/project.properties
-/gameplay-samples/sample01-longboard/android/NUL
-/gameplay-samples/sample01-longboard/android/src
-/gameplay-samples/sample01-longboard/android/assets
-/gameplay-samples/sample01-longboard/android/bin
-/gameplay-samples/sample01-longboard/android/gen
-/gameplay-samples/sample01-longboard/android/libs
-/gameplay-samples/sample01-longboard/android/obj
-/gameplay-samples/sample01-longboard/android/project.properties
-/gameplay-samples/sample01-longboard/android/local.properties
-/gameplay-samples/sample02-spaceship/android/project.properties
-/gameplay-samples/sample02-spaceship/android/assets
-/gameplay-samples/sample02-spaceship/android/bin
-/gameplay-samples/sample02-spaceship/android/gen
-/gameplay-samples/sample02-spaceship/android/libs
-/gameplay-samples/sample02-spaceship/android/obj
-/gameplay-samples/sample02-spaceship/android/src
-/gameplay-samples/sample02-spaceship/android/proguard.cfg
-/gameplay-samples/sample02-spaceship/android/local.properties
-/gameplay-samples/sample03-character/android/project.properties
-/gameplay-samples/sample03-character/android/proguard.cfg
-/gameplay-samples/sample03-character/android/local.properties
-/gameplay-samples/sample01-longboard/android/proguard.cfg
-/gameplay-samples/sample02-spaceship/android/NUL
-/gameplay-samples/sample01-longboard/android/proguard.cfg
-/gameplay-samples/sample03-character/android/src
-/gameplay-samples/sample03-character/android/assets
-/gameplay-samples/sample03-character/android/bin
-/gameplay-samples/sample03-character/android/gen
-/gameplay-samples/sample03-character/android/libs
-/gameplay-samples/sample03-character/android/obj
-/gameplay-samples/sample03-character/android/NUL
-/gameplay-samples/sample01-longboard/NUL
-
-
 /gameplay-samples/sample04-particles/Device-Debug
 /gameplay-samples/sample04-particles/Debug
 /gameplay-samples/sample04-particles/DebugMem
-/gameplay-samples/sample03-character/res/gamepad.xcf
 /gameplay-samples/sample04-particles/android/src
 /gameplay-samples/sample04-particles/android/assets
 /gameplay-samples/sample04-particles/android/bin
@@ -165,4 +170,30 @@ Thumbs.db
 /gameplay-samples/sample04-particles/android/obj
 /gameplay-samples/sample04-particles/android/proguard.cfg
 /gameplay-samples/sample04-particles/android/local.properties
-/gameplay-samples/sample04-particles/android/project.properties
+/gameplay-samples/sample04-particles/android/project.properties
+
+/gameplay-samples/sample05-lua/Debug
+/gameplay-samples/sample05-lua/DebugMem
+/gameplay-samples/sample05-lua/Release
+/gameplay-samples/sample05-lua/Simulator
+/gameplay-samples/sample05-lua/Simulator-Coverage
+/gameplay-samples/sample05-lua/Simulator-Profile
+/gameplay-samples/sample05-lua/Device-Debug
+/gameplay-samples/sample05-lua/Device-Coverage
+/gameplay-samples/sample05-lua/Device-Profile
+/gameplay-samples/sample05-lua/Device-Release
+/gameplay-samples/sample05-lua/res/shaders
+/gameplay-samples/sample05-lua/res/logo_powered_white.png
+/gameplay-samples/sample05-lua/sample05-lua.xcodeproj/xcuserdata
+/gameplay-samples/sample05-lua/android/src
+/gameplay-samples/sample05-lua/android/assets
+/gameplay-samples/sample05-lua/android/bin
+/gameplay-samples/sample05-lua/android/gen
+/gameplay-samples/sample05-lua/android/libs
+/gameplay-samples/sample05-lua/android/obj
+/gameplay-samples/sample05-lua/android/NUL
+/gameplay-samples/sample05-lua/android/local.properties
+/gameplay-samples/sample05-lua/android/proguard.cfg
+/gameplay-samples/sample05-lua/android/project.properties
+
+/gameplay-internal

+ 59 - 0
gameplay-luagen/README.md

@@ -0,0 +1,59 @@
+## Usage
+To generate the Lua script bindings for gameplay, run the generate-doxygen-xml.bat (or .sh) script. Then, on Windows, open the gameplay-luagen Visual Studio solution and build and run the gameplay-luagen project. On Mac, open the gameplay-luagen XCode workspace and build and run the gameplay-luagen project.
+
+There are also prebuilt binaries in the gameplay/bin folder.
+
+
+## Tips for Using Lua with gameplay
+- On any function in gameplay that returns a pointer that is owned by the user calling that function (i.e. a create() function), add @script{create} as the last line of its doxygen comments.
+- On any function, variable, class, struct, enum, etc. that should not be accessible from Lua (except for things that are static to a .cpp file, which is already ignored), add @script{ignore} to its doxygen comments.
+- On any functions, variables, classes, structs, enums, etc. that are local to a .cpp file, declare them as static 1) because it is good practice and 2) so that Lua does not generate bindings for them.
+- To get printf/GP_WARN-like functionality using gameplay and Lua, use printError(string.format("...", ...)).
+- To do integer like comparisons or casts on a number variable x in Lua, use math.floor(x)
+- Make sure all your member function calls use ':' instead of '.'
+- Remember to access all gameplay variables, including static and global variables with '()' on the end of the name.
+- Primitive data type arrays and object arrays are both inefficient when created in Lua and passed to C++, so try to minimize this.
+- There is no reasonable way to unload a Lua script (one would have to parse the script completely to find all global function and variable names and then set those global table entries to nil and invoke the garbage collector).
+    - The recommended usage pattern is to put each script's variables and functions inside a table (see Lua technical note 7). i.e.
+
+    -- If you want to load the module at most once, add a line like this.
+    if Module then return end
+    
+    -- Declare the module Module.
+    Module = {}
+    
+    -- Declare a variable within the module.
+    Module.a = 47
+    
+    -- Declare a function within the module.
+    function Module.myFunc()
+       return Module.a + 17
+    end
+- Note: you can't pass an enum to a function that doesn't explicitly take an enum (i.e. Control::setTextColor, which takes an unsigned char). In these cases, you need to go look up the enum values and pass them directly.
+
+## Unsupported Features
+- operators
+- templates
+- variable arguments
+- Lua doesn't support as many types as C++ so if there are functions that overload on parameters with types that overlap in Lua, the overloading won't work properly (i.e. char, short, int, long, float, double and all corresponding unsigned variants overlap in Lua).
+
+### To Do List
+- Get Mac OS X and iOS working.
+- Fix hierarchy inheritance
+- Fix memory leaks in gameplay-luagen and in generated code.
+    * Add "@script{create}" to the appropriate gameplay functions.
+    * Add "@script{own}" to array parameters that are owned by the function or class they are passed to?
+- Add a global function that implements casting for use from Lua scripts (i.e. to downcast from a Control to a Button).
+
+### Future Feature List
+- Add support for users to generate bindings for their own classes.
+- Look into updating bindValue() to support binding to any Lua script function.
+
+
+## Disclaimer
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 
+INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 
+PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 
+OTHER DEALINGS IN THE SOFTWARE.

+ 15 - 0
gameplay-luagen/gameplay-api/xml/combine.xslt

@@ -0,0 +1,15 @@
+<!-- XSLT script to combine the generated output into a single file. 
+     If you have xsltproc you could use:
+     xsltproc combine.xslt index.xml >all.xml
+-->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+  <xsl:output method="xml" version="1.0" indent="no" standalone="yes" />
+  <xsl:template match="/">
+    <doxygen version="{doxygenindex/@version}">
+      <!-- Load all doxgen generated xml files -->
+      <xsl:for-each select="doxygenindex/compound">
+        <xsl:copy-of select="document( concat( @refid, '.xml' ) )/doxygen/*" />
+      </xsl:for-each>
+    </doxygen>
+  </xsl:template>
+</xsl:stylesheet>

+ 832 - 0
gameplay-luagen/gameplay-api/xml/compound.xsd

@@ -0,0 +1,832 @@
+<?xml version='1.0' encoding='utf-8' ?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+  <xsd:element name="doxygen" type="DoxygenType"/>
+
+  <!-- Complex types -->
+
+  <xsd:complexType name="DoxygenType">
+    <xsd:sequence maxOccurs="unbounded">
+      <xsd:element name="compounddef" type="compounddefType" minOccurs="0" />
+    </xsd:sequence>
+    <xsd:attribute name="version" type="DoxVersionNumber" use="required" />
+  </xsd:complexType>
+
+  <xsd:complexType name="compounddefType">
+    <xsd:sequence>
+      <xsd:element name="compoundname" type="xsd:string"/>
+      <xsd:element name="title" type="xsd:string" minOccurs="0" />
+      <xsd:element name="basecompoundref" type="compoundRefType" minOccurs="0" maxOccurs="unbounded" />
+      <xsd:element name="derivedcompoundref" type="compoundRefType" minOccurs="0" maxOccurs="unbounded" />
+      <xsd:element name="includes" type="incType" minOccurs="0" maxOccurs="unbounded" />
+      <xsd:element name="includedby" type="incType" minOccurs="0" maxOccurs="unbounded" />
+      <xsd:element name="incdepgraph" type="graphType" minOccurs="0" />
+      <xsd:element name="invincdepgraph" type="graphType" minOccurs="0" />
+      <xsd:element name="innerdir" type="refType" minOccurs="0" maxOccurs="unbounded" />
+      <xsd:element name="innerfile" type="refType" minOccurs="0" maxOccurs="unbounded" />
+      <xsd:element name="innerclass" type="refType" minOccurs="0" maxOccurs="unbounded" />
+      <xsd:element name="innernamespace" type="refType" minOccurs="0" maxOccurs="unbounded" />
+      <xsd:element name="innerpage" type="refType" minOccurs="0" maxOccurs="unbounded" />
+      <xsd:element name="innergroup" type="refType" minOccurs="0" maxOccurs="unbounded" />
+      <xsd:element name="templateparamlist" type="templateparamlistType" minOccurs="0" />
+      <xsd:element name="sectiondef" type="sectiondefType" minOccurs="0" maxOccurs="unbounded" />
+      <xsd:element name="briefdescription" type="descriptionType" minOccurs="0" />
+      <xsd:element name="detaileddescription" type="descriptionType" minOccurs="0" />
+      <xsd:element name="inheritancegraph" type="graphType" minOccurs="0" />
+      <xsd:element name="collaborationgraph" type="graphType" minOccurs="0" />
+      <xsd:element name="programlisting" type="listingType" minOccurs="0" />
+      <xsd:element name="location" type="locationType" minOccurs="0" />
+      <xsd:element name="listofallmembers" type="listofallmembersType" minOccurs="0" />
+    </xsd:sequence>
+    <xsd:attribute name="id" type="xsd:string" />
+    <xsd:attribute name="kind" type="DoxCompoundKind" />
+    <xsd:attribute name="prot" type="DoxProtectionKind" />
+  </xsd:complexType>
+
+  <xsd:complexType name="listofallmembersType">
+    <xsd:sequence>
+      <xsd:element name="member" type="memberRefType" minOccurs="0" maxOccurs="unbounded" />
+    </xsd:sequence>
+  </xsd:complexType>
+
+  <xsd:complexType name="memberRefType">
+    <xsd:sequence>
+      <xsd:element name="scope" />
+      <xsd:element name="name" />
+    </xsd:sequence>
+    <xsd:attribute name="refid" type="xsd:string" />
+    <xsd:attribute name="prot" type="DoxProtectionKind" />
+    <xsd:attribute name="virt" type="DoxVirtualKind" />
+    <xsd:attribute name="ambiguityscope" type="xsd:string" />
+  </xsd:complexType>
+
+  <xsd:complexType name="compoundRefType">
+    <xsd:simpleContent>
+      <xsd:extension base="xsd:string">
+        <xsd:attribute name="refid" type="xsd:string" use="optional" />
+        <xsd:attribute name="prot" type="DoxProtectionKind" />
+        <xsd:attribute name="virt" type="DoxVirtualKind" />
+      </xsd:extension>
+    </xsd:simpleContent>
+  </xsd:complexType>
+
+  <xsd:complexType name="reimplementType">
+    <xsd:simpleContent>
+      <xsd:extension base="xsd:string">
+        <xsd:attribute name="refid" type="xsd:string" />
+      </xsd:extension>
+    </xsd:simpleContent>
+  </xsd:complexType>
+
+  <xsd:complexType name="incType">
+    <xsd:simpleContent>
+      <xsd:extension base="xsd:string">
+        <xsd:attribute name="refid" type="xsd:string" />
+        <xsd:attribute name="local" type="DoxBool" />
+      </xsd:extension>
+    </xsd:simpleContent>
+  </xsd:complexType>
+
+  <xsd:complexType name="refType">
+    <xsd:simpleContent>
+      <xsd:extension base="xsd:string">
+        <xsd:attribute name="refid" type="xsd:string" />
+        <xsd:attribute name="prot" type="DoxProtectionKind" use="optional"/>
+      </xsd:extension>
+    </xsd:simpleContent>
+  </xsd:complexType>
+
+  <xsd:complexType name="refTextType">
+    <xsd:simpleContent>
+      <xsd:extension base="xsd:string">
+       <xsd:attribute name="refid" type="xsd:string" />
+       <xsd:attribute name="kindref" type="DoxRefKind" />
+       <xsd:attribute name="external" type="xsd:string" use="optional"/>
+       <xsd:attribute name="tooltip" type="xsd:string" use="optional"/>
+      </xsd:extension>
+    </xsd:simpleContent>
+  </xsd:complexType>
+
+  <xsd:complexType name="sectiondefType">
+    <xsd:sequence>
+      <xsd:element name="header" type="xsd:string" minOccurs="0" />
+      <xsd:element name="description" type="descriptionType" minOccurs="0" />
+      <xsd:element name="memberdef" type="memberdefType" maxOccurs="unbounded" />
+    </xsd:sequence>
+    <xsd:attribute name="kind" type="DoxSectionKind" />
+  </xsd:complexType>
+
+  <xsd:complexType name="memberdefType">
+    <xsd:sequence>
+      <xsd:element name="templateparamlist" type="templateparamlistType" minOccurs="0" />
+      <xsd:element name="type" type="linkedTextType" minOccurs="0" />
+      <xsd:element name="definition" minOccurs="0" />
+      <xsd:element name="argsstring" minOccurs="0" />
+      <xsd:element name="name" />
+      <xsd:element name="read" minOccurs="0" />
+      <xsd:element name="write" minOccurs="0" />
+      <xsd:element name="bitfield" minOccurs="0" />
+      <xsd:element name="reimplements" type="reimplementType" minOccurs="0" maxOccurs="unbounded" />
+      <xsd:element name="reimplementedby" type="reimplementType" minOccurs="0" maxOccurs="unbounded" />
+      <xsd:element name="param" type="paramType" minOccurs="0" maxOccurs="unbounded" />
+      <xsd:element name="enumvalue" type="enumvalueType" minOccurs="0" maxOccurs="unbounded" />
+      <xsd:element name="initializer" type="linkedTextType" minOccurs="0" />
+      <xsd:element name="exceptions" type="linkedTextType" minOccurs="0" />
+      <xsd:element name="briefdescription" type="descriptionType" minOccurs="0" />
+      <xsd:element name="detaileddescription" type="descriptionType" minOccurs="0" />
+      <xsd:element name="inbodydescription" type="descriptionType" minOccurs="0" />
+      <xsd:element name="location" type="locationType" />
+      <xsd:element name="references" type="referenceType" minOccurs="0" maxOccurs="unbounded" />
+      <xsd:element name="referencedby" type="referenceType" minOccurs="0" maxOccurs="unbounded" />
+    </xsd:sequence>
+    <xsd:attribute name="kind" type="DoxMemberKind" />
+    <xsd:attribute name="id" type="xsd:string" />
+    <xsd:attribute name="prot" type="DoxProtectionKind" />
+    <xsd:attribute name="static" type="DoxBool" />
+    <xsd:attribute name="const" type="DoxBool" />
+    <xsd:attribute name="explicit" type="DoxBool" />
+    <xsd:attribute name="inline" type="DoxBool" />
+    <xsd:attribute name="virt" type="DoxVirtualKind" />
+    <xsd:attribute name="volatile" type="DoxBool" />
+    <xsd:attribute name="mutable" type="DoxBool" />
+    <!-- Qt property -->
+    <xsd:attribute name="readable" type="DoxBool" use="optional"/>
+    <xsd:attribute name="writable" type="DoxBool" use="optional"/>
+    <!-- C++/CLI variable -->
+    <xsd:attribute name="initonly" type="DoxBool" use="optional"/>
+    <!-- C++/CLI and C# property -->
+    <xsd:attribute name="settable" type="DoxBool" use="optional"/>
+    <xsd:attribute name="gettable" type="DoxBool" use="optional"/>
+    <!-- C++/CLI function -->
+    <xsd:attribute name="final" type="DoxBool" use="optional"/>
+    <xsd:attribute name="sealed" type="DoxBool" use="optional"/>
+    <xsd:attribute name="new" type="DoxBool" use="optional"/>
+    <!-- C++/CLI event -->
+    <xsd:attribute name="add" type="DoxBool" use="optional"/>
+    <xsd:attribute name="remove" type="DoxBool" use="optional"/>
+    <xsd:attribute name="raise" type="DoxBool" use="optional"/>
+    <!-- Objective-C 2.0 protocol method -->
+    <xsd:attribute name="optional" type="DoxBool" use="optional"/>
+    <xsd:attribute name="required" type="DoxBool" use="optional"/>
+    <!-- Objective-C 2.0 property accessor -->
+    <xsd:attribute name="accessor" type="DoxAccessor" use="optional"/>
+  </xsd:complexType>
+
+  <xsd:complexType name="descriptionType" mixed="true">
+    <xsd:sequence>
+      <xsd:element name="title" type="xsd:string" minOccurs="0"/>	    
+      <xsd:element name="para" type="docParaType" minOccurs="0" maxOccurs="unbounded" />
+      <xsd:element name="sect1" type="docSect1Type" minOccurs="0" maxOccurs="unbounded" />
+      <xsd:element name="internal" type="docInternalType" minOccurs="0" />
+    </xsd:sequence>
+  </xsd:complexType>
+
+  <xsd:complexType name="enumvalueType" mixed="true">
+    <xsd:sequence>
+      <xsd:element name="name" />
+      <xsd:element name="initializer" type="linkedTextType" minOccurs="0" />
+      <xsd:element name="briefdescription" type="descriptionType" minOccurs="0" />
+      <xsd:element name="detaileddescription" type="descriptionType" minOccurs="0" />
+    </xsd:sequence>
+    <xsd:attribute name="id" type="xsd:string" />
+    <xsd:attribute name="prot" type="DoxProtectionKind" />
+  </xsd:complexType>
+
+  <xsd:complexType name="templateparamlistType">
+    <xsd:sequence>
+      <xsd:element name="param" type="paramType" minOccurs="0" maxOccurs="unbounded" />
+    </xsd:sequence>
+  </xsd:complexType>
+
+  <xsd:complexType name="paramType">
+    <xsd:sequence>
+      <xsd:element name="type" type="linkedTextType" minOccurs="0" />
+      <xsd:element name="declname" minOccurs="0" />
+      <xsd:element name="defname" minOccurs="0" />
+      <xsd:element name="array" minOccurs="0" />
+      <xsd:element name="defval" type="linkedTextType" minOccurs="0" />
+      <xsd:element name="briefdescription" type="descriptionType" minOccurs="0" />
+    </xsd:sequence>
+  </xsd:complexType>
+
+  <xsd:complexType name="linkedTextType" mixed="true">
+    <xsd:sequence>
+    <xsd:element name="ref" type="refTextType" minOccurs="0" maxOccurs="unbounded" />
+    </xsd:sequence>
+  </xsd:complexType>
+
+  <xsd:complexType name="graphType">
+    <xsd:sequence>
+      <xsd:element name="node" type="nodeType" maxOccurs="unbounded" />
+    </xsd:sequence>
+  </xsd:complexType>
+
+  <xsd:complexType name="nodeType">
+    <xsd:sequence>
+      <xsd:element name="label" />
+      <xsd:element name="link" type="linkType" minOccurs="0" />
+      <xsd:element name="childnode" type="childnodeType" minOccurs="0" maxOccurs="unbounded" />
+    </xsd:sequence>
+    <xsd:attribute name="id" type="xsd:string" />
+  </xsd:complexType>
+
+  <xsd:complexType name="childnodeType">
+    <xsd:sequence>
+      <xsd:element name="edgelabel" minOccurs="0" maxOccurs="unbounded"/>
+    </xsd:sequence>
+    <xsd:attribute name="refid" type="xsd:string" />
+    <xsd:attribute name="relation" type="DoxGraphRelation" />
+  </xsd:complexType>
+
+  <xsd:complexType name="linkType">
+    <xsd:attribute name="refid" type="xsd:string" />
+    <xsd:attribute name="external" type="xsd:string" use="optional"/>
+  </xsd:complexType>
+
+  <xsd:complexType name="listingType">
+    <xsd:sequence>
+      <xsd:element name="codeline" type="codelineType" minOccurs="0" maxOccurs="unbounded" />
+    </xsd:sequence>
+  </xsd:complexType>
+
+  <xsd:complexType name="codelineType">
+    <xsd:sequence>
+      <xsd:element name="highlight" type="highlightType" minOccurs="0" maxOccurs="unbounded" />
+    </xsd:sequence>
+    <xsd:attribute name="lineno" type="xsd:integer" />
+    <xsd:attribute name="refid" type="xsd:string" />
+    <xsd:attribute name="refkind" type="DoxRefKind" />
+    <xsd:attribute name="external" type="DoxBool" />
+  </xsd:complexType>
+
+  <xsd:complexType name="highlightType" mixed="true">
+    <xsd:choice minOccurs="0" maxOccurs="unbounded">
+      <xsd:element name="sp" />
+      <xsd:element name="ref" type="refTextType" />
+    </xsd:choice>
+    <xsd:attribute name="class" type="DoxHighlightClass" />
+  </xsd:complexType>
+
+  <xsd:complexType name="referenceType" mixed="true">
+    <xsd:attribute name="refid" type="xsd:string" />
+    <xsd:attribute name="compoundref" type="xsd:string" use="optional" />
+    <xsd:attribute name="startline" type="xsd:integer" />
+    <xsd:attribute name="endline" type="xsd:integer" />
+  </xsd:complexType>
+
+  <xsd:complexType name="locationType">
+    <xsd:attribute name="file" type="xsd:string" />
+    <xsd:attribute name="line" type="xsd:integer" />
+    <xsd:attribute name="bodyfile" type="xsd:string" />
+    <xsd:attribute name="bodystart" type="xsd:integer" />
+    <xsd:attribute name="bodyend" type="xsd:integer" />
+  </xsd:complexType>
+
+  <xsd:complexType name="docSect1Type" mixed="true">
+    <xsd:sequence>
+      <xsd:element name="title" type="xsd:string" />	    
+      <xsd:element name="para" type="docParaType" minOccurs="0" maxOccurs="unbounded" />
+      <xsd:element name="sect2" type="docSect2Type" minOccurs="0" maxOccurs="unbounded" />
+      <xsd:element name="internal" type="docInternalS1Type" minOccurs="0" />
+    </xsd:sequence>
+    <xsd:attribute name="id" type="xsd:string" />
+  </xsd:complexType>
+
+  <xsd:complexType name="docSect2Type" mixed="true">
+    <xsd:sequence>
+      <xsd:element name="title" type="xsd:string" />	    
+      <xsd:element name="para" type="docParaType" minOccurs="0" maxOccurs="unbounded" />
+      <xsd:element name="sect3" type="docSect3Type" minOccurs="0" maxOccurs="unbounded" />
+      <xsd:element name="internal" type="docInternalS2Type" minOccurs="0" />
+    </xsd:sequence>
+    <xsd:attribute name="id" type="xsd:string" />
+  </xsd:complexType>
+
+  <xsd:complexType name="docSect3Type" mixed="true">
+    <xsd:sequence>
+      <xsd:element name="title" type="xsd:string" />	    
+      <xsd:element name="para" type="docParaType" minOccurs="0" maxOccurs="unbounded" />
+      <xsd:element name="sect4" type="docSect4Type" minOccurs="0" maxOccurs="unbounded" />
+      <xsd:element name="internal" type="docInternalS3Type" minOccurs="0" />
+    </xsd:sequence>
+    <xsd:attribute name="id" type="xsd:string" />
+  </xsd:complexType>
+
+  <xsd:complexType name="docSect4Type" mixed="true">
+    <xsd:sequence>
+      <xsd:element name="title" type="xsd:string" />	    
+      <xsd:element name="para" type="docParaType" minOccurs="0" maxOccurs="unbounded" />
+      <xsd:element name="internal" type="docInternalS4Type" minOccurs="0" />
+    </xsd:sequence>
+    <xsd:attribute name="id" type="xsd:string" />
+  </xsd:complexType>
+
+  <xsd:complexType name="docInternalType" mixed="true">
+    <xsd:sequence>
+      <xsd:element name="para"  type="docParaType"  minOccurs="0" maxOccurs="unbounded" />
+      <xsd:element name="sect1" type="docSect1Type" minOccurs="0" maxOccurs="unbounded" />
+    </xsd:sequence>
+  </xsd:complexType>
+
+  <xsd:complexType name="docInternalS1Type" mixed="true">
+    <xsd:sequence>
+      <xsd:element name="para"  type="docParaType"  minOccurs="0" maxOccurs="unbounded" />
+      <xsd:element name="sect2" type="docSect2Type" minOccurs="0" maxOccurs="unbounded" />
+    </xsd:sequence>
+  </xsd:complexType>
+
+  <xsd:complexType name="docInternalS2Type" mixed="true">
+    <xsd:sequence>
+      <xsd:element name="para"  type="docParaType"  minOccurs="0" maxOccurs="unbounded" />
+      <xsd:element name="sect3" type="docSect3Type" minOccurs="0" maxOccurs="unbounded" />
+    </xsd:sequence>
+  </xsd:complexType>
+
+  <xsd:complexType name="docInternalS3Type" mixed="true">
+    <xsd:sequence>
+      <xsd:element name="para"  type="docParaType"  minOccurs="0" maxOccurs="unbounded" />
+      <xsd:element name="sect3" type="docSect4Type" minOccurs="0" maxOccurs="unbounded" />
+    </xsd:sequence>
+  </xsd:complexType>
+
+  <xsd:complexType name="docInternalS4Type" mixed="true">
+    <xsd:sequence>
+      <xsd:element name="para"  type="docParaType"  minOccurs="0" maxOccurs="unbounded" />
+    </xsd:sequence>
+  </xsd:complexType>
+ 
+  <xsd:group name="docTitleCmdGroup">
+    <xsd:choice>
+      <xsd:element name="ulink" type="docURLLink" />
+      <xsd:element name="bold" type="docMarkupType" />
+      <xsd:element name="emphasis" type="docMarkupType" />
+      <xsd:element name="computeroutput" type="docMarkupType" />
+      <xsd:element name="subscript" type="docMarkupType" />
+      <xsd:element name="superscript" type="docMarkupType" />
+      <xsd:element name="center" type="docMarkupType" />
+      <xsd:element name="small" type="docMarkupType" />
+      <xsd:element name="htmlonly" type="xsd:string" />
+      <xsd:element name="manonly" type="xsd:string" />
+      <xsd:element name="xmlonly" type="xsd:string" />
+      <xsd:element name="rtfonly" type="xsd:string" />
+      <xsd:element name="latexonly" type="xsd:string" />
+      <xsd:element name="dot" type="xsd:string" />
+      <xsd:element name="anchor" type="docAnchorType" />
+      <xsd:element name="formula" type="docFormulaType" />
+      <xsd:element name="ref" type="docRefTextType" />
+      <xsd:element name="copy" type="docEmptyType" />
+      <xsd:element name="trademark" type="docEmptyType" />
+      <xsd:element name="registered" type="docEmptyType" />
+      <xsd:element name="lsquo" type="docEmptyType" />
+      <xsd:element name="rsquo" type="docEmptyType" />
+      <xsd:element name="ldquo" type="docEmptyType" />
+      <xsd:element name="rdquo" type="docEmptyType" />
+      <xsd:element name="ndash" type="docEmptyType" />
+      <xsd:element name="mdash" type="docEmptyType" />
+      <xsd:element name="umlaut" type="docCharType" />
+      <xsd:element name="acute" type="docCharType" />
+      <xsd:element name="grave" type="docCharType" />
+      <xsd:element name="circ" type="docCharType" />
+      <xsd:element name="slash" type="docCharType" />
+      <xsd:element name="tilde" type="docCharType" />
+      <xsd:element name="cedil" type="docCharType" />
+      <xsd:element name="ring" type="docCharType" />
+      <xsd:element name="szlig" type="docEmptyType" />
+      <xsd:element name="nonbreakablespace" type="docEmptyType" />
+    </xsd:choice>
+  </xsd:group>
+
+  <xsd:complexType name="docTitleType" mixed="true">
+    <xsd:group ref="docTitleCmdGroup" minOccurs="0" maxOccurs="unbounded" />
+  </xsd:complexType>
+
+  <xsd:group name="docCmdGroup">
+    <xsd:choice>
+      <xsd:group ref="docTitleCmdGroup"/>
+      <xsd:element name="linebreak" type="docEmptyType" />
+      <xsd:element name="hruler" type="docEmptyType" />
+      <xsd:element name="preformatted" type="docMarkupType" />
+      <xsd:element name="programlisting" type="listingType" />
+      <xsd:element name="verbatim" type="xsd:string" />
+      <xsd:element name="indexentry" type="docIndexEntryType" />
+      <xsd:element name="orderedlist" type="docListType" />
+      <xsd:element name="itemizedlist" type="docListType" />
+      <xsd:element name="simplesect" type="docSimpleSectType" />
+      <xsd:element name="title" type="docTitleType" />
+      <xsd:element name="variablelist" type="docVariableListType" />
+      <xsd:element name="table" type="docTableType" />
+      <xsd:element name="heading" type="docHeadingType" />
+      <xsd:element name="image" type="docImageType" />
+      <xsd:element name="dotfile" type="docDotFileType" />
+      <xsd:element name="toclist" type="docTocListType" />
+      <xsd:element name="language" type="docLanguageType" />
+      <xsd:element name="parameterlist" type="docParamListType" />
+      <xsd:element name="xrefsect" type="docXRefSectType" />
+      <xsd:element name="copydoc" type="docCopyType" />
+      <xsd:element name="blockquote" type="docBlockQuoteType" />
+    </xsd:choice>
+  </xsd:group>
+
+  <xsd:complexType name="docParaType" mixed="true">
+    <xsd:group ref="docCmdGroup" minOccurs="0" maxOccurs="unbounded" />
+  </xsd:complexType>
+
+  <xsd:complexType name="docMarkupType" mixed="true">
+    <xsd:group ref="docCmdGroup" minOccurs="0" maxOccurs="unbounded" />
+  </xsd:complexType>
+
+  <xsd:complexType name="docURLLink" mixed="true">
+    <xsd:group ref="docTitleCmdGroup" minOccurs="0" maxOccurs="unbounded" />
+    <xsd:attribute name="url" type="xsd:string" />
+  </xsd:complexType>
+
+  <xsd:complexType name="docAnchorType" mixed="true">
+    <xsd:attribute name="id" type="xsd:string" />
+  </xsd:complexType>
+
+  <xsd:complexType name="docFormulaType" mixed="true">
+    <xsd:attribute name="id" type="xsd:string" />
+  </xsd:complexType>
+
+  <xsd:complexType name="docIndexEntryType">
+    <xsd:sequence>
+      <xsd:element name="primaryie" type="xsd:string" />
+      <xsd:element name="secondaryie" type="xsd:string" />
+    </xsd:sequence>
+  </xsd:complexType>
+
+  <xsd:complexType name="docListType">
+    <xsd:sequence>
+      <xsd:element name="listitem" type="docListItemType" maxOccurs="unbounded" />
+    </xsd:sequence>
+  </xsd:complexType>
+
+  <xsd:complexType name="docListItemType">
+    <xsd:sequence>
+      <xsd:element name="para" type="docParaType" minOccurs="0" maxOccurs="unbounded" />
+    </xsd:sequence>
+  </xsd:complexType>
+
+  <xsd:complexType name="docSimpleSectType">
+    <xsd:sequence>
+      <xsd:element name="title" type="docTitleType" minOccurs="0" />
+      <xsd:sequence minOccurs="0" maxOccurs="unbounded">
+        <xsd:element name="para" type="docParaType" minOccurs="1" maxOccurs="unbounded" />
+        <xsd:element name="simplesectsep" type="docEmptyType" minOccurs="0"/>
+      </xsd:sequence>
+    </xsd:sequence>
+    <xsd:attribute name="kind" type="DoxSimpleSectKind" />
+  </xsd:complexType>
+
+  <xsd:complexType name="docVarListEntryType">
+    <xsd:sequence>
+      <xsd:element name="term" type="docTitleType" />
+    </xsd:sequence>
+  </xsd:complexType>
+
+  <xsd:group name="docVariableListGroup">
+    <xsd:sequence>
+      <xsd:element name="varlistentry" type="docVarListEntryType" />
+      <xsd:element name="listitem" type="docListItemType" />
+    </xsd:sequence>
+  </xsd:group>
+
+  <xsd:complexType name="docVariableListType">
+    <xsd:sequence>
+      <xsd:group ref="docVariableListGroup" maxOccurs="unbounded" />
+    </xsd:sequence>
+  </xsd:complexType>
+
+  <xsd:complexType name="docRefTextType" mixed="true">
+    <xsd:group ref="docTitleCmdGroup" minOccurs="0" maxOccurs="unbounded" />
+    <xsd:attribute name="refid" type="xsd:string" />
+    <xsd:attribute name="kindref" type="DoxRefKind" />
+    <xsd:attribute name="external" type="xsd:string" />
+  </xsd:complexType>
+
+  <xsd:complexType name="docTableType">
+    <xsd:sequence>
+      <xsd:element name="row" type="docRowType" minOccurs="0" maxOccurs="unbounded" />
+      <xsd:element name="caption" type="docCaptionType" minOccurs="0" />
+    </xsd:sequence>
+    <xsd:attribute name="rows" type="xsd:integer" />
+    <xsd:attribute name="cols" type="xsd:integer" />
+  </xsd:complexType>
+
+  <xsd:complexType name="docRowType">
+    <xsd:sequence>
+      <xsd:element name="entry" type="docEntryType" minOccurs="0" maxOccurs="unbounded" />
+    </xsd:sequence>
+  </xsd:complexType>
+
+  <xsd:complexType name="docEntryType">
+    <xsd:sequence>
+      <xsd:element name="para" type="docParaType" minOccurs="0" maxOccurs="unbounded" />
+    </xsd:sequence>
+    <xsd:attribute name="thead" type="DoxBool" />
+  </xsd:complexType>
+
+  <xsd:complexType name="docCaptionType" mixed="true">
+    <xsd:group ref="docTitleCmdGroup" minOccurs="0" maxOccurs="unbounded" />
+  </xsd:complexType>
+
+  <xsd:complexType name="docHeadingType" mixed="true">
+    <xsd:group ref="docTitleCmdGroup" minOccurs="0" maxOccurs="unbounded" />
+    <xsd:attribute name="level" type="xsd:integer" /> <!-- todo: range 1-6 -->
+  </xsd:complexType>
+
+  <xsd:complexType name="docImageType" mixed="true">
+    <xsd:group ref="docTitleCmdGroup" minOccurs="0" maxOccurs="unbounded" />
+    <xsd:attribute name="type" type="DoxImageKind" /> 
+    <xsd:attribute name="name" type="xsd:string" /> 
+    <xsd:attribute name="width" type="xsd:string" /> 
+    <xsd:attribute name="height" type="xsd:string" /> 
+  </xsd:complexType>
+
+  <xsd:complexType name="docDotFileType" mixed="true">
+    <xsd:group ref="docTitleCmdGroup" minOccurs="0" maxOccurs="unbounded" />
+    <xsd:attribute name="name" type="xsd:string" /> 
+  </xsd:complexType>
+
+  <xsd:complexType name="docTocItemType" mixed="true">
+    <xsd:group ref="docTitleCmdGroup" minOccurs="0" maxOccurs="unbounded" />
+    <xsd:attribute name="id" type="xsd:string" /> 
+  </xsd:complexType>
+
+  <xsd:complexType name="docTocListType">
+    <xsd:sequence>
+      <xsd:element name="tocitem" type="docTocItemType" minOccurs="0" maxOccurs="unbounded" />
+    </xsd:sequence>
+  </xsd:complexType>
+
+  <xsd:complexType name="docLanguageType">
+    <xsd:sequence>
+      <xsd:element name="para" type="docParaType" minOccurs="0" maxOccurs="unbounded" />
+    </xsd:sequence>
+    <xsd:attribute name="langid" type="xsd:string" /> 
+  </xsd:complexType>
+
+  <xsd:complexType name="docParamListType">
+    <xsd:sequence>
+      <xsd:element name="parameteritem" type="docParamListItem" minOccurs="0" maxOccurs="unbounded" />
+    </xsd:sequence>
+    <xsd:attribute name="kind" type="DoxParamListKind" /> 
+  </xsd:complexType>
+
+  <xsd:complexType name="docParamListItem">
+    <xsd:sequence>
+      <xsd:element name="parameternamelist" type="docParamNameList" minOccurs="0" maxOccurs="unbounded" />
+      <xsd:element name="parameterdescription" type="descriptionType" />
+    </xsd:sequence>
+  </xsd:complexType>
+
+  <xsd:complexType name="docParamNameList">
+    <xsd:sequence>
+      <xsd:element name="parametertype" type="docParamType" minOccurs="0" maxOccurs="unbounded" />
+      <xsd:element name="parametername" type="docParamName" minOccurs="0" maxOccurs="unbounded" />
+    </xsd:sequence>
+  </xsd:complexType>
+
+  <xsd:complexType name="docParamType" mixed="true">
+    <xsd:sequence>
+      <xsd:element name="ref" type="refTextType" minOccurs="0" maxOccurs="1" />
+    </xsd:sequence>
+  </xsd:complexType>
+
+  <xsd:complexType name="docParamName" mixed="true">
+    <xsd:sequence>
+      <xsd:element name="ref" type="refTextType" minOccurs="0" maxOccurs="1" />
+    </xsd:sequence>
+    <xsd:attribute name="direction" type="DoxParamDir" use="optional" />
+  </xsd:complexType>
+
+  <xsd:complexType name="docXRefSectType">
+    <xsd:sequence>
+      <xsd:element name="xreftitle" type="xsd:string" minOccurs="0" maxOccurs="unbounded" />
+      <xsd:element name="xrefdescription" type="descriptionType" />
+    </xsd:sequence>
+    <xsd:attribute name="id" type="xsd:string" /> 
+  </xsd:complexType>
+
+  <xsd:complexType name="docCopyType">
+    <xsd:sequence>
+      <xsd:element name="para" type="docParaType" minOccurs="0" maxOccurs="unbounded" />
+      <xsd:element name="sect1" type="docSect1Type" minOccurs="0" maxOccurs="unbounded" />
+      <xsd:element name="internal" type="docInternalType" minOccurs="0" />
+    </xsd:sequence>
+    <xsd:attribute name="link" type="xsd:string" /> 
+  </xsd:complexType>
+
+  <xsd:complexType name="docBlockQuoteType">
+    <xsd:sequence>
+      <xsd:element name="para" type="docParaType" minOccurs="0" maxOccurs="unbounded" />
+    </xsd:sequence>
+  </xsd:complexType>
+
+  <xsd:complexType name="docCharType">
+    <xsd:attribute name="char" type="DoxCharRange"/> 
+  </xsd:complexType>
+
+  <xsd:complexType name="docEmptyType"/>
+
+  <!-- Simple types -->
+
+  <xsd:simpleType name="DoxBool">
+    <xsd:restriction base="xsd:string">
+      <xsd:enumeration value="yes" />
+      <xsd:enumeration value="no" />
+    </xsd:restriction>
+  </xsd:simpleType>
+
+  <xsd:simpleType name="DoxGraphRelation">
+    <xsd:restriction base="xsd:string">
+      <xsd:enumeration value="include" />
+      <xsd:enumeration value="usage" />
+      <xsd:enumeration value="template-instance" />
+      <xsd:enumeration value="public-inheritance" />
+      <xsd:enumeration value="protected-inheritance" />
+      <xsd:enumeration value="private-inheritance" />
+    </xsd:restriction>
+  </xsd:simpleType>
+
+  <xsd:simpleType name="DoxRefKind">
+    <xsd:restriction base="xsd:string">
+      <xsd:enumeration value="compound" />
+      <xsd:enumeration value="member" />
+    </xsd:restriction>
+  </xsd:simpleType>
+
+  <xsd:simpleType name="DoxMemberKind">
+    <xsd:restriction base="xsd:string">
+      <xsd:enumeration value="define" />
+      <xsd:enumeration value="property" />
+      <xsd:enumeration value="event" />
+      <xsd:enumeration value="variable" />
+      <xsd:enumeration value="typedef" />
+      <xsd:enumeration value="enum" />
+      <xsd:enumeration value="function" />
+      <xsd:enumeration value="signal" />
+      <xsd:enumeration value="prototype" />
+      <xsd:enumeration value="friend" />
+      <xsd:enumeration value="dcop" />
+      <xsd:enumeration value="slot" />
+    </xsd:restriction>
+  </xsd:simpleType>
+
+  <xsd:simpleType name="DoxProtectionKind">
+    <xsd:restriction base="xsd:string">
+      <xsd:enumeration value="public" />
+      <xsd:enumeration value="protected" />
+      <xsd:enumeration value="private" />
+      <xsd:enumeration value="package" />
+    </xsd:restriction>
+  </xsd:simpleType>
+
+  <xsd:simpleType name="DoxVirtualKind">
+    <xsd:restriction base="xsd:string">
+      <xsd:enumeration value="non-virtual" />
+      <xsd:enumeration value="virtual" />
+      <xsd:enumeration value="pure-virtual" />
+    </xsd:restriction>
+  </xsd:simpleType>
+
+  <xsd:simpleType name="DoxCompoundKind">
+    <xsd:restriction base="xsd:string">
+      <xsd:enumeration value="class" />
+      <xsd:enumeration value="struct" />
+      <xsd:enumeration value="union" />
+      <xsd:enumeration value="interface" />
+      <xsd:enumeration value="protocol" />
+      <xsd:enumeration value="category" />
+      <xsd:enumeration value="exception" />
+      <xsd:enumeration value="file" />
+      <xsd:enumeration value="namespace" />
+      <xsd:enumeration value="group" />
+      <xsd:enumeration value="page" />
+      <xsd:enumeration value="example" />
+      <xsd:enumeration value="dir" />
+    </xsd:restriction>
+  </xsd:simpleType>
+
+  <xsd:simpleType name="DoxSectionKind">
+    <xsd:restriction base="xsd:string">
+      <xsd:enumeration value="user-defined" />
+      <xsd:enumeration value="public-type" />
+      <xsd:enumeration value="public-func" />
+      <xsd:enumeration value="public-attrib" />
+      <xsd:enumeration value="public-slot" />
+      <xsd:enumeration value="signal" />
+      <xsd:enumeration value="dcop-func" />
+      <xsd:enumeration value="property" />
+      <xsd:enumeration value="event" />
+      <xsd:enumeration value="public-static-func" />
+      <xsd:enumeration value="public-static-attrib" />
+      <xsd:enumeration value="protected-type" />
+      <xsd:enumeration value="protected-func" />
+      <xsd:enumeration value="protected-attrib" />
+      <xsd:enumeration value="protected-slot" />
+      <xsd:enumeration value="protected-static-func" />
+      <xsd:enumeration value="protected-static-attrib" />
+      <xsd:enumeration value="package-type" />
+      <xsd:enumeration value="package-func" />
+      <xsd:enumeration value="package-attrib" />
+      <xsd:enumeration value="package-static-func" />
+      <xsd:enumeration value="package-static-attrib" />
+      <xsd:enumeration value="private-type" />
+      <xsd:enumeration value="private-func" />
+      <xsd:enumeration value="private-attrib" />
+      <xsd:enumeration value="private-slot" />
+      <xsd:enumeration value="private-static-func" />
+      <xsd:enumeration value="private-static-attrib" />
+      <xsd:enumeration value="friend" />
+      <xsd:enumeration value="related" />
+      <xsd:enumeration value="define" />
+      <xsd:enumeration value="prototype" />
+      <xsd:enumeration value="typedef" />
+      <xsd:enumeration value="enum" />
+      <xsd:enumeration value="func" />
+      <xsd:enumeration value="var" />
+    </xsd:restriction>
+  </xsd:simpleType>
+
+  <xsd:simpleType name="DoxHighlightClass">
+    <xsd:restriction base="xsd:string">
+      <xsd:enumeration value="comment" />
+      <xsd:enumeration value="normal" />
+      <xsd:enumeration value="preprocessor" />
+      <xsd:enumeration value="keyword" />
+      <xsd:enumeration value="keywordtype" />
+      <xsd:enumeration value="keywordflow" />
+      <xsd:enumeration value="stringliteral" />
+      <xsd:enumeration value="charliteral" />
+    </xsd:restriction>
+  </xsd:simpleType>
+
+  <xsd:simpleType name="DoxSimpleSectKind">
+    <xsd:restriction base="xsd:string">
+      <xsd:enumeration value="see" />
+      <xsd:enumeration value="return" />
+      <xsd:enumeration value="author" />
+      <xsd:enumeration value="authors" />
+      <xsd:enumeration value="version" />
+      <xsd:enumeration value="since" />
+      <xsd:enumeration value="date" />
+      <xsd:enumeration value="note" />
+      <xsd:enumeration value="warning" />
+      <xsd:enumeration value="pre" />
+      <xsd:enumeration value="post" />
+      <xsd:enumeration value="copyright" />
+      <xsd:enumeration value="invariant" />
+      <xsd:enumeration value="remark" />
+      <xsd:enumeration value="attention" />
+      <xsd:enumeration value="par" />
+      <xsd:enumeration value="rcs" />
+    </xsd:restriction>
+  </xsd:simpleType>
+
+  <xsd:simpleType name="DoxVersionNumber">
+    <xsd:restriction base="xsd:string">
+      <xsd:pattern value="\d+\.\d+.*" />
+    </xsd:restriction>
+  </xsd:simpleType>
+
+  <xsd:simpleType name="DoxImageKind">
+    <xsd:restriction base="xsd:string">
+      <xsd:enumeration value="html" />
+      <xsd:enumeration value="latex" />
+      <xsd:enumeration value="rtf" />
+    </xsd:restriction>
+  </xsd:simpleType>
+
+  <xsd:simpleType name="DoxParamListKind">
+    <xsd:restriction base="xsd:string">
+      <xsd:enumeration value="param" />
+      <xsd:enumeration value="retval" />
+      <xsd:enumeration value="exception" />
+      <xsd:enumeration value="templateparam" />
+    </xsd:restriction>
+  </xsd:simpleType>
+
+  <xsd:simpleType name="DoxCharRange">
+    <xsd:restriction base="xsd:string">
+      <xsd:pattern value="[aeiouncAEIOUNC]" />
+    </xsd:restriction>
+  </xsd:simpleType>
+
+  <xsd:simpleType name="DoxParamDir">
+    <xsd:restriction base="xsd:string">
+      <xsd:enumeration value="in"/>
+      <xsd:enumeration value="out"/>
+      <xsd:enumeration value="inout"/>
+    </xsd:restriction>
+  </xsd:simpleType>
+
+  <xsd:simpleType name="DoxAccessor">
+    <xsd:restriction base="xsd:string">
+      <xsd:enumeration value="retain"/>
+      <xsd:enumeration value="copy"/>
+      <xsd:enumeration value="assign"/>
+    </xsd:restriction>
+  </xsd:simpleType>
+
+</xsd:schema>
+

+ 3 - 0
gameplay-luagen/gameplay-api/xml/index.xml

@@ -0,0 +1,3 @@
+<?xml version='1.0' encoding='UTF-8' standalone='no'?>
+<doxygenindex xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="index.xsd" version="1.8.1">
+</doxygenindex>

+ 66 - 0
gameplay-luagen/gameplay-api/xml/index.xsd

@@ -0,0 +1,66 @@
+<?xml version='1.0' encoding='utf-8' ?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+  <xsd:element name="doxygenindex" type="DoxygenType"/>
+
+  <xsd:complexType name="DoxygenType">
+    <xsd:sequence>
+      <xsd:element name="compound" type="CompoundType" minOccurs="0" maxOccurs="unbounded"/>
+    </xsd:sequence>
+    <xsd:attribute name="version" type="xsd:string" use="required"/>
+  </xsd:complexType>
+
+  <xsd:complexType name="CompoundType">
+    <xsd:sequence>
+      <xsd:element name="name" type="xsd:string"/>
+      <xsd:element name="member" type="MemberType" minOccurs="0" maxOccurs="unbounded"/>
+    </xsd:sequence>
+    <xsd:attribute name="refid" type="xsd:string" use="required"/>
+    <xsd:attribute name="kind" type="CompoundKind" use="required"/>
+  </xsd:complexType>
+
+  <xsd:complexType name="MemberType">
+    <xsd:sequence>
+      <xsd:element name="name" type="xsd:string"/>
+    </xsd:sequence>
+    <xsd:attribute name="refid" type="xsd:string" use="required"/>
+    <xsd:attribute name="kind" type="MemberKind" use="required"/>
+  </xsd:complexType>
+  
+  <xsd:simpleType name="CompoundKind">
+    <xsd:restriction base="xsd:string">
+      <xsd:enumeration value="class"/>
+      <xsd:enumeration value="struct"/>
+      <xsd:enumeration value="union"/>
+      <xsd:enumeration value="interface"/>
+      <xsd:enumeration value="protocol"/>
+      <xsd:enumeration value="category"/>
+      <xsd:enumeration value="exception"/>
+      <xsd:enumeration value="file"/>
+      <xsd:enumeration value="namespace"/>
+      <xsd:enumeration value="group"/>
+      <xsd:enumeration value="page"/>
+      <xsd:enumeration value="example"/>
+      <xsd:enumeration value="dir"/>
+    </xsd:restriction>
+  </xsd:simpleType>
+
+  <xsd:simpleType name="MemberKind">
+    <xsd:restriction base="xsd:string">
+      <xsd:enumeration value="define"/>
+      <xsd:enumeration value="property"/>
+      <xsd:enumeration value="event"/>
+      <xsd:enumeration value="variable"/>
+      <xsd:enumeration value="typedef"/>
+      <xsd:enumeration value="enum"/>
+      <xsd:enumeration value="enumvalue"/>
+      <xsd:enumeration value="function"/>
+      <xsd:enumeration value="signal"/>
+      <xsd:enumeration value="prototype"/>
+      <xsd:enumeration value="friend"/>
+      <xsd:enumeration value="dcop"/>
+      <xsd:enumeration value="slot"/>
+    </xsd:restriction>
+  </xsd:simpleType>
+
+</xsd:schema>
+

+ 1794 - 0
gameplay-luagen/gameplay-luagen.doxyfile

@@ -0,0 +1,1794 @@
+# Doxyfile 1.8.1
+
+# This file describes the settings to be used by the documentation system
+# doxygen (www.doxygen.org) for a project
+#
+# All text after a hash (#) is considered a comment and will be ignored
+# The format is:
+#       TAG = value [value, ...]
+# For lists items can also be appended using:
+#       TAG += value [value, ...]
+# Values that contain spaces should be placed between quotes (" ")
+
+#---------------------------------------------------------------------------
+# Project related configuration options
+#---------------------------------------------------------------------------
+
+# This tag specifies the encoding used for all characters in the config file 
+# that follow. The default is UTF-8 which is also the encoding used for all 
+# text before the first occurrence of this tag. Doxygen uses libiconv (or the 
+# iconv built into libc) for the transcoding. See 
+# http://www.gnu.org/software/libiconv for the list of possible encodings.
+
+DOXYFILE_ENCODING      = UTF-8
+
+# The PROJECT_NAME tag is a single word (or sequence of words) that should 
+# identify the project. Note that if you do not use Doxywizard you need 
+# to put quotes around the project name if it contains spaces.
+
+PROJECT_NAME           = gameplay
+
+# The PROJECT_NUMBER tag can be used to enter a project or revision number. 
+# This could be handy for archiving the generated documentation or 
+# if some version control system is used.
+
+PROJECT_NUMBER         = 1.4.0
+
+# Using the PROJECT_BRIEF tag one can provide an optional one line description 
+# for a project that appears at the top of each page and should give viewer 
+# a quick idea about the purpose of the project. Keep the description short.
+
+PROJECT_BRIEF          = 
+
+# With the PROJECT_LOGO tag one can specify an logo or icon that is 
+# included in the documentation. The maximum height of the logo should not 
+# exceed 55 pixels and the maximum width should not exceed 200 pixels. 
+# Doxygen will copy the logo to the output directory.
+
+PROJECT_LOGO           = 
+
+# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) 
+# base path where the generated documentation will be put. 
+# If a relative path is entered, it will be relative to the location 
+# where doxygen was started. If left blank the current directory will be used.
+
+OUTPUT_DIRECTORY       = .
+
+# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create 
+# 4096 sub-directories (in 2 levels) under the output directory of each output 
+# format and will distribute the generated files over these directories. 
+# Enabling this option can be useful when feeding doxygen a huge amount of 
+# source files, where putting all generated files in the same directory would 
+# otherwise cause performance problems for the file system.
+
+CREATE_SUBDIRS         = NO
+
+# The OUTPUT_LANGUAGE tag is used to specify the language in which all 
+# documentation generated by doxygen is written. Doxygen will use this 
+# information to generate all constant output in the proper language. 
+# The default language is English, other supported languages are: 
+# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, 
+# Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German, 
+# Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English 
+# messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian, 
+# Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrillic, Slovak, 
+# Slovene, Spanish, Swedish, Ukrainian, and Vietnamese.
+
+OUTPUT_LANGUAGE        = English
+
+# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will 
+# include brief member descriptions after the members that are listed in 
+# the file and class documentation (similar to JavaDoc). 
+# Set to NO to disable this.
+
+BRIEF_MEMBER_DESC      = YES
+
+# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend 
+# the brief description of a member or function before the detailed description. 
+# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the 
+# brief descriptions will be completely suppressed.
+
+REPEAT_BRIEF           = YES
+
+# This tag implements a quasi-intelligent brief description abbreviator 
+# that is used to form the text in various listings. Each string 
+# in this list, if found as the leading text of the brief description, will be 
+# stripped from the text and the result after processing the whole list, is 
+# used as the annotated text. Otherwise, the brief description is used as-is. 
+# If left blank, the following values are used ("$name" is automatically 
+# replaced with the name of the entity): "The $name class" "The $name widget" 
+# "The $name file" "is" "provides" "specifies" "contains" 
+# "represents" "a" "an" "the"
+
+ABBREVIATE_BRIEF       = "The $name class" \
+                         "The $name widget" \
+                         "The $name file" \
+                         is \
+                         provides \
+                         specifies \
+                         contains \
+                         represents \
+                         a \
+                         an \
+                         the
+
+# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then 
+# Doxygen will generate a detailed section even if there is only a brief 
+# description.
+
+ALWAYS_DETAILED_SEC    = NO
+
+# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all 
+# inherited members of a class in the documentation of that class as if those 
+# members were ordinary class members. Constructors, destructors and assignment 
+# operators of the base classes will not be shown.
+
+INLINE_INHERITED_MEMB  = NO
+
+# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full 
+# path before files name in the file list and in the header files. If set 
+# to NO the shortest path that makes the file name unique will be used.
+
+FULL_PATH_NAMES        = YES
+
+# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag 
+# can be used to strip a user-defined part of the path. Stripping is 
+# only done if one of the specified strings matches the left-hand part of 
+# the path. The tag can be used to show relative paths in the file list. 
+# If left blank the directory from which doxygen is run is used as the 
+# path to strip.
+
+STRIP_FROM_PATH        = 
+
+# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of 
+# the path mentioned in the documentation of a class, which tells 
+# the reader which header file to include in order to use a class. 
+# If left blank only the name of the header file containing the class 
+# definition is used. Otherwise one should specify the include paths that 
+# are normally passed to the compiler using the -I flag.
+
+STRIP_FROM_INC_PATH    = 
+
+# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter 
+# (but less readable) file names. This can be useful if your file system 
+# doesn't support long names like on DOS, Mac, or CD-ROM.
+
+SHORT_NAMES            = NO
+
+# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen 
+# will interpret the first line (until the first dot) of a JavaDoc-style 
+# comment as the brief description. If set to NO, the JavaDoc 
+# comments will behave just like regular Qt-style comments 
+# (thus requiring an explicit @brief command for a brief description.)
+
+JAVADOC_AUTOBRIEF      = NO
+
+# If the QT_AUTOBRIEF tag is set to YES then Doxygen will 
+# interpret the first line (until the first dot) of a Qt-style 
+# comment as the brief description. If set to NO, the comments 
+# will behave just like regular Qt-style comments (thus requiring 
+# an explicit \brief command for a brief description.)
+
+QT_AUTOBRIEF           = NO
+
+# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen 
+# treat a multi-line C++ special comment block (i.e. a block of //! or /// 
+# comments) as a brief description. This used to be the default behaviour. 
+# The new default is to treat a multi-line C++ comment block as a detailed 
+# description. Set this tag to YES if you prefer the old behaviour instead.
+
+MULTILINE_CPP_IS_BRIEF = NO
+
+# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented 
+# member inherits the documentation from any documented member that it 
+# re-implements.
+
+INHERIT_DOCS           = YES
+
+# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce 
+# a new page for each member. If set to NO, the documentation of a member will 
+# be part of the file/class/namespace that contains it.
+
+SEPARATE_MEMBER_PAGES  = NO
+
+# The TAB_SIZE tag can be used to set the number of spaces in a tab. 
+# Doxygen uses this value to replace tabs by spaces in code fragments.
+
+TAB_SIZE               = 4
+
+# This tag can be used to specify a number of aliases that acts 
+# as commands in the documentation. An alias has the form "name=value". 
+# For example adding "sideeffect=\par Side Effects:\n" will allow you to 
+# put the command \sideeffect (or @sideeffect) in the documentation, which 
+# will result in a user-defined paragraph with heading "Side Effects:". 
+# You can put \n's in the value part of an alias to insert newlines.
+
+ALIASES                = "script{1} = \xmlonly <xmlonly>\1</xmlonly> \endxmlonly"
+
+# This tag can be used to specify a number of word-keyword mappings (TCL only). 
+# A mapping has the form "name=value". For example adding 
+# "class=itcl::class" will allow you to use the command class in the 
+# itcl::class meaning.
+
+TCL_SUBST              = 
+
+# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C 
+# sources only. Doxygen will then generate output that is more tailored for C. 
+# For instance, some of the names that are used will be different. The list 
+# of all members will be omitted, etc.
+
+OPTIMIZE_OUTPUT_FOR_C  = NO
+
+# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java 
+# sources only. Doxygen will then generate output that is more tailored for 
+# Java. For instance, namespaces will be presented as packages, qualified 
+# scopes will look different, etc.
+
+OPTIMIZE_OUTPUT_JAVA   = NO
+
+# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran 
+# sources only. Doxygen will then generate output that is more tailored for 
+# Fortran.
+
+OPTIMIZE_FOR_FORTRAN   = NO
+
+# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL 
+# sources. Doxygen will then generate output that is tailored for 
+# VHDL.
+
+OPTIMIZE_OUTPUT_VHDL   = NO
+
+# Doxygen selects the parser to use depending on the extension of the files it 
+# parses. With this tag you can assign which parser to use for a given extension. 
+# Doxygen has a built-in mapping, but you can override or extend it using this 
+# tag. The format is ext=language, where ext is a file extension, and language 
+# is one of the parsers supported by doxygen: IDL, Java, Javascript, CSharp, C, 
+# C++, D, PHP, Objective-C, Python, Fortran, VHDL, C, C++. For instance to make 
+# doxygen treat .inc files as Fortran files (default is PHP), and .f files as C 
+# (default is Fortran), use: inc=Fortran f=C. Note that for custom extensions 
+# you also need to set FILE_PATTERNS otherwise the files are not read by doxygen.
+
+EXTENSION_MAPPING      = 
+
+# If MARKDOWN_SUPPORT is enabled (the default) then doxygen pre-processes all 
+# comments according to the Markdown format, which allows for more readable 
+# documentation. See http://daringfireball.net/projects/markdown/ for details. 
+# The output of markdown processing is further processed by doxygen, so you 
+# can mix doxygen, HTML, and XML commands with Markdown formatting. 
+# Disable only in case of backward compatibilities issues.
+
+MARKDOWN_SUPPORT       = YES
+
+# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want 
+# to include (a tag file for) the STL sources as input, then you should 
+# set this tag to YES in order to let doxygen match functions declarations and 
+# definitions whose arguments contain STL classes (e.g. func(std::string); v.s. 
+# func(std::string) {}). This also makes the inheritance and collaboration 
+# diagrams that involve STL classes more complete and accurate.
+
+BUILTIN_STL_SUPPORT    = NO
+
+# If you use Microsoft's C++/CLI language, you should set this option to YES to 
+# enable parsing support.
+
+CPP_CLI_SUPPORT        = NO
+
+# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only. 
+# Doxygen will parse them like normal C++ but will assume all classes use public 
+# instead of private inheritance when no explicit protection keyword is present.
+
+SIP_SUPPORT            = NO
+
+# For Microsoft's IDL there are propget and propput attributes to indicate getter 
+# and setter methods for a property. Setting this option to YES (the default) 
+# will make doxygen replace the get and set methods by a property in the 
+# documentation. This will only work if the methods are indeed getting or 
+# setting a simple type. If this is not the case, or you want to show the 
+# methods anyway, you should set this option to NO.
+
+IDL_PROPERTY_SUPPORT   = YES
+
+# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC 
+# tag is set to YES, then doxygen will reuse the documentation of the first 
+# member in the group (if any) for the other members of the group. By default 
+# all members of a group must be documented explicitly.
+
+DISTRIBUTE_GROUP_DOC   = NO
+
+# Set the SUBGROUPING tag to YES (the default) to allow class member groups of 
+# the same type (for instance a group of public functions) to be put as a 
+# subgroup of that type (e.g. under the Public Functions section). Set it to 
+# NO to prevent subgrouping. Alternatively, this can be done per class using 
+# the \nosubgrouping command.
+
+SUBGROUPING            = YES
+
+# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and 
+# unions are shown inside the group in which they are included (e.g. using 
+# @ingroup) instead of on a separate page (for HTML and Man pages) or 
+# section (for LaTeX and RTF).
+
+INLINE_GROUPED_CLASSES = NO
+
+# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and 
+# unions with only public data fields will be shown inline in the documentation 
+# of the scope in which they are defined (i.e. file, namespace, or group 
+# documentation), provided this scope is documented. If set to NO (the default), 
+# structs, classes, and unions are shown on a separate page (for HTML and Man 
+# pages) or section (for LaTeX and RTF).
+
+INLINE_SIMPLE_STRUCTS  = NO
+
+# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum 
+# is documented as struct, union, or enum with the name of the typedef. So 
+# typedef struct TypeS {} TypeT, will appear in the documentation as a struct 
+# with name TypeT. When disabled the typedef will appear as a member of a file, 
+# namespace, or class. And the struct will be named TypeS. This can typically 
+# be useful for C code in case the coding convention dictates that all compound 
+# types are typedef'ed and only the typedef is referenced, never the tag name.
+
+TYPEDEF_HIDES_STRUCT   = NO
+
+# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to 
+# determine which symbols to keep in memory and which to flush to disk. 
+# When the cache is full, less often used symbols will be written to disk. 
+# For small to medium size projects (<1000 input files) the default value is 
+# probably good enough. For larger projects a too small cache size can cause 
+# doxygen to be busy swapping symbols to and from disk most of the time 
+# causing a significant performance penalty. 
+# If the system has enough physical memory increasing the cache will improve the 
+# performance by keeping more symbols in memory. Note that the value works on 
+# a logarithmic scale so increasing the size by one will roughly double the 
+# memory usage. The cache size is given by this formula: 
+# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0, 
+# corresponding to a cache size of 2^16 = 65536 symbols.
+
+SYMBOL_CACHE_SIZE      = 0
+
+# Similar to the SYMBOL_CACHE_SIZE the size of the symbol lookup cache can be 
+# set using LOOKUP_CACHE_SIZE. This cache is used to resolve symbols given 
+# their name and scope. Since this can be an expensive process and often the 
+# same symbol appear multiple times in the code, doxygen keeps a cache of 
+# pre-resolved symbols. If the cache is too small doxygen will become slower. 
+# If the cache is too large, memory is wasted. The cache size is given by this 
+# formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range is 0..9, the default is 0, 
+# corresponding to a cache size of 2^16 = 65536 symbols.
+
+LOOKUP_CACHE_SIZE      = 0
+
+#---------------------------------------------------------------------------
+# Build related configuration options
+#---------------------------------------------------------------------------
+
+# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in 
+# documentation are documented, even if no documentation was available. 
+# Private class members and static file members will be hidden unless 
+# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
+
+EXTRACT_ALL            = NO
+
+# If the EXTRACT_PRIVATE tag is set to YES all private members of a class 
+# will be included in the documentation.
+
+EXTRACT_PRIVATE        = NO
+
+# If the EXTRACT_PACKAGE tag is set to YES all members with package or internal
+# scope will be included in the documentation.
+
+EXTRACT_PACKAGE        = NO
+
+# If the EXTRACT_STATIC tag is set to YES all static members of a file 
+# will be included in the documentation.
+
+EXTRACT_STATIC         = NO
+
+# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) 
+# defined locally in source files will be included in the documentation. 
+# If set to NO only classes defined in header files are included.
+
+EXTRACT_LOCAL_CLASSES  = NO
+
+# This flag is only useful for Objective-C code. When set to YES local 
+# methods, which are defined in the implementation section but not in 
+# the interface are included in the documentation. 
+# If set to NO (the default) only methods in the interface are included.
+
+EXTRACT_LOCAL_METHODS  = NO
+
+# If this flag is set to YES, the members of anonymous namespaces will be 
+# extracted and appear in the documentation as a namespace called 
+# 'anonymous_namespace{file}', where file will be replaced with the base 
+# name of the file that contains the anonymous namespace. By default 
+# anonymous namespaces are hidden.
+
+EXTRACT_ANON_NSPACES   = NO
+
+# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all 
+# undocumented members of documented classes, files or namespaces. 
+# If set to NO (the default) these members will be included in the 
+# various overviews, but no documentation section is generated. 
+# This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_MEMBERS     = NO
+
+# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all 
+# undocumented classes that are normally visible in the class hierarchy. 
+# If set to NO (the default) these classes will be included in the various 
+# overviews. This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_CLASSES     = NO
+
+# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all 
+# friend (class|struct|union) declarations. 
+# If set to NO (the default) these declarations will be included in the 
+# documentation.
+
+HIDE_FRIEND_COMPOUNDS  = YES
+
+# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any 
+# documentation blocks found inside the body of a function. 
+# If set to NO (the default) these blocks will be appended to the 
+# function's detailed documentation block.
+
+HIDE_IN_BODY_DOCS      = NO
+
+# The INTERNAL_DOCS tag determines if documentation 
+# that is typed after a \internal command is included. If the tag is set 
+# to NO (the default) then the documentation will be excluded. 
+# Set it to YES to include the internal documentation.
+
+INTERNAL_DOCS          = NO
+
+# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate 
+# file names in lower-case letters. If set to YES upper-case letters are also 
+# allowed. This is useful if you have classes or files whose names only differ 
+# in case and if your file system supports case sensitive file names. Windows 
+# and Mac users are advised to set this option to NO.
+
+CASE_SENSE_NAMES       = NO
+
+# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen 
+# will show members with their full class and namespace scopes in the 
+# documentation. If set to YES the scope will be hidden.
+
+HIDE_SCOPE_NAMES       = NO
+
+# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen 
+# will put a list of the files that are included by a file in the documentation 
+# of that file.
+
+SHOW_INCLUDE_FILES     = YES
+
+# If the FORCE_LOCAL_INCLUDES tag is set to YES then Doxygen 
+# will list include files with double quotes in the documentation 
+# rather than with sharp brackets.
+
+FORCE_LOCAL_INCLUDES   = NO
+
+# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] 
+# is inserted in the documentation for inline members.
+
+INLINE_INFO            = YES
+
+# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen 
+# will sort the (detailed) documentation of file and class members 
+# alphabetically by member name. If set to NO the members will appear in 
+# declaration order.
+
+SORT_MEMBER_DOCS       = YES
+
+# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the 
+# brief documentation of file, namespace and class members alphabetically 
+# by member name. If set to NO (the default) the members will appear in 
+# declaration order.
+
+SORT_BRIEF_DOCS        = NO
+
+# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen 
+# will sort the (brief and detailed) documentation of class members so that 
+# constructors and destructors are listed first. If set to NO (the default) 
+# the constructors will appear in the respective orders defined by 
+# SORT_MEMBER_DOCS and SORT_BRIEF_DOCS. 
+# This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO 
+# and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO.
+
+SORT_MEMBERS_CTORS_1ST = NO
+
+# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the 
+# hierarchy of group names into alphabetical order. If set to NO (the default) 
+# the group names will appear in their defined order.
+
+SORT_GROUP_NAMES       = NO
+
+# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be 
+# sorted by fully-qualified names, including namespaces. If set to 
+# NO (the default), the class list will be sorted only by class name, 
+# not including the namespace part. 
+# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. 
+# Note: This option applies only to the class list, not to the 
+# alphabetical list.
+
+SORT_BY_SCOPE_NAME     = NO
+
+# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to 
+# do proper type resolution of all parameters of a function it will reject a 
+# match between the prototype and the implementation of a member function even 
+# if there is only one candidate or it is obvious which candidate to choose 
+# by doing a simple string match. By disabling STRICT_PROTO_MATCHING doxygen 
+# will still accept a match between prototype and implementation in such cases.
+
+STRICT_PROTO_MATCHING  = NO
+
+# The GENERATE_TODOLIST tag can be used to enable (YES) or 
+# disable (NO) the todo list. This list is created by putting \todo 
+# commands in the documentation.
+
+GENERATE_TODOLIST      = YES
+
+# The GENERATE_TESTLIST tag can be used to enable (YES) or 
+# disable (NO) the test list. This list is created by putting \test 
+# commands in the documentation.
+
+GENERATE_TESTLIST      = YES
+
+# The GENERATE_BUGLIST tag can be used to enable (YES) or 
+# disable (NO) the bug list. This list is created by putting \bug 
+# commands in the documentation.
+
+GENERATE_BUGLIST       = YES
+
+# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or 
+# disable (NO) the deprecated list. This list is created by putting 
+# \deprecated commands in the documentation.
+
+GENERATE_DEPRECATEDLIST= YES
+
+# The ENABLED_SECTIONS tag can be used to enable conditional 
+# documentation sections, marked by \if sectionname ... \endif.
+
+ENABLED_SECTIONS       = 
+
+# The MAX_INITIALIZER_LINES tag determines the maximum number of lines 
+# the initial value of a variable or macro consists of for it to appear in 
+# the documentation. If the initializer consists of more lines than specified 
+# here it will be hidden. Use a value of 0 to hide initializers completely. 
+# The appearance of the initializer of individual variables and macros in the 
+# documentation can be controlled using \showinitializer or \hideinitializer 
+# command in the documentation regardless of this setting.
+
+MAX_INITIALIZER_LINES  = 30
+
+# Set the SHOW_USED_FILES tag to NO to disable the list of files generated 
+# at the bottom of the documentation of classes and structs. If set to YES the 
+# list will mention the files that were used to generate the documentation.
+
+SHOW_USED_FILES        = NO
+
+# Set the SHOW_FILES tag to NO to disable the generation of the Files page. 
+# This will remove the Files entry from the Quick Index and from the 
+# Folder Tree View (if specified). The default is YES.
+
+SHOW_FILES             = NO
+
+# Set the SHOW_NAMESPACES tag to NO to disable the generation of the 
+# Namespaces page.  This will remove the Namespaces entry from the Quick Index 
+# and from the Folder Tree View (if specified). The default is YES.
+
+SHOW_NAMESPACES        = NO
+
+# The FILE_VERSION_FILTER tag can be used to specify a program or script that 
+# doxygen should invoke to get the current version for each file (typically from 
+# the version control system). Doxygen will invoke the program by executing (via 
+# popen()) the command <command> <input-file>, where <command> is the value of 
+# the FILE_VERSION_FILTER tag, and <input-file> is the name of an input file 
+# provided by doxygen. Whatever the program writes to standard output 
+# is used as the file version. See the manual for examples.
+
+FILE_VERSION_FILTER    = 
+
+# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed 
+# by doxygen. The layout file controls the global structure of the generated 
+# output files in an output format independent way. The create the layout file 
+# that represents doxygen's defaults, run doxygen with the -l option. 
+# You can optionally specify a file name after the option, if omitted 
+# DoxygenLayout.xml will be used as the name of the layout file.
+
+LAYOUT_FILE            = 
+
+# The CITE_BIB_FILES tag can be used to specify one or more bib files 
+# containing the references data. This must be a list of .bib files. The 
+# .bib extension is automatically appended if omitted. Using this command 
+# requires the bibtex tool to be installed. See also 
+# http://en.wikipedia.org/wiki/BibTeX for more info. For LaTeX the style 
+# of the bibliography can be controlled using LATEX_BIB_STYLE. To use this 
+# feature you need bibtex and perl available in the search path.
+
+CITE_BIB_FILES         = 
+
+#---------------------------------------------------------------------------
+# configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+
+# The QUIET tag can be used to turn on/off the messages that are generated 
+# by doxygen. Possible values are YES and NO. If left blank NO is used.
+
+QUIET                  = NO
+
+# The WARNINGS tag can be used to turn on/off the warning messages that are 
+# generated by doxygen. Possible values are YES and NO. If left blank 
+# NO is used.
+
+WARNINGS               = YES
+
+# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings 
+# for undocumented members. If EXTRACT_ALL is set to YES then this flag will 
+# automatically be disabled.
+
+WARN_IF_UNDOCUMENTED   = YES
+
+# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for 
+# potential errors in the documentation, such as not documenting some 
+# parameters in a documented function, or documenting parameters that 
+# don't exist or using markup commands wrongly.
+
+WARN_IF_DOC_ERROR      = YES
+
+# The WARN_NO_PARAMDOC option can be enabled to get warnings for 
+# functions that are documented, but have no documentation for their parameters 
+# or return value. If set to NO (the default) doxygen will only warn about 
+# wrong or incomplete parameter documentation, but not about the absence of 
+# documentation.
+
+WARN_NO_PARAMDOC       = NO
+
+# The WARN_FORMAT tag determines the format of the warning messages that 
+# doxygen can produce. The string should contain the $file, $line, and $text 
+# tags, which will be replaced by the file and line number from which the 
+# warning originated and the warning text. Optionally the format may contain 
+# $version, which will be replaced by the version of the file (if it could 
+# be obtained via FILE_VERSION_FILTER)
+
+WARN_FORMAT            = "$file:$line: $text"
+
+# The WARN_LOGFILE tag can be used to specify a file to which warning 
+# and error messages should be written. If left blank the output is written 
+# to stderr.
+
+WARN_LOGFILE           = 
+
+#---------------------------------------------------------------------------
+# configuration options related to the input files
+#---------------------------------------------------------------------------
+
+# The INPUT tag can be used to specify the files and/or directories that contain 
+# documented source files. You may enter file names like "myfile.cpp" or 
+# directories like "/usr/src/myproject". Separate the files or directories 
+# with spaces.
+
+INPUT                  = ../gameplay/src
+
+# This tag can be used to specify the character encoding of the source files 
+# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is 
+# also the default input encoding. Doxygen uses libiconv (or the iconv built 
+# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for 
+# the list of possible encodings.
+
+INPUT_ENCODING         = UTF-8
+
+# If the value of the INPUT tag contains directories, you can use the 
+# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp 
+# and *.h) to filter out the source-files in the directories. If left 
+# blank the following patterns are tested: 
+# *.c *.cc *.cxx *.cpp *.c++ *.d *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh 
+# *.hxx *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.dox *.py 
+# *.f90 *.f *.for *.vhd *.vhdl
+
+FILE_PATTERNS          = *.h \
+                         *.cpp
+
+# The RECURSIVE tag can be used to turn specify whether or not subdirectories 
+# should be searched for input files as well. Possible values are YES and NO. 
+# If left blank NO is used.
+
+RECURSIVE              = NO
+
+# The EXCLUDE tag can be used to specify files and/or directories that should be 
+# excluded from the INPUT source files. This way you can easily exclude a 
+# subdirectory from a directory tree whose root is specified with the INPUT tag. 
+# Note that relative paths are relative to the directory from which doxygen is 
+# run.
+
+EXCLUDE                = 
+
+# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or 
+# directories that are symbolic links (a Unix file system feature) are excluded 
+# from the input.
+
+EXCLUDE_SYMLINKS       = NO
+
+# If the value of the INPUT tag contains directories, you can use the 
+# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude 
+# certain files from those directories. Note that the wildcards are matched 
+# against the file with absolute path, so to exclude all test directories 
+# for example use the pattern */test/*
+
+EXCLUDE_PATTERNS       = 
+
+# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names 
+# (namespaces, classes, functions, etc.) that should be excluded from the 
+# output. The symbol name can be a fully qualified name, a word, or if the 
+# wildcard * is used, a substring. Examples: ANamespace, AClass, 
+# AClass::ANamespace, ANamespace::*Test
+
+EXCLUDE_SYMBOLS        = 
+
+# The EXAMPLE_PATH tag can be used to specify one or more files or 
+# directories that contain example code fragments that are included (see 
+# the \include command).
+
+EXAMPLE_PATH           = 
+
+# If the value of the EXAMPLE_PATH tag contains directories, you can use the 
+# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp 
+# and *.h) to filter out the source-files in the directories. If left 
+# blank all files are included.
+
+EXAMPLE_PATTERNS       = *
+
+# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be 
+# searched for input files to be used with the \include or \dontinclude 
+# commands irrespective of the value of the RECURSIVE tag. 
+# Possible values are YES and NO. If left blank NO is used.
+
+EXAMPLE_RECURSIVE      = NO
+
+# The IMAGE_PATH tag can be used to specify one or more files or 
+# directories that contain image that are included in the documentation (see 
+# the \image command).
+
+IMAGE_PATH             = 
+
+# The INPUT_FILTER tag can be used to specify a program that doxygen should 
+# invoke to filter for each input file. Doxygen will invoke the filter program 
+# by executing (via popen()) the command <filter> <input-file>, where <filter> 
+# is the value of the INPUT_FILTER tag, and <input-file> is the name of an 
+# input file. Doxygen will then use the output that the filter program writes 
+# to standard output.  If FILTER_PATTERNS is specified, this tag will be 
+# ignored.
+
+INPUT_FILTER           = 
+
+# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern 
+# basis.  Doxygen will compare the file name with each pattern and apply the 
+# filter if there is a match.  The filters are a list of the form: 
+# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further 
+# info on how filters are used. If FILTER_PATTERNS is empty or if 
+# non of the patterns match the file name, INPUT_FILTER is applied.
+
+FILTER_PATTERNS        = 
+
+# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using 
+# INPUT_FILTER) will be used to filter the input files when producing source 
+# files to browse (i.e. when SOURCE_BROWSER is set to YES).
+
+FILTER_SOURCE_FILES    = NO
+
+# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file 
+# pattern. A pattern will override the setting for FILTER_PATTERN (if any) 
+# and it is also possible to disable source filtering for a specific pattern 
+# using *.ext= (so without naming a filter). This option only has effect when 
+# FILTER_SOURCE_FILES is enabled.
+
+FILTER_SOURCE_PATTERNS = 
+
+#---------------------------------------------------------------------------
+# configuration options related to source browsing
+#---------------------------------------------------------------------------
+
+# If the SOURCE_BROWSER tag is set to YES then a list of source files will 
+# be generated. Documented entities will be cross-referenced with these sources. 
+# Note: To get rid of all source code in the generated output, make sure also 
+# VERBATIM_HEADERS is set to NO.
+
+SOURCE_BROWSER         = NO
+
+# Setting the INLINE_SOURCES tag to YES will include the body 
+# of functions and classes directly in the documentation.
+
+INLINE_SOURCES         = NO
+
+# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct 
+# doxygen to hide any special comment blocks from generated source code 
+# fragments. Normal C and C++ comments will always remain visible.
+
+STRIP_CODE_COMMENTS    = YES
+
+# If the REFERENCED_BY_RELATION tag is set to YES 
+# then for each documented function all documented 
+# functions referencing it will be listed.
+
+REFERENCED_BY_RELATION = NO
+
+# If the REFERENCES_RELATION tag is set to YES 
+# then for each documented function all documented entities 
+# called/used by that function will be listed.
+
+REFERENCES_RELATION    = NO
+
+# If the REFERENCES_LINK_SOURCE tag is set to YES (the default) 
+# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from 
+# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will 
+# link to the source code.  Otherwise they will link to the documentation.
+
+REFERENCES_LINK_SOURCE = YES
+
+# If the USE_HTAGS tag is set to YES then the references to source code 
+# will point to the HTML generated by the htags(1) tool instead of doxygen 
+# built-in source browser. The htags tool is part of GNU's global source 
+# tagging system (see http://www.gnu.org/software/global/global.html). You 
+# will need version 4.8.6 or higher.
+
+USE_HTAGS              = NO
+
+# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen 
+# will generate a verbatim copy of the header file for each class for 
+# which an include is specified. Set to NO to disable this.
+
+VERBATIM_HEADERS       = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+
+# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index 
+# of all compounds will be generated. Enable this if the project 
+# contains a lot of classes, structs, unions or interfaces.
+
+ALPHABETICAL_INDEX     = YES
+
+# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then 
+# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns 
+# in which this list will be split (can be a number in the range [1..20])
+
+COLS_IN_ALPHA_INDEX    = 5
+
+# In case all classes in a project start with a common prefix, all 
+# classes will be put under the same header in the alphabetical index. 
+# The IGNORE_PREFIX tag can be used to specify one or more prefixes that 
+# should be ignored while generating the index headers.
+
+IGNORE_PREFIX          = 
+
+#---------------------------------------------------------------------------
+# configuration options related to the HTML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_HTML tag is set to YES (the default) Doxygen will 
+# generate HTML output.
+
+GENERATE_HTML          = NO
+
+# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. 
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
+# put in front of it. If left blank `html' will be used as the default path.
+
+HTML_OUTPUT            = html
+
+# The HTML_FILE_EXTENSION tag can be used to specify the file extension for 
+# each generated HTML page (for example: .htm,.php,.asp). If it is left blank 
+# doxygen will generate files with .html extension.
+
+HTML_FILE_EXTENSION    = .html
+
+# The HTML_HEADER tag can be used to specify a personal HTML header for 
+# each generated HTML page. If it is left blank doxygen will generate a 
+# standard header. Note that when using a custom header you are responsible  
+# for the proper inclusion of any scripts and style sheets that doxygen 
+# needs, which is dependent on the configuration options used. 
+# It is advised to generate a default header using "doxygen -w html 
+# header.html footer.html stylesheet.css YourConfigFile" and then modify 
+# that header. Note that the header is subject to change so you typically 
+# have to redo this when upgrading to a newer version of doxygen or when 
+# changing the value of configuration settings such as GENERATE_TREEVIEW!
+
+HTML_HEADER            = 
+
+# The HTML_FOOTER tag can be used to specify a personal HTML footer for 
+# each generated HTML page. If it is left blank doxygen will generate a 
+# standard footer.
+
+HTML_FOOTER            = 
+
+# The HTML_STYLESHEET tag can be used to specify a user-defined cascading 
+# style sheet that is used by each HTML page. It can be used to 
+# fine-tune the look of the HTML output. If the tag is left blank doxygen 
+# will generate a default style sheet. Note that doxygen will try to copy 
+# the style sheet file to the HTML output directory, so don't put your own 
+# style sheet in the HTML output directory as well, or it will be erased!
+
+HTML_STYLESHEET        = 
+
+# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or 
+# other source files which should be copied to the HTML output directory. Note 
+# that these files will be copied to the base HTML output directory. Use the 
+# $relpath$ marker in the HTML_HEADER and/or HTML_FOOTER files to load these 
+# files. In the HTML_STYLESHEET file, use the file name only. Also note that 
+# the files will be copied as-is; there are no commands or markers available.
+
+HTML_EXTRA_FILES       = 
+
+# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. 
+# Doxygen will adjust the colors in the style sheet and background images 
+# according to this color. Hue is specified as an angle on a colorwheel, 
+# see http://en.wikipedia.org/wiki/Hue for more information. 
+# For instance the value 0 represents red, 60 is yellow, 120 is green, 
+# 180 is cyan, 240 is blue, 300 purple, and 360 is red again. 
+# The allowed range is 0 to 359.
+
+HTML_COLORSTYLE_HUE    = 220
+
+# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of 
+# the colors in the HTML output. For a value of 0 the output will use 
+# grayscales only. A value of 255 will produce the most vivid colors.
+
+HTML_COLORSTYLE_SAT    = 100
+
+# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to 
+# the luminance component of the colors in the HTML output. Values below 
+# 100 gradually make the output lighter, whereas values above 100 make 
+# the output darker. The value divided by 100 is the actual gamma applied, 
+# so 80 represents a gamma of 0.8, The value 220 represents a gamma of 2.2, 
+# and 100 does not change the gamma.
+
+HTML_COLORSTYLE_GAMMA  = 80
+
+# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML 
+# page will contain the date and time when the page was generated. Setting 
+# this to NO can help when comparing the output of multiple runs.
+
+HTML_TIMESTAMP         = YES
+
+# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML 
+# documentation will contain sections that can be hidden and shown after the 
+# page has loaded.
+
+HTML_DYNAMIC_SECTIONS  = NO
+
+# With HTML_INDEX_NUM_ENTRIES one can control the preferred number of 
+# entries shown in the various tree structured indices initially; the user 
+# can expand and collapse entries dynamically later on. Doxygen will expand 
+# the tree to such a level that at most the specified number of entries are 
+# visible (unless a fully collapsed tree already exceeds this amount). 
+# So setting the number of entries 1 will produce a full collapsed tree by 
+# default. 0 is a special value representing an infinite number of entries 
+# and will result in a full expanded tree by default.
+
+HTML_INDEX_NUM_ENTRIES = 113
+
+# If the GENERATE_DOCSET tag is set to YES, additional index files 
+# will be generated that can be used as input for Apple's Xcode 3 
+# integrated development environment, introduced with OSX 10.5 (Leopard). 
+# To create a documentation set, doxygen will generate a Makefile in the 
+# HTML output directory. Running make will produce the docset in that 
+# directory and running "make install" will install the docset in 
+# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find 
+# it at startup. 
+# See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html 
+# for more information.
+
+GENERATE_DOCSET        = NO
+
+# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the 
+# feed. A documentation feed provides an umbrella under which multiple 
+# documentation sets from a single provider (such as a company or product suite) 
+# can be grouped.
+
+DOCSET_FEEDNAME        = "Doxygen generated docs"
+
+# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that 
+# should uniquely identify the documentation set bundle. This should be a 
+# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen 
+# will append .docset to the name.
+
+DOCSET_BUNDLE_ID       = org.doxygen.Project
+
+# When GENERATE_PUBLISHER_ID tag specifies a string that should uniquely identify 
+# the documentation publisher. This should be a reverse domain-name style 
+# string, e.g. com.mycompany.MyDocSet.documentation.
+
+DOCSET_PUBLISHER_ID    = org.doxygen.Publisher
+
+# The GENERATE_PUBLISHER_NAME tag identifies the documentation publisher.
+
+DOCSET_PUBLISHER_NAME  = Publisher
+
+# If the GENERATE_HTMLHELP tag is set to YES, additional index files 
+# will be generated that can be used as input for tools like the 
+# Microsoft HTML help workshop to generate a compiled HTML help file (.chm) 
+# of the generated HTML documentation.
+
+GENERATE_HTMLHELP      = NO
+
+# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can 
+# be used to specify the file name of the resulting .chm file. You 
+# can add a path in front of the file if the result should not be 
+# written to the html output directory.
+
+CHM_FILE               = 
+
+# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can 
+# be used to specify the location (absolute path including file name) of 
+# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run 
+# the HTML help compiler on the generated index.hhp.
+
+HHC_LOCATION           = 
+
+# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag 
+# controls if a separate .chi index file is generated (YES) or that 
+# it should be included in the master .chm file (NO).
+
+GENERATE_CHI           = NO
+
+# If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING 
+# is used to encode HtmlHelp index (hhk), content (hhc) and project file 
+# content.
+
+CHM_INDEX_ENCODING     = 
+
+# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag 
+# controls whether a binary table of contents is generated (YES) or a 
+# normal table of contents (NO) in the .chm file.
+
+BINARY_TOC             = NO
+
+# The TOC_EXPAND flag can be set to YES to add extra items for group members 
+# to the contents of the HTML help documentation and to the tree view.
+
+TOC_EXPAND             = NO
+
+# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and 
+# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated 
+# that can be used as input for Qt's qhelpgenerator to generate a 
+# Qt Compressed Help (.qch) of the generated HTML documentation.
+
+GENERATE_QHP           = NO
+
+# If the QHG_LOCATION tag is specified, the QCH_FILE tag can 
+# be used to specify the file name of the resulting .qch file. 
+# The path specified is relative to the HTML output folder.
+
+QCH_FILE               = 
+
+# The QHP_NAMESPACE tag specifies the namespace to use when generating 
+# Qt Help Project output. For more information please see 
+# http://doc.trolltech.com/qthelpproject.html#namespace
+
+QHP_NAMESPACE          = org.doxygen.Project
+
+# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating 
+# Qt Help Project output. For more information please see 
+# http://doc.trolltech.com/qthelpproject.html#virtual-folders
+
+QHP_VIRTUAL_FOLDER     = doc
+
+# If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to 
+# add. For more information please see 
+# http://doc.trolltech.com/qthelpproject.html#custom-filters
+
+QHP_CUST_FILTER_NAME   = 
+
+# The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the 
+# custom filter to add. For more information please see 
+# <a href="http://doc.trolltech.com/qthelpproject.html#custom-filters"> 
+# Qt Help Project / Custom Filters</a>.
+
+QHP_CUST_FILTER_ATTRS  = 
+
+# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this 
+# project's 
+# filter section matches. 
+# <a href="http://doc.trolltech.com/qthelpproject.html#filter-attributes"> 
+# Qt Help Project / Filter Attributes</a>.
+
+QHP_SECT_FILTER_ATTRS  = 
+
+# If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can 
+# be used to specify the location of Qt's qhelpgenerator. 
+# If non-empty doxygen will try to run qhelpgenerator on the generated 
+# .qhp file.
+
+QHG_LOCATION           = 
+
+# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files  
+# will be generated, which together with the HTML files, form an Eclipse help 
+# plugin. To install this plugin and make it available under the help contents 
+# menu in Eclipse, the contents of the directory containing the HTML and XML 
+# files needs to be copied into the plugins directory of eclipse. The name of 
+# the directory within the plugins directory should be the same as 
+# the ECLIPSE_DOC_ID value. After copying Eclipse needs to be restarted before 
+# the help appears.
+
+GENERATE_ECLIPSEHELP   = NO
+
+# A unique identifier for the eclipse help plugin. When installing the plugin 
+# the directory name containing the HTML and XML files should also have 
+# this name.
+
+ECLIPSE_DOC_ID         = org.doxygen.Project
+
+# The DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) 
+# at top of each HTML page. The value NO (the default) enables the index and 
+# the value YES disables it. Since the tabs have the same information as the 
+# navigation tree you can set this option to NO if you already set 
+# GENERATE_TREEVIEW to YES.
+
+DISABLE_INDEX          = NO
+
+# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index 
+# structure should be generated to display hierarchical information. 
+# If the tag value is set to YES, a side panel will be generated 
+# containing a tree-like index structure (just like the one that 
+# is generated for HTML Help). For this to work a browser that supports 
+# JavaScript, DHTML, CSS and frames is required (i.e. any modern browser). 
+# Windows users are probably better off using the HTML help feature. 
+# Since the tree basically has the same information as the tab index you 
+# could consider to set DISABLE_INDEX to NO when enabling this option.
+
+GENERATE_TREEVIEW      = NO
+
+# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values 
+# (range [0,1..20]) that doxygen will group on one line in the generated HTML 
+# documentation. Note that a value of 0 will completely suppress the enum 
+# values from appearing in the overview section.
+
+ENUM_VALUES_PER_LINE   = 4
+
+# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be 
+# used to set the initial width (in pixels) of the frame in which the tree 
+# is shown.
+
+TREEVIEW_WIDTH         = 250
+
+# When the EXT_LINKS_IN_WINDOW option is set to YES doxygen will open 
+# links to external symbols imported via tag files in a separate window.
+
+EXT_LINKS_IN_WINDOW    = NO
+
+# Use this tag to change the font size of Latex formulas included 
+# as images in the HTML documentation. The default is 10. Note that 
+# when you change the font size after a successful doxygen run you need 
+# to manually remove any form_*.png images from the HTML output directory 
+# to force them to be regenerated.
+
+FORMULA_FONTSIZE       = 10
+
+# Use the FORMULA_TRANPARENT tag to determine whether or not the images 
+# generated for formulas are transparent PNGs. Transparent PNGs are 
+# not supported properly for IE 6.0, but are supported on all modern browsers. 
+# Note that when changing this option you need to delete any form_*.png files 
+# in the HTML output before the changes have effect.
+
+FORMULA_TRANSPARENT    = YES
+
+# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax 
+# (see http://www.mathjax.org) which uses client side Javascript for the 
+# rendering instead of using prerendered bitmaps. Use this if you do not 
+# have LaTeX installed or if you want to formulas look prettier in the HTML 
+# output. When enabled you may also need to install MathJax separately and 
+# configure the path to it using the MATHJAX_RELPATH option.
+
+USE_MATHJAX            = NO
+
+# When MathJax is enabled you need to specify the location relative to the 
+# HTML output directory using the MATHJAX_RELPATH option. The destination 
+# directory should contain the MathJax.js script. For instance, if the mathjax 
+# directory is located at the same level as the HTML output directory, then 
+# MATHJAX_RELPATH should be ../mathjax. The default value points to 
+# the MathJax Content Delivery Network so you can quickly see the result without 
+# installing MathJax.  However, it is strongly recommended to install a local 
+# copy of MathJax from http://www.mathjax.org before deployment.
+
+MATHJAX_RELPATH        = http://www.mathjax.org/mathjax
+
+# The MATHJAX_EXTENSIONS tag can be used to specify one or MathJax extension 
+# names that should be enabled during MathJax rendering.
+
+MATHJAX_EXTENSIONS     = 
+
+# When the SEARCHENGINE tag is enabled doxygen will generate a search box 
+# for the HTML output. The underlying search engine uses javascript 
+# and DHTML and should work on any modern browser. Note that when using 
+# HTML help (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets 
+# (GENERATE_DOCSET) there is already a search function so this one should 
+# typically be disabled. For large projects the javascript based search engine 
+# can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution.
+
+SEARCHENGINE           = YES
+
+# When the SERVER_BASED_SEARCH tag is enabled the search engine will be 
+# implemented using a PHP enabled web server instead of at the web client 
+# using Javascript. Doxygen will generate the search PHP script and index 
+# file to put on the web server. The advantage of the server 
+# based approach is that it scales better to large projects and allows 
+# full text search. The disadvantages are that it is more difficult to setup 
+# and does not have live searching capabilities.
+
+SERVER_BASED_SEARCH    = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will 
+# generate Latex output.
+
+GENERATE_LATEX         = NO
+
+# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. 
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
+# put in front of it. If left blank `latex' will be used as the default path.
+
+LATEX_OUTPUT           = latex
+
+# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be 
+# invoked. If left blank `latex' will be used as the default command name. 
+# Note that when enabling USE_PDFLATEX this option is only used for 
+# generating bitmaps for formulas in the HTML output, but not in the 
+# Makefile that is written to the output directory.
+
+LATEX_CMD_NAME         = latex
+
+# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to 
+# generate index for LaTeX. If left blank `makeindex' will be used as the 
+# default command name.
+
+MAKEINDEX_CMD_NAME     = makeindex
+
+# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact 
+# LaTeX documents. This may be useful for small projects and may help to 
+# save some trees in general.
+
+COMPACT_LATEX          = NO
+
+# The PAPER_TYPE tag can be used to set the paper type that is used 
+# by the printer. Possible values are: a4, letter, legal and 
+# executive. If left blank a4wide will be used.
+
+PAPER_TYPE             = a4
+
+# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX 
+# packages that should be included in the LaTeX output.
+
+EXTRA_PACKAGES         = 
+
+# The LATEX_HEADER tag can be used to specify a personal LaTeX header for 
+# the generated latex document. The header should contain everything until 
+# the first chapter. If it is left blank doxygen will generate a 
+# standard header. Notice: only use this tag if you know what you are doing!
+
+LATEX_HEADER           = 
+
+# The LATEX_FOOTER tag can be used to specify a personal LaTeX footer for 
+# the generated latex document. The footer should contain everything after 
+# the last chapter. If it is left blank doxygen will generate a 
+# standard footer. Notice: only use this tag if you know what you are doing!
+
+LATEX_FOOTER           = 
+
+# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated 
+# is prepared for conversion to pdf (using ps2pdf). The pdf file will 
+# contain links (just like the HTML output) instead of page references 
+# This makes the output suitable for online browsing using a pdf viewer.
+
+PDF_HYPERLINKS         = YES
+
+# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of 
+# plain latex in the generated Makefile. Set this option to YES to get a 
+# higher quality PDF documentation.
+
+USE_PDFLATEX           = YES
+
+# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. 
+# command to the generated LaTeX files. This will instruct LaTeX to keep 
+# running if errors occur, instead of asking the user for help. 
+# This option is also used when generating formulas in HTML.
+
+LATEX_BATCHMODE        = NO
+
+# If LATEX_HIDE_INDICES is set to YES then doxygen will not 
+# include the index chapters (such as File Index, Compound Index, etc.) 
+# in the output.
+
+LATEX_HIDE_INDICES     = NO
+
+# If LATEX_SOURCE_CODE is set to YES then doxygen will include 
+# source code with syntax highlighting in the LaTeX output. 
+# Note that which sources are shown also depends on other settings 
+# such as SOURCE_BROWSER.
+
+LATEX_SOURCE_CODE      = NO
+
+# The LATEX_BIB_STYLE tag can be used to specify the style to use for the 
+# bibliography, e.g. plainnat, or ieeetr. The default style is "plain". See 
+# http://en.wikipedia.org/wiki/BibTeX for more info.
+
+LATEX_BIB_STYLE        = plain
+
+#---------------------------------------------------------------------------
+# configuration options related to the RTF output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output 
+# The RTF output is optimized for Word 97 and may not look very pretty with 
+# other RTF readers or editors.
+
+GENERATE_RTF           = NO
+
+# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. 
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
+# put in front of it. If left blank `rtf' will be used as the default path.
+
+RTF_OUTPUT             = rtf
+
+# If the COMPACT_RTF tag is set to YES Doxygen generates more compact 
+# RTF documents. This may be useful for small projects and may help to 
+# save some trees in general.
+
+COMPACT_RTF            = NO
+
+# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated 
+# will contain hyperlink fields. The RTF file will 
+# contain links (just like the HTML output) instead of page references. 
+# This makes the output suitable for online browsing using WORD or other 
+# programs which support those fields. 
+# Note: wordpad (write) and others do not support links.
+
+RTF_HYPERLINKS         = NO
+
+# Load style sheet definitions from file. Syntax is similar to doxygen's 
+# config file, i.e. a series of assignments. You only have to provide 
+# replacements, missing definitions are set to their default value.
+
+RTF_STYLESHEET_FILE    = 
+
+# Set optional variables used in the generation of an rtf document. 
+# Syntax is similar to doxygen's config file.
+
+RTF_EXTENSIONS_FILE    = 
+
+#---------------------------------------------------------------------------
+# configuration options related to the man page output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_MAN tag is set to YES (the default) Doxygen will 
+# generate man pages
+
+GENERATE_MAN           = NO
+
+# The MAN_OUTPUT tag is used to specify where the man pages will be put. 
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
+# put in front of it. If left blank `man' will be used as the default path.
+
+MAN_OUTPUT             = man
+
+# The MAN_EXTENSION tag determines the extension that is added to 
+# the generated man pages (default is the subroutine's section .3)
+
+MAN_EXTENSION          = .3
+
+# If the MAN_LINKS tag is set to YES and Doxygen generates man output, 
+# then it will generate one additional man file for each entity 
+# documented in the real man page(s). These additional files 
+# only source the real man page, but without them the man command 
+# would be unable to find the correct page. The default is NO.
+
+MAN_LINKS              = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the XML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_XML tag is set to YES Doxygen will 
+# generate an XML file that captures the structure of 
+# the code including all documentation.
+
+GENERATE_XML           = YES
+
+# The XML_OUTPUT tag is used to specify where the XML pages will be put. 
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
+# put in front of it. If left blank `xml' will be used as the default path.
+
+XML_OUTPUT             = xml
+
+# The XML_SCHEMA tag can be used to specify an XML schema, 
+# which can be used by a validating XML parser to check the 
+# syntax of the XML files.
+
+XML_SCHEMA             = 
+
+# The XML_DTD tag can be used to specify an XML DTD, 
+# which can be used by a validating XML parser to check the 
+# syntax of the XML files.
+
+XML_DTD                = 
+
+# If the XML_PROGRAMLISTING tag is set to YES Doxygen will 
+# dump the program listings (including syntax highlighting 
+# and cross-referencing information) to the XML output. Note that 
+# enabling this will significantly increase the size of the XML output.
+
+XML_PROGRAMLISTING     = NO
+
+#---------------------------------------------------------------------------
+# configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will 
+# generate an AutoGen Definitions (see autogen.sf.net) file 
+# that captures the structure of the code including all 
+# documentation. Note that this feature is still experimental 
+# and incomplete at the moment.
+
+GENERATE_AUTOGEN_DEF   = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the Perl module output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_PERLMOD tag is set to YES Doxygen will 
+# generate a Perl module file that captures the structure of 
+# the code including all documentation. Note that this 
+# feature is still experimental and incomplete at the 
+# moment.
+
+GENERATE_PERLMOD       = NO
+
+# If the PERLMOD_LATEX tag is set to YES Doxygen will generate 
+# the necessary Makefile rules, Perl scripts and LaTeX code to be able 
+# to generate PDF and DVI output from the Perl module output.
+
+PERLMOD_LATEX          = NO
+
+# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be 
+# nicely formatted so it can be parsed by a human reader.  This is useful 
+# if you want to understand what is going on.  On the other hand, if this 
+# tag is set to NO the size of the Perl module output will be much smaller 
+# and Perl will parse it just the same.
+
+PERLMOD_PRETTY         = YES
+
+# The names of the make variables in the generated doxyrules.make file 
+# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. 
+# This is useful so different doxyrules.make files included by the same 
+# Makefile don't overwrite each other's variables.
+
+PERLMOD_MAKEVAR_PREFIX = 
+
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor
+#---------------------------------------------------------------------------
+
+# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will 
+# evaluate all C-preprocessor directives found in the sources and include 
+# files.
+
+ENABLE_PREPROCESSING   = YES
+
+# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro 
+# names in the source code. If set to NO (the default) only conditional 
+# compilation will be performed. Macro expansion can be done in a controlled 
+# way by setting EXPAND_ONLY_PREDEF to YES.
+
+MACRO_EXPANSION        = NO
+
+# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES 
+# then the macro expansion is limited to the macros specified with the 
+# PREDEFINED and EXPAND_AS_DEFINED tags.
+
+EXPAND_ONLY_PREDEF     = NO
+
+# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files 
+# pointed to by INCLUDE_PATH will be searched when a #include is found.
+
+SEARCH_INCLUDES        = YES
+
+# The INCLUDE_PATH tag can be used to specify one or more directories that 
+# contain include files that are not input files but should be processed by 
+# the preprocessor.
+
+INCLUDE_PATH           = 
+
+# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard 
+# patterns (like *.h and *.hpp) to filter out the header-files in the 
+# directories. If left blank, the patterns specified with FILE_PATTERNS will 
+# be used.
+
+INCLUDE_FILE_PATTERNS  = 
+
+# The PREDEFINED tag can be used to specify one or more macro names that 
+# are defined before the preprocessor is started (similar to the -D option of 
+# gcc). The argument of the tag is a list of macros of the form: name 
+# or name=definition (no spaces). If the definition and the = are 
+# omitted =1 is assumed. To prevent a macro definition from being 
+# undefined via #undef or recursively expanded use the := operator 
+# instead of the = operator.
+
+PREDEFINED             = 
+
+# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then 
+# this tag can be used to specify a list of macro names that should be expanded. 
+# The macro definition that is found in the sources will be used. 
+# Use the PREDEFINED tag if you want to use a different macro definition that 
+# overrules the definition found in the source code.
+
+EXPAND_AS_DEFINED      = 
+
+# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then 
+# doxygen's preprocessor will remove all references to function-like macros 
+# that are alone on a line, have an all uppercase name, and do not end with a 
+# semicolon, because these will confuse the parser if not removed.
+
+SKIP_FUNCTION_MACROS   = YES
+
+#---------------------------------------------------------------------------
+# Configuration::additions related to external references
+#---------------------------------------------------------------------------
+
+# The TAGFILES option can be used to specify one or more tagfiles. For each 
+# tag file the location of the external documentation should be added. The 
+# format of a tag file without this location is as follows: 
+#   TAGFILES = file1 file2 ... 
+# Adding location for the tag files is done as follows: 
+#   TAGFILES = file1=loc1 "file2 = loc2" ... 
+# where "loc1" and "loc2" can be relative or absolute paths 
+# or URLs. Note that each tag file must have a unique name (where the name does 
+# NOT include the path). If a tag file is not located in the directory in which 
+# doxygen is run, you must also specify the path to the tagfile here.
+
+TAGFILES               = 
+
+# When a file name is specified after GENERATE_TAGFILE, doxygen will create 
+# a tag file that is based on the input files it reads.
+
+GENERATE_TAGFILE       = 
+
+# If the ALLEXTERNALS tag is set to YES all external classes will be listed 
+# in the class index. If set to NO only the inherited external classes 
+# will be listed.
+
+ALLEXTERNALS           = NO
+
+# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed 
+# in the modules index. If set to NO, only the current project's groups will 
+# be listed.
+
+EXTERNAL_GROUPS        = YES
+
+# The PERL_PATH should be the absolute path and name of the perl script 
+# interpreter (i.e. the result of `which perl').
+
+PERL_PATH              = /usr/bin/perl
+
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool
+#---------------------------------------------------------------------------
+
+# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will 
+# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base 
+# or super classes. Setting the tag to NO turns the diagrams off. Note that 
+# this option also works with HAVE_DOT disabled, but it is recommended to 
+# install and use dot, since it yields more powerful graphs.
+
+CLASS_DIAGRAMS         = YES
+
+# You can define message sequence charts within doxygen comments using the \msc 
+# command. Doxygen will then run the mscgen tool (see 
+# http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the 
+# documentation. The MSCGEN_PATH tag allows you to specify the directory where 
+# the mscgen tool resides. If left empty the tool is assumed to be found in the 
+# default search path.
+
+MSCGEN_PATH            = 
+
+# If set to YES, the inheritance and collaboration graphs will hide 
+# inheritance and usage relations if the target is undocumented 
+# or is not a class.
+
+HIDE_UNDOC_RELATIONS   = YES
+
+# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is 
+# available from the path. This tool is part of Graphviz, a graph visualization 
+# toolkit from AT&T and Lucent Bell Labs. The other options in this section 
+# have no effect if this option is set to NO (the default)
+
+HAVE_DOT               = NO
+
+# The DOT_NUM_THREADS specifies the number of dot invocations doxygen is 
+# allowed to run in parallel. When set to 0 (the default) doxygen will 
+# base this on the number of processors available in the system. You can set it 
+# explicitly to a value larger than 0 to get control over the balance 
+# between CPU load and processing speed.
+
+DOT_NUM_THREADS        = 0
+
+# By default doxygen will use the Helvetica font for all dot files that 
+# doxygen generates. When you want a differently looking font you can specify 
+# the font name using DOT_FONTNAME. You need to make sure dot is able to find 
+# the font, which can be done by putting it in a standard location or by setting 
+# the DOTFONTPATH environment variable or by setting DOT_FONTPATH to the 
+# directory containing the font.
+
+DOT_FONTNAME           = Helvetica
+
+# The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs. 
+# The default size is 10pt.
+
+DOT_FONTSIZE           = 10
+
+# By default doxygen will tell dot to use the Helvetica font. 
+# If you specify a different font using DOT_FONTNAME you can use DOT_FONTPATH to 
+# set the path where dot can find it.
+
+DOT_FONTPATH           = 
+
+# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen 
+# will generate a graph for each documented class showing the direct and 
+# indirect inheritance relations. Setting this tag to YES will force the 
+# CLASS_DIAGRAMS tag to NO.
+
+CLASS_GRAPH            = YES
+
+# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen 
+# will generate a graph for each documented class showing the direct and 
+# indirect implementation dependencies (inheritance, containment, and 
+# class references variables) of the class with other documented classes.
+
+COLLABORATION_GRAPH    = YES
+
+# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen 
+# will generate a graph for groups, showing the direct groups dependencies
+
+GROUP_GRAPHS           = YES
+
+# If the UML_LOOK tag is set to YES doxygen will generate inheritance and 
+# collaboration diagrams in a style similar to the OMG's Unified Modeling 
+# Language.
+
+UML_LOOK               = NO
+
+# If the UML_LOOK tag is enabled, the fields and methods are shown inside 
+# the class node. If there are many fields or methods and many nodes the 
+# graph may become too big to be useful. The UML_LIMIT_NUM_FIELDS 
+# threshold limits the number of items for each type to make the size more 
+# managable. Set this to 0 for no limit. Note that the threshold may be 
+# exceeded by 50% before the limit is enforced.
+
+UML_LIMIT_NUM_FIELDS   = 10
+
+# If set to YES, the inheritance and collaboration graphs will show the 
+# relations between templates and their instances.
+
+TEMPLATE_RELATIONS     = NO
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT 
+# tags are set to YES then doxygen will generate a graph for each documented 
+# file showing the direct and indirect include dependencies of the file with 
+# other documented files.
+
+INCLUDE_GRAPH          = YES
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and 
+# HAVE_DOT tags are set to YES then doxygen will generate a graph for each 
+# documented header file showing the documented files that directly or 
+# indirectly include this file.
+
+INCLUDED_BY_GRAPH      = YES
+
+# If the CALL_GRAPH and HAVE_DOT options are set to YES then 
+# doxygen will generate a call dependency graph for every global function 
+# or class method. Note that enabling this option will significantly increase 
+# the time of a run. So in most cases it will be better to enable call graphs 
+# for selected functions only using the \callgraph command.
+
+CALL_GRAPH             = NO
+
+# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then 
+# doxygen will generate a caller dependency graph for every global function 
+# or class method. Note that enabling this option will significantly increase 
+# the time of a run. So in most cases it will be better to enable caller 
+# graphs for selected functions only using the \callergraph command.
+
+CALLER_GRAPH           = NO
+
+# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen 
+# will generate a graphical hierarchy of all classes instead of a textual one.
+
+GRAPHICAL_HIERARCHY    = YES
+
+# If the DIRECTORY_GRAPH and HAVE_DOT tags are set to YES 
+# then doxygen will show the dependencies a directory has on other directories 
+# in a graphical way. The dependency relations are determined by the #include 
+# relations between the files in the directories.
+
+DIRECTORY_GRAPH        = YES
+
+# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images 
+# generated by dot. Possible values are svg, png, jpg, or gif. 
+# If left blank png will be used. If you choose svg you need to set 
+# HTML_FILE_EXTENSION to xhtml in order to make the SVG files 
+# visible in IE 9+ (other browsers do not have this requirement).
+
+DOT_IMAGE_FORMAT       = png
+
+# If DOT_IMAGE_FORMAT is set to svg, then this option can be set to YES to 
+# enable generation of interactive SVG images that allow zooming and panning. 
+# Note that this requires a modern browser other than Internet Explorer. 
+# Tested and working are Firefox, Chrome, Safari, and Opera. For IE 9+ you 
+# need to set HTML_FILE_EXTENSION to xhtml in order to make the SVG files 
+# visible. Older versions of IE do not have SVG support.
+
+INTERACTIVE_SVG        = NO
+
+# The tag DOT_PATH can be used to specify the path where the dot tool can be 
+# found. If left blank, it is assumed the dot tool can be found in the path.
+
+DOT_PATH               = 
+
+# The DOTFILE_DIRS tag can be used to specify one or more directories that 
+# contain dot files that are included in the documentation (see the 
+# \dotfile command).
+
+DOTFILE_DIRS           = 
+
+# The MSCFILE_DIRS tag can be used to specify one or more directories that 
+# contain msc files that are included in the documentation (see the 
+# \mscfile command).
+
+MSCFILE_DIRS           = 
+
+# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of 
+# nodes that will be shown in the graph. If the number of nodes in a graph 
+# becomes larger than this value, doxygen will truncate the graph, which is 
+# visualized by representing a node as a red box. Note that doxygen if the 
+# number of direct children of the root node in a graph is already larger than 
+# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note 
+# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH.
+
+DOT_GRAPH_MAX_NODES    = 50
+
+# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the 
+# graphs generated by dot. A depth value of 3 means that only nodes reachable 
+# from the root by following a path via at most 3 edges will be shown. Nodes 
+# that lay further from the root node will be omitted. Note that setting this 
+# option to 1 or 2 may greatly reduce the computation time needed for large 
+# code bases. Also note that the size of a graph can be further restricted by 
+# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction.
+
+MAX_DOT_GRAPH_DEPTH    = 0
+
+# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent 
+# background. This is disabled by default, because dot on Windows does not 
+# seem to support this out of the box. Warning: Depending on the platform used, 
+# enabling this option may lead to badly anti-aliased labels on the edges of 
+# a graph (i.e. they become hard to read).
+
+DOT_TRANSPARENT        = NO
+
+# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output 
+# files in one run (i.e. multiple -o and -T options on the command line). This 
+# makes dot run faster, but since only newer versions of dot (>1.8.10) 
+# support this, this feature is disabled by default.
+
+DOT_MULTI_TARGETS      = NO
+
+# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will 
+# generate a legend page explaining the meaning of the various boxes and 
+# arrows in the dot generated graphs.
+
+GENERATE_LEGEND        = YES
+
+# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will 
+# remove the intermediate dot files that are used to generate 
+# the various graphs.
+
+DOT_CLEANUP            = YES

+ 20 - 0
gameplay-luagen/gameplay-luagen.sln

@@ -0,0 +1,20 @@
+
+Microsoft Visual Studio Solution File, Format Version 11.00
+# Visual Studio 2010
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gameplay-luagen", "gameplay-luagen.vcxproj", "{CA137C5D-FDE1-4095-926A-59E8472504BF}"
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|Win32 = Debug|Win32
+		Release|Win32 = Release|Win32
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{CA137C5D-FDE1-4095-926A-59E8472504BF}.Debug|Win32.ActiveCfg = Debug|Win32
+		{CA137C5D-FDE1-4095-926A-59E8472504BF}.Debug|Win32.Build.0 = Debug|Win32
+		{CA137C5D-FDE1-4095-926A-59E8472504BF}.Release|Win32.ActiveCfg = Release|Win32
+		{CA137C5D-FDE1-4095-926A-59E8472504BF}.Release|Win32.Build.0 = Release|Win32
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+EndGlobal

+ 108 - 0
gameplay-luagen/gameplay-luagen.vcxproj

@@ -0,0 +1,108 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup Label="ProjectConfigurations">
+    <ProjectConfiguration Include="Debug|Win32">
+      <Configuration>Debug</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|Win32">
+      <Configuration>Release</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+  </ItemGroup>
+  <ItemGroup>
+    <ClCompile Include="src\ClassBinding.cpp" />
+    <ClCompile Include="src\DebugNew.cpp" />
+    <ClCompile Include="src\FunctionBinding.cpp" />
+    <ClCompile Include="src\Generator.cpp" />
+    <ClCompile Include="src\main.cpp" />
+  </ItemGroup>
+  <ItemGroup>
+    <ClInclude Include="src\Base.h" />
+    <ClInclude Include="src\ClassBinding.h" />
+    <ClInclude Include="src\DebugNew.h" />
+    <ClInclude Include="src\EnumBinding.h" />
+    <ClInclude Include="src\FunctionBinding.h" />
+    <ClInclude Include="src\Generator.h" />
+    <ClInclude Include="src\TypedefBinding.h" />
+  </ItemGroup>
+  <PropertyGroup Label="Globals">
+    <ProjectGuid>{CA137C5D-FDE1-4095-926A-59E8472504BF}</ProjectGuid>
+    <Keyword>Win32Proj</Keyword>
+    <RootNamespace>gameplayluagen</RootNamespace>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseDebugLibraries>true</UseDebugLibraries>
+    <CharacterSet>Unicode</CharacterSet>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseDebugLibraries>false</UseDebugLibraries>
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+    <CharacterSet>Unicode</CharacterSet>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+  <ImportGroup Label="ExtensionSettings">
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <PropertyGroup Label="UserMacros" />
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <LinkIncremental>true</LinkIncremental>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <LinkIncremental>false</LinkIncremental>
+  </PropertyGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <ClCompile>
+      <PrecompiledHeader>
+      </PrecompiledHeader>
+      <WarningLevel>Level3</WarningLevel>
+      <Optimization>Disabled</Optimization>
+      <PreprocessorDefinitions>GP_ERRORS_AS_WARNINGS;_ITERATOR_DEBUG_LEVEL=0;WIN32;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories>..\external-deps\tinyxml2\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
+    </ClCompile>
+    <Link>
+      <SubSystem>Console</SubSystem>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <AdditionalLibraryDirectories>..\external-deps\tinyxml2\lib\win32;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+      <AdditionalDependencies>tinyxml2.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
+    </Link>
+    <PreBuildEvent>
+      <Command>del /Q "$(ProjectDir)..\gameplay\src\lua\*"</Command>
+    </PreBuildEvent>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <PrecompiledHeader>
+      </PrecompiledHeader>
+      <Optimization>MaxSpeed</Optimization>
+      <FunctionLevelLinking>true</FunctionLevelLinking>
+      <IntrinsicFunctions>true</IntrinsicFunctions>
+      <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories>..\external-deps\tinyxml2\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+    </ClCompile>
+    <Link>
+      <SubSystem>Console</SubSystem>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <OptimizeReferences>true</OptimizeReferences>
+      <AdditionalLibraryDirectories>..\external-deps\tinyxml2\lib\win32;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+      <AdditionalDependencies>tinyxml2.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
+    </Link>
+    <PreBuildEvent>
+      <Command>del /Q "$(ProjectDir)..\gameplay\src\lua\*"</Command>
+    </PreBuildEvent>
+  </ItemDefinitionGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+  <ImportGroup Label="ExtensionTargets">
+  </ImportGroup>
+</Project>

+ 48 - 0
gameplay-luagen/gameplay-luagen.vcxproj.filters

@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup>
+    <Filter Include="src">
+      <UniqueIdentifier>{ff86fc9c-4adf-479c-bcfc-fef8919ed4c1}</UniqueIdentifier>
+    </Filter>
+  </ItemGroup>
+  <ItemGroup>
+    <ClCompile Include="src\ClassBinding.cpp">
+      <Filter>src</Filter>
+    </ClCompile>
+    <ClCompile Include="src\DebugNew.cpp">
+      <Filter>src</Filter>
+    </ClCompile>
+    <ClCompile Include="src\FunctionBinding.cpp">
+      <Filter>src</Filter>
+    </ClCompile>
+    <ClCompile Include="src\Generator.cpp">
+      <Filter>src</Filter>
+    </ClCompile>
+    <ClCompile Include="src\main.cpp">
+      <Filter>src</Filter>
+    </ClCompile>
+  </ItemGroup>
+  <ItemGroup>
+    <ClInclude Include="src\Base.h">
+      <Filter>src</Filter>
+    </ClInclude>
+    <ClInclude Include="src\ClassBinding.h">
+      <Filter>src</Filter>
+    </ClInclude>
+    <ClInclude Include="src\DebugNew.h">
+      <Filter>src</Filter>
+    </ClInclude>
+    <ClInclude Include="src\EnumBinding.h">
+      <Filter>src</Filter>
+    </ClInclude>
+    <ClInclude Include="src\FunctionBinding.h">
+      <Filter>src</Filter>
+    </ClInclude>
+    <ClInclude Include="src\Generator.h">
+      <Filter>src</Filter>
+    </ClInclude>
+    <ClInclude Include="src\TypedefBinding.h">
+      <Filter>src</Filter>
+    </ClInclude>
+  </ItemGroup>
+</Project>

+ 11 - 0
gameplay-luagen/gameplay-luagen.vcxproj.user

@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <LocalDebuggerCommandArguments>"$(ProjectDir)xml/" "$(ProjectDir)../gameplay/src/lua/"</LocalDebuggerCommandArguments>
+    <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <LocalDebuggerCommandArguments>"$(ProjectDir)xml/" "$(ProjectDir)../gameplay/src/lua/"</LocalDebuggerCommandArguments>
+    <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
+  </PropertyGroup>
+</Project>

+ 258 - 0
gameplay-luagen/gameplay-luagen.xcodeproj/project.pbxproj

@@ -0,0 +1,258 @@
+// !$*UTF8*$!
+{
+	archiveVersion = 1;
+	classes = {
+	};
+	objectVersion = 46;
+	objects = {
+
+/* Begin PBXBuildFile section */
+		42B7F6FD15B06EFE002BB8C3 /* ClassBinding.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 42B7F6F215B06EFE002BB8C3 /* ClassBinding.cpp */; };
+		42B7F6FE15B06EFE002BB8C3 /* DebugNew.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 42B7F6F415B06EFE002BB8C3 /* DebugNew.cpp */; };
+		42B7F6FF15B06EFE002BB8C3 /* FunctionBinding.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 42B7F6F715B06EFE002BB8C3 /* FunctionBinding.cpp */; };
+		42B7F70015B06EFE002BB8C3 /* Generator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 42B7F6F915B06EFE002BB8C3 /* Generator.cpp */; };
+		42B7F70115B06EFE002BB8C3 /* main.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 42B7F6FB15B06EFE002BB8C3 /* main.cpp */; };
+		42B7F71215B06F67002BB8C3 /* libtinyxml2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 42B7F71115B06F67002BB8C3 /* libtinyxml2.a */; };
+/* End PBXBuildFile section */
+
+/* Begin PBXCopyFilesBuildPhase section */
+		42B7F6DE15B06E85002BB8C3 /* CopyFiles */ = {
+			isa = PBXCopyFilesBuildPhase;
+			buildActionMask = 2147483647;
+			dstPath = /usr/share/man/man1/;
+			dstSubfolderSpec = 0;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 1;
+		};
+/* End PBXCopyFilesBuildPhase section */
+
+/* Begin PBXFileReference section */
+		42B7F6E015B06E85002BB8C3 /* gameplay-luagen */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = "gameplay-luagen"; sourceTree = BUILT_PRODUCTS_DIR; };
+		42B7F6F115B06EFE002BB8C3 /* Base.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Base.h; path = src/Base.h; sourceTree = SOURCE_ROOT; };
+		42B7F6F215B06EFE002BB8C3 /* ClassBinding.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ClassBinding.cpp; path = src/ClassBinding.cpp; sourceTree = SOURCE_ROOT; };
+		42B7F6F315B06EFE002BB8C3 /* ClassBinding.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ClassBinding.h; path = src/ClassBinding.h; sourceTree = SOURCE_ROOT; };
+		42B7F6F415B06EFE002BB8C3 /* DebugNew.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DebugNew.cpp; path = src/DebugNew.cpp; sourceTree = SOURCE_ROOT; };
+		42B7F6F515B06EFE002BB8C3 /* DebugNew.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DebugNew.h; path = src/DebugNew.h; sourceTree = SOURCE_ROOT; };
+		42B7F6F615B06EFE002BB8C3 /* EnumBinding.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = EnumBinding.h; path = src/EnumBinding.h; sourceTree = SOURCE_ROOT; };
+		42B7F6F715B06EFE002BB8C3 /* FunctionBinding.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = FunctionBinding.cpp; path = src/FunctionBinding.cpp; sourceTree = SOURCE_ROOT; };
+		42B7F6F815B06EFE002BB8C3 /* FunctionBinding.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FunctionBinding.h; path = src/FunctionBinding.h; sourceTree = SOURCE_ROOT; };
+		42B7F6F915B06EFE002BB8C3 /* Generator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Generator.cpp; path = src/Generator.cpp; sourceTree = SOURCE_ROOT; };
+		42B7F6FA15B06EFE002BB8C3 /* Generator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Generator.h; path = src/Generator.h; sourceTree = SOURCE_ROOT; };
+		42B7F6FB15B06EFE002BB8C3 /* main.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = main.cpp; path = src/main.cpp; sourceTree = SOURCE_ROOT; };
+		42B7F6FC15B06EFE002BB8C3 /* TypedefBinding.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TypedefBinding.h; path = src/TypedefBinding.h; sourceTree = SOURCE_ROOT; };
+		42B7F71115B06F67002BB8C3 /* libtinyxml2.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libtinyxml2.a; path = "../external-deps/tinyxml2/lib/macosx/libtinyxml2.a"; sourceTree = "<group>"; };
+/* End PBXFileReference section */
+
+/* Begin PBXFrameworksBuildPhase section */
+		42B7F6DD15B06E85002BB8C3 /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				42B7F71215B06F67002BB8C3 /* libtinyxml2.a in Frameworks */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+/* End PBXFrameworksBuildPhase section */
+
+/* Begin PBXGroup section */
+		42B7F6D515B06E85002BB8C3 = {
+			isa = PBXGroup;
+			children = (
+				42B7F6E315B06E85002BB8C3 /* src */,
+				42B7F70B15B06F3A002BB8C3 /* Libraries */,
+				42B7F6E115B06E85002BB8C3 /* Products */,
+			);
+			sourceTree = "<group>";
+		};
+		42B7F6E115B06E85002BB8C3 /* Products */ = {
+			isa = PBXGroup;
+			children = (
+				42B7F6E015B06E85002BB8C3 /* gameplay-luagen */,
+			);
+			name = Products;
+			sourceTree = "<group>";
+		};
+		42B7F6E315B06E85002BB8C3 /* src */ = {
+			isa = PBXGroup;
+			children = (
+				42B7F6F115B06EFE002BB8C3 /* Base.h */,
+				42B7F6F215B06EFE002BB8C3 /* ClassBinding.cpp */,
+				42B7F6F315B06EFE002BB8C3 /* ClassBinding.h */,
+				42B7F6F415B06EFE002BB8C3 /* DebugNew.cpp */,
+				42B7F6F515B06EFE002BB8C3 /* DebugNew.h */,
+				42B7F6F615B06EFE002BB8C3 /* EnumBinding.h */,
+				42B7F6F715B06EFE002BB8C3 /* FunctionBinding.cpp */,
+				42B7F6F815B06EFE002BB8C3 /* FunctionBinding.h */,
+				42B7F6F915B06EFE002BB8C3 /* Generator.cpp */,
+				42B7F6FA15B06EFE002BB8C3 /* Generator.h */,
+				42B7F6FB15B06EFE002BB8C3 /* main.cpp */,
+				42B7F6FC15B06EFE002BB8C3 /* TypedefBinding.h */,
+			);
+			name = src;
+			path = "gameplay-luagen";
+			sourceTree = "<group>";
+		};
+		42B7F70B15B06F3A002BB8C3 /* Libraries */ = {
+			isa = PBXGroup;
+			children = (
+				42B7F71115B06F67002BB8C3 /* libtinyxml2.a */,
+			);
+			name = Libraries;
+			sourceTree = "<group>";
+		};
+/* End PBXGroup section */
+
+/* Begin PBXNativeTarget section */
+		42B7F6DF15B06E85002BB8C3 /* gameplay-luagen */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 42B7F6EA15B06E85002BB8C3 /* Build configuration list for PBXNativeTarget "gameplay-luagen" */;
+			buildPhases = (
+				42B7F6DC15B06E85002BB8C3 /* Sources */,
+				42B7F6DD15B06E85002BB8C3 /* Frameworks */,
+				42B7F6DE15B06E85002BB8C3 /* CopyFiles */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+			);
+			name = "gameplay-luagen";
+			productName = "gameplay-luagen";
+			productReference = 42B7F6E015B06E85002BB8C3 /* gameplay-luagen */;
+			productType = "com.apple.product-type.tool";
+		};
+/* End PBXNativeTarget section */
+
+/* Begin PBXProject section */
+		42B7F6D715B06E85002BB8C3 /* Project object */ = {
+			isa = PBXProject;
+			attributes = {
+				LastUpgradeCheck = 0430;
+			};
+			buildConfigurationList = 42B7F6DA15B06E85002BB8C3 /* Build configuration list for PBXProject "gameplay-luagen" */;
+			compatibilityVersion = "Xcode 3.2";
+			developmentRegion = English;
+			hasScannedForEncodings = 0;
+			knownRegions = (
+				en,
+			);
+			mainGroup = 42B7F6D515B06E85002BB8C3;
+			productRefGroup = 42B7F6E115B06E85002BB8C3 /* Products */;
+			projectDirPath = "";
+			projectRoot = "";
+			targets = (
+				42B7F6DF15B06E85002BB8C3 /* gameplay-luagen */,
+			);
+		};
+/* End PBXProject section */
+
+/* Begin PBXSourcesBuildPhase section */
+		42B7F6DC15B06E85002BB8C3 /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				42B7F6FD15B06EFE002BB8C3 /* ClassBinding.cpp in Sources */,
+				42B7F6FE15B06EFE002BB8C3 /* DebugNew.cpp in Sources */,
+				42B7F6FF15B06EFE002BB8C3 /* FunctionBinding.cpp in Sources */,
+				42B7F70015B06EFE002BB8C3 /* Generator.cpp in Sources */,
+				42B7F70115B06EFE002BB8C3 /* main.cpp in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+/* End PBXSourcesBuildPhase section */
+
+/* Begin XCBuildConfiguration section */
+		42B7F6E815B06E85002BB8C3 /* Debug */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ALWAYS_SEARCH_USER_PATHS = NO;
+				ARCHS = "$(ARCHS_STANDARD_32_BIT)";
+				COPY_PHASE_STRIP = NO;
+				GCC_C_LANGUAGE_STANDARD = gnu99;
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_ENABLE_OBJC_EXCEPTIONS = YES;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				GCC_PREPROCESSOR_DEFINITIONS = (
+					"DEBUG=1",
+					"$(inherited)",
+				);
+				GCC_SYMBOLS_PRIVATE_EXTERN = NO;
+				GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
+				GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+				GCC_WARN_ABOUT_RETURN_TYPE = YES;
+				GCC_WARN_UNINITIALIZED_AUTOS = YES;
+				GCC_WARN_UNUSED_VARIABLE = YES;
+				MACOSX_DEPLOYMENT_TARGET = 10.7;
+				ONLY_ACTIVE_ARCH = YES;
+				SDKROOT = macosx;
+			};
+			name = Debug;
+		};
+		42B7F6E915B06E85002BB8C3 /* Release */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ALWAYS_SEARCH_USER_PATHS = NO;
+				ARCHS = "$(ARCHS_STANDARD_32_BIT)";
+				COPY_PHASE_STRIP = YES;
+				DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
+				GCC_C_LANGUAGE_STANDARD = gnu99;
+				GCC_ENABLE_OBJC_EXCEPTIONS = YES;
+				GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
+				GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+				GCC_WARN_ABOUT_RETURN_TYPE = YES;
+				GCC_WARN_UNINITIALIZED_AUTOS = YES;
+				GCC_WARN_UNUSED_VARIABLE = YES;
+				MACOSX_DEPLOYMENT_TARGET = 10.7;
+				SDKROOT = macosx;
+			};
+			name = Release;
+		};
+		42B7F6EB15B06E85002BB8C3 /* Debug */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				HEADER_SEARCH_PATHS = "../external-deps/tinyxml2/include";
+				LIBRARY_SEARCH_PATHS = (
+					"$(inherited)",
+					"\"$(SRCROOT)/../external-deps/tinyxml2/lib/macosx\"",
+				);
+				PRODUCT_NAME = "$(TARGET_NAME)";
+			};
+			name = Debug;
+		};
+		42B7F6EC15B06E85002BB8C3 /* Release */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				HEADER_SEARCH_PATHS = "../external-deps/tinyxml2/include";
+				LIBRARY_SEARCH_PATHS = (
+					"$(inherited)",
+					"\"$(SRCROOT)/../external-deps/tinyxml2/lib/macosx\"",
+				);
+				PRODUCT_NAME = "$(TARGET_NAME)";
+			};
+			name = Release;
+		};
+/* End XCBuildConfiguration section */
+
+/* Begin XCConfigurationList section */
+		42B7F6DA15B06E85002BB8C3 /* Build configuration list for PBXProject "gameplay-luagen" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				42B7F6E815B06E85002BB8C3 /* Debug */,
+				42B7F6E915B06E85002BB8C3 /* Release */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Release;
+		};
+		42B7F6EA15B06E85002BB8C3 /* Build configuration list for PBXNativeTarget "gameplay-luagen" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				42B7F6EB15B06E85002BB8C3 /* Debug */,
+				42B7F6EC15B06E85002BB8C3 /* Release */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Release;
+		};
+/* End XCConfigurationList section */
+	};
+	rootObject = 42B7F6D715B06E85002BB8C3 /* Project object */;
+}

+ 113 - 0
gameplay-luagen/gameplay-luagen.xcodeproj/xcshareddata/xcschemes/gameplay-luagen.xcscheme

@@ -0,0 +1,113 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Scheme
+   version = "1.7">
+   <BuildAction
+      parallelizeBuildables = "YES"
+      buildImplicitDependencies = "YES">
+      <BuildActionEntries>
+         <BuildActionEntry
+            buildForTesting = "YES"
+            buildForRunning = "YES"
+            buildForProfiling = "YES"
+            buildForArchiving = "YES"
+            buildForAnalyzing = "YES">
+            <BuildableReference
+               BuildableIdentifier = "primary"
+               BlueprintIdentifier = "42B7F6DF15B06E85002BB8C3"
+               BuildableName = "gameplay-luagen"
+               BlueprintName = "gameplay-luagen"
+               ReferencedContainer = "container:gameplay-luagen.xcodeproj">
+            </BuildableReference>
+         </BuildActionEntry>
+      </BuildActionEntries>
+   </BuildAction>
+   <TestAction
+      selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
+      selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
+      shouldUseLaunchSchemeArgsEnv = "YES"
+      buildConfiguration = "Debug">
+      <Testables>
+      </Testables>
+      <MacroExpansion>
+         <BuildableReference
+            BuildableIdentifier = "primary"
+            BlueprintIdentifier = "42B7F6DF15B06E85002BB8C3"
+            BuildableName = "gameplay-luagen"
+            BlueprintName = "gameplay-luagen"
+            ReferencedContainer = "container:gameplay-luagen.xcodeproj">
+         </BuildableReference>
+      </MacroExpansion>
+   </TestAction>
+   <LaunchAction
+      selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
+      selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
+      launchStyle = "0"
+      useCustomWorkingDirectory = "NO"
+      buildConfiguration = "Debug"
+      ignoresPersistentStateOnLaunch = "NO"
+      debugDocumentVersioning = "YES"
+      allowLocationSimulation = "YES">
+      <PreActions>
+         <ExecutionAction
+            ActionType = "Xcode.IDEStandardExecutionActionsCore.ExecutionActionType.ShellScriptAction">
+            <ActionContent
+               title = "Run Script"
+               scriptText = "rm ${SRCROOT}/../gameplay/src/lua/*&#10;">
+               <EnvironmentBuildable>
+                  <BuildableReference
+                     BuildableIdentifier = "primary"
+                     BlueprintIdentifier = "42B7F6DF15B06E85002BB8C3"
+                     BuildableName = "gameplay-luagen"
+                     BlueprintName = "gameplay-luagen"
+                     ReferencedContainer = "container:gameplay-luagen.xcodeproj">
+                  </BuildableReference>
+               </EnvironmentBuildable>
+            </ActionContent>
+         </ExecutionAction>
+      </PreActions>
+      <BuildableProductRunnable>
+         <BuildableReference
+            BuildableIdentifier = "primary"
+            BlueprintIdentifier = "42B7F6DF15B06E85002BB8C3"
+            BuildableName = "gameplay-luagen"
+            BlueprintName = "gameplay-luagen"
+            ReferencedContainer = "container:gameplay-luagen.xcodeproj">
+         </BuildableReference>
+      </BuildableProductRunnable>
+      <CommandLineArguments>
+         <CommandLineArgument
+            argument = "$(PROJECT_DIR)/xml"
+            isEnabled = "YES">
+         </CommandLineArgument>
+         <CommandLineArgument
+            argument = "$(PROJECT_DIR)/../gameplay/src/lua/"
+            isEnabled = "YES">
+         </CommandLineArgument>
+      </CommandLineArguments>
+      <AdditionalOptions>
+      </AdditionalOptions>
+   </LaunchAction>
+   <ProfileAction
+      shouldUseLaunchSchemeArgsEnv = "YES"
+      savedToolIdentifier = ""
+      useCustomWorkingDirectory = "NO"
+      buildConfiguration = "Release"
+      debugDocumentVersioning = "YES">
+      <BuildableProductRunnable>
+         <BuildableReference
+            BuildableIdentifier = "primary"
+            BlueprintIdentifier = "42B7F6DF15B06E85002BB8C3"
+            BuildableName = "gameplay-luagen"
+            BlueprintName = "gameplay-luagen"
+            ReferencedContainer = "container:gameplay-luagen.xcodeproj">
+         </BuildableReference>
+      </BuildableProductRunnable>
+   </ProfileAction>
+   <AnalyzeAction
+      buildConfiguration = "Debug">
+   </AnalyzeAction>
+   <ArchiveAction
+      buildConfiguration = "Release"
+      revealArchiveInOrganizer = "YES">
+   </ArchiveAction>
+</Scheme>

+ 2 - 0
gameplay-luagen/generate-doxygen-xml.bat

@@ -0,0 +1,2 @@
+del /Q .\xml\*
+doxygen gameplay-luagen.doxyfile

+ 87 - 0
gameplay-luagen/src/Base.h

@@ -0,0 +1,87 @@
+#include <algorithm>
+#include <cassert>
+#include <fstream>
+#include <iostream>
+#include <map>
+#include <set>
+#include <string>
+#include <vector>
+#include <sys/types.h>
+#include <sys/stat.h>
+using namespace std;
+
+#define LUA_GLOBAL_FILENAME "lua_Global"
+#define LUA_ALL_BINDINGS_FILENAME "lua_all_bindings"
+#define LUA_OBJECT "ScriptUtil::LuaObject"
+#define SCOPE_REPLACEMENT ""
+#define SCOPE_REPLACEMENT_SIZE strlen(SCOPE_REPLACEMENT)
+#define REF_CLASS_NAME "Ref"
+#define REMOVE_NAMESPACE true
+
+#ifdef WIN32
+#include <windows.h>
+#pragma warning(disable : 4996)
+#pragma warning(disable : 4244)
+#pragma warning(disable : 4345)
+#else
+#include <dirent.h>
+#endif
+
+// Object deletion macro
+#define SAFE_DELETE(x) \
+    { \
+        delete x; \
+        x = NULL; \
+    }
+
+// Array deletion macro
+#define SAFE_DELETE_ARRAY(x) \
+    { \
+        delete[] x; \
+        x = NULL; \
+    }
+
+extern void printError(const char* format, ...);
+
+// Current function macro.
+#ifdef WIN32
+#define __current__func__ __FUNCTION__
+#else
+#define __current__func__ __func__
+#endif
+
+// Assert macros.
+#ifdef _DEBUG
+#define GP_ASSERT(expression) do { \
+    if (!(expression)) \
+    { \
+        printError("%s -- Assertion '" #expression "' failed.\n", __current__func__); \
+        assert(expression); \
+    } } while (0)
+#else
+#define GP_ASSERT(expression)
+#endif
+
+// Error macro.
+#ifdef GP_ERRORS_AS_WARNINGS
+#define GP_ERROR GP_WARN
+#else
+#define GP_ERROR(...) do \
+    { \
+        printError("%s -- ", __current__func__); \
+        printError(__VA_ARGS__); \
+        printError("\n"); \
+        assert(0); \
+        std::exit(-1); \
+    } while (0)
+#endif
+
+// Warning macro.
+#define GP_WARN(...) do \
+    { \
+        printError("%s -- ", __current__func__); \
+        printError(__VA_ARGS__); \
+        printError("\n"); \
+    } while (0)
+
+#include "DebugNew.h"

+ 299 - 0
gameplay-luagen/src/ClassBinding.cpp

@@ -0,0 +1,299 @@
+#include "ClassBinding.h"
+#include "Generator.h"
+
+static void generateInstanceGetter(ostream& o, const string& classname, const string& uniquename)
+{
+    o << "static " << classname << "* getInstance(lua_State* state)\n";
+    o << "{\n";
+    o << "    void* userdata = luaL_checkudata(state, 1, \"" << uniquename << "\");\n";
+    o << "    luaL_argcheck(state, userdata != NULL, 1, \"\'" << uniquename << "\' expected.\");\n";
+    o << "    return (" << classname << "*)((" << LUA_OBJECT << "*)userdata)->instance;\n";
+    o << "}\n\n";
+}
+
+ClassBinding::ClassBinding(string classname, string refId) : classname(classname),
+    refId(refId), inaccessibleConstructor(false), inaccessibleDestructor(false)
+{
+    // If specified, remove the namespace from the class name.
+    if (REMOVE_NAMESPACE)
+    {
+        this->classname = Generator::getInstance()->getClassNameWithoutNamespace(classname);
+    }
+
+    // Calculate the unique name for the class.
+    uniquename = Generator::getUniqueName(this->classname);
+}
+
+void ClassBinding::write(string dir, const set<string>& includes, string* bindingNS)
+{
+    // Calculate the constructor string.
+    size_t index = uniquename.rfind(SCOPE_REPLACEMENT);
+    string constructorString = "";
+    string* constructorUniqueName = NULL;
+    if (index != uniquename.npos && index != uniquename.length())
+        constructorString += uniquename.substr(index + SCOPE_REPLACEMENT_SIZE);
+    else
+        constructorString += uniquename;
+
+    // Generate a constructor function if there isn't one
+    // and the class doesn't have an inaccessible constructor.
+    FunctionBinding b(classname, uniquename);
+    b.name = constructorString;
+    b.returnParam = FunctionBinding::Param(FunctionBinding::Param::TYPE_CONSTRUCTOR, FunctionBinding::Param::KIND_POINTER, refId);
+    b.type = FunctionBinding::MEMBER_FUNCTION;
+    b.own = true;
+
+    map<string, vector<FunctionBinding> >::iterator iter = bindings.find(b.getFunctionName());
+    if (iter == bindings.end())
+    {
+        if (!inaccessibleConstructor)
+        {
+            bindings[b.getFunctionName()].push_back(b);
+            constructorUniqueName = new string(b.getFunctionName());
+        }
+    }
+    else
+    {
+        constructorUniqueName = new string(iter->second[0].getFunctionName());
+    }
+
+    // Calculate the destructor string.
+    index = uniquename.rfind(SCOPE_REPLACEMENT);
+    string destructorString = "~";
+    string* destructorUniqueName = NULL;
+    if (index != uniquename.npos && index != uniquename.length())
+        destructorString += uniquename.substr(index + SCOPE_REPLACEMENT_SIZE);
+    else
+        destructorString += uniquename;
+
+    // Generate a destructor function if there isn't one
+    // and the class doesn't have an inaccessible destructor
+    // or the class is derived from Ref.
+    b = FunctionBinding(classname, uniquename);
+    b.name = destructorString;
+    b.returnParam = FunctionBinding::Param(FunctionBinding::Param::TYPE_DESTRUCTOR);
+    b.type = FunctionBinding::MEMBER_FUNCTION;
+
+    iter = bindings.find(b.getFunctionName());
+    if (iter == bindings.end())
+    {
+        if (!inaccessibleDestructor || Generator::getInstance()->isRef(classname))
+        {
+            bindings[b.getFunctionName()].push_back(b);
+            destructorUniqueName = new string(b.getFunctionName());
+        }
+    }
+    else
+    {
+        destructorUniqueName = new string(iter->second[0].getFunctionName());
+    }
+
+    // Write out the header.
+    {
+        string path = dir + string("lua_") + uniquename + string(".h");
+        ofstream o(path.c_str());
+        if (!o)
+        {
+            GP_ERROR("Failed to open file '%s' for generating Lua bindings.", path.c_str());
+            return;
+        }
+
+        string includeGuard = string("lua_") + uniquename + string("_H_");
+        transform(includeGuard.begin(), includeGuard.end(), includeGuard.begin(), ::toupper);
+        o << "#ifndef " << includeGuard << "\n";
+        o << "#define " << includeGuard << "\n\n";
+
+        if (bindingNS)
+        {
+            o << "namespace " << *bindingNS << "\n";
+            o << "{\n\n";
+        }
+
+        o << "// Lua bindings for " << classname << ".\n";
+            
+        // Write out the binding functions declarations.
+        iter = bindings.begin();
+        for (; iter != bindings.end(); iter++)
+        {
+            o << "int " << iter->second[0].getFunctionName() << "(lua_State* state);\n";
+        }
+        o << "\n";
+
+        // Write out the signature of the function used to register the class with Lua.
+        o << "void luaRegister_" << uniquename << "();\n\n";
+
+        if (bindingNS)
+            o << "}\n\n";
+        o << "#endif\n";
+        o.close();
+    }
+
+    // Write out the implementation.
+    {
+        string path = dir + string("lua_") + uniquename + string(".cpp");
+        ofstream o(path.c_str());
+        if (!o)
+        {
+            GP_ERROR("Failed to open file '%s' for generating Lua bindings.", path.c_str());
+            return;
+        }
+        
+        o << "#include \"Base.h\"\n";
+        o << "#include \"ScriptController.h\"\n";
+        o << "#include \"lua_" << uniquename << ".h\"\n";
+
+        // Ensure we include the original class header, even 
+        // if the list of includes doesn't have it.
+        if (includes.find(include) == includes.end())
+            o << "#include \"" << include << "\"\n";
+
+        for (set<string>::iterator includeIter = includes.begin(); includeIter != includes.end(); includeIter++)
+        {
+            o << "#include \"" << *includeIter << "\"\n";
+        }
+        o << "\n";
+        
+
+        // If the original class is part of a namespace and we aren't generating into that namespace,
+        // include its member with a 'using' statement.
+        if (ns.length() > 0 && (!bindingNS || (*bindingNS != ns)))
+        {
+            o << "using " << ns << ";\n\n";
+        }
+
+        if (bindingNS)
+        {
+            o << "namespace " << *bindingNS << "\n";
+            o << "{\n\n";
+        }
+
+        // Write out the function used to register the class with Lua.
+        o << "void luaRegister_" << uniquename << "()\n";
+        o << "{\n";
+        
+        // Get the member functions ready to bind.
+        iter = bindings.begin();
+        bool hasMembers = false;
+        for (; iter != bindings.end(); iter++)
+        {
+            for (unsigned int i = 0, count = iter->second.size(); i < count; i++)
+            {
+                if (iter->second[i].type == FunctionBinding::MEMBER_FUNCTION ||
+                    iter->second[i].type == FunctionBinding::MEMBER_CONSTANT ||
+                    iter->second[i].type == FunctionBinding::MEMBER_VARIABLE)
+                {
+                    hasMembers = true;
+                    break;
+                }
+            }
+
+            if (hasMembers)
+                break;
+        }
+        if (hasMembers)
+        {
+            o << "    const luaL_Reg lua_members[] = \n";
+            o << "    {\n";
+            iter = bindings.begin();
+            for (; iter != bindings.end(); iter++)
+            {
+                for (unsigned int i = 0, count = iter->second.size(); i < count; i++)
+                {
+                    if ((iter->second[i].type == FunctionBinding::MEMBER_FUNCTION ||
+                        iter->second[i].type == FunctionBinding::MEMBER_CONSTANT ||
+                        iter->second[i].type == FunctionBinding::MEMBER_VARIABLE) &&
+                        iter->second[i].returnParam.type != FunctionBinding::Param::TYPE_CONSTRUCTOR &&
+                        iter->second[i].returnParam.type != FunctionBinding::Param::TYPE_DESTRUCTOR)
+                    {
+                        o << "        {\"" << iter->second[i].name << "\", " << iter->second[i].getFunctionName() << "},\n";
+                        break;
+                    }
+                }
+            }
+            o << "        {NULL, NULL}\n";
+            o << "    };\n";
+        }
+        else
+        {
+            o << "    const luaL_Reg* lua_members = NULL;\n";
+        }
+
+        // Get the static functions ready to bind.
+        iter = bindings.begin();
+        bool hasStatics = false;
+        for (; iter != bindings.end(); iter++)
+        {
+            for (unsigned int i = 0, count = iter->second.size(); i < count; i++)
+            {
+                if (iter->second[i].type == FunctionBinding::STATIC_FUNCTION ||
+                    iter->second[i].type == FunctionBinding::STATIC_CONSTANT ||
+                    iter->second[i].type == FunctionBinding::STATIC_VARIABLE)
+                {
+                    hasStatics = true;
+                    break;
+                }
+            }
+
+            if (hasStatics)
+                break;
+        }
+        if (hasStatics)
+        {
+            o << "    const luaL_Reg lua_statics[] = \n";
+            o << "    {\n";
+            iter = bindings.begin();
+            for (; iter != bindings.end(); iter++)
+            {
+                for (unsigned int i = 0, count = iter->second.size(); i < count; i++)
+                {
+                    if (iter->second[i].type == FunctionBinding::STATIC_FUNCTION ||
+                    iter->second[i].type == FunctionBinding::STATIC_CONSTANT ||
+                    iter->second[i].type == FunctionBinding::STATIC_VARIABLE)
+                    {
+                        o << "        {\"" << iter->second[i].name << "\", " << iter->second[i].getFunctionName() << "},\n";
+                        break;
+                    }
+                }
+            }
+            o << "        {NULL, NULL}\n";
+            o << "    };\n";
+        }
+        else
+        {
+            o << "    const luaL_Reg* lua_statics = NULL;\n";
+        }
+
+        // Output the scope path for the class (used for inner classes).
+        vector<string> scopePath = Generator::getScopePath(classname, ns);
+        o << "    std::vector<std::string> scopePath;\n";
+        for (vector<string>::iterator scopeIter = scopePath.begin(); scopeIter != scopePath.end(); scopeIter++)
+        {
+            o << "    scopePath.push_back(\"" << *scopeIter << "\");\n";
+        }
+
+        // Register the class (its member and static functions and constructor and destructor).
+        o << "\n    ScriptUtil::registerClass(\"" << uniquename << "\", lua_members, ";
+        o << ((constructorUniqueName) ? *constructorUniqueName : "NULL") << ", ";
+        o << ((destructorUniqueName) ? *destructorUniqueName : "NULL") << ", ";
+        o << "lua_statics, scopePath);\n";
+        o << "}\n\n";
+
+        // Write out the function used to get the instance for
+        // calling member functions and variables.
+        generateInstanceGetter(o, classname, uniquename);
+
+        // Write out the binding functions.
+        iter = bindings.begin();
+        for (; iter != bindings.end(); iter++)
+        {
+            FunctionBinding::write(o, iter->second);
+        }
+
+        if (bindingNS)
+            o << "}\n";
+        o.close();
+    }
+
+    SAFE_DELETE(constructorUniqueName);
+    SAFE_DELETE(destructorUniqueName);
+}

+ 51 - 0
gameplay-luagen/src/ClassBinding.h

@@ -0,0 +1,51 @@
+#ifndef CLASSBINDING_H_
+#define CLASSBINDING_H_
+
+#include "Base.h"
+#include "FunctionBinding.h"
+
+/**
+ * Represents the script binding for a class.
+ */
+struct ClassBinding
+{
+    /**
+     * Constructor.
+     * 
+     * @param classname The name of the class.
+     * @param refId The reference ID for the class (generated by Doxygen).
+     */
+    ClassBinding(string classname = "", string refId = "");
+
+    /**
+     * Writes out the generated Lua bindings in C++ to the given directory.
+     * 
+     * @param dir The directory to write the bindings files (.h and .cpp) to.
+     * @param includes The includes for the class.
+     * @param bindingNS The namespace to generate the Lua bindings within.
+     */
+    void write(string dir, const set<string>& includes, string* bindingNS = NULL);
+
+    /** Holds all the public function bindings of the class. */
+    map<string, vector<FunctionBinding> > bindings;
+    /** Holds bindings for hidden functions of the class (protected/private). */
+    map<string, vector<FunctionBinding> > hidden;
+    /** Holds the name(s) of the derived class(es). */
+    vector<string> derived;
+    /** Holds the name of the class. */
+    string classname;
+    /** Holds the class's unique name (used only in the script bindings). */
+    string uniquename;
+    /** Holds the class's (Doxygen-generated) reference id. */
+    string refId;
+    /** Holds the needed include for the original class declaration. */
+    string include;
+    /** Holds whether the class has an inaccessible (protected/private) constructor (or has a pure-virtual method). */
+    bool inaccessibleConstructor;
+    /** Holds whether the class has an inaccessible (protected/private) destructor. */
+    bool inaccessibleDestructor;
+    /** Holds the class' namespace (if it has one). */
+    string ns;
+};
+
+#endif

+ 302 - 0
gameplay-luagen/src/DebugNew.cpp

@@ -0,0 +1,302 @@
+#include <new>
+#include <exception>
+#include <cstdio>
+#include <cstdarg>
+
+#ifdef WIN32
+#include <windows.h>
+#include <dbghelp.h>
+#pragma comment(lib,"dbghelp.lib")
+
+#define MAX_STACK_FRAMES 16
+bool __trackStackTrace = false;
+#endif
+
+struct MemoryAllocationRecord
+{
+    unsigned long address;          // address returned to the caller after allocation
+    unsigned int size;              // size of the allocation request
+    const char* file;               // source file of allocation request
+    int line;                       // source line of the allocation request
+    MemoryAllocationRecord* next;
+    MemoryAllocationRecord* prev;
+#ifdef WIN32
+    bool trackStackTrace;
+    unsigned int pc[MAX_STACK_FRAMES];
+#endif
+};
+
+MemoryAllocationRecord* __memoryAllocations = 0;
+int __memoryAllocationCount = 0;
+
+void* debugAlloc(std::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)
+{
+    return debugAlloc(size, file, line);
+}
+
+void* operator new[] (std::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)
+{
+    return operator new (size, "", 0);
+}
+
+void* operator new[] (std::size_t size) throw(std::bad_alloc)
+{
+    return operator new (size, "", 0);
+}
+
+void* operator new (std::size_t size, const std::nothrow_t&) throw()
+{
+    return operator new (size, "", 0);
+}
+
+void* operator new[] (std::size_t size, const std::nothrow_t&) throw()
+{
+    return operator new (size, "", 0);
+}
+
+void operator delete (void* p) throw()
+{
+    debugFree(p);
+}
+
+void operator delete[] (void* p) throw()
+{
+    operator delete (p);
+}
+
+void operator delete (void* p, const char* file, int line) throw()
+{
+    operator delete (p);
+}
+
+void operator delete[] (void* p, const char* file, int line) throw()
+{
+    operator delete (p);
+}
+
+#ifdef _MSC_VER
+#pragma warning( default : 4290 )
+#endif
+
+// Include Base.h (needed for logging macros) AFTER new operator impls
+#include "Base.h"
+
+void* debugAlloc(std::size_t size, const char* file, int line)
+{
+    // Allocate memory + size for a MemoryAlloctionRecord
+    unsigned char* mem = (unsigned char*)malloc(size + sizeof(MemoryAllocationRecord));
+
+    MemoryAllocationRecord* rec = (MemoryAllocationRecord*)mem;
+
+    // Move memory pointer past record
+    mem += sizeof(MemoryAllocationRecord);
+
+    rec->address = (unsigned long)mem;
+    rec->size = size;
+    rec->file = file;
+    rec->line = line;
+    rec->next = __memoryAllocations;
+    rec->prev = 0;
+
+    // Capture the stack frame (up to MAX_STACK_FRAMES) if we 
+    // are running on Windows and the user has enabled it.
+#if defined(WIN32)
+    rec->trackStackTrace = __trackStackTrace;
+    if (rec->trackStackTrace)
+    {
+        static bool initialized = false;
+        if (!initialized)
+        {
+            if (!SymInitialize(GetCurrentProcess(), NULL, true))
+                printError("Stack trace tracking will not work.\n");
+            initialized = true;
+        }
+    
+        // Get the current context (state of EBP, EIP, ESP registers).
+        static CONTEXT context;
+        RtlCaptureContext(&context);
+    
+        static STACKFRAME64 stackFrame;
+        memset(&stackFrame, 0, sizeof(STACKFRAME64));
+
+        // Initialize the stack frame based on the machine architecture.
+#ifdef _M_IX86
+        static const DWORD machineType = IMAGE_FILE_MACHINE_I386;
+        stackFrame.AddrPC.Offset = context.Eip;
+        stackFrame.AddrPC.Mode = AddrModeFlat;
+        stackFrame.AddrFrame.Offset = context.Ebp;
+        stackFrame.AddrFrame.Mode = AddrModeFlat;
+        stackFrame.AddrStack.Offset = context.Esp;
+        stackFrame.AddrStack.Mode = AddrModeFlat;
+#else
+#error "Machine architecture not supported!"
+#endif
+
+        // Walk up the stack and store the program counters.
+        memset(rec->pc, 0, sizeof(rec->pc));
+        for (int i = 0; i < MAX_STACK_FRAMES; i++)
+        {
+            rec->pc[i] = stackFrame.AddrPC.Offset;
+            if (!StackWalk64(machineType, GetCurrentProcess(), GetCurrentThread(), &stackFrame,
+                &context, NULL, SymFunctionTableAccess64, SymGetModuleBase64, NULL))
+            {
+                break;
+            }
+        }
+    }
+#endif
+
+    if (__memoryAllocations)
+        __memoryAllocations->prev = rec;
+    __memoryAllocations = rec;
+    ++__memoryAllocationCount;
+
+    return mem;
+}
+
+void debugFree(void* p)
+{
+    if (p == 0)
+        return;
+
+    // Backup passed in pointer to access memory allocation record
+    void* mem = ((unsigned char*)p) - sizeof(MemoryAllocationRecord);
+
+    MemoryAllocationRecord* rec = (MemoryAllocationRecord*)mem;
+
+    // Sanity check: ensure that address in record matches passed in address
+    if (rec->address != (unsigned long)p)
+    {
+        printError("[memory] CORRUPTION: Attempting to free memory address with invalid memory allocation record.\n");
+        return;
+    }
+
+    // Link this item out
+    if (__memoryAllocations == rec)
+        __memoryAllocations = rec->next;
+    if (rec->prev)
+        rec->prev->next = rec->next;
+    if (rec->next)
+        rec->next->prev = rec->prev;
+    --__memoryAllocationCount;
+
+    // Free the address from the original alloc location (before mem allocation record)
+    free(mem);
+}
+
+#ifdef WIN32
+void printStackTrace(MemoryAllocationRecord* rec)
+{
+    const unsigned int bufferSize = 512;
+
+    // Resolve the program counter to the corresponding function names.
+    unsigned int pc;
+    for (int i = 0; i < MAX_STACK_FRAMES; i++)
+    {
+        // Check to see if we are at the end of the stack trace.
+        pc = rec->pc[i];
+        if (pc == 0)
+            break;
+
+        // Get the function name.
+        unsigned char buffer[sizeof(IMAGEHLP_SYMBOL64) + bufferSize];
+        IMAGEHLP_SYMBOL64* symbol = (IMAGEHLP_SYMBOL64*)buffer;
+        DWORD64 displacement;
+        memset(symbol, 0, sizeof(IMAGEHLP_SYMBOL64) + bufferSize);
+        symbol->SizeOfStruct = sizeof(IMAGEHLP_SYMBOL64);
+        symbol->MaxNameLength = bufferSize;
+        if (!SymGetSymFromAddr64(GetCurrentProcess(), pc, &displacement, symbol))
+        {
+            printError("[memory] STACK TRACE: <unknown location>\n");
+        }
+        else
+        {
+            symbol->Name[bufferSize - 1] = '\0';
+
+            // Check if we need to go further up the stack.
+            if (strncmp(symbol->Name, "operator new", 12) == 0)
+            {
+                // In operator new or new[], keep going...
+            }
+            else
+            {
+                // Get the file and line number.
+                if (pc != 0)
+                {
+                    IMAGEHLP_LINE64 line;
+                    DWORD displacement;
+                    memset(&line, 0, sizeof(line));
+                    line.SizeOfStruct = sizeof(line);
+                    if (!SymGetLineFromAddr64(GetCurrentProcess(), pc, &displacement, &line))
+                    {
+                        printError("[memory] STACK TRACE: %s - <unknown file>:<unknown line number>\n", symbol->Name);
+                    }
+                    else
+                    {
+                        const char* file = strrchr(line.FileName, '\\');
+                        if(!file) 
+                            file = line.FileName;
+                        else
+                            file++;
+                        
+                        printError("[memory] STACK TRACE: %s - %s:%d\n", symbol->Name, file, line.LineNumber);
+                    }
+                }
+            }
+        }
+    }
+}
+#endif
+
+extern void printMemoryLeaks()
+{
+    // Dump general heap memory leaks
+    if (__memoryAllocationCount == 0)
+    {
+        printError("[memory] All HEAP allocations successfully cleaned up (no leaks detected).\n");
+    }
+    else
+    {
+        printError("[memory] WARNING: %d HEAP allocations still active in memory.\n", __memoryAllocationCount);
+        MemoryAllocationRecord* rec = __memoryAllocations;
+        while (rec)
+        {
+#ifdef WIN32
+            if (rec->trackStackTrace)
+            {
+                printError("[memory] LEAK: HEAP allocation leak at address %#x of size %d:\n", rec->address, rec->size);
+                printStackTrace(rec);
+            }
+            else
+                printError("[memory] LEAK: HEAP allocation leak at address %#x of size %d from line %d in file '%s'.\n", rec->address, rec->size, rec->line, rec->file);
+#else
+                printError("[memory] LEAK: HEAP allocation leak at address %#x of size %d from line %d in file '%s'.\n", rec->address, rec->size, rec->line, rec->file);
+#endif
+            rec = rec->next;
+        }
+    }
+}
+
+#if defined(WIN32)
+void setTrackStackTrace(bool trackStackTrace)
+{
+    __trackStackTrace = trackStackTrace;
+}
+
+void toggleTrackStackTrace()
+{
+    __trackStackTrace = !__trackStackTrace;
+}
+#endif

+ 50 - 0
gameplay-luagen/src/DebugNew.h

@@ -0,0 +1,50 @@
+#ifndef DEBUGNEW_H_
+#define DEBUGNEW_H_
+
+#include <new>
+#include <exception>
+
+#define TRACK_MEMORY() \
+    static struct MemoryTrackerClass { ~MemoryTrackerClass() { printMemoryLeaks(); system("pause"); } } m
+
+// Prints all heap and reference leaks to stderr.
+extern void printMemoryLeaks();
+
+// global new/delete operator overloads
+#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 delete (void* p) throw();
+void operator delete[] (void* p) throw();
+void operator delete (void* p, const char* file, int line) throw();
+void operator delete[] (void* p, const char* file, int line) throw();
+#ifdef _MSC_VER
+#pragma warning( default : 4290 )
+#endif
+
+// Re-define new to use versions with file and line number
+#define DEBUG_NEW new (__FILE__, __LINE__)
+#define new DEBUG_NEW
+
+#endif
+
+#if defined(WIN32)
+
+/**
+ * Sets whether stack traces are tracked on memory allocations or not.
+ * 
+ * @param trackStackTrace Whether to track the stack trace on memory allocations.
+ */
+void setTrackStackTrace(bool trackStackTrace);
+
+/**
+ * Toggles stack trace tracking on memory allocations.
+ */
+void toggleTrackStackTrace();
+#endif

+ 16 - 0
gameplay-luagen/src/EnumBinding.h

@@ -0,0 +1,16 @@
+#ifndef ENUMBINDING_H
+#define ENUMBINDING_H
+
+#include "Base.h"
+
+/**
+ * Represents a script binding for an enumeration.
+ */
+struct EnumBinding
+{
+    vector<string> values;
+    vector<string> scopePath;
+    string include;
+};
+
+#endif

+ 988 - 0
gameplay-luagen/src/FunctionBinding.cpp

@@ -0,0 +1,988 @@
+#include "FunctionBinding.h"
+#include "Generator.h"
+
+
+// Helper functions.
+static inline void outputLuaTypeCheckInstance(ostream& o);
+static inline void outputLuaTypeCheck(ostream& o, int index, const FunctionBinding::Param& p = 
+    FunctionBinding::Param(FunctionBinding::Param::TYPE_OBJECT, FunctionBinding::Param::KIND_POINTER));
+static inline void indent(ostream& o, int indentLevel);
+static inline void outputBindingInvocation(ostream& o, const FunctionBinding& b, unsigned int paramCount, unsigned int indentLevel);
+static inline void outputGetParam(ostream& o, const FunctionBinding::Param& p, int i, int indentLevel, bool offsetIndex = false);
+static inline void outputMatchedBinding(ostream& o, const FunctionBinding& b, unsigned int paramCount, unsigned int indentLevel);
+static inline void outputReturnValue(ostream& o, const FunctionBinding& b, int indentLevel);
+
+
+FunctionBinding::Param::Param(FunctionBinding::Param::Type type, Kind kind, const string& info) : 
+    type(type), kind(kind), info(info), hasDefaultValue(false)
+{
+}
+
+bool FunctionBinding::Param::operator==(const Param& p) const
+{
+    return this->type == p.type && this->kind == p.kind && this->info == p.info;
+}
+
+bool FunctionBinding::Param::operator!=(const Param& p) const
+{
+    return !(*this == p);
+}
+
+FunctionBinding::FunctionBinding(string classname, string uniquename) : classname(classname), uniquename(uniquename), name(""), own(false)
+{
+}
+
+string FunctionBinding::getFunctionName() const
+{
+    if (functionName.length() == 0)
+    {
+        functionName = "lua_";
+        functionName += uniquename;
+    
+        if (type == STATIC_FUNCTION ||
+            type == STATIC_CONSTANT ||
+            type == STATIC_VARIABLE)
+            functionName += "_static";
+        functionName += "_";
+
+        if (returnParam.type == Param::TYPE_CONSTRUCTOR)
+            functionName += "_init";
+        else if (returnParam.type == Param::TYPE_DESTRUCTOR)
+            functionName += "_gc";
+        else
+        {
+            size_t i = name.rfind("::");
+            if (i != name.npos)
+                functionName += name.substr(i + 2);
+            else
+                functionName += name;
+        }
+    }
+
+    return functionName;
+}
+
+unsigned int FunctionBinding::getMinParamCount() const
+{
+    for (unsigned int i = 0; i < paramTypes.size(); i++)
+    {
+        if (paramTypes[i].hasDefaultValue)
+            return i;
+    }
+    return paramTypes.size();
+}
+
+void FunctionBinding::write(ostream& o, const vector<FunctionBinding>& bindings)
+{
+    GP_ASSERT(bindings.size() > 0);
+
+    // Print the function signature.
+    o << "int " << bindings[0].getFunctionName() << "(lua_State* state)\n";
+    o << "{\n";
+
+    if (bindings.size() == 1 && bindings[0].type == FunctionBinding::MEMBER_VARIABLE)
+    {
+        // Validate the parameter count.
+        o << "    // Validate the number of parameters.\n";
+        o << "    if (lua_gettop(state) > 2)\n";
+        o << "    {\n";
+        o << "        lua_pushstring(state, \"Invalid number of parameters (expected 1 or 2).\");\n";
+        o << "        lua_error(state);\n";
+        o << "    }\n\n";
+        
+        // Get or set the member variable depending on the number of parameters.
+        o << "    " << bindings[0].classname << "* instance = getInstance(state);\n";
+        o << "    if (lua_gettop(state) == 2)\n";
+        o << "    {\n";
+        outputGetParam(o, bindings[0].returnParam, 1, 2);
+
+        if (bindings[0].returnParam.kind == FunctionBinding::Param::KIND_POINTER &&
+            bindings[0].returnParam.type != FunctionBinding::Param::TYPE_OBJECT &&
+            bindings[0].returnParam.info.size() > 0)
+        {
+            o << "        memcpy(instance->" << bindings[0].name << ", param2, sizeof(";
+            o << FunctionBinding::Param(bindings[0].returnParam.type) << ") * " << bindings[0].returnParam.info << ");\n";
+        }
+        else
+        {
+            o << "        instance->" << bindings[0].name << " = ";
+            if (bindings[0].returnParam.type == FunctionBinding::Param::TYPE_OBJECT &&
+                bindings[0].returnParam.kind != FunctionBinding::Param::KIND_POINTER)
+            {
+                o << "*";
+            }
+            o << "param2;\n";
+        }
+
+        o << "        return 0;\n";
+        o << "    }\n";
+        o << "    else\n";
+        o << "    {\n";
+        
+        // Pass the return value back to Lua.
+        if (bindings[0].returnParam.type == FunctionBinding::Param::TYPE_OBJECT)
+        {
+            switch (bindings[0].returnParam.kind)
+            {
+            case FunctionBinding::Param::KIND_POINTER:
+                o << "        void* returnPtr = (void*)instance->" << bindings[0].name << ";\n";
+                break;
+            case FunctionBinding::Param::KIND_VALUE:
+                o << "        void* returnPtr = (void*)new " << bindings[0].returnParam << "(instance->" << bindings[0].name << ");\n";
+                break;
+            case FunctionBinding::Param::KIND_REFERENCE:
+                o << "        void* returnPtr = (void*)&(instance->" << bindings[0].name << ");\n";
+                break;
+            default:
+                GP_ERROR("Invalid return value kind '%d'.", bindings[0].returnParam.kind);
+                break;
+            }
+        }
+        else
+        {
+            o << "        " << bindings[0].returnParam << " result = instance->" << bindings[0].name << ";\n";
+        }
+        outputReturnValue(o, bindings[0], 2);
+        o << "    }\n";
+        o << "}\n\n";
+    }
+    else if (bindings.size() == 1 && 
+        (bindings[0].type == FunctionBinding::STATIC_VARIABLE ||
+        bindings[0].type == FunctionBinding::GLOBAL_VARIABLE))
+    {
+        // Validate the parameter count.
+        o << "    // Validate the number of parameters.\n";
+        o << "    if (lua_gettop(state) > 1)\n";
+        o << "    {\n";
+        o << "        lua_pushstring(state, \"Invalid number of parameters (expected 0 or 1).\");\n";
+        o << "        lua_error(state);\n";
+        o << "    }\n\n";
+        
+        // Get or set the static variable depending on the number of parameters.
+        o << "    if (lua_gettop(state) == 1)\n";
+        o << "    {\n";
+        outputGetParam(o, bindings[0].returnParam, 0, 2);
+
+        if (bindings[0].returnParam.kind == FunctionBinding::Param::KIND_POINTER &&
+            bindings[0].returnParam.type != FunctionBinding::Param::TYPE_OBJECT &&
+            bindings[0].returnParam.info.size() > 0)
+        {
+            o << "        memcpy(";
+            if (bindings[0].classname.size() > 0)
+                o << bindings[0].classname << "::";
+            o << bindings[0].name << ", param1, sizeof(";
+            o << FunctionBinding::Param(bindings[0].returnParam.type) << ") * " << bindings[0].returnParam.info << ");\n";
+        }
+        else
+        {
+            o << "        ";
+            if (bindings[0].classname.size() > 0)
+                o << bindings[0].classname << "::";
+            o << bindings[0].name << " = ";
+            if (bindings[0].returnParam.type == FunctionBinding::Param::TYPE_OBJECT &&
+                bindings[0].returnParam.kind != FunctionBinding::Param::KIND_POINTER)
+            {
+                o << "*";
+            }
+            o << "param1;\n";
+        }
+        o << "        return 0;\n";
+        o << "    }\n";
+        o << "    else\n";
+        o << "    {\n";
+        
+        // Pass the return value back to Lua.
+        if (bindings[0].returnParam.type == FunctionBinding::Param::TYPE_OBJECT)
+        {
+            switch (bindings[0].returnParam.kind)
+            {
+            case FunctionBinding::Param::KIND_POINTER:
+                o << "        void* returnPtr = (void*)";
+                if (bindings[0].classname.size() > 0)
+                    o << bindings[0].classname << "::";
+                o << bindings[0].name << ";\n";
+                break;
+            case FunctionBinding::Param::KIND_VALUE:
+                o << "        void* returnPtr = (void*)new " << bindings[0].returnParam << "(";
+                if (bindings[0].classname.size() > 0)
+                    o << bindings[0].classname << "::";
+                o << bindings[0].name << ");\n";
+                break;
+            case FunctionBinding::Param::KIND_REFERENCE:
+                o << "        void* returnPtr = (void*)&(";
+                if (bindings[0].classname.size() > 0)
+                    o << bindings[0].classname << "::";
+                o << bindings[0].name << ");\n";
+                break;
+            default:
+                GP_ERROR("Invalid return value kind '%d'.", bindings[0].returnParam.kind);
+                break;
+            }
+        }
+        else
+        {
+            o << "        " << bindings[0].returnParam << " result = ";
+            if (bindings[0].classname.size() > 0)
+                o << bindings[0].classname << "::";
+            o << bindings[0].name << ";\n";
+        }
+        outputReturnValue(o, bindings[0], 2);
+        o << "    }\n";
+        o << "}\n\n";
+    }
+    else if (bindings.size() == 1 && bindings[0].type == FunctionBinding::MEMBER_CONSTANT)
+    {
+        // Validate the parameter count.
+        o << "    // Validate the number of parameters.\n";
+        o << "    if (lua_gettop(state) > 1)\n";
+        o << "    {\n";
+        o << "        lua_pushstring(state, \"Invalid number of parameters (expected 1).\");\n";
+        o << "        lua_error(state);\n";
+        o << "    }\n\n";
+        
+        // Pass the return value back to Lua.
+        o << "    " << bindings[0].classname << "* instance = getInstance(state);\n";
+        if (bindings[0].returnParam.type == FunctionBinding::Param::TYPE_OBJECT)
+        {
+            switch (bindings[0].returnParam.kind)
+            {
+            case FunctionBinding::Param::KIND_POINTER:
+                o << "    void* returnPtr = (void*)instance->" << bindings[0].name << ";\n";
+                break;
+            case FunctionBinding::Param::KIND_VALUE:
+                o << "    void* returnPtr = (void*)new " << bindings[0].returnParam << "(instance->" << bindings[0].name << ");\n";
+                break;
+            case FunctionBinding::Param::KIND_REFERENCE:
+                o << "    void* returnPtr = (void*)&(instance->" << bindings[0].name << ");\n";
+                break;
+            default:
+                GP_ERROR("Invalid return value kind '%d'.", bindings[0].returnParam.kind);
+                break;
+            }
+        }
+        else
+        {
+            o << "    " << bindings[0].returnParam << " result = instance->" << bindings[0].name << ";\n";
+        }
+        outputReturnValue(o, bindings[0], 1);
+        o << "}\n\n";
+    }
+    else if (bindings.size() == 1 && 
+        (bindings[0].type == FunctionBinding::STATIC_CONSTANT ||
+        bindings[0].type == FunctionBinding::GLOBAL_CONSTANT))
+    {
+        // Validate the parameter count.
+        o << "    // Validate the number of parameters.\n";
+        o << "    if (lua_gettop(state) > 0)\n";
+        o << "    {\n";
+        o << "        lua_pushstring(state, \"Invalid number of parameters (expected 0).\");\n";
+        o << "        lua_error(state);\n";
+        o << "    }\n\n";
+        
+        // Pass the return value back to Lua.
+        if (bindings[0].returnParam.type == FunctionBinding::Param::TYPE_OBJECT)
+        {
+            switch (bindings[0].returnParam.kind)
+            {
+            case FunctionBinding::Param::KIND_POINTER:
+                o << "    void* returnPtr = (void*)";
+                if (bindings[0].classname.size() > 0)
+                    o << bindings[0].classname << "::";
+                o << bindings[0].name << ";\n";
+                break;
+            case FunctionBinding::Param::KIND_VALUE:
+                o << "    void* returnPtr = (void*)new " << bindings[0].returnParam << "(";
+                if (bindings[0].classname.size() > 0)
+                    o << bindings[0].classname << "::";
+                o << bindings[0].name << ");\n";
+                break;
+            case FunctionBinding::Param::KIND_REFERENCE:
+                o << "    void* returnPtr = (void*)&(";
+                if (bindings[0].classname.size() > 0)
+                    o << bindings[0].classname << "::";
+                o << bindings[0].name << ");\n";
+                break;
+            default:
+                GP_ERROR("Invalid return value kind '%d'.", bindings[0].returnParam.kind);
+                break;
+            }
+        }
+        else
+        {
+            o << "    " << bindings[0].returnParam << " result = ";
+            if (bindings[0].classname.size() > 0)
+                o << bindings[0].classname << "::";
+            o << bindings[0].name << ";\n";
+        }
+        outputReturnValue(o, bindings[0], 1);
+        o << "}\n\n";
+    }
+    else
+    {
+        // Get all valid parameter counts.
+        unsigned int paramCountOffset;
+        map<unsigned int, vector<const FunctionBinding*> > paramCounts;
+        for (unsigned int i = 0, count = bindings.size(); i < count; i++)
+        {
+            unsigned int minParamCount = bindings[i].getMinParamCount();
+            paramCountOffset = (bindings[i].type == FunctionBinding::MEMBER_FUNCTION && bindings[i].returnParam.type != FunctionBinding::Param::TYPE_CONSTRUCTOR) ? 1 : 0;
+            paramCounts[minParamCount + paramCountOffset].push_back(&bindings[i]);
+
+            if (minParamCount < bindings[i].paramTypes.size())
+            {
+                for (unsigned int c = minParamCount + 1; c <= bindings[i].paramTypes.size(); c++)
+                {
+                    paramCounts[c + paramCountOffset].push_back(&bindings[i]);
+                }
+            }
+        }
+        
+        // Get the parameter count.
+        o << "    // Get the number of parameters.\n";
+        o << "    int paramCount = lua_gettop(state);\n\n";
+        
+        // Retrieve all the parameters and attempt to match them to a valid binding,
+        // notifying the user if the number of parameters is invalid.
+        o << "    // Attempt to match the parameters to a valid binding.\n";
+        o << "    switch (paramCount)\n";
+        o << "    {\n";
+        map<unsigned int, vector<const FunctionBinding*> >::iterator iter;
+        unsigned int checkCount = 0;
+        for (iter = paramCounts.begin(); iter != paramCounts.end(); iter++)
+        {
+            o << "        case " << iter->first << ":\n";
+            o << "        {\n";
+
+            for (unsigned int i = 0, count = iter->second.size(); i < count; i++)
+            {
+                // Only indent if there are parameters.
+                if (iter->first > 0)
+                    indent(o, 3);
+
+                if (i > 0)
+                {                    
+                    o << "else ";
+                }
+                outputMatchedBinding(o, *(iter->second[i]), iter->first, 3);
+            }
+
+            // Only print an else clause with error report if there are parameters.
+            if (iter->first > 0)
+            {
+                indent(o, 3);
+                o << "else\n";
+                indent(o, 3);
+                o << "{\n";
+                indent(o, 4);
+                o << "lua_pushstring(state, \"" << bindings[0].getFunctionName();
+                o << " - Failed to match the given parameters to a valid function signature.\");\n";
+                indent(o, 4);
+                o << "lua_error(state);\n";
+                indent(o, 3);
+                o << "}\n";
+            }
+            
+            o << "            break;\n";
+            o << "        }\n";
+        }
+        
+        o << "        default:\n";
+        o << "        {\n";
+        o << "            lua_pushstring(state, \"Invalid number of parameters (expected "; 
+        for (iter = paramCounts.begin(), checkCount = 1; iter != paramCounts.end(); iter++)
+        {
+            if (checkCount == paramCounts.size() && paramCounts.size() > 1)
+                o << " or ";
+            o << iter->first;
+            checkCount++;
+
+            if (checkCount < paramCounts.size())
+                o << ", ";
+        }
+        o << ").\");\n";
+        o << "            lua_error(state);\n";
+        o << "            break;\n";
+        o << "        }\n";
+        o << "    }\n";
+        o << "    return 0;\n";
+        o << "}\n\n";
+    }
+}
+
+bool FunctionBinding::signaturesMatch(const FunctionBinding& b1, const FunctionBinding& b2)
+{
+    if (b1.type == b2.type)
+    {
+        bool namesMatch = b1.name == b2.name;
+
+        // Ignore class qualifiers on member function bindings (to support inherited overloaded bindings).
+        if (b1.type == FunctionBinding::MEMBER_CONSTANT ||
+            b1.type == FunctionBinding::MEMBER_FUNCTION ||
+            b1.type == FunctionBinding::MEMBER_VARIABLE)
+        {
+            string b1name = b1.name;
+            string b2name = b2.name;
+            size_t i = b1name.rfind("::");
+            if (i != b1name.npos)
+                b1name = b1name.substr(i + 2);
+            i = b2name.rfind("::");
+            if (i != b2name.npos)
+                b2name = b2name.substr(i + 2);
+    
+            namesMatch = b1name == b2name;
+        }
+
+        // Check the binding's name, parameter types and return value type.
+        if (namesMatch)
+        {
+            if (b1.paramTypes.size() != b2.paramTypes.size())
+                return false;
+
+            for (unsigned int i = 0, count = b1.paramTypes.size(); i < count; i++)
+            {
+                if (b1.paramTypes[i] != b2.paramTypes[i])
+                    return false;
+            }
+
+            return true;
+        }
+    }
+    return false;
+}
+
+ostream& operator<<(ostream& o, const FunctionBinding::Param& param)
+{
+    switch (param.type)
+    {
+    case FunctionBinding::Param::TYPE_VOID:
+        o << "void";
+        break;
+    case FunctionBinding::Param::TYPE_BOOL:
+        o << "bool";
+        break;
+    case FunctionBinding::Param::TYPE_CHAR:
+        o << "char";
+        break;
+    case FunctionBinding::Param::TYPE_SHORT:
+        o << "short";
+        break;
+    case FunctionBinding::Param::TYPE_INT:
+        o << "int";
+        break;
+    case FunctionBinding::Param::TYPE_LONG:
+        o << "long";
+        break;
+    case FunctionBinding::Param::TYPE_UCHAR:
+        o << "unsigned char";
+        break;
+    case FunctionBinding::Param::TYPE_USHORT:
+        o << "unsigned short";
+        break;
+    case FunctionBinding::Param::TYPE_UINT:
+        o << "unsigned int";
+        break;
+    case FunctionBinding::Param::TYPE_ULONG:
+        o << "unsigned long";
+        break;
+    case FunctionBinding::Param::TYPE_FLOAT:
+        o << "float";
+        break;
+    case FunctionBinding::Param::TYPE_DOUBLE:
+        o << "double";
+        break;
+    case FunctionBinding::Param::TYPE_ENUM:
+        o << Generator::getInstance()->getIdentifier(param.info);
+        break;
+    case FunctionBinding::Param::TYPE_STRING:
+        if (param.info == "string")
+            o << "std::string";
+        else
+            o << "const char";
+        break;
+    case FunctionBinding::Param::TYPE_OBJECT:
+    case FunctionBinding::Param::TYPE_CONSTRUCTOR:
+        o << Generator::getInstance()->getIdentifier(param.info);
+        break;
+    case FunctionBinding::Param::TYPE_UNRECOGNIZED:
+        o << param.info;
+        break;
+    case FunctionBinding::Param::TYPE_DESTRUCTOR:
+    default:
+        break;
+    }
+
+    if (param.kind == FunctionBinding::Param::KIND_POINTER)
+        o << "*";
+
+    return o;
+}
+
+// ---------------------------------------------
+// Helper functions
+
+static inline void outputLuaTypeCheckInstance(ostream& o)
+{
+    o << "(lua_type(state, 1) == LUA_TUSERDATA)";
+}
+
+static inline void outputLuaTypeCheck(ostream& o, int index, const FunctionBinding::Param& p)
+{
+    switch (p.type)
+    {
+    case FunctionBinding::Param::TYPE_BOOL:
+        if (p.kind == FunctionBinding::Param::KIND_POINTER) 
+        {
+            o << "(lua_type(state, " << index << ") == LUA_TTABLE || ";
+            o << "lua_type(state, " << index << ") == LUA_TLIGHTUSERDATA)";
+        }
+        else
+        {
+            o << "lua_type(state, " << index << ") == LUA_TBOOLEAN";
+        }
+        break;
+    case FunctionBinding::Param::TYPE_CHAR:
+    case FunctionBinding::Param::TYPE_SHORT:
+    case FunctionBinding::Param::TYPE_INT:
+    case FunctionBinding::Param::TYPE_LONG:
+    case FunctionBinding::Param::TYPE_UCHAR:
+    case FunctionBinding::Param::TYPE_USHORT:
+    case FunctionBinding::Param::TYPE_UINT:
+    case FunctionBinding::Param::TYPE_ULONG:
+    case FunctionBinding::Param::TYPE_FLOAT:
+    case FunctionBinding::Param::TYPE_DOUBLE:
+        if (p.kind == FunctionBinding::Param::KIND_POINTER) 
+        {
+            o << "(lua_type(state, " << index << ") == LUA_TTABLE || ";
+            o << "lua_type(state, " << index << ") == LUA_TLIGHTUSERDATA)";
+        }
+        else
+        {
+            o << "lua_type(state, " << index << ") == LUA_TNUMBER";
+        }
+        break;
+    case FunctionBinding::Param::TYPE_STRING:
+    case FunctionBinding::Param::TYPE_ENUM:
+        o << "(lua_type(state, " << index << ") == LUA_TSTRING || ";
+        o << "lua_type(state, " << index << ") == LUA_TNIL)";
+        break;
+    case FunctionBinding::Param::TYPE_OBJECT:
+        o << "(lua_type(state, " << index << ") == LUA_TUSERDATA || ";
+        if (p.kind == FunctionBinding::Param::KIND_POINTER)
+            o << "lua_type(state, " << index << ") == LUA_TTABLE || ";
+        o << "lua_type(state, " << index << ") == LUA_TNIL)";
+        break;
+    case FunctionBinding::Param::TYPE_CONSTRUCTOR:
+    case FunctionBinding::Param::TYPE_DESTRUCTOR:
+    case FunctionBinding::Param::TYPE_VOID:
+    case FunctionBinding::Param::TYPE_VARARGS:
+    default:
+        o << "lua_type(state, " << index << ") == LUA_TNONE";
+    }
+}
+
+static inline void indent(ostream& o, int indentLevel)
+{
+    for (int k = 0; k < indentLevel; k++)
+        o << "    ";
+}
+
+static inline void outputBindingInvocation(ostream& o, const FunctionBinding& b, unsigned int paramCount, unsigned int indentLevel)
+{
+    bool isNormalMember = (b.type == FunctionBinding::MEMBER_FUNCTION && b.returnParam.type != FunctionBinding::Param::TYPE_CONSTRUCTOR);
+
+    // Get the passed in parameters.
+    for (unsigned int i = 0, count = paramCount - (isNormalMember ? 1 : 0); i < count; i++)
+    {
+        outputGetParam(o, b.paramTypes[i], i, indentLevel, isNormalMember);
+    }
+
+    // Get the instance for member functions.
+    if ((b.type == FunctionBinding::MEMBER_FUNCTION) &&
+        b.returnParam.type != FunctionBinding::Param::TYPE_CONSTRUCTOR &&
+        b.returnParam.type != FunctionBinding::Param::TYPE_DESTRUCTOR)
+    {
+        indent(o, indentLevel);
+        o << b.classname << "* instance = getInstance(state);\n";
+    }
+
+    if (b.returnParam.type == FunctionBinding::Param::TYPE_DESTRUCTOR)
+    {
+        indent(o, indentLevel);
+        o << "void* userdata = luaL_checkudata(state, 1, \"" << Generator::getUniqueName(b.classname) << "\");\n";
+        indent(o, indentLevel);
+        o << "luaL_argcheck(state, userdata != NULL, 1, \"\'" << Generator::getUniqueName(b.classname) << "\' expected.\");\n";
+        indent(o, indentLevel);
+        o << LUA_OBJECT << "* object = (" << LUA_OBJECT << "*)userdata;\n";
+        indent(o, indentLevel);
+        o << "if (object->owns)\n";
+        indent(o, indentLevel);
+        o << "{\n";
+        indent(o, indentLevel + 1);
+        o << b.classname << "* instance = (" << b.classname << "*)object->instance;\n";
+        if (Generator::getInstance()->isRef(b.classname))
+        {
+            indent(o, indentLevel + 1);
+            o << "SAFE_RELEASE(instance);\n";
+        }
+        else
+        {
+            indent(o, indentLevel + 1);
+            o << "SAFE_DELETE(instance);\n";
+        }
+        indent(o, indentLevel);
+        o << "}\n";
+    }
+    else
+    {
+        // Create a variable to hold the return type (if appropriate).
+        if (!(b.returnParam.type == FunctionBinding::Param::TYPE_CONSTRUCTOR || 
+            b.returnParam.type == FunctionBinding::Param::TYPE_VOID || 
+            b.returnParam.type == FunctionBinding::Param::TYPE_OBJECT))
+        {
+            indent(o, indentLevel);
+            o << b.returnParam << " result = ";
+        }
+
+        // For functions that return objects, create the appropriate user data in Lua.
+        if (b.returnParam.type == FunctionBinding::Param::TYPE_CONSTRUCTOR || b.returnParam.type == FunctionBinding::Param::TYPE_OBJECT)
+        {
+            indent(o, indentLevel);
+            switch (b.returnParam.kind)
+            {
+            case FunctionBinding::Param::KIND_POINTER:
+                o << "void* returnPtr = (void*)";
+                break;
+            case FunctionBinding::Param::KIND_VALUE:
+                o << "void* returnPtr = (void*)new " << b.returnParam << "(";
+                break;
+            case FunctionBinding::Param::KIND_REFERENCE:
+                o << "void* returnPtr = (void*)&(";
+                break;
+            default:
+                GP_ERROR("Invalid return value kind '%d'.", b.returnParam.kind);
+                break;
+            }
+        }
+
+        if (b.type == FunctionBinding::STATIC_FUNCTION)
+        {
+            if (b.returnParam.type == FunctionBinding::Param::TYPE_VOID)
+                indent(o, indentLevel);
+            o << b.classname << "::" << b.name << "(";
+        }
+        else if (b.type == FunctionBinding::GLOBAL_FUNCTION)
+        {
+            if (b.returnParam.type == FunctionBinding::Param::TYPE_VOID)
+                indent(o, indentLevel);
+            o << b.name << "(";
+        }
+        else if (b.type == FunctionBinding::MEMBER_FUNCTION)
+        {
+            if (b.returnParam.type == FunctionBinding::Param::TYPE_CONSTRUCTOR)
+            {
+                o << "new " << Generator::getInstance()->getIdentifier(b.returnParam.info) << "(";
+            }
+            else
+            {
+                if (b.returnParam.type == FunctionBinding::Param::TYPE_VOID)
+                    indent(o, indentLevel);
+                o << "instance->" << b.name << "(";
+            }
+        }
+
+        // Pass the arguments.
+        for (unsigned int i = 0, count = paramCount - ((isNormalMember) ? 1 : 0); i < count; i++)
+        {
+            if (b.paramTypes[i].type == FunctionBinding::Param::TYPE_OBJECT && b.paramTypes[i].kind != FunctionBinding::Param::KIND_POINTER)
+                o << "*";
+            o << "param" << i + 1;
+
+            if (i != count - 1)
+                o << ", ";
+        }
+
+        // Output the matching parenthesis for the case where a non-pointer object is being returned.
+        if (b.returnParam.type == FunctionBinding::Param::TYPE_OBJECT && b.returnParam.kind != FunctionBinding::Param::KIND_POINTER)
+            o << ")";
+
+        o << ");\n";
+    }
+
+    outputReturnValue(o, b, indentLevel);
+}
+
+static inline void outputGetParam(ostream& o, const FunctionBinding::Param& p, int i, int indentLevel, bool offsetIndex)
+{
+    indent(o, indentLevel);
+    o << "// Get parameter " << i + 1 << " off the stack.\n";
+
+    switch (p.type)
+    {
+    case FunctionBinding::Param::TYPE_UNRECOGNIZED:
+        indent(o, indentLevel);
+        o << "GP_WARN(\"Attempting to get parameter " << i + 1 << " with unrecognized type " << p.info << " as an unsigned integer.\");\n";
+    case FunctionBinding::Param::TYPE_BOOL:
+    case FunctionBinding::Param::TYPE_CHAR:
+    case FunctionBinding::Param::TYPE_SHORT:
+    case FunctionBinding::Param::TYPE_INT:
+    case FunctionBinding::Param::TYPE_LONG:
+    case FunctionBinding::Param::TYPE_UCHAR:
+    case FunctionBinding::Param::TYPE_USHORT:
+    case FunctionBinding::Param::TYPE_UINT:
+    case FunctionBinding::Param::TYPE_ULONG:
+    case FunctionBinding::Param::TYPE_FLOAT:
+    case FunctionBinding::Param::TYPE_DOUBLE:
+    case FunctionBinding::Param::TYPE_STRING:
+    case FunctionBinding::Param::TYPE_ENUM:
+        indent(o, indentLevel);
+        o << p << " param" << i + 1 << " = ";
+        break;
+    default:
+        // Ignore these cases.
+        break;
+    }
+
+    int paramIndex = (offsetIndex) ? i + 2 : i + 1;
+    switch (p.type)
+    {
+    case FunctionBinding::Param::TYPE_BOOL:
+        if (p.kind == FunctionBinding::Param::KIND_POINTER)
+            o << "ScriptUtil::getBoolPointer(" << paramIndex << ");\n";
+        else
+            o << "ScriptUtil::luaCheckBool(state, " << paramIndex << ");\n";
+        break;
+    case FunctionBinding::Param::TYPE_CHAR:
+        o << "(char)luaL_checkint(state, " << paramIndex << ");\n";
+        break;
+    case FunctionBinding::Param::TYPE_SHORT:
+        if (p.kind == FunctionBinding::Param::KIND_POINTER)
+            o << "ScriptUtil::getShortPointer(" << paramIndex << ");\n";
+        else
+            o << "(short)luaL_checkint(state, " << paramIndex << ");\n";
+        break;
+    case FunctionBinding::Param::TYPE_INT:
+        if (p.kind == FunctionBinding::Param::KIND_POINTER)
+            o << "ScriptUtil::getIntPointer(" << paramIndex << ");\n";
+        else
+            o << "(int)luaL_checkint(state, " << paramIndex << ");\n";
+        break;
+    case FunctionBinding::Param::TYPE_LONG:
+        if (p.kind == FunctionBinding::Param::KIND_POINTER)
+            o << "ScriptUtil::getLongPointer(" << paramIndex << ");\n";
+        else
+            o << "(long)luaL_checklong(state, " << paramIndex << ");\n";
+        break;
+    case FunctionBinding::Param::TYPE_UCHAR:
+        if (p.kind == FunctionBinding::Param::KIND_POINTER)
+            o << "ScriptUtil::getUnsignedCharPointer(" << paramIndex << ");\n";
+        else
+            o << "(unsigned char)luaL_checkunsigned(state, " << paramIndex << ");\n";
+        break;
+    case FunctionBinding::Param::TYPE_USHORT:
+        if (p.kind == FunctionBinding::Param::KIND_POINTER)
+            o << "ScriptUtil::getUnsignedShortPointer(" << paramIndex << ");\n";
+        else
+            o << "(unsigned short)luaL_checkunsigned(state, " << paramIndex << ");\n";
+        break;
+    case FunctionBinding::Param::TYPE_UINT:
+        if (p.kind == FunctionBinding::Param::KIND_POINTER)
+            o << "ScriptUtil::getUnsignedIntPointer(" << paramIndex << ");\n";
+        else
+            o << "(unsigned int)luaL_checkunsigned(state, " << paramIndex << ");\n";
+        break;
+    case FunctionBinding::Param::TYPE_ULONG:
+        if (p.kind == FunctionBinding::Param::KIND_POINTER)
+            o << "ScriptUtil::getUnsignedLongPointer(" << paramIndex << ");\n";
+        else
+            o << "(unsigned long)luaL_checkunsigned(state, " << paramIndex << ");\n";
+        break;
+    case FunctionBinding::Param::TYPE_FLOAT:
+        if (p.kind == FunctionBinding::Param::KIND_POINTER)
+            o << "ScriptUtil::getFloatPointer(" << paramIndex << ");\n";
+        else
+            o << "(float)luaL_checknumber(state, " << paramIndex << ");\n";
+        break;
+    case FunctionBinding::Param::TYPE_DOUBLE:
+        if (p.kind == FunctionBinding::Param::KIND_POINTER)
+            o << "ScriptUtil::getDoublePointer(" << paramIndex << ");\n";
+        else
+            o << "(double)luaL_checknumber(state, " << paramIndex << ");\n";
+        break;
+    case FunctionBinding::Param::TYPE_STRING:
+        o << "ScriptUtil::getString(" << paramIndex << ", " << ((p.info == "string") ? "true" : "false") << ");\n";
+        break;
+    case FunctionBinding::Param::TYPE_ENUM:
+        o << "(" << p << ")lua_enumFromString_" << Generator::getInstance()->getUniqueNameFromRef(p.info) << "(luaL_checkstring(state, " << paramIndex << "));\n";
+        break;
+    case FunctionBinding::Param::TYPE_UNRECOGNIZED:
+        // Attempt to retrieve the unrecognized type as an unsigned integer.
+        o << "(" << p.info << ")luaL_checkunsigned(state, " << paramIndex << ");\n";
+        break;
+    case FunctionBinding::Param::TYPE_OBJECT:
+        indent(o, indentLevel);
+        o << p;
+        if (p.kind != FunctionBinding::Param::KIND_POINTER)
+            o << "*";
+        o << " param" << i + 1 << " = ";
+        o << "ScriptUtil::getObjectPointer<";
+        o << Generator::getInstance()->getIdentifier(p.info) << ">(" << paramIndex;
+        o << ", \"" << Generator::getInstance()->getUniqueNameFromRef(p.info) << "\", ";
+        o << ((p.kind != FunctionBinding::Param::KIND_POINTER) ? "true" : "false") << ");\n";
+        break;
+    case FunctionBinding::Param::TYPE_CONSTRUCTOR:
+    case FunctionBinding::Param::TYPE_DESTRUCTOR:
+    case FunctionBinding::Param::TYPE_VOID:
+    default:
+        // Ignore these cases.
+        break;
+    }
+
+    o << "\n";
+}
+
+static inline void outputMatchedBinding(ostream& o, const FunctionBinding& b, unsigned int paramCount, unsigned int indentLevel)
+{
+    bool isNormalMember = (b.type == FunctionBinding::MEMBER_FUNCTION && b.returnParam.type != FunctionBinding::Param::TYPE_CONSTRUCTOR);
+
+    // If the current invocation of the function takes zero parameters, then invoke the binding.
+    if (paramCount == 0)
+    {
+        outputBindingInvocation(o, b, paramCount, indentLevel);
+    }
+    else
+    {
+        // NOTE: The way this currently works may cause some issues since Lua
+        // has a smaller set of types than C++. There may be cases where functions
+        // that take types with less precision (i.e. int vs. float) are called
+        // when the user in fact wanted to call the version with more precision.
+        // (this will only happen for overloaded functions).
+
+        o << "if (";
+        for (unsigned int i = 0, count = paramCount; i < count; i++)
+        {
+            if (isNormalMember && i == 0)
+                outputLuaTypeCheckInstance(o);
+            else
+                outputLuaTypeCheck(o, i + 1, b.paramTypes[(isNormalMember ? i - 1 : i)]);
+
+            if (i == count - 1)
+                o << ")\n";
+            else
+            {
+                o << " &&\n";
+                indent(o, indentLevel + 1);
+            }
+        }
+        indent(o, indentLevel);
+        o << "{\n";
+            
+        outputBindingInvocation(o, b, paramCount, indentLevel + 1);
+
+        indent(o, indentLevel);
+        o << "}\n";
+    }
+}
+
+static inline void outputReturnValue(ostream& o, const FunctionBinding& b, int indentLevel)
+{
+    // Pass the return value back to Lua.
+    if (!(b.returnParam.type == FunctionBinding::Param::TYPE_CONSTRUCTOR || 
+        b.returnParam.type == FunctionBinding::Param::TYPE_DESTRUCTOR ||
+        b.returnParam.type == FunctionBinding::Param::TYPE_VOID || 
+        b.returnParam.type == FunctionBinding::Param::TYPE_OBJECT))
+    {
+        o << "\n";
+        indent(o, indentLevel);
+        o << "// Push the return value onto the stack.\n";
+
+        // If the return type is a basic type pointer, return it as light user data.
+        if (b.returnParam.type != FunctionBinding::Param::TYPE_ENUM &&
+            b.returnParam.type != FunctionBinding::Param::TYPE_STRING &&
+            b.returnParam.kind == FunctionBinding::Param::KIND_POINTER)
+        {
+            indent(o, indentLevel);
+            o << "lua_pushlightuserdata(state, result);\n";
+            indent(o, indentLevel);
+            o << "return 1;\n";
+            return;
+        }
+    }
+
+    indent(o, indentLevel);
+    switch (b.returnParam.type)
+    {
+    case FunctionBinding::Param::TYPE_BOOL:
+        o << "lua_pushboolean(state, result);\n";
+        break;
+    case FunctionBinding::Param::TYPE_CHAR:
+    case FunctionBinding::Param::TYPE_SHORT:
+    case FunctionBinding::Param::TYPE_INT:
+    case FunctionBinding::Param::TYPE_LONG:
+        o << "lua_pushinteger(state, result);\n";
+        break;
+    case FunctionBinding::Param::TYPE_UNRECOGNIZED:
+        o << "GP_WARN(\"Attempting to return value with unrecognized type " << b.returnParam.info << " as an unsigned integer.\");\n";
+        indent(o, indentLevel);
+    case FunctionBinding::Param::TYPE_UCHAR:
+    case FunctionBinding::Param::TYPE_USHORT:
+    case FunctionBinding::Param::TYPE_UINT:
+    case FunctionBinding::Param::TYPE_ULONG:
+        o << "lua_pushunsigned(state, result);\n";
+        break;
+    case FunctionBinding::Param::TYPE_FLOAT:
+    case FunctionBinding::Param::TYPE_DOUBLE:
+        o << "lua_pushnumber(state, result);\n";
+        break;
+    case FunctionBinding::Param::TYPE_ENUM:
+        o << "lua_pushstring(state, lua_stringFromEnum_" << Generator::getInstance()->getUniqueNameFromRef(b.returnParam.info) << "(result));\n";
+        break;
+    case FunctionBinding::Param::TYPE_STRING:
+        if (b.returnParam.info == "string")
+            o << "lua_pushstring(state, result.c_str());\n";
+        else
+            o << "lua_pushstring(state, result);\n";
+        break;
+    case FunctionBinding::Param::TYPE_OBJECT:
+    case FunctionBinding::Param::TYPE_CONSTRUCTOR:
+        o << "if (returnPtr)\n";
+        indent(o, indentLevel);
+        o << "{\n";
+        indent(o, indentLevel + 1);
+        o << LUA_OBJECT << "* object = (" << LUA_OBJECT << "*)lua_newuserdata(state, sizeof(" << LUA_OBJECT << "));\n";
+        indent(o, indentLevel + 1);
+        o << "object->instance = returnPtr;\n";
+        indent(o, indentLevel + 1);
+        o << "object->owns = ";
+        if (b.own || (b.returnParam.type == FunctionBinding::Param::TYPE_OBJECT && b.returnParam.kind == FunctionBinding::Param::KIND_VALUE))
+            o << "true";
+        else
+            o << "false";
+        o << ";\n";
+        indent(o, indentLevel + 1);
+        o << "luaL_getmetatable(state, \"" << Generator::getInstance()->getUniqueNameFromRef(b.returnParam.info) << "\");\n";
+        indent(o, indentLevel + 1);
+        o << "lua_setmetatable(state, -2);\n";
+        indent(o, indentLevel);
+        o << "}\n";
+        indent(o, indentLevel);
+        o << "else\n";
+        indent(o, indentLevel);
+        o << "{\n";
+        indent(o, indentLevel + 1);
+        o << "lua_pushnil(state);\n";
+        indent(o, indentLevel);
+        o << "}\n";
+        break;
+    case FunctionBinding::Param::TYPE_DESTRUCTOR:
+    case FunctionBinding::Param::TYPE_VOID:
+    default:
+        o << "\n";
+        indent(o, indentLevel);
+        o << "return 0;\n";
+        return;
+    }
+
+    o << "\n";
+    indent(o, indentLevel);
+    o << "return 1;\n";
+}

+ 165 - 0
gameplay-luagen/src/FunctionBinding.h

@@ -0,0 +1,165 @@
+#ifndef FUNCTIONBINDING_H_
+#define FUNCTIONBINDING_H_
+
+#include "Base.h"
+
+/**
+ * Represents a binding from a function or variable to a function within the script runtime.
+ */
+struct FunctionBinding
+{
+    /**
+     * Represents the type of the binding.
+     */
+    enum Type
+    {
+        GLOBAL_FUNCTION,
+        GLOBAL_VARIABLE,
+        GLOBAL_CONSTANT,
+        STATIC_FUNCTION,
+        STATIC_VARIABLE,
+        STATIC_CONSTANT,
+        MEMBER_FUNCTION,
+        MEMBER_VARIABLE,
+        MEMBER_CONSTANT
+    };
+
+    /**
+     * Represents either a parameter or a return value.
+     */
+    struct Param
+    {
+        /**
+         * Represents the type of parameter or return value.
+         */
+        enum Type
+        {
+            TYPE_CONSTRUCTOR,
+            TYPE_DESTRUCTOR,
+            TYPE_VOID,
+            TYPE_BOOL,
+            TYPE_CHAR,
+            TYPE_SHORT,
+            TYPE_INT,
+            TYPE_LONG,
+            TYPE_UCHAR,
+            TYPE_USHORT,
+            TYPE_UINT,
+            TYPE_ULONG,
+            TYPE_FLOAT,
+            TYPE_DOUBLE,
+            TYPE_STRING,
+            TYPE_OBJECT,
+            TYPE_ENUM,
+            TYPE_UNRECOGNIZED,
+            TYPE_VARARGS
+        };
+
+        /** 
+         * Represents the kind or nature of the parameter/return value.
+         */
+        enum Kind
+        {
+            KIND_VALUE,
+            KIND_REFERENCE,
+            KIND_POINTER
+        };
+
+        /**
+         * Constructor.
+         * 
+         * @param type The type of the parameter.
+         * @param kind The kind of the parameter.
+         * @param info The extra info of the parameter (optional).
+         */
+        Param(Type type = TYPE_VOID, Kind kind = KIND_VALUE, const string& info = "");
+
+        /**
+         * Equality operator.
+         * 
+         * @param p The param to compare to.
+         * @return True if the parameters are equal; false otherwise.
+         */
+        bool operator==(const Param& p) const;
+
+        /**
+         * Inequality operator.
+         * 
+         * @param p The param to compare to.
+         * @return True if the parameters are not equal; false otherwise.
+         */
+        bool operator!=(const Param& p) const;
+
+        /** The type of the parameter. */
+        Type type;
+        /** The kind of the parameter. */
+        Kind kind;
+        /** Extra info (either the class name for a pointer 
+        type or whether a string type is a std::string or a C-string). */
+        string info;
+        /** Whether the parameter has a default value. */
+        bool hasDefaultValue;
+    };
+
+    /**
+     * Constructor.
+     *
+     * @param classname The name of the class that owns this binding.
+     * @param uniquename The class's unique name (used only in the script bindings).
+     */
+    FunctionBinding(string classname = "", string uniquename = "");
+
+    /**
+     * Retrieves the C++ function name for the script binding.
+     * 
+     * @return The C++ function name for the script binding.
+     */
+    string getFunctionName() const;
+
+    /**
+     * Gets the minimum number of parameters needed to call 
+     * the function that the binding corresponds to.
+     * 
+     * @return The minimum number of parameters.
+     */
+    unsigned int getMinParamCount() const;
+
+    /**
+     * Writes out the script binding for the given set of binding objects
+     * (the given set corresponds to all overloaded versions of a function).
+     * 
+     * @param o The output stream to write to.
+     * @param bindings The set of binding objects.
+     */
+    static void write(ostream& o, const vector<FunctionBinding>& bindings);
+
+    /**
+     * Retrieves whether the given two bindings have matching signatures.
+     * 
+     * @param b1 The first binding.
+     * @param b2 The second binding.
+     * @return True if the signatures match; false otherwise.
+     */
+    static bool signaturesMatch(const FunctionBinding& b1, const FunctionBinding& b2);
+
+    /** The binding's type. */
+    Type type;
+    /** The binding's return value. */
+    Param returnParam;
+    /** The binding's parameters. */
+    vector<Param> paramTypes;
+    /** The name of the class that owns this binding. */
+    string classname;
+    /** Holds the class's unique name (used only in the script bindings). */
+    string uniquename;
+    /** The name of the binding (function or variable name). */
+    string name;
+    /** Holds the unique name of the C++ function that implements the Lua binding. */
+    mutable string functionName;
+    /** Holds whether the binding's return value is a object that is owned by whomever calls the function. */
+    bool own;
+};
+
+ostream& operator<<(ostream& o, const FunctionBinding::Param& param);
+
+#endif

+ 1870 - 0
gameplay-luagen/src/Generator.cpp

@@ -0,0 +1,1870 @@
+#include "Generator.h"
+
+Generator* Generator::__instance = NULL;
+
+set<string> __warnings;
+
+// Warning flags.
+static bool __printTemplateWarning = false;
+static bool __printVarargWarning = false;
+static bool __printOperatorWarning = false;
+
+// Utility functions (local to this file).
+static string trim(const string& str);
+static string stripTypeQualifiers(const string& typeStr, FunctionBinding::Param::Kind& kind);
+static inline bool isWantedFileNormal(const string& s);
+static inline bool isNamespaceFile(const string& s);
+static bool getFileList(string directory, vector<string>& files, bool (*isWantedFile)(const string& s));
+static bool isReservedKeyword(string name);
+
+Generator* Generator::getInstance()
+{
+    if (!__instance)
+        __instance = new Generator();
+
+    return __instance;
+}
+
+void Generator::releaseInstance()
+{
+    SAFE_DELETE(__instance);
+}
+
+string Generator::getUniqueName(string name)
+{
+    // Calculate the unique name for the given identifier (class, struct, enum, etc).
+    string uniquename = name;
+    size_t i = uniquename.find("::");
+    while (i != uniquename.npos)
+    {
+        uniquename.replace(i, 2, SCOPE_REPLACEMENT);
+        i = uniquename.find("::");
+    }
+
+    return uniquename;
+}
+
+string Generator::getUniqueNameFromRef(string refId)
+{
+    return getUniqueName(getIdentifier(refId));
+}
+
+vector<string> Generator::getScopePath(string classname, string ns)
+{
+    size_t i = classname.find("::");
+    vector<string> scopePath;
+    while (i != classname.npos)
+    {
+        string scope = classname.substr(0, i);
+        if (scope != ns)
+            scopePath.push_back(scope);
+        classname = classname.substr(i + 2);
+        i = classname.find("::");
+    }
+
+    return scopePath;
+}
+
+string Generator::getIdentifier(string refId)
+{
+    if (_refIds.find(refId) != _refIds.end())
+        return _refIds[refId];
+    return refId;
+}
+
+string Generator::getClassNameWithoutNamespace(string classname)
+{
+    size_t index = classname.find("::");
+    if (index != classname.npos)
+    {
+        string ns = classname.substr(0, index);
+        if (_namespaces.find(ns) != _namespaces.end())
+        {
+            string tmp = classname.substr(index + 2);
+            size_t tmpIndex = tmp.find("::");
+            if (tmpIndex != tmp.npos)
+                tmp = tmp.substr(0, tmpIndex);
+
+            tmp = ns + string("::") + tmp;
+            if (find(_namespaces[ns].begin(), _namespaces[ns].end(), tmp) != _namespaces[ns].end())
+                return classname.substr(index + 2);
+        }
+    }
+
+    return classname;
+}
+
+void Generator::setIdentifier(string refId, string id)
+{
+    _refIds[refId] = id;
+}
+
+bool Generator::isDerived(const ClassBinding& c, string classname)
+{
+    for (unsigned int i = 0; i < c.derived.size(); i++)
+    {
+        const string& derivedClassName = getIdentifier(c.derived[i]);
+        if (derivedClassName == classname || 
+            (_classes.find(derivedClassName) != _classes.end() &&
+            isDerived(_classes[derivedClassName], classname)))
+        {
+            return true;
+        }
+    }
+    return false;
+}
+
+bool Generator::isRef(string classname)
+{
+    // Check if the class is derived from Ref.
+    for (unsigned int i = 0; i < _topLevelBaseClasses.size(); i++)
+    {
+        if (_topLevelBaseClasses[i] == REF_CLASS_NAME)
+        {
+            return isDerived(_classes[_topLevelBaseClasses[i]], classname);
+        }
+    }
+    return classname == REF_CLASS_NAME;
+}
+
+string Generator::getCompoundName(XMLElement* node)
+{
+    // Get the name of the namespace, class, struct, or file that we are processing.
+    XMLElement* nameElement = node->FirstChildElement("compoundname");
+    if (!nameElement)
+    {
+        GP_ERROR("Missing 'compoundname' child node of 'compounddef' node for XML document '%s'.", _file);
+        return "";
+    }
+    const char* text = nameElement->GetText();
+    if (!text)
+    {
+        GP_ERROR("The 'compoundname' node is empty for XML document '%s'.", _file);
+        return "";
+    }
+
+    return string(text);
+}
+
+void Generator::run(string inDir, string outDir)
+{
+    // Set the output directory.
+    _outDir = outDir;
+
+    // Get a list of the Doxygen XML files that specify a namespace.
+    // Note: we must do this before adding the normal files so that
+    // when we process the files sequentially, we process the namespaces
+    // before the normal files (so that namespaces can be removed
+    // properly from class/struct names, etc.)
+    vector<string> files;
+    getFileList(inDir, files, isNamespaceFile);
+
+    // Add all of the normal Doxygen XML files we want to use to generate Lua bindings.
+    if (!getFileList(inDir, files, isWantedFileNormal) || files.empty())
+    {
+        GP_ERROR("Failed to get a valid list of files to generate bindings from using directory '%s'.", inDir.c_str());
+        return;
+    }
+
+    // Go through each file and build the data needed to generate the bindings.
+    for (vector<string>::iterator iter = files.begin(); iter != files.end(); iter++)
+    {
+        tinyxml2::XMLDocument doc;
+        _file = iter->c_str();
+        doc.LoadFile(iter->c_str());
+
+        int ret = doc.ErrorID();
+        if (ret != 0)
+        {
+            GP_ERROR("Failed to load XML document '%s' properly with error ID %d.", iter->c_str(), ret);
+            continue;
+        }
+
+        XMLElement* rootNode = doc.FirstChildElement("doxygen");
+        if (!rootNode)
+        {
+            GP_ERROR("Missing root 'doxygen' node for XML document '%s'.", iter->c_str());
+            continue;
+        }
+        XMLElement* node = rootNode->FirstChildElement("compounddef");
+        if (!node)
+        {
+            GP_ERROR("Missing 'compounddef' node for XML document '%s'.", iter->c_str());
+            continue;
+        }
+
+        const char* kind = node->Attribute("kind");
+        if (kind && strcmp(kind, "namespace") == 0)
+        {
+            string name = getCompoundName(node);
+            cout << "Parsing namespace " << name << "...\n";
+            getNamespace(node, name);
+        }
+        else if ( (kind && (strcmp(kind, "class") == 0 || strcmp(kind, "struct") == 0) ) && strcmp(node->Attribute("prot"), "public") == 0)
+        {
+            string name = getCompoundName(node);
+            cout << "Parsing class/struct " << name << "...\n";
+            getClass(node, name);
+        }
+        else if (kind && strcmp(kind, "file") == 0)
+        {
+            string name = getCompoundName(node);
+            cout << "Parsing file " << name << "...\n";
+            if (name.find(".h") != name.npos)
+            {
+                getFunctions(node);
+                getEnums(node, name);
+            }
+            else if (name.find(".cpp") != name.npos)
+            {
+                getIncludes(node, name);
+            }
+        }
+    }
+
+    // Resolve all inheritance.
+    resolveInheritance();
+
+    // Resolve all unrecognized parameter and return value types.
+    resolveTypes();
+
+    // Resolve all inherited include files.
+    resolveInheritedIncludes();
+
+    // Generate the script bindings.
+    generateBindings();
+
+    // Print out all warnings (unsupported types, function name-Lua keyword clashes, etc.)
+    if (__warnings.size() > 0)
+    {
+        cout << "\nWarnings:\n";
+        for (set<string>::iterator iter = __warnings.begin(); iter!= __warnings.end(); iter++)
+        {
+            GP_WARN("%s", iter->c_str());
+        }
+    }
+
+    // Print warnings for the use of unsupported C++ features.
+    if (__printTemplateWarning)
+        GP_WARN("Detected the use of template parameters; this feature of C++ is not supported.");
+    if (__printVarargWarning)
+        GP_WARN("Detected the use of variable argument lists; this feature of C++ is not supported.");
+    if (__printOperatorWarning)
+        GP_WARN("Detected the use of operator overloading; this feature of C++ is not supported.");
+}
+
+Generator::Generator()
+{
+}
+
+Generator::~Generator()
+{
+}
+
+void Generator::getFunctions(XMLElement* fileNode)
+{
+    // Process all public, non-static functions and variables that are defined in this file.
+    XMLElement* node = NULL;
+    const char* kind = NULL;
+    const char* isStatic = NULL;
+    for (node = fileNode->FirstChildElement("sectiondef"); node != NULL; node = node->NextSiblingElement("sectiondef"))
+    {
+        kind = node->Attribute("kind");
+        if (kind && strcmp(kind, "func") == 0)
+        {
+            XMLElement* e = node->FirstChildElement("memberdef");
+            while (e)
+            {
+                isStatic = e->Attribute("static");
+                if (e->FirstChildElement("templateparamlist"))
+                {
+                    __printTemplateWarning = true;
+                }
+                else if (getScriptFlag(e) != "ignore" &&
+                    (!isStatic || strcmp(isStatic, "yes") != 0))
+                {
+                    FunctionBinding b;
+                    b.type = FunctionBinding::GLOBAL_FUNCTION;
+                    b.name = getName(e);
+
+                    if (!isReservedKeyword(b.name))
+                    {
+                        // Ignore operators.
+                        if (b.name.find("operator") != 0)
+                        {
+                            b.returnParam = getParam(e);
+
+                            getParams(e, b);
+                            getCreateFlag(e, b);
+                            _functions[b.getFunctionName()].push_back(b);
+                        }
+                        else
+                        {
+                            __printOperatorWarning = true;
+                        }
+                    }
+                    else
+                    {
+                        __warnings.insert(string("Function name '") + b.name + string("' is a reserved Lua keyword; binding '") + b.getFunctionName() + string("' was not generated."));
+                    }
+                }
+                e = e->NextSiblingElement("memberdef");
+            }
+        }
+        else if (kind && strcmp(kind, "var") == 0)
+        {
+            XMLElement* e = node->FirstChildElement("memberdef");
+            while (e)
+            {
+                isStatic = e->Attribute("static");
+                if (getScriptFlag(e) != "ignore" &&
+                    (!isStatic || strcmp(isStatic, "yes") != 0))
+                {
+                    FunctionBinding b;
+                    if (getIsConstType(e))
+                        b.type = FunctionBinding::GLOBAL_CONSTANT;
+                    else
+                        b.type = FunctionBinding::GLOBAL_VARIABLE;
+
+                    b.name = getName(e);
+                    if (!isReservedKeyword(b.name))
+                    {
+                        b.returnParam = getParam(e, true);
+                        _functions[b.getFunctionName()].push_back(b);
+                    }
+                    else
+                    {
+                        __warnings.insert(string("Function name '") + b.name + string("' is a reserved Lua keyword; binding '") + b.getFunctionName() + string("' was not generated."));
+                    }
+                }
+                e = e->NextSiblingElement("memberdef");
+            }
+        }
+    }
+}
+
+void Generator::getNamespace(XMLElement* nsNode, const string& name)
+{
+    // Skip the 'std' namespace.
+    if (name == "std")
+        return;
+
+    // Create a list of all classes that are a part of this namespace.
+    XMLElement* e = nsNode->FirstChildElement("innerclass");
+    while (e)
+    {
+        _namespaces[name].push_back(e->GetText());
+        e = e->NextSiblingElement("innerclass");
+    }
+
+    // Parse all functions that are directly in this namespace.
+    getFunctions(nsNode);
+
+    // Parse all enums that are directly in this namespace.
+    getEnums(nsNode, name);
+
+    // Parse all typedefs.
+    getTypedefs(nsNode, name);
+    e = nsNode->FirstChildElement("");
+}
+
+void Generator::getClass(XMLElement* classNode, const string& name)
+{
+    // Check if we should ignore this class.
+    if (getScriptFlag(classNode) == "ignore")
+        return;
+
+    // Get the ref id for the class.
+    string refId = classNode->Attribute("id");
+
+    // Create the class binding object that we will store the function bindings in (name -> binding).
+    ClassBinding classBinding(name, refId);
+
+    // Store the mapping between the ref id and the class's fully qualified name.
+    Generator::getInstance()->setIdentifier(refId, classBinding.classname);
+
+    // Get the include header for the original class declaration.
+    XMLElement* includeElement = classNode->FirstChildElement("includes");
+    if (includeElement)
+    {
+        const char* text = includeElement->GetText();
+        if (!text)
+        {
+            GP_ERROR("The 'includes' node is empty (a class must have an include file) for XML document '%s'.", _file);
+            return;
+        }
+        classBinding.include = text;
+    }
+    else
+    {
+        // See if we are an inner class. If so, attempt to get the include from the root parent class.
+        size_t index = classBinding.classname.find("::");
+        if (index != classBinding.classname.npos)
+        {
+            string parentClassName = classBinding.classname.substr(0, index);
+            if (_classes.find(parentClassName) != _classes.end())
+                classBinding.include = _classes[parentClassName].include;
+        }
+    }
+
+    // Track whether the class has any pure virtual functions.
+    bool hasPureVirtual = false;
+
+    // Process all public members that are defined in this class.
+    XMLElement* node = NULL;
+    const char* kind = NULL;
+    for (node = classNode->FirstChildElement("sectiondef"); node != NULL; node = node->NextSiblingElement("sectiondef"))
+    {
+        kind = node->Attribute("kind");
+        if (!kind)
+        {
+            GP_ERROR("Section definition is missing required 'kind' attribute in XML document  '%s'.", _file);
+            return;
+        }
+
+        // Process public static functions.
+        if (strcmp(kind, "public-static-func") == 0)
+        {
+            XMLElement* e = node->FirstChildElement("memberdef");
+            while (e)
+            {
+                if (e->FirstChildElement("templateparamlist"))
+                {
+                    __printTemplateWarning = true;
+                }
+                else if (getScriptFlag(e) != "ignore")
+                {
+                    FunctionBinding b(classBinding.classname, classBinding.uniquename);
+                    b.type = FunctionBinding::STATIC_FUNCTION;
+
+                    b.name = getName(e);
+                    if (!isReservedKeyword(b.name))
+                    {
+                        b.returnParam = getParam(e, false, b.classname);
+                        
+                        getParams(e, b);
+                        getCreateFlag(e, b);
+                        classBinding.bindings[b.getFunctionName()].push_back(b);
+                    }
+                    else
+                    {
+                        __warnings.insert(string("Function name '") + b.name + string("' is a reserved Lua keyword; binding '") + b.getFunctionName() + string("' was not generated."));
+                    }
+                }
+                e = e->NextSiblingElement("memberdef");
+            }
+        }
+        // Process public member functions.
+        else if (strcmp(kind, "public-func") == 0)
+        {
+            XMLElement* e = node->FirstChildElement("memberdef");
+            while (e)
+            {
+                if (e->FirstChildElement("templateparamlist"))
+                {
+                    __printTemplateWarning = true;
+                }
+                else if (getScriptFlag(e) != "ignore")
+                {
+                    if (strcmp(e->Attribute("virt"), "pure-virtual") == 0)
+                        hasPureVirtual = true;
+
+                    FunctionBinding b(classBinding.classname, classBinding.uniquename);
+                    b.type = FunctionBinding::MEMBER_FUNCTION;
+
+                    b.name = getName(e);
+
+                    if (!isReservedKeyword(b.name))
+                    {
+                        // Ignore operators.
+                        if (b.name.find("operator") != 0)
+                        {
+                            b.returnParam = getParam(e, false, b.classname);
+                            if (b.returnParam.type == FunctionBinding::Param::TYPE_CONSTRUCTOR)
+                            {
+                                b.returnParam.info = refId;
+                                b.own = true;
+                            }
+
+                            getParams(e, b);
+                            getCreateFlag(e, b);
+                            classBinding.bindings[b.getFunctionName()].push_back(b);
+                        }
+                        else
+                        {
+                            __printOperatorWarning = true;
+                        }
+                    }
+                    else
+                    {
+                        __warnings.insert(string("Function name '") + b.name + string("' is a reserved Lua keyword; binding '") + b.getFunctionName() + string("' was not generated."));
+                    }
+                }
+                e = e->NextSiblingElement("memberdef");
+            }
+        }
+        // Process public static variables.
+        else if (strcmp(kind, "public-static-attrib") == 0)
+        {
+            XMLElement* e = node->FirstChildElement("memberdef");
+            while (e)
+            {
+                if (getScriptFlag(e) != "ignore")
+                {
+                    FunctionBinding b(classBinding.classname, classBinding.uniquename);
+                    if (getIsConstType(e))
+                        b.type = FunctionBinding::STATIC_CONSTANT;
+                    else
+                        b.type = FunctionBinding::STATIC_VARIABLE;
+
+                    b.name = getName(e);
+                    if (!isReservedKeyword(b.name))
+                    {
+                        b.returnParam = getParam(e, true, b.classname);
+                        classBinding.bindings[b.getFunctionName()].push_back(b);
+                    }
+                    else
+                    {
+                        __warnings.insert(string("Function name '") + b.name + string("' is a reserved Lua keyword; binding '") + b.getFunctionName() + string("' was not generated."));
+                    }
+                }
+                e = e->NextSiblingElement("memberdef");
+            }
+        }
+        // Process public member variables.
+        else if (strcmp(kind, "public-attrib") == 0)
+        {
+            XMLElement* e = node->FirstChildElement("memberdef");
+            while (e)
+            {
+                if (e->FirstChildElement("templateparamlist"))
+                {
+                    __printTemplateWarning = true;
+                }
+                else if (getScriptFlag(e) != "ignore")
+                {
+                    FunctionBinding b(classBinding.classname, classBinding.uniquename);
+                    if (getIsConstType(e))
+                        b.type = FunctionBinding::MEMBER_CONSTANT;
+                    else
+                        b.type = FunctionBinding::MEMBER_VARIABLE;
+
+                    b.name = getName(e);
+                    if (!isReservedKeyword(b.name))
+                    {
+                        b.returnParam = getParam(e, true, b.classname);
+                        classBinding.bindings[b.getFunctionName()].push_back(b);
+                    }
+                    else
+                    {
+                        __warnings.insert(string("Function name '") + b.name + string("' is a reserved Lua keyword; binding '") + b.getFunctionName() + string("' was not generated."));
+                    }
+                }
+                e = e->NextSiblingElement("memberdef");
+            }
+        }
+        else if (strcmp(kind, "protected-func") == 0 ||
+                 strcmp(kind, "private-func") == 0)
+        {
+            // Check for inaccessible constructor/destructor
+            // and create a list of all other inaccessible functions
+            // (we do this so that classes that override a public function
+            // and change its scope to protected or private work properly
+            // from Lua-i.e. no binding is generated for such functions).
+            XMLElement* e = node->FirstChildElement("memberdef");
+            while (e)
+            {
+                if (strcmp(e->Attribute("virt"), "pure-virtual") == 0)
+                    hasPureVirtual = true;
+
+                FunctionBinding::Param t = getParam(e);
+                if (t.type == FunctionBinding::Param::TYPE_CONSTRUCTOR)
+                {
+                    classBinding.inaccessibleConstructor = true;
+                }
+                else if (t.type == FunctionBinding::Param::TYPE_DESTRUCTOR)
+                {
+                    classBinding.inaccessibleDestructor = true;
+                }
+                else
+                {
+                    FunctionBinding b(classBinding.classname, classBinding.uniquename);
+                    b.type = FunctionBinding::MEMBER_FUNCTION;
+
+                    b.name = getName(e);
+                
+                    if (!isReservedKeyword(b.name))
+                    {
+                        // Ignore operators.
+                        if (b.name.find("operator") != 0)
+                        {
+                            b.returnParam = getParam(e, false, b.classname);
+                            if (b.returnParam.type == FunctionBinding::Param::TYPE_CONSTRUCTOR)
+                            {
+                                b.returnParam.info = refId;
+                                b.own = true;
+                            }
+
+                            getParams(e, b);
+                            getCreateFlag(e, b);
+                            classBinding.hidden[b.getFunctionName()].push_back(b);
+                        }
+                        else
+                        {
+                            __printOperatorWarning = true;
+                        }
+                    }
+                }
+                e = e->NextSiblingElement("memberdef");
+            }
+        }
+        else if (strcmp(kind, "protected-static-func") == 0 ||
+                 strcmp(kind, "private-static-func") == 0)
+        {
+            // Create a list of all other inaccessible functions
+            // (we do this so that classes that override a public function
+            // and change its scope to protected or private work properly
+            // from Lua-i.e. no binding is generated for such functions).
+
+            XMLElement* e = node->FirstChildElement("memberdef");
+            while (e)
+            {
+                if (e->FirstChildElement("templateparamlist"))
+                {
+                    __printTemplateWarning = true;
+                }
+                else if (getScriptFlag(e) != "ignore")
+                {
+                    FunctionBinding b(classBinding.classname, classBinding.uniquename);
+                    b.type = FunctionBinding::STATIC_FUNCTION;
+
+                    b.name = getName(e);
+                    if (!isReservedKeyword(b.name))
+                    {
+                        b.returnParam = getParam(e, false, b.classname);
+                        
+                        getParams(e, b);
+                        getCreateFlag(e, b);
+                        classBinding.hidden[b.getFunctionName()].push_back(b);
+                    }
+                }
+                e = e->NextSiblingElement("memberdef");
+            }
+        }
+        // Process public enums and typedefs.
+        else if (strcmp(kind, "public-type") == 0)
+        {
+            XMLElement* e = node->FirstChildElement("memberdef");
+            while (e)
+            {
+                if (getScriptFlag(e) != "ignore")
+                {
+                    if (strcmp(e->Attribute("kind"), "enum") == 0)
+                    {
+                        getEnum(e, classBinding.classname, classBinding.ns, classBinding.include);
+                    }
+                    else if (strcmp(e->Attribute("kind"), "typedef") == 0)
+                    {
+                        getTypedef(e, classBinding.classname, classBinding.ns);
+                    }
+                }
+                e = e->NextSiblingElement("memberdef");
+            }
+        }
+        else
+        {
+            // Ignore other section definitions.
+        }
+    }
+
+    // If the class has a pure-virtual method, we mark the constructor as inaccessible
+    // and remove any constructor bindings that are in the list.
+    if (hasPureVirtual)
+    {
+        classBinding.inaccessibleConstructor = true;
+        map<string, vector<FunctionBinding> >::iterator iter = classBinding.bindings.begin();
+        for (; iter != classBinding.bindings.end(); iter++)
+        {
+            if (iter->second[0].returnParam.type == FunctionBinding::Param::TYPE_CONSTRUCTOR)
+            {
+                classBinding.bindings.erase(iter);
+                break;
+            }
+        }
+    }
+
+    // Store the class's derived class(es)' ref id(s) if it has any.
+    node = classNode->FirstChildElement("derivedcompoundref");
+    while (node)
+    {
+        classBinding.derived.push_back(node->Attribute("refid"));
+        node = node->NextSiblingElement("derivedcompoundref");
+    }
+
+    // If the class has no base classes and it has derived classes, add it to the list of top-level classes.
+    if (!classNode->FirstChildElement("basecompoundref") && classBinding.derived.size() > 0)
+        _topLevelBaseClasses.push_back(classBinding.classname);
+
+    // Insert the class binding into the global table.
+    _classes[classBinding.classname] = classBinding;
+}
+
+void Generator::getEnums(XMLElement* fileNode, string ns)
+{
+    XMLElement* node = NULL;
+    const char* kind = NULL;
+    for (node = fileNode->FirstChildElement("sectiondef"); node != NULL; node = node->NextSiblingElement("sectiondef"))
+    {
+        kind = node->Attribute("kind");
+        if (!kind)
+        {
+            GP_ERROR("Section definition is missing required 'kind' attribute in XML document  '%s'.", _file);
+            return;
+        }
+
+        // Process the enums.
+        if (strcmp(kind, "enum") == 0)
+        {
+            XMLElement* e = node->FirstChildElement("memberdef");
+            while (e)
+            {
+                if (getScriptFlag(e) != "ignore" && strcmp(e->Attribute("kind"), "enum") == 0)
+                {
+                    getEnum(e, "", ns);
+                }
+                e = e->NextSiblingElement("memberdef");
+            }
+        }
+    }
+}
+
+void Generator::getEnum(XMLElement* e, string classname, string ns, string include)
+{
+    // Get the enumeration's name.
+    string enumname = classname;
+    if (enumname.size() > 0)
+        enumname += string("::");
+    enumname += getName(e);
+
+    // Get the ref id for the enum.
+    string refId = e->Attribute("id");
+
+    // Store the ref id to name mapping.
+    Generator::getInstance()->setIdentifier(refId, enumname);
+    
+    // Add the enum to the enum list if it's not there 
+    // (we implicitly create it when we set its scope path).
+    if (_enums.find(enumname) == _enums.end())
+        _enums[enumname].scopePath = Generator::getScopePath(enumname, ns);
+
+    // Set the include file for the enum.
+    if (include.size() > 0)
+        _enums[enumname].include = include;
+    else
+    {
+        XMLElement* location = e->FirstChildElement("location");
+        if (location)
+            _enums[enumname].include = location->Attribute("file");
+    }
+
+    for (e = e->FirstChildElement("enumvalue"); e; e = e->NextSiblingElement("enumvalue"))
+    {
+        _enums[enumname].values.push_back(getName(e));
+    }
+}
+
+void Generator::getTypedefs(XMLElement* fileNode, string ns)
+{
+    XMLElement* node = NULL;
+    const char* kind = NULL;
+    for (node = fileNode->FirstChildElement("sectiondef"); node != NULL; node = node->NextSiblingElement("sectiondef"))
+    {
+        kind = node->Attribute("kind");
+        if (!kind)
+        {
+            GP_ERROR("Section definition is missing required 'kind' attribute in XML document  '%s'.", _file);
+            return;
+        }
+
+        // Process the enums.
+        if (strcmp(kind, "typedef") == 0)
+        {
+            XMLElement* e = node->FirstChildElement("memberdef");
+            while (e)
+            {
+                if (getScriptFlag(e) != "ignore" && strcmp(e->Attribute("kind"), "typedef") == 0)
+                {
+                    getTypedef(e, "", ns);
+                }
+                e = e->NextSiblingElement("memberdef");
+            }
+        }
+    }
+}
+
+void Generator::getTypedef(XMLElement* e, string classname, string ns)
+{
+    TypedefBinding t;
+
+    // Get the typedef's name.
+    string tname = classname;
+    if (tname.size() > 0)
+        tname += string("::");
+    tname += getName(e);
+
+    if (!REMOVE_NAMESPACE)
+        tname = ns + string("::") + tname;
+
+    // Get the typedef's id and store the mapping from ref id to name.
+    string refId = e->Attribute("id");
+    setIdentifier(refId, tname);
+
+    FunctionBinding::Param p = getParam(e);
+    if (p.info.size() > 0)
+        t.refId = p.info;
+
+    _typedefs[tname] = t;
+}
+
+static inline bool getScriptFlagHelper(XMLElement* e, string& flag)
+{
+    XMLElement* x = e->FirstChildElement("xmlonly");
+    if (x)
+    {
+        flag = x->GetText();
+        return true;
+    }
+
+    x = e->FirstChild() ? e->FirstChild()->ToElement() : NULL;
+    while (x)
+    {
+        if (getScriptFlagHelper(x, flag))
+            return true;
+
+        x = x->NextSibling() ? x->NextSibling()->ToElement() : NULL;
+    }
+    return false;
+}
+
+string Generator::getScriptFlag(XMLElement* e)
+{
+    string flag;
+
+    XMLElement* n = e->FirstChildElement("detaileddescription");
+    if (n)
+        getScriptFlagHelper(n, flag);
+    
+    return flag;
+}
+
+
+void Generator::getCreateFlag(XMLElement* e, FunctionBinding& b)
+{
+    if (getScriptFlag(e) == "create")
+        b.own = true;
+}
+
+string Generator::getName(XMLElement* e)
+{
+    // Get the name for the binding.
+    XMLElement* nameElement = e->FirstChildElement("name");
+    if (!nameElement)
+    {
+        GP_ERROR("Missing 'name' child node in XML document '%s'.", _file);
+        return string();
+    }
+    return nameElement->GetText();
+}
+
+bool Generator::getIsConstType(XMLElement* e)
+{
+    XMLElement* typeElement = e->FirstChildElement("type");
+    if (!typeElement)
+    {
+        GP_ERROR("Missing 'type' node in XML document '%s'.", _file);
+        return false;
+    }
+
+    XMLNode* textNode = typeElement->FirstChild();
+    if (textNode)
+    {
+        XMLText* text = textNode->ToText();
+        if (text)
+        {
+            string type = text->Value();
+            return type.find("const") != type.npos;
+        }
+    }
+    return false;
+}
+
+FunctionBinding::Param Generator::getParam(XMLElement* e, bool isVariable, string classname)
+{
+    // Get the type for the current element (either the return type or a parameter type).
+    XMLElement* typeElement = e->FirstChildElement("type");
+    if (!typeElement)
+    {
+        GP_ERROR("Missing 'type' node in XML document '%s'.", _file);
+    }
+
+    FunctionBinding::Param p;
+    XMLNode* textNode = typeElement->FirstChild();
+    if (!textNode)
+    {
+        // Get the name of the current element to see if it is a destructor.
+        string name = getName(e);
+        if (name.find("~") == 0)
+        {
+            p = FunctionBinding::Param(FunctionBinding::Param::TYPE_DESTRUCTOR);
+        }
+        else
+        {
+            // Assume it's a constructor.
+            p = FunctionBinding::Param(FunctionBinding::Param::TYPE_CONSTRUCTOR, FunctionBinding::Param::KIND_POINTER, name);
+        }
+    }
+    else
+    {
+        // Get the type string without const or reference qualifiers (and trim whitespace).
+        string refId = "";
+        string typeStr = "";
+        FunctionBinding::Param::Kind kind;
+        {
+            // Attempt to process the type as reference (i.e. class, struct, enum, typedef, etc.) type.
+            XMLNode* node = textNode;
+            while (node)
+            {
+                if (strcmp(node->Value(), "ref") == 0)
+                {
+                    refId = node->ToElement()->Attribute("refid");
+                    typeStr += node->ToElement()->GetText();
+                }
+                else if (node->ToText())
+                {
+                    typeStr += node->ToText()->Value();
+                }
+
+                node = node->NextSibling();
+            }
+
+            typeStr = stripTypeQualifiers(typeStr, kind);
+        }
+
+        if (typeStr == "void")
+        {
+            p = FunctionBinding::Param(FunctionBinding::Param::TYPE_VOID, kind);
+        }
+        else if (typeStr == "bool")
+        {
+            p = FunctionBinding::Param(FunctionBinding::Param::TYPE_BOOL, kind);
+        }
+        else if (typeStr == "char" && kind != FunctionBinding::Param::KIND_POINTER)
+        {
+            p = FunctionBinding::Param(FunctionBinding::Param::TYPE_CHAR, kind);
+        }
+        else if (typeStr == "short")
+        {
+            p = FunctionBinding::Param(FunctionBinding::Param::TYPE_SHORT, kind);
+        }
+        else if (typeStr == "int")
+        {
+            p = FunctionBinding::Param(FunctionBinding::Param::TYPE_INT, kind);
+        }
+        else if (typeStr == "long")
+        {
+            p = FunctionBinding::Param(FunctionBinding::Param::TYPE_LONG, kind);
+        }
+        else if (typeStr == "unsigned char")
+        {
+            p = FunctionBinding::Param(FunctionBinding::Param::TYPE_UCHAR, kind);
+        }
+        else if (typeStr == "unsigned short")
+        {
+            p = FunctionBinding::Param(FunctionBinding::Param::TYPE_USHORT, kind);
+        }
+        else if (typeStr == "unsigned int")
+        {
+            p = FunctionBinding::Param(FunctionBinding::Param::TYPE_UINT, kind);
+        }
+        else if (typeStr == "unsigned long")
+        {
+            p = FunctionBinding::Param(FunctionBinding::Param::TYPE_ULONG, kind);
+        }
+        else if (typeStr == "float")
+        {
+            p = FunctionBinding::Param(FunctionBinding::Param::TYPE_FLOAT, kind);
+        }
+        else if (typeStr == "double")
+        {
+            p = FunctionBinding::Param(FunctionBinding::Param::TYPE_DOUBLE, kind);
+        }
+        else if (typeStr == "string" || typeStr == "std::string")
+        {
+            p = FunctionBinding::Param(FunctionBinding::Param::TYPE_STRING, kind, "string");
+        }
+        else if (typeStr == "char" && kind == FunctionBinding::Param::KIND_POINTER)
+        {
+            p = FunctionBinding::Param(FunctionBinding::Param::TYPE_STRING, kind, "char*");
+        }
+        else if (_enums.find(typeStr) != _enums.end() ||
+            (classname.size() > 0 && _enums.find(classname + string("::") + typeStr) != _enums.end()))
+        {
+            p = FunctionBinding::Param(FunctionBinding::Param::TYPE_ENUM, kind, refId);
+        }
+        else if (typeStr == "...")
+        {
+            __printVarargWarning = true;
+            p = FunctionBinding::Param(FunctionBinding::Param::TYPE_VARARGS);
+        }
+        else
+        {
+            p = FunctionBinding::Param(FunctionBinding::Param::TYPE_UNRECOGNIZED, kind, (refId.size() > 0) ? refId : typeStr);
+        }
+
+        // Check if the type is a pointer declared with square brackets (i.e. float x[4]).
+        XMLElement* arrayElement = NULL;
+        if ((arrayElement = e->FirstChildElement("array")) != NULL ||
+            (isVariable && (arrayElement = e->FirstChildElement("argsstring")) != NULL))
+        {
+            const char* text = arrayElement->GetText();
+            string arrayString = (text ? text : "");
+            string::size_type i = arrayString.find("[");
+            string::size_type k = arrayString.find("]");
+            if (i != arrayString.npos && k != arrayString.npos)
+            {
+                p.kind = FunctionBinding::Param::KIND_POINTER;
+                if (i != k - 1)
+                    p.info = arrayString.substr(i + 1, k - (i + 1));
+            }
+        }
+    }
+
+    // Get the default value for the parameter if it has one.
+    XMLElement* defaultValueElement = e->FirstChildElement("defval");
+    if (defaultValueElement)
+    {
+        p.hasDefaultValue = true;
+    }
+
+    return p;
+}
+
+void Generator::getParams(XMLElement* e, FunctionBinding& b)
+{
+    XMLElement* param = e->FirstChildElement("param");
+    while (param)
+    {
+        FunctionBinding::Param p = getParam(param, false, b.classname);
+        if (p.type != FunctionBinding::Param::TYPE_VARARGS)
+            b.paramTypes.push_back(p);
+        param = param->NextSiblingElement("param");
+    }
+}
+
+void Generator::resolveMembers(const ClassBinding& c)
+{
+    vector<ClassBinding*> derived;
+
+    // Go through the derived classes' bindings and update them.
+    ClassBinding* cb = NULL;
+    map<string, vector<FunctionBinding> >::const_iterator iter;
+    for (unsigned int i = 0; i < c.derived.size(); i++)
+    {
+        // If the class is not in the map of classes, then
+        // it was marked to be ignored, so skip over it.
+        string derivedClassName = getIdentifier(c.derived[i]);
+        if (_classes.find(derivedClassName) == _classes.end())
+            continue;
+
+        cb = &_classes[derivedClassName];
+
+        // Go through this class' bindings and add them to the current
+        // derived class if they are not already there (excluding constructors and destructors).
+        for (iter = c.bindings.begin(); iter != c.bindings.end(); iter++)
+        {
+            FunctionBinding b(cb->classname, cb->uniquename);
+            b.type = iter->second[0].type;
+            b.name = iter->second[0].name;
+
+            map<string, vector<FunctionBinding> >::iterator findIter = cb->bindings.find(b.getFunctionName());
+            map<string, vector<FunctionBinding> >::iterator hiddenIter = cb->hidden.find(b.getFunctionName());
+            if (findIter == cb->bindings.end() && hiddenIter == cb->hidden.end())
+            {
+                for (unsigned int i = 0, iCount = iter->second.size(); i < iCount; i++)
+                {
+                    if (iter->second[i].returnParam.type != FunctionBinding::Param::TYPE_CONSTRUCTOR &&
+                        iter->second[i].returnParam.type != FunctionBinding::Param::TYPE_DESTRUCTOR)
+                    {
+                        // Copy the binding, but set its function name to 
+                        // empty so that it is regenerated correctly.
+                        b = iter->second[i];
+                        b.functionName = "";
+                        b.classname = cb->classname;
+                        b.uniquename = cb->uniquename;
+
+                        cb->bindings[b.getFunctionName()].push_back(b);
+                    }
+                }
+            }
+            else
+            {
+                bool addBinding;
+                for (unsigned int i = 0, iCount = iter->second.size(); i < iCount; i++)
+                {
+                    string name = iter->second[i].name;
+
+                    addBinding = true;
+                    if (findIter != cb->bindings.end())
+                    {
+                        for (unsigned int j = 0, jCount = findIter->second.size(); j < jCount; j++)
+                        {
+                            if (FunctionBinding::signaturesMatch(iter->second[i], findIter->second[j]))
+                            {
+                                addBinding = false;
+                                break;
+                            }
+                        }
+
+                        // To call the base function, we have to qualify the call since
+                        // the derived class has a function with the same name and different parameters.
+                        if (addBinding)
+                            name = iter->second[i].classname + string("::") + iter->second[i].name;
+                    }
+                    if (hiddenIter != cb->hidden.end())
+                    {
+                        for (unsigned int j = 0, jCount = hiddenIter->second.size(); j < jCount; j++)
+                        {
+                            if (FunctionBinding::signaturesMatch(iter->second[i], hiddenIter->second[j]))
+                            {
+                                addBinding = false;
+                                break;
+                            }
+                        }
+                    }
+
+                    if (addBinding)
+                    {
+                        FunctionBinding b = iter->second[i];
+                        b.name = name;
+                        b.functionName = findIter->first;
+                        b.classname = cb->classname;
+                        b.uniquename = getUniqueName(cb->classname);
+
+                        if (findIter != cb->bindings.end())
+                            findIter->second.push_back(b);
+                        else
+                            cb->bindings[b.getFunctionName()].push_back(b);
+                    }
+                }
+            }
+        }
+
+        derived.push_back(cb);
+    }
+
+    // Go through the derived classes' bindings and resolve the members for their derived classes.
+    for (unsigned int i = 0; i < derived.size(); i++)
+    {
+        resolveMembers(*derived[i]);
+    }
+}
+
+void Generator::resolveInheritance()
+{
+    // Go through the class inheritance tree and update each class's bindings list 
+    // to include the bindings from the base class that haven't been overridden.
+    for (unsigned int i = 0; i < _topLevelBaseClasses.size(); i++)
+    {
+        resolveMembers(_classes[_topLevelBaseClasses[i]]);
+    }
+}
+
+void Generator::resolveIncludes(const ClassBinding& c)
+{
+    vector<ClassBinding*> derived;
+
+    // Go through the derived classes' bindings and update them.
+    ClassBinding* cb = NULL;
+    map<string, vector<FunctionBinding> >::const_iterator iter;
+    for (unsigned int i = 0; i < c.derived.size(); i++)
+    {
+        // If the class is not in the map of classes, then
+        // it was marked to be ignored, so skip over it.
+        string derivedClassName = getIdentifier(c.derived[i]);
+        if (_classes.find(derivedClassName) == _classes.end())
+            continue;
+
+        cb = &_classes[derivedClassName];
+
+        // Add all include files (uniquely) from the base class to the derived class.
+        map<string, set<string> >::iterator baseIncludes = _includes.find(c.include);
+        if (baseIncludes != _includes.end() && baseIncludes->second.size() > 0)
+        {
+            set<string>::iterator iter = baseIncludes->second.begin();
+            set<string>& derivedIncludes = _includes[cb->include];
+            for (; iter != baseIncludes->second.end(); iter++)
+            {
+                derivedIncludes.insert(*iter);
+            }
+        }
+        
+        derived.push_back(cb);
+    }
+
+    // Go through the derived classes' bindings and resolve the members for their derived classes.
+    for (unsigned int i = 0; i < derived.size(); i++)
+    {
+        resolveIncludes(*derived[i]);
+    }
+}
+
+void Generator::resolveInheritedIncludes()
+{
+    // Go through the class inheritance tree and update each class's 
+    // list of includes to include the includes from the base class
+    for (unsigned int i = 0; i < _topLevelBaseClasses.size(); i++)
+    {
+        resolveIncludes(_classes[_topLevelBaseClasses[i]]);
+    }
+}
+
+void Generator::resolveType(FunctionBinding::Param* param, string functionName, string header)
+{
+    string name = getIdentifier(param->info);
+
+    if (param->type == FunctionBinding::Param::TYPE_UNRECOGNIZED)
+    {
+        map<string, TypedefBinding>::iterator typedefIter = _typedefs.find(name);
+        if (typedefIter != _typedefs.end() && typedefIter->second.refId.size() > 0)
+        {
+            param->type = FunctionBinding::Param::TYPE_OBJECT;
+            param->info = typedefIter->second.refId;
+        }
+        else
+        {
+            map<string, ClassBinding>::iterator classIter = _classes.find(name);
+            if (classIter != _classes.end())
+            {
+                param->type = FunctionBinding::Param::TYPE_OBJECT;
+            }
+            else
+            {
+                map<string, EnumBinding>::iterator enumIter = _enums.find(name);
+                if (enumIter != _enums.end())
+                {
+                    param->type = FunctionBinding::Param::TYPE_ENUM;
+                }
+                else
+                {
+                    __warnings.insert(string("Unrecognized C++ type: ") + functionName + string(" -- ") + (name.size() > 0 ? name : param->info));
+                }
+            }
+        }
+    }
+
+    // Ensure that the header for the Lua enum conversion 
+    // functions is included in the file containing the
+    // generated binding that this param/return value is part of.
+    if (param->type == FunctionBinding::Param::TYPE_ENUM)
+    {
+        string enumHeader = string("lua_") + getUniqueName(name) + string(".h");
+        if (_includes.find(header) != _includes.end())
+        {
+            set<string>& includes = _includes[header];
+            if (includes.find(enumHeader) == includes.end())
+                includes.insert(enumHeader);
+        }
+        else
+        {
+            _includes[header].insert(enumHeader);
+        }
+    }
+}
+
+void Generator::resolveTypes()
+{
+    // Go through all member functions and attempt to resolve unrecognized types.
+    for (map<string, ClassBinding>::iterator iter = _classes.begin(); iter != _classes.end(); iter++)
+    {
+        map<string, vector<FunctionBinding> >::iterator functionNameIter = iter->second.bindings.begin();
+        for (; functionNameIter != iter->second.bindings.end(); functionNameIter++)
+        {
+            vector<FunctionBinding>::iterator functionIter = functionNameIter->second.begin();
+            for (; functionIter != functionNameIter->second.end(); functionIter++)
+            {
+                resolveType(&functionIter->returnParam, iter->first + string("::") + functionIter->name, iter->second.include);
+
+                vector<FunctionBinding::Param>::iterator paramIter = functionIter->paramTypes.begin();
+                for (; paramIter != functionIter->paramTypes.end(); paramIter++)
+                {
+                    resolveType(&(*paramIter), iter->first + string("::") + functionIter->name, iter->second.include);
+                }
+            }
+        }
+    }
+
+    // Go through all non-member functions and attempt to resolve unrecognized types.
+    string globalHeader = string("lua_") + string(LUA_GLOBAL_FILENAME) + string(".h");
+    for (map<string, vector<FunctionBinding> >::iterator iter = _functions.begin(); iter != _functions.end(); iter++)
+    {
+        vector<FunctionBinding>::iterator functionIter = iter->second.begin();
+        for (; functionIter != iter->second.end(); functionIter++)
+        {
+            resolveType(&functionIter->returnParam, functionIter->name, globalHeader);
+
+            vector<FunctionBinding::Param>::iterator paramIter = functionIter->paramTypes.begin();
+            for (; paramIter != functionIter->paramTypes.end(); paramIter++)
+            {
+                resolveType(&(*paramIter), functionIter->name, globalHeader);
+            }
+        }
+    }
+}
+
+void Generator::generateBindings()
+{
+    string* bindingNS = new string("gameplay");
+    
+    string luaAllHStr = _outDir + string(LUA_ALL_BINDINGS_FILENAME) + string(".h");
+    ofstream luaAllH(luaAllHStr.c_str());
+    string includeGuard = string(LUA_ALL_BINDINGS_FILENAME) + string("_H_");
+    transform(includeGuard.begin(), includeGuard.end(), includeGuard.begin(), ::toupper);
+    luaAllH << "#ifndef " << includeGuard << "\n";
+    luaAllH << "#define " << includeGuard << "\n\n";
+    
+    string luaAllCppStr = _outDir + string(LUA_ALL_BINDINGS_FILENAME) + string(".cpp");
+    ofstream luaAllCpp(luaAllCppStr.c_str());
+    luaAllCpp << "#include \"Base.h\"\n";
+    luaAllCpp << "#include \"" << string(LUA_ALL_BINDINGS_FILENAME) << ".h\"\n\n";
+    if (bindingNS)
+    {
+        luaAllCpp << "namespace " << *bindingNS << "\n";
+        luaAllCpp << "{\n\n";
+    }
+    luaAllCpp << "void lua_RegisterAllBindings()\n";
+    luaAllCpp << "{\n";
+
+    // Write out all the class bindings.
+    if (_classes.size() > 0)
+    {
+        map<string, ClassBinding>::iterator iter = _classes.begin();
+        for (; iter != _classes.end(); iter++)
+        {
+            cout << "Generating bindings for '" << iter->first << "'...\n";
+            iter->second.write(_outDir, _includes[iter->second.include], bindingNS);
+
+            luaAllH << "#include \"lua_" << iter->second.uniquename << ".h\"\n";
+            luaAllCpp << "    luaRegister_" << iter->second.uniquename << "();\n";
+        }
+    }
+
+    // Go through all the classes and if they have any derived classes, add them to the list of base classes.
+    vector<string> baseClasses;
+    for (map<string, ClassBinding>::iterator iter = _classes.begin(); iter != _classes.end(); iter++)
+    {
+        if (iter->second.derived.size() > 0)
+            baseClasses.push_back(iter->first);
+    }
+
+    // Write out all the enum files.
+    if (_enums.size() > 0)
+    {
+        // Write out the enum conversion function declarations.
+        for (map<string, EnumBinding>::iterator iter = _enums.begin(); iter != _enums.end(); iter++)
+        {
+            // Header.
+            string enumHStr = _outDir + string("lua_") + getUniqueName(iter->first) + string(".h");
+            ofstream enumH(enumHStr.c_str());
+            includeGuard = string("lua_") + getUniqueName(iter->first) + string("_H_");
+            transform(includeGuard.begin(), includeGuard.end(), includeGuard.begin(), ::toupper);
+            enumH << "#ifndef " << includeGuard << "\n";
+            enumH << "#define " << includeGuard << "\n\n";
+            enumH << "#include \"" << iter->second.include << "\"\n\n";
+
+            if (bindingNS)
+            {
+                enumH << "namespace " << *bindingNS << "\n";
+                enumH << "{\n\n";
+            }
+
+            enumH << "// Lua bindings for enum conversion functions for " << iter->first << ".\n";
+            enumH << iter->first << " lua_enumFromString_" << getUniqueName(iter->first) << "(const char* s);\n";
+            enumH << "const char* lua_stringFromEnum_" << getUniqueName(iter->first) << "(" << iter->first << " e);\n\n";
+
+            if (bindingNS)
+            {
+                enumH << "}\n\n";
+            }
+
+            enumH << "#endif\n";
+            enumH.close();
+
+            // Implementation.
+            string enumCppStr = _outDir + string("lua_") + getUniqueName(iter->first) + string(".cpp"); 
+            ofstream enumCpp(enumCppStr.c_str());
+            enumCpp << "#include \"Base.h\"\n";
+            enumCpp << "#include \"lua_" << getUniqueName(iter->first) << ".h\"\n\n";
+
+            if (bindingNS)
+            {
+                enumCpp << "namespace " << *bindingNS << "\n";
+                enumCpp << "{\n\n";
+            }
+
+            enumCpp << "static const char* enumStringEmpty = \"\";\n\n";
+
+            // Build the scope string if applicable.
+            string scope;
+            if (iter->second.scopePath.size() > 0)
+            {
+                for (unsigned int i = 0; i < iter->second.scopePath.size(); i++)
+                {
+                    scope += iter->second.scopePath[i] + string("::");
+                }
+            }
+
+            // Write out the string constants that correspond to the enumeration values.
+            for (unsigned int i = 0; i < iter->second.values.size(); i++)
+            {
+                enumCpp << "static const char* luaEnumString_" << getUniqueName(iter->first) << "_";
+                enumCpp << iter->second.values[i] << " = \"" << iter->second.values[i] << "\";\n";
+            }
+            enumCpp << "\n";
+
+            enumCpp << iter->first << " lua_enumFromString_" << getUniqueName(iter->first) << "(const char* s)\n";
+            enumCpp << "{\n";
+                
+            for (unsigned int i = 0; i < iter->second.values.size(); i++)
+            {
+                enumCpp << "    ";
+                        
+                enumCpp << "if (strcmp(s, luaEnumString_" << getUniqueName(iter->first) << "_" << iter->second.values[i] << ") == 0)\n";
+                enumCpp << "        return ";
+                if (scope.size() > 0)
+                    enumCpp << scope;
+                enumCpp << iter->second.values[i] << ";\n";
+
+                if (i == iter->second.values.size() - 1)
+                {
+                    enumCpp << "    GP_ERROR(\"Invalid enumeration value '%s' for enumeration " << iter->first << ".\", s);\n";
+                    enumCpp << "    return ";
+                    if (scope.size() > 0)
+                        enumCpp << scope;
+                    enumCpp << iter->second.values[0] << ";\n";
+                }
+            }
+
+            enumCpp << "}\n\n";
+
+            enumCpp << "const char* lua_stringFromEnum_" << getUniqueName(iter->first) << "(" << iter->first << " e)\n";
+            enumCpp << "{\n";
+
+            // Write out the enum-to-string conversion code.
+            for (unsigned int i = 0; i < iter->second.values.size(); i++)
+            {
+                enumCpp << "    ";
+                        
+                enumCpp << "if (e == ";
+                if (scope.size() > 0)
+                    enumCpp << scope;
+                enumCpp << iter->second.values[i] << ")\n";
+                enumCpp << "        return luaEnumString_" << getUniqueName(iter->first) << "_" << iter->second.values[i] << ";\n";
+
+                if (i == iter->second.values.size() - 1)
+                {
+                    enumCpp << "    GP_ERROR(\"Invalid enumeration value '%d' for enumeration " << iter->first << ".\", e);\n";
+                    enumCpp << "    return enumStringEmpty;\n";
+                }
+            }
+
+            enumCpp << "}\n\n";
+
+            if (bindingNS)
+            {
+                enumCpp << "}\n\n";
+            }
+            enumCpp.close();
+        }
+    }
+
+    // Write out the global bindings file.
+    cout << "Generating global bindings...\n";
+    if (baseClasses.size() > 0 || _functions.size() > 0 || _enums.size() > 0)
+    {
+        // Write out the header file.
+        {
+            string path = _outDir + string(LUA_GLOBAL_FILENAME) + string(".h");
+            ofstream global(path.c_str());
+            if (!global)
+            {
+                GP_ERROR("Failed to open file '%s' for generating Lua bindings.", path.c_str());
+                goto end;
+            }
+            includeGuard = string(LUA_GLOBAL_FILENAME) + string("_H_");
+            transform(includeGuard.begin(), includeGuard.end(), includeGuard.begin(), ::toupper);
+            global << "#ifndef " << includeGuard << "\n";
+            global << "#define " << includeGuard << "\n\n";
+
+            // Write out the needed includes for the global enumeration function.
+            for (map<string, EnumBinding>::iterator iter = _enums.begin(); iter != _enums.end(); iter++)
+            {
+                global << "#include \"lua_" << getUniqueName(iter->first) << ".h\"\n";
+            }
+            global << "\n";
+            luaAllH << "#include \"" << string(LUA_GLOBAL_FILENAME) << ".h\"\n";
+            luaAllCpp << "    luaRegister_" << LUA_GLOBAL_FILENAME << "();\n";
+
+            if (bindingNS)
+            {
+                global << "namespace " << *bindingNS << "\n";
+                global << "{\n\n";
+            }
+
+            if (_functions.size() > 0)
+            {
+                global << "// Lua bindings for global functions.\n";
+
+                // Write out the binding function declarations.
+                for (map<string, vector<FunctionBinding> >::iterator iter = _functions.begin(); iter != _functions.end(); iter++)
+                {
+                    global << "int " << iter->second[0].getFunctionName() << "(lua_State* state);\n";
+                }
+                global << "\n";
+            }
+
+            if (_enums.size() > 0)
+            {
+                global << "// Global enum to string conversion function (used to pass enums to Lua from C++).\n";
+                global << "const char* lua_stringFromEnumGlobal(std::string& enumname, unsigned int value);\n\n";
+            }
+            
+            // Write out the signature of the function used to register the global functions with Lua.
+            global << "void luaRegister_" << LUA_GLOBAL_FILENAME << "();\n\n";
+
+            if (bindingNS)
+                global << "}\n\n";
+            global << "#endif\n";
+            global.close();
+        }
+
+        // Write out the implementation.
+        {
+            string path = _outDir + string(LUA_GLOBAL_FILENAME) + string(".cpp");
+            ofstream global(path.c_str());
+            if (!global)
+            {
+                GP_ERROR("Failed to open file '%s' for generating Lua bindings.", path.c_str());
+                goto end;
+            }
+            
+            global << "#include \"ScriptController.h\"\n";
+            global << "#include \"" << LUA_GLOBAL_FILENAME << ".h\"\n";
+            map<string, set<string> >::iterator iter = _includes.find(string(LUA_GLOBAL_FILENAME) + string(".h"));
+            if (iter != _includes.end())
+            {
+                set<string>::iterator includeIter = iter->second.begin();
+                for (; includeIter != iter->second.end(); includeIter++)
+                {
+                    global << "#include \"" << *includeIter << "\"\n";
+                }
+            }
+            global << "\n";
+
+            if (bindingNS)
+            {
+                global << "namespace " << *bindingNS << "\n";
+                global << "{\n\n";
+            }
+
+            // Write out the function used to register all global bindings with Lua.
+            global << "void luaRegister_" << LUA_GLOBAL_FILENAME << "()\n";
+            global << "{\n";
+        
+            if (_functions.size() > 0)
+            {
+                global << "\n";
+                // Bind the non-member functions.
+                for (map<string, vector<FunctionBinding> >::iterator iter = _functions.begin(); iter != _functions.end(); iter++)
+                {
+                    global << "    ScriptUtil::registerFunction(\"" << iter->second[0].name << "\", " << iter->second[0].getFunctionName() << ");\n";
+                }
+            }
+
+            // Generate the hierarchy map.
+            if (baseClasses.size() > 0)
+            {
+                global << "\n    std::map<std::string, std::vector<std::string> > hierarchy;\n";
+                for (unsigned int i = 0, count = baseClasses.size(); i < count; i++)
+                {
+                    set<string> derived;
+                    getAllDerived(derived, baseClasses[i]);
+                    for (set<string>::iterator iter = derived.begin(); iter != derived.end(); iter++)
+                    {
+                        global << "    hierarchy[\"" << baseClasses[i] << "\"].push_back(\"" << *iter << "\");\n";
+                    }
+                }
+                global << "    ScriptUtil::setGlobalHierarchy(hierarchy);\n";
+            }
+
+            // Register all enums.
+            if (_enums.size() > 0)
+            {
+                for (map<string, EnumBinding>::iterator iter = _enums.begin(); iter != _enums.end(); iter++)
+                {
+                    global << "\n    // Register enumeration " << iter->first << ".\n";
+                    global << "    {\n";
+
+                    global << "        std::vector<std::string> scopePath;\n";
+                    for (unsigned int i = 0; i < iter->second.scopePath.size(); i++)
+                    {
+                        global << "        scopePath.push_back(\"" << iter->second.scopePath[i] << "\");\n";
+                    }
+
+                    vector<string>::iterator enumIter = iter->second.values.begin();
+                    for (; enumIter != iter->second.values.end(); enumIter++)
+                    {
+                        global << "        ScriptUtil::registerConstantString(\"" << *enumIter << "\", \"" << *enumIter << "\", scopePath);\n";
+                    }
+
+                    global << "    }\n";
+                }
+            }
+            global << "}\n\n";
+            
+            // Write out the binding functions.
+            for (map<string, vector<FunctionBinding> >::iterator iter = _functions.begin(); iter != _functions.end(); iter++)
+            {
+                FunctionBinding::write(global, iter->second);
+            }
+
+            // Write out the global enum conversion function (used to pass enums from C++ to Lua).
+            global << "static const char* enumStringEmpty = \"\";\n\n";
+            global << "const char* lua_stringFromEnumGlobal(std::string& enumname, unsigned int value)\n";
+            global << "{\n";
+            for (map<string, EnumBinding>::iterator iter = _enums.begin(); iter != _enums.end(); iter++)
+            {
+                global << "    if (enumname == \"";
+                global << iter->first << "\")\n";
+                global << "        return lua_stringFromEnum_" << getUniqueName(iter->first) << "((" << iter->first << ")value);\n";
+            }
+            global << "\n";
+            global << "    GP_ERROR(\"Unrecognized enumeration type '%s'.\", enumname.c_str());\n";
+            global << "    return enumStringEmpty;\n";
+            global << "}\n\n";
+
+            if (bindingNS)
+                global << "}\n";
+            global.close();
+        }
+    }
+
+end:
+    luaAllCpp << "}\n\n";
+    if (bindingNS)
+        luaAllCpp << "}\n\n";
+    luaAllCpp.close();
+
+    if (bindingNS)
+    {
+        luaAllH << "\nnamespace " << *bindingNS << "\n";
+        luaAllH << "{\n\n";
+    }
+    luaAllH << "void lua_RegisterAllBindings();\n\n";
+    if (bindingNS)
+        luaAllH<< "}\n\n";
+    luaAllH << "#endif\n";
+    luaAllH.close();
+
+    SAFE_DELETE(bindingNS);
+}
+
+void Generator::getAllDerived(set<string>& derived, string classname)
+{
+    for (unsigned int i = 0, count = _classes[classname].derived.size(); i < count; i++)
+    {
+        string derivedClassName = getIdentifier(_classes[classname].derived[i]);
+        derived.insert(derivedClassName);
+        getAllDerived(derived, derivedClassName);
+    }
+}
+
+void Generator::getIncludes(XMLElement* e, string filename)
+{
+    filename.replace(filename.find(".cpp"), 4, ".h");
+    for (e = e->FirstChildElement("includes"); e; e = e->NextSiblingElement("includes"))
+    {
+        if (e->Attribute("refid"))
+            _includes[filename].insert(e->GetText());
+    }
+}
+
+// ----------------------------------------------------------------------------
+// Utility functions
+
+static string trim(const string& str)
+{
+    string s = str;
+    while (isspace(s[0]))
+    {
+        s.erase(s.begin());
+    }
+    while (isspace(s[s.size() - 1]))
+    {
+        s.erase(s.begin() + s.size() - 1);
+    }
+    return s;
+}
+
+static string stripTypeQualifiers(const string& typeStr, FunctionBinding::Param::Kind& kind)
+{
+    string type = typeStr;
+    kind = FunctionBinding::Param::KIND_VALUE;
+
+    // Check if the type is a reference.
+    string::size_type i = type.find("&");
+    if (i != type.npos)
+    {
+        kind = FunctionBinding::Param::KIND_REFERENCE;
+        type.erase(type.begin() + i);
+    }
+
+    // Check if the type is a pointer.
+    i = type.find("*");
+    if (i != type.npos)
+    {
+        kind = FunctionBinding::Param::KIND_POINTER;
+        type.erase(type.begin() + i);
+    }
+
+    // Ignore const qualifiers.
+    i = type.find("const ");
+    if (i != type.npos)
+    {
+        type.erase(type.begin() + i, type.begin() + i + 6);
+    }
+
+    return trim(type);
+}
+
+static inline bool isWantedFileNormal(const string& s)
+{
+    if (s.find(".xml") == s.size() - 4)
+    {
+        if (s.find("class") == 0 || s.find("struct") == 0 || 
+            (s.find("_") == 0 && (s.find("h.xml") != s.npos || s.find("cpp.xml") != s.npos)))
+            return true;
+    }
+    return false;
+}
+
+static inline bool isNamespaceFile(const string& s)
+{
+    if (s.find(".xml") == s.size() - 4)
+    {
+        if (s.find("namespace") == 0)
+            return true;
+    }
+    return false;
+}
+
+static bool getFileList(string directory, vector<string>& files, bool (*isWantedFile)(const string& s))
+{
+#ifdef WIN32
+    string path = directory + string("/*");
+
+    // Convert char to wchar.
+    basic_string<TCHAR> wPath;
+    wPath.assign(path.begin(), path.end());
+
+    WIN32_FIND_DATA FindFileData;
+    HANDLE hFind = FindFirstFile(wPath.c_str(), &FindFileData);
+    if (hFind == INVALID_HANDLE_VALUE) 
+    {
+        return false;
+    }
+    do
+    {
+        // Add to the list if this is not a directory and it passes the test function.
+        if ((FindFileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0)
+        {
+            // Convert wchar to char.
+            basic_string<TCHAR> wfilename(FindFileData.cFileName);
+            string filename;
+            filename.assign(wfilename.begin(), wfilename.end());
+
+            if (isWantedFile(filename))
+            {
+                filename = string(directory) + string("/") + filename;
+                files.push_back(filename);
+            }
+        }
+    } while (FindNextFile(hFind, &FindFileData) != 0);
+
+    FindClose(hFind);
+    return true;
+#else
+    string path = directory + string("/.");
+    struct dirent* dp;
+    DIR* dir = opendir(path.c_str());
+    if (!dir)
+    {
+        return false;
+    }
+    while ((dp = readdir(dir)) != NULL)
+    {
+        string filepath(path);
+        filepath.append("/");
+        filepath.append(dp->d_name);
+
+        struct stat buf;
+        if (!stat(filepath.c_str(), &buf))
+        {
+            // Add to the list if this is not a directory and it passes the test function.
+            if (!S_ISDIR(buf.st_mode))
+            {
+                string filename = dp->d_name;
+                if (isWantedFile(filename))
+                {
+                    filename = string(directory) + string("/") + filename;
+                    files.push_back(filename);
+                }
+            }
+        }
+    }
+    closedir(dir);
+    return true;
+#endif
+}
+
+bool isReservedKeyword(string name)
+{
+    static set<string> keywords;
+    if (keywords.size() == 0)
+    {
+        keywords.insert("and");
+        keywords.insert("break");
+        keywords.insert("do");
+        keywords.insert("else");
+        keywords.insert("elseif");
+        keywords.insert("end");
+        keywords.insert("false");
+        keywords.insert("for");
+        keywords.insert("function");
+        keywords.insert("if");
+        keywords.insert("in");
+        keywords.insert("local");
+        keywords.insert("nil");
+        keywords.insert("not");
+        keywords.insert("or");
+        keywords.insert("repeat");
+        keywords.insert("return");
+        keywords.insert("then");
+        keywords.insert("true");
+        keywords.insert("until");
+        keywords.insert("while");
+    };
+
+    return keywords.find(name) != keywords.end();
+}
+
+// ----------------------------------------------------------------------------

+ 204 - 0
gameplay-luagen/src/Generator.h

@@ -0,0 +1,204 @@
+#ifndef GENERATOR_H_
+#define GENERATOR_H_
+
+#include "Base.h"
+#include "ClassBinding.h"
+#include "EnumBinding.h"
+#include "FunctionBinding.h"
+#include "Generator.h"
+#include "TypedefBinding.h"
+
+#include <tinyxml2.h>
+using namespace tinyxml2;
+
+/**
+ * Generates script bindings.
+ */
+class Generator
+{
+public:
+
+    /**
+     * Retrieves the global instance of the generator.
+     * 
+     * @return The global instance of the generator.
+     */
+    static Generator* getInstance();
+
+    /**
+     * Releases the global instance of the generator.
+     */
+    static void releaseInstance();
+
+    /**
+     * Retrieves the unique name for the given identifier (class, struct, enum, etc.).
+     * 
+     * @param name The identifier's name.
+     * @return The unique name.
+     */
+    static string getUniqueName(string name);
+
+    /**
+     * Retrieves the unique name for the given ref id.
+     * 
+     * @param refId The ref id.
+     * @return The unique name.
+     */
+    string getUniqueNameFromRef(string refId);
+
+    /**
+     * Gets the scope path for a given fully resolved classname.
+     * 
+     * @param classname The class name.
+     * @param ns The namespace of the class if it has one.
+     * @return The scope path.
+     */
+    static vector<string> getScopePath(string classname, string ns = string());
+
+    /**
+     * Retrieves the class/struct/enum name for the given ref id.
+     * 
+     * @param refId The ref id.
+     * @return The class/struct/enum name.
+     */
+    string getIdentifier(string refId);
+
+    /**
+     * Gets the given class name without the namespace.
+     * 
+     * @param classname The fully qualified name of the class.
+     * @return The class name without the namespace.
+     */
+    string getClassNameWithoutNamespace(string classname);
+
+    /**
+     * Sets the given ref id and class/struct/enum name pair.
+     * 
+     * @param refId The ref id.
+     * @param classname The class/struct/enum name.
+     */
+    void setIdentifier(string refId, string classname);
+
+    /**
+     * Generates Lua bindings for all classes defined within the given input directory
+     * and places the generated class bindings in the given output directory.
+     * Note that the input directory must point to a folder containing the Doxygen XML 
+     * output files for the classes that the user wants to generate bindings for.
+     * 
+     * @param inDir The input directory (must contain Doxygen XML output files).
+     * @param outDir The output directory.
+     */
+    void run(string inDir, string outDir);
+
+    /**
+     * Retrieves whether the given class is derived from Ref.
+     * 
+     * @param classname The name of the class.
+     * @return True if the class is derived from Ref; false otherwise.
+     */
+    bool isRef(string classname);
+
+protected:
+    /**
+     * Constructor.
+     */
+    Generator();
+
+    /**
+     * Destructor.
+     */
+    ~Generator();
+
+    // Checks if the given class name specifies a class derived from the class represented by the given class binding.
+    bool isDerived(const ClassBinding& c, string classname);
+
+    // Gets the name of the namespace, file, class, or struct.
+    string getCompoundName(XMLElement* node);
+
+    // Parses the non-member functions and adds them to the list.
+    void getFunctions(XMLElement* classNode);
+
+    // Parses the namespace (with the given name).
+    void getNamespace(XMLElement* nsNode, const string& name);
+
+    // Parses the class (with the given name) and adds it to the list.
+    void getClass(XMLElement* classNode, const string& name);
+
+    // Parses all enumerations within a file (optionally within a namespace).
+    void getEnums(XMLElement* fileNode, string ns = "");
+    
+    // Parses the enumeration type and adds it to the global list.
+    void getEnum(XMLElement* e, string classname = "", string ns = "", string include = "");
+
+    // Parses all typedefs within a file (optionall within a namespace).
+    void getTypedefs(XMLElement* fileNode, string ns = "");
+
+    // Parses the typedef and adds it to the global list.
+    void getTypedef(XMLElement* e, string classname = "", string ns = "");
+
+    // Gets the script flag if it is specified.
+    string getScriptFlag(XMLElement* e);
+
+    // Gets whether the current function has been marked as a creation function
+    // (indicating that the return value is owned by the script runtime and not C++).
+    void getCreateFlag(XMLElement* e, FunctionBinding& b);
+
+    // Gets the name of the binding.
+    string getName(XMLElement* e);
+
+    // Gets whether the type is const or not.
+    bool getIsConstType(XMLElement* e);
+
+    // Gets the parameter or return value, optionally within the scope of the given class.
+    FunctionBinding::Param getParam(XMLElement* e, bool isVariable = false,  string classname = "");
+
+    // Gets all of the parameters for a function.
+    void getParams(XMLElement* e, FunctionBinding& b);
+
+    // Resolves members for all classes' derived from class 'c'.
+    void resolveMembers(const ClassBinding& c);
+
+    // Resolves the inheritance.
+    void resolveInheritance();
+
+    // Resolves includes for all classes' derived from class 'c'.
+    void resolveIncludes(const ClassBinding& c);
+
+    // Resolves inherited include files.
+    void resolveInheritedIncludes();
+
+    // Resolves the type for a single parameter/return value 
+    // (also takes the function that the parameter/return value is for along
+    // with the header file that the parameter/return value belongs to-the original
+    // class header file for class bindings or the global Lua bindings header file
+    // for global bindings).
+    void resolveType(FunctionBinding::Param* param, string functionName, string header);
+
+    // Resolves all unrecognized types.
+    void resolveTypes();
+
+    // Generates the bindings to C++ header and source files.
+    void generateBindings();
+    
+    // Gets the set off all classes that derives from the given class.
+    void getAllDerived(set<string>& derived, string classname);
+
+    // Gets the included files for a cpp file.
+    void getIncludes(XMLElement* e, string filename);
+
+private:
+    static Generator* __instance;
+
+    const char* _file;
+    map<string, string> _refIds;
+    string _outDir;
+    map<string, ClassBinding> _classes;
+    vector<string> _topLevelBaseClasses;
+    map<string, set<string> > _includes;
+    map<string, vector<FunctionBinding> > _functions;
+    map<string, EnumBinding> _enums;
+    map<string, vector<string> > _namespaces;
+    map<string, TypedefBinding> _typedefs;
+};
+
+#endif

+ 16 - 0
gameplay-luagen/src/TypedefBinding.h

@@ -0,0 +1,16 @@
+#ifndef TYPEDEFBINDING_H_
+#define TYPEDEFBINDING_H_
+
+/**
+ * Represents a typedef.
+ * 
+ * Note: the name of the typedef is stored as the key in the 
+ * map containing all typedefs. The refId member is set if
+ * the typedef is a class, struct, or enumerated type.
+ */
+struct TypedefBinding
+{
+    string refId;
+};
+
+#endif

+ 40 - 0
gameplay-luagen/src/main.cpp

@@ -0,0 +1,40 @@
+#include "Base.h"
+#include "Generator.h"
+
+//TRACK_MEMORY();
+
+void printError(const char* format, ...)
+{
+    va_list argptr;
+    va_start(argptr, format);
+#ifdef WIN32
+    int sz = vfprintf(stderr, format, argptr);
+    if (sz > 0)
+    {
+        char* buf = new char[sz + 1];
+        vsprintf(buf, format, argptr);
+        buf[sz] = 0;
+        OutputDebugStringA(buf);
+        SAFE_DELETE_ARRAY(buf);
+    }
+#else
+    vfprintf(stderr, format, argptr);
+#endif
+    va_end(argptr);
+}
+
+int main(int argc, char** argv)
+{
+    // Ensure the user is calling the program correctly.
+    if (argc < 2 || argc > 3)
+    {
+        GP_ERROR("Usage: luagen <input-directory> [output-directory]");
+    }
+
+    // Generate the bindings.
+    Generator::getInstance()->run(argv[1], (argc == 3) ? argv[2] : argv[1]);
+    Generator::releaseInstance();
+
+    system("pause");
+    return 0;
+}

+ 10 - 2
gameplay-template/android/jni/template.Android.mk

@@ -16,6 +16,7 @@
 SAMPLE_PATH := $(call my-dir)/../../src
 LIBPNG_PATH := ../GAMEPLAY_PATH/external-deps/libpng/lib/android/arm
 ZLIB_PATH := ../GAMEPLAY_PATH/external-deps/zlib/lib/android/arm
+LUA_PATH := ../GAMEPLAY_PATH/external-deps/lua/lib/android/arm
 BULLET_PATH := ../GAMEPLAY_PATH/external-deps/bullet/lib/android/arm
 VORBIS_PATH := ../GAMEPLAY_PATH/external-deps/oggvorbis/lib/android/arm
 OPENAL_PATH := ../GAMEPLAY_PATH/external-deps/openal/lib/android/arm
@@ -41,6 +42,13 @@ LOCAL_MODULE    := libzlib
 LOCAL_SRC_FILES := libzlib.a
 include $(PREBUILT_STATIC_LIBRARY)
 
+# liblua
+LOCAL_PATH := $(LUA_PATH)
+include $(CLEAR_VARS)
+LOCAL_MODULE    := liblua
+LOCAL_SRC_FILES := liblua.a
+include $(PREBUILT_STATIC_LIBRARY)
+
 # libbullet
 LOCAL_PATH := $(BULLET_PATH)
 include $(CLEAR_VARS)
@@ -70,9 +78,9 @@ LOCAL_MODULE    := TEMPLATE_PROJECT
 LOCAL_SRC_FILES := ../GAMEPLAY_PATH/gameplay/src/gameplay-main-android.cpp TemplateGame.cpp
 
 LOCAL_LDLIBS    := -llog -landroid -lEGL -lGLESv2 -lOpenSLES
-LOCAL_CFLAGS    := -D__ANDROID__ -I"../GAMEPLAY_PATH/external-deps/bullet/include" -I"../GAMEPLAY_PATH/external-deps/libpng/include" -I"../GAMEPLAY_PATH/external-deps/oggvorbis/include" -I"../GAMEPLAY_PATH/external-deps/openal/include" -I"../GAMEPLAY_PATH/gameplay/src"
+LOCAL_CFLAGS    := -D__ANDROID__ -Wno-psabi -I"../GAMEPLAY_PATH/external-deps/lua/include" -I"../GAMEPLAY_PATH/external-deps/bullet/include" -I"../GAMEPLAY_PATH/external-deps/libpng/include" -I"../GAMEPLAY_PATH/external-deps/oggvorbis/include" -I"../GAMEPLAY_PATH/external-deps/openal/include" -I"../GAMEPLAY_PATH/gameplay/src"
 
-LOCAL_STATIC_LIBRARIES := android_native_app_glue libgameplay libpng libzlib libbullet libvorbis libOpenAL
+LOCAL_STATIC_LIBRARIES := android_native_app_glue libgameplay libpng libzlib liblua libbullet libvorbis libOpenAL
 
 include $(BUILD_SHARED_LIBRARY)
 $(call import-module,android/native_app_glue)

+ 9 - 9
gameplay-template/gameplay-template.vcxproj

@@ -74,15 +74,15 @@
       <WarningLevel>Level3</WarningLevel>
       <Optimization>Disabled</Optimization>
       <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_ITERATOR_DEBUG_LEVEL=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories>GAMEPLAY_PATH/external-deps/bullet/include;GAMEPLAY_PATH/gameplay/src;GAMEPLAY_PATH/external-deps/openal/include/AL;GAMEPLAY_PATH/external-deps/oggvorbis/include;GAMEPLAY_PATH/external-deps/libpng/include;GAMEPLAY_PATH/external-deps/zlib/include;GAMEPLAY_PATH/external-deps/glew/include</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>GAMEPLAY_PATH/external-deps/lua/include;GAMEPLAY_PATH/external-deps/bullet/include;GAMEPLAY_PATH/gameplay/src;GAMEPLAY_PATH/external-deps/openal/include/AL;GAMEPLAY_PATH/external-deps/oggvorbis/include;GAMEPLAY_PATH/external-deps/libpng/include;GAMEPLAY_PATH/external-deps/zlib/include;GAMEPLAY_PATH/external-deps/glew/include</AdditionalIncludeDirectories>
       <RuntimeTypeInfo>true</RuntimeTypeInfo>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
     </ClCompile>
     <Link>
       <SubSystem>Windows</SubSystem>
       <GenerateDebugInformation>true</GenerateDebugInformation>
-      <AdditionalDependencies>OpenAL32.lib;OpenGL32.lib;GLU32.lib;glew32.lib;libpng14.lib;zlib.lib;gameplay.lib;libogg.lib;libvorbis.lib;libvorbisfile.lib;BulletDynamics.lib;BulletCollision.lib;LinearMath.lib;%(AdditionalDependencies)</AdditionalDependencies>
-      <AdditionalLibraryDirectories>GAMEPLAY_PATH/external-deps/bullet/lib/win32;GAMEPLAY_PATH/external-deps/openal/lib/win32;GAMEPLAY_PATH/external-deps/oggvorbis/lib/win32;GAMEPLAY_PATH/external-deps/glew/lib/win32;GAMEPLAY_PATH/external-deps/libpng/lib/win32;GAMEPLAY_PATH/external-deps/zlib/lib/win32;GAMEPLAY_PATH/gameplay/$(Configuration)</AdditionalLibraryDirectories>
+      <AdditionalDependencies>lua.lib;OpenAL32.lib;OpenGL32.lib;GLU32.lib;glew32.lib;libpng14.lib;zlib.lib;gameplay.lib;libogg.lib;libvorbis.lib;libvorbisfile.lib;BulletDynamics.lib;BulletCollision.lib;LinearMath.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalLibraryDirectories>GAMEPLAY_PATH/external-deps/lua/lib/win32;GAMEPLAY_PATH/external-deps/bullet/lib/win32;GAMEPLAY_PATH/external-deps/openal/lib/win32;GAMEPLAY_PATH/external-deps/oggvorbis/lib/win32;GAMEPLAY_PATH/external-deps/glew/lib/win32;GAMEPLAY_PATH/external-deps/libpng/lib/win32;GAMEPLAY_PATH/external-deps/zlib/lib/win32;GAMEPLAY_PATH/gameplay/$(Configuration)</AdditionalLibraryDirectories>
     </Link>
     <PostBuildEvent>
       <Command>
@@ -104,7 +104,7 @@
       <WarningLevel>Level3</WarningLevel>
       <Optimization>Disabled</Optimization>
       <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;GAMEPLAY_MEM_LEAK_DETECTION;_ITERATOR_DEBUG_LEVEL=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories>GAMEPLAY_PATH/external-deps/bullet/include;GAMEPLAY_PATH/gameplay/src;GAMEPLAY_PATH/external-deps/openal/include/AL;GAMEPLAY_PATH/external-deps/oggvorbis/include;GAMEPLAY_PATH/external-deps/libpng/include;GAMEPLAY_PATH/external-deps/zlib/include;GAMEPLAY_PATH/external-deps/glew/include</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>GAMEPLAY_PATH/external-deps/lua/include;GAMEPLAY_PATH/external-deps/bullet/include;GAMEPLAY_PATH/gameplay/src;GAMEPLAY_PATH/external-deps/openal/include/AL;GAMEPLAY_PATH/external-deps/oggvorbis/include;GAMEPLAY_PATH/external-deps/libpng/include;GAMEPLAY_PATH/external-deps/zlib/include;GAMEPLAY_PATH/external-deps/glew/include</AdditionalIncludeDirectories>
       <RuntimeTypeInfo>true</RuntimeTypeInfo>
       <ShowIncludes>false</ShowIncludes>
       <PreprocessToFile>false</PreprocessToFile>
@@ -113,8 +113,8 @@
     <Link>
       <SubSystem>Windows</SubSystem>
       <GenerateDebugInformation>true</GenerateDebugInformation>
-      <AdditionalDependencies>OpenAL32.lib;OpenGL32.lib;GLU32.lib;glew32.lib;libpng14.lib;zlib.lib;gameplay.lib;libogg.lib;libvorbis.lib;libvorbisfile.lib;BulletDynamics.lib;BulletCollision.lib;LinearMath.lib;%(AdditionalDependencies)</AdditionalDependencies>
-      <AdditionalLibraryDirectories>GAMEPLAY_PATH/external-deps/bullet/lib/win32;GAMEPLAY_PATH/external-deps/openal/lib/win32;GAMEPLAY_PATH/external-deps/oggvorbis/lib/win32;GAMEPLAY_PATH/external-deps/glew/lib/win32;GAMEPLAY_PATH/external-deps/libpng/lib/win32;GAMEPLAY_PATH/external-deps/zlib/lib/win32;GAMEPLAY_PATH/gameplay/$(Configuration)</AdditionalLibraryDirectories>
+      <AdditionalDependencies>lua.lib;OpenAL32.lib;OpenGL32.lib;GLU32.lib;glew32.lib;libpng14.lib;zlib.lib;gameplay.lib;libogg.lib;libvorbis.lib;libvorbisfile.lib;BulletDynamics.lib;BulletCollision.lib;LinearMath.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalLibraryDirectories>GAMEPLAY_PATH/external-deps/lua/lib/win32;GAMEPLAY_PATH/external-deps/bullet/lib/win32;GAMEPLAY_PATH/external-deps/openal/lib/win32;GAMEPLAY_PATH/external-deps/oggvorbis/lib/win32;GAMEPLAY_PATH/external-deps/glew/lib/win32;GAMEPLAY_PATH/external-deps/libpng/lib/win32;GAMEPLAY_PATH/external-deps/zlib/lib/win32;GAMEPLAY_PATH/gameplay/$(Configuration)</AdditionalLibraryDirectories>
     </Link>
     <PostBuildEvent>
       <Command>
@@ -138,15 +138,15 @@
       <FunctionLevelLinking>true</FunctionLevelLinking>
       <IntrinsicFunctions>true</IntrinsicFunctions>
       <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_ITERATOR_DEBUG_LEVEL=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories>GAMEPLAY_PATH/external-deps/bullet/include;GAMEPLAY_PATH/gameplay/src;GAMEPLAY_PATH/external-deps/openal/include/AL;GAMEPLAY_PATH/external-deps/oggvorbis/include;GAMEPLAY_PATH/external-deps/libpng/include;GAMEPLAY_PATH/external-deps/zlib/include;GAMEPLAY_PATH/external-deps/glew/include</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>GAMEPLAY_PATH/external-deps/lua/include;GAMEPLAY_PATH/external-deps/bullet/include;GAMEPLAY_PATH/gameplay/src;GAMEPLAY_PATH/external-deps/openal/include/AL;GAMEPLAY_PATH/external-deps/oggvorbis/include;GAMEPLAY_PATH/external-deps/libpng/include;GAMEPLAY_PATH/external-deps/zlib/include;GAMEPLAY_PATH/external-deps/glew/include</AdditionalIncludeDirectories>
     </ClCompile>
     <Link>
       <SubSystem>Windows</SubSystem>
       <GenerateDebugInformation>true</GenerateDebugInformation>
       <EnableCOMDATFolding>true</EnableCOMDATFolding>
       <OptimizeReferences>true</OptimizeReferences>
-      <AdditionalDependencies>OpenAL32.lib;OpenGL32.lib;GLU32.lib;glew32.lib;libpng14.lib;zlib.lib;gameplay.lib;BulletDynamics.lib;BulletCollision.lib;LinearMath.lib;libogg.lib;libvorbis.lib;libvorbisfile.lib;%(AdditionalDependencies)</AdditionalDependencies>
-      <AdditionalLibraryDirectories>GAMEPLAY_PATH/external-deps/bullet/lib/win32;GAMEPLAY_PATH/external-deps/openal/lib/win32;GAMEPLAY_PATH/external-deps/oggvorbis/lib/win32;GAMEPLAY_PATH/external-deps/glew/lib/win32;GAMEPLAY_PATH/external-deps/libpng/lib/win32;GAMEPLAY_PATH/external-deps/zlib/lib/win32;GAMEPLAY_PATH/gameplay/$(Configuration)</AdditionalLibraryDirectories>
+      <AdditionalDependencies>lua.lib;OpenAL32.lib;OpenGL32.lib;GLU32.lib;glew32.lib;libpng14.lib;zlib.lib;gameplay.lib;BulletDynamics.lib;BulletCollision.lib;LinearMath.lib;libogg.lib;libvorbis.lib;libvorbisfile.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalLibraryDirectories>GAMEPLAY_PATH/external-deps/lua/lib/win32;GAMEPLAY_PATH/external-deps/bullet/lib/win32;GAMEPLAY_PATH/external-deps/openal/lib/win32;GAMEPLAY_PATH/external-deps/oggvorbis/lib/win32;GAMEPLAY_PATH/external-deps/glew/lib/win32;GAMEPLAY_PATH/external-deps/libpng/lib/win32;GAMEPLAY_PATH/external-deps/zlib/lib/win32;GAMEPLAY_PATH/gameplay/$(Configuration)</AdditionalLibraryDirectories>
     </Link>
     <PostBuildEvent>
       <Command>

+ 50 - 8
gameplay-template/template.cproject

@@ -30,10 +30,14 @@
 								</option>
 								<option id="com.qnx.qcc.option.compiler.includePath.1368017357" name="Include Directories (-I)" superClass="com.qnx.qcc.option.compiler.includePath" valueType="includePath">
 									<listOptionValue builtIn="false" value="${QNX_TARGET}/../target-override/usr/include"/>
+                                    <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}/GAMEPLAY_PATH/external-deps/lua/include&quot;"/>
 									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}/GAMEPLAY_PATH/external-deps/bullet/include&quot;"/>
 									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}/GAMEPLAY_PATH/external-deps/oggvorbis/include&quot;"/>
 									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}/GAMEPLAY_PATH/gameplay/src&quot;"/>
 								</option>
+								<option id="com.qnx.qcc.option.compiler.qccoptions.552975054" name="QCC Options" superClass="com.qnx.qcc.option.compiler.qccoptions" valueType="stringList">
+									<listOptionValue builtIn="false" value="-Wno-psabi"/>
+								</option
 								<inputType id="com.qnx.qcc.inputType.compiler.220599794" superClass="com.qnx.qcc.inputType.compiler"/>
 							</tool>
 							<tool id="com.qnx.qcc.tool.assembler.553483674" name="QCC Assembler" superClass="com.qnx.qcc.tool.assembler">
@@ -51,6 +55,7 @@
 									<listOptionValue builtIn="false" value="${QNX_TARGET}/../target-override/armle-v7/lib"/>
 									<listOptionValue builtIn="false" value="${QNX_TARGET}/../target-override/armle-v7/usr/lib"/>
 									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}/GAMEPLAY_PATH/gameplay/${ConfigName}&quot;"/>
+                                    <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}/GAMEPLAY_PATH/external-deps/lua/lib/qnx/arm&quot;"/>
 									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}/GAMEPLAY_PATH/external-deps/bullet/lib/qnx/arm&quot;"/>
 									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}/GAMEPLAY_PATH/external-deps/oggvorbis/lib/qnx/arm&quot;"/>
 								</option>
@@ -65,6 +70,7 @@
 									<listOptionValue builtIn="false" value="OpenAL"/>
 									<listOptionValue builtIn="false" value="asound"/>
 									<listOptionValue builtIn="false" value="gameplay"/>
+                                    <listOptionValue builtIn="false" value="lua"/>
 									<listOptionValue builtIn="false" value="bullet"/>
 									<listOptionValue builtIn="false" value="vorbis"/>
 								</option>
@@ -110,10 +116,14 @@
 								</option>
 								<option id="com.qnx.qcc.option.compiler.includePath.1438345058" name="Include Directories (-I)" superClass="com.qnx.qcc.option.compiler.includePath" valueType="includePath">
 									<listOptionValue builtIn="false" value="${QNX_TARGET}/../target-override/usr/include"/>
+                                    <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}/GAMEPLAY_PATH/external-deps/lua/include&quot;"/>
 									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}/GAMEPLAY_PATH/external-deps/bullet/include&quot;"/>
 									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}/GAMEPLAY_PATH/external-deps/oggvorbis/include&quot;"/>
 									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}/GAMEPLAY_PATH/gameplay/src&quot;"/>
 								</option>
+								<option id="com.qnx.qcc.option.compiler.qccoptions.552975054" name="QCC Options" superClass="com.qnx.qcc.option.compiler.qccoptions" valueType="stringList">
+									<listOptionValue builtIn="false" value="-Wno-psabi"/>
+								</option
 								<inputType id="com.qnx.qcc.inputType.compiler.145250449" superClass="com.qnx.qcc.inputType.compiler"/>
 							</tool>
 							<tool id="com.qnx.qcc.tool.assembler.2006281313" name="QCC Assembler" superClass="com.qnx.qcc.tool.assembler">
@@ -129,6 +139,7 @@
 									<listOptionValue builtIn="false" value="${QNX_TARGET}/../target-override/armle-v7/lib"/>
 									<listOptionValue builtIn="false" value="${QNX_TARGET}/../target-override/armle-v7/usr/lib"/>
 									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}/GAMEPLAY_PATH/gameplay/${ConfigName}&quot;"/>
+                                    <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}/GAMEPLAY_PATH/external-deps/lua/lib/qnx/arm&quot;"/>
 									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}/GAMEPLAY_PATH/external-deps/bullet/lib/qnx/arm&quot;"/>
 									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}/GAMEPLAY_PATH/external-deps/oggvorbis/lib/qnx/arm&quot;"/>
 								</option>
@@ -143,6 +154,7 @@
 									<listOptionValue builtIn="false" value="OpenAL"/>
 									<listOptionValue builtIn="false" value="asound"/>
 									<listOptionValue builtIn="false" value="gameplay"/>
+                                    <listOptionValue builtIn="false" value="lua"/>
 									<listOptionValue builtIn="false" value="bullet"/>
 									<listOptionValue builtIn="false" value="vorbis"/>
 								</option>
@@ -189,10 +201,14 @@
 								</option>
 								<option id="com.qnx.qcc.option.compiler.includePath.2039847498" name="Include Directories (-I)" superClass="com.qnx.qcc.option.compiler.includePath" valueType="includePath">
 									<listOptionValue builtIn="false" value="${QNX_TARGET}/../target-override/usr/include"/>
+                                    <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}/GAMEPLAY_PATH/external-deps/lua/include&quot;"/>
 									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}/GAMEPLAY_PATH/external-deps/bullet/include&quot;"/>
 									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}/GAMEPLAY_PATH/external-deps/oggvorbis/include&quot;"/>
 									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}/GAMEPLAY_PATH/gameplay/src&quot;"/>
 								</option>
+								<option id="com.qnx.qcc.option.compiler.qccoptions.552975054" name="QCC Options" superClass="com.qnx.qcc.option.compiler.qccoptions" valueType="stringList">
+									<listOptionValue builtIn="false" value="-Wno-psabi"/>
+								</option
 								<inputType id="com.qnx.qcc.inputType.compiler.1151876862" superClass="com.qnx.qcc.inputType.compiler"/>
 							</tool>
 							<tool id="com.qnx.qcc.tool.assembler.502016742" name="QCC Assembler" superClass="com.qnx.qcc.tool.assembler">
@@ -210,6 +226,7 @@
 									<listOptionValue builtIn="false" value="${QNX_TARGET}/../target-override/armle-v7/lib"/>
 									<listOptionValue builtIn="false" value="${QNX_TARGET}/../target-override/armle-v7/usr/lib"/>
 									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}/GAMEPLAY_PATH/gameplay/${ConfigName}&quot;"/>
+                                    <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}/GAMEPLAY_PATH/external-deps/lua/lib/qnx/arm&quot;"/>
 									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}/GAMEPLAY_PATH/external-deps/bullet/lib/qnx/arm&quot;"/>
 									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}/GAMEPLAY_PATH/external-deps/oggvorbis/lib/qnx/arm&quot;"/>
 								</option>
@@ -224,6 +241,7 @@
 									<listOptionValue builtIn="false" value="OpenAL"/>
 									<listOptionValue builtIn="false" value="asound"/>
 									<listOptionValue builtIn="false" value="gameplay"/>
+                                    <listOptionValue builtIn="false" value="lua"/>
 									<listOptionValue builtIn="false" value="bullet"/>
 									<listOptionValue builtIn="false" value="vorbis"/>
 								</option>
@@ -270,10 +288,14 @@
 								</option>
 								<option id="com.qnx.qcc.option.compiler.includePath.197126708" name="Include Directories (-I)" superClass="com.qnx.qcc.option.compiler.includePath" valueType="includePath">
 									<listOptionValue builtIn="false" value="${QNX_TARGET}/../target-override/usr/include"/>
+                                    <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}/GAMEPLAY_PATH/external-deps/lua/include&quot;"/>
 									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}/GAMEPLAY_PATH/external-deps/bullet/include&quot;"/>
 									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}/GAMEPLAY_PATH/external-deps/oggvorbis/include&quot;"/>
 									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}/GAMEPLAY_PATH/gameplay/src&quot;"/>
 								</option>
+								<option id="com.qnx.qcc.option.compiler.qccoptions.552975054" name="QCC Options" superClass="com.qnx.qcc.option.compiler.qccoptions" valueType="stringList">
+									<listOptionValue builtIn="false" value="-Wno-psabi"/>
+								</option
 								<inputType id="com.qnx.qcc.inputType.compiler.383272251" superClass="com.qnx.qcc.inputType.compiler"/>
 							</tool>
 							<tool id="com.qnx.qcc.tool.assembler.1630912693" name="QCC Assembler" superClass="com.qnx.qcc.tool.assembler">
@@ -292,6 +314,7 @@
 									<listOptionValue builtIn="false" value="${QNX_TARGET}/../target-override/armle-v7/lib"/>
 									<listOptionValue builtIn="false" value="${QNX_TARGET}/../target-override/armle-v7/usr/lib"/>
 									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}/GAMEPLAY_PATH/gameplay/${ConfigName}&quot;"/>
+                                    <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}/GAMEPLAY_PATH/external-deps/lua/lib/qnx/arm&quot;"/>
 									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}/GAMEPLAY_PATH/external-deps/bullet/lib/qnx/arm&quot;"/>
 									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}/GAMEPLAY_PATH/external-deps/oggvorbis/lib/qnx/arm&quot;"/>
 								</option>
@@ -306,6 +329,7 @@
 									<listOptionValue builtIn="false" value="OpenAL"/>
 									<listOptionValue builtIn="false" value="asound"/>
 									<listOptionValue builtIn="false" value="gameplay"/>
+                                    <listOptionValue builtIn="false" value="lua"/>
 									<listOptionValue builtIn="false" value="bullet"/>
 									<listOptionValue builtIn="false" value="vorbis"/>
 								</option>
@@ -350,10 +374,14 @@
 								</option>
 								<option id="com.qnx.qcc.option.compiler.includePath.456477750" name="Include Directories (-I)" superClass="com.qnx.qcc.option.compiler.includePath" valueType="includePath">
 									<listOptionValue builtIn="false" value="${QNX_TARGET}/../target-override/usr/include"/>
+                                    <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}/GAMEPLAY_PATH/external-deps/lua/include&quot;"/>
 									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}/GAMEPLAY_PATH/external-deps/bullet/include&quot;"/>
 									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}/GAMEPLAY_PATH/external-deps/oggvorbis/include&quot;"/>
 									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}/GAMEPLAY_PATH/gameplay/src&quot;"/>
 								</option>
+								<option id="com.qnx.qcc.option.compiler.qccoptions.552975054" name="QCC Options" superClass="com.qnx.qcc.option.compiler.qccoptions" valueType="stringList">
+									<listOptionValue builtIn="false" value="-Wno-psabi"/>
+								</option
 								<inputType id="com.qnx.qcc.inputType.compiler.2030100054" superClass="com.qnx.qcc.inputType.compiler"/>
 							</tool>
 							<tool id="com.qnx.qcc.tool.assembler.1374999439" name="QCC Assembler" superClass="com.qnx.qcc.tool.assembler">
@@ -371,6 +399,7 @@
 									<listOptionValue builtIn="false" value="${QNX_TARGET}/../target-override/x86/lib"/>
 									<listOptionValue builtIn="false" value="${QNX_TARGET}/../target-override/x86/usr/lib"/>
 									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}/GAMEPLAY_PATH/gameplay/${ConfigName}&quot;"/>
+                                    <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}/GAMEPLAY_PATH/external-deps/lua/lib/qnx/x86&quot;"/>
 									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}/GAMEPLAY_PATH/external-deps/bullet/lib/qnx/x86&quot;"/>
 									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}/GAMEPLAY_PATH/external-deps/oggvorbis/lib/qnx/x86&quot;"/>
 								</option>
@@ -385,6 +414,7 @@
 									<listOptionValue builtIn="false" value="OpenAL"/>
 									<listOptionValue builtIn="false" value="asound"/>
 									<listOptionValue builtIn="false" value="gameplay"/>
+                                    <listOptionValue builtIn="false" value="lua"/>
 									<listOptionValue builtIn="false" value="bullet"/>
 									<listOptionValue builtIn="false" value="vorbis"/>
 								</option>
@@ -430,10 +460,14 @@
 								</option>
 								<option id="com.qnx.qcc.option.compiler.includePath.923690234" name="Include Directories (-I)" superClass="com.qnx.qcc.option.compiler.includePath" valueType="includePath">
 									<listOptionValue builtIn="false" value="${QNX_TARGET}/../target-override/usr/include"/>
+                                    <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}/GAMEPLAY_PATH/external-deps/lua/include&quot;"/>
 									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}/GAMEPLAY_PATH/external-deps/bullet/include&quot;"/>
 									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}/GAMEPLAY_PATH/external-deps/oggvorbis/include&quot;"/>
 									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}/GAMEPLAY_PATH/gameplay/src&quot;"/>
 								</option>
+								<option id="com.qnx.qcc.option.compiler.qccoptions.552975054" name="QCC Options" superClass="com.qnx.qcc.option.compiler.qccoptions" valueType="stringList">
+									<listOptionValue builtIn="false" value="-Wno-psabi"/>
+								</option
 								<inputType id="com.qnx.qcc.inputType.compiler.1329574373" superClass="com.qnx.qcc.inputType.compiler"/>
 							</tool>
 							<tool id="com.qnx.qcc.tool.assembler.1843174104" name="QCC Assembler" superClass="com.qnx.qcc.tool.assembler">
@@ -449,11 +483,12 @@
 								<option id="com.qnx.qcc.option.linker.langcpp.634706544" name="C++ (-lang-c++)" superClass="com.qnx.qcc.option.linker.langcpp" value="true" valueType="boolean"/>
 								<option id="com.qnx.qcc.option.linker.security.1149202874" name="Enhanced Security (-Wl,-z,relro -Wl,-z,now)" superClass="com.qnx.qcc.option.linker.security" value="true" valueType="boolean"/>
 								<option id="com.qnx.qcc.option.linker.libraryPaths.836471121" name="Library Paths (-L)" superClass="com.qnx.qcc.option.linker.libraryPaths" valueType="libPaths">
-									<listOptionValue builtIn="false" value="${QNX_TARGET}/../target-override/armle-v7/lib"/>
-									<listOptionValue builtIn="false" value="${QNX_TARGET}/../target-override/armle-v7/usr/lib"/>
+									<listOptionValue builtIn="false" value="${QNX_TARGET}/../target-override/x86/lib"/>
+									<listOptionValue builtIn="false" value="${QNX_TARGET}/../target-override/x86/usr/lib"/>
 									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}/GAMEPLAY_PATH/gameplay/${ConfigName}&quot;"/>
-									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}/GAMEPLAY_PATH/external-deps/bullet/lib/qnx/arm&quot;"/>
-									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}/GAMEPLAY_PATH/external-deps/oggvorbis/lib/qnx/arm&quot;"/>
+                                    <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}/GAMEPLAY_PATH/external-deps/lua/lib/qnx/x86&quot;"/>
+									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}/GAMEPLAY_PATH/external-deps/bullet/lib/qnx/x86&quot;"/>
+									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}/GAMEPLAY_PATH/external-deps/oggvorbis/lib/qnx/x86&quot;"/>
 								</option>
 								<option id="com.qnx.qcc.option.linker.libraries.1203875316" name="Libraries (-l)" superClass="com.qnx.qcc.option.linker.libraries" valueType="libs">
 									<listOptionValue builtIn="false" value="GLESv2"/>
@@ -466,6 +501,7 @@
 									<listOptionValue builtIn="false" value="OpenAL"/>
 									<listOptionValue builtIn="false" value="asound"/>
 									<listOptionValue builtIn="false" value="gameplay"/>
+                                    <listOptionValue builtIn="false" value="lua"/>
 									<listOptionValue builtIn="false" value="bullet"/>
 									<listOptionValue builtIn="false" value="vorbis"/>
 								</option>
@@ -511,10 +547,14 @@
 								</option>
 								<option id="com.qnx.qcc.option.compiler.includePath.1486948386" name="Include Directories (-I)" superClass="com.qnx.qcc.option.compiler.includePath" valueType="includePath">
 									<listOptionValue builtIn="false" value="${QNX_TARGET}/../target-override/usr/include"/>
+                                    <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}/GAMEPLAY_PATH/external-deps/lua/include&quot;"/>
 									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}/GAMEPLAY_PATH/external-deps/bullet/include&quot;"/>
 									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}/GAMEPLAY_PATH/external-deps/oggvorbis/include&quot;"/>
 									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}/GAMEPLAY_PATH/gameplay/src&quot;"/>
 								</option>
+								<option id="com.qnx.qcc.option.compiler.qccoptions.552975054" name="QCC Options" superClass="com.qnx.qcc.option.compiler.qccoptions" valueType="stringList">
+									<listOptionValue builtIn="false" value="-Wno-psabi"/>
+								</option
 								<inputType id="com.qnx.qcc.inputType.compiler.1418704610" superClass="com.qnx.qcc.inputType.compiler"/>
 							</tool>
 							<tool id="com.qnx.qcc.tool.assembler.785476179" name="QCC Assembler" superClass="com.qnx.qcc.tool.assembler">
@@ -530,11 +570,12 @@
 								<option id="com.qnx.qcc.option.linker.langcpp.1437332425" name="C++ (-lang-c++)" superClass="com.qnx.qcc.option.linker.langcpp" value="true" valueType="boolean"/>
 								<option id="com.qnx.qcc.option.linker.security.1625644976" name="Enhanced Security (-Wl,-z,relro -Wl,-z,now)" superClass="com.qnx.qcc.option.linker.security" value="true" valueType="boolean"/>
 								<option id="com.qnx.qcc.option.linker.libraryPaths.1870486762" name="Library Paths (-L)" superClass="com.qnx.qcc.option.linker.libraryPaths" valueType="libPaths">
-									<listOptionValue builtIn="false" value="${QNX_TARGET}/../target-override/armle-v7/lib"/>
-									<listOptionValue builtIn="false" value="${QNX_TARGET}/../target-override/armle-v7/usr/lib"/>
+									<listOptionValue builtIn="false" value="${QNX_TARGET}/../target-override/x86/lib"/>
+									<listOptionValue builtIn="false" value="${QNX_TARGET}/../target-override/x86/usr/lib"/>
 									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}/GAMEPLAY_PATH/gameplay/${ConfigName}&quot;"/>
-									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}/GAMEPLAY_PATH/external-deps/bullet/lib/qnx/arm&quot;"/>
-									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}/GAMEPLAY_PATH/external-deps/oggvorbis/lib/qnx/arm&quot;"/>
+                                    <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}/GAMEPLAY_PATH/external-deps/lua/lib/qnx/x86&quot;"/>
+									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}/GAMEPLAY_PATH/external-deps/bullet/lib/qnx/x86&quot;"/>
+									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}/GAMEPLAY_PATH/external-deps/oggvorbis/lib/qnx/x86&quot;"/>
 								</option>
 								<option id="com.qnx.qcc.option.linker.libraries.2055007034" name="Libraries (-l)" superClass="com.qnx.qcc.option.linker.libraries" valueType="libs">
 									<listOptionValue builtIn="false" value="GLESv2"/>
@@ -547,6 +588,7 @@
 									<listOptionValue builtIn="false" value="OpenAL"/>
 									<listOptionValue builtIn="false" value="asound"/>
 									<listOptionValue builtIn="false" value="gameplay"/>
+                                    <listOptionValue builtIn="false" value="lua"/>
 									<listOptionValue builtIn="false" value="bullet"/>
 									<listOptionValue builtIn="false" value="vorbis"/>
 								</option>

+ 17 - 25
gameplay.doxyfile

@@ -1,4 +1,4 @@
-# Doxyfile 1.8.0
+# Doxyfile 1.8.1
 
 # This file describes the settings to be used by the documentation system
 # doxygen (www.doxygen.org) for a project
@@ -194,7 +194,7 @@ SEPARATE_MEMBER_PAGES  = NO
 # The TAB_SIZE tag can be used to set the number of spaces in a tab. 
 # Doxygen uses this value to replace tabs by spaces in code fragments.
 
-TAB_SIZE               = 8
+TAB_SIZE               = 4
 
 # This tag can be used to specify a number of aliases that acts 
 # as commands in the documentation. An alias has the form "name=value". 
@@ -203,7 +203,7 @@ TAB_SIZE               = 8
 # will result in a user-defined paragraph with heading "Side Effects:". 
 # You can put \n's in the value part of an alias to insert newlines.
 
-ALIASES                = 
+ALIASES                = "script{1} = \xmlonly <xmlonly>\1</xmlonly> \endxmlonly"
 
 # This tag can be used to specify a number of word-keyword mappings (TCL only). 
 # A mapping has the form "name=value". For example adding 
@@ -564,12 +564,6 @@ MAX_INITIALIZER_LINES  = 30
 
 SHOW_USED_FILES        = NO
 
-# If the sources in your project are distributed over multiple directories 
-# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy 
-# in the documentation. The default is NO.
-
-SHOW_DIRECTORIES       = NO
-
 # Set the SHOW_FILES tag to NO to disable the generation of the Files page. 
 # This will remove the Files entry from the Quick Index and from the 
 # Folder Tree View (if specified). The default is YES.
@@ -954,20 +948,23 @@ HTML_COLORSTYLE_GAMMA  = 80
 
 HTML_TIMESTAMP         = YES
 
-# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, 
-# files or namespaces will be aligned in HTML using tables. If set to 
-# NO a bullet list will be used.
-
-HTML_ALIGN_MEMBERS     = YES
-
 # If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML 
 # documentation will contain sections that can be hidden and shown after the 
-# page has loaded. For this to work a browser that supports 
-# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox 
-# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari).
+# page has loaded.
 
 HTML_DYNAMIC_SECTIONS  = NO
 
+# With HTML_INDEX_NUM_ENTRIES one can control the preferred number of 
+# entries shown in the various tree structured indices initially; the user 
+# can expand and collapse entries dynamically later on. Doxygen will expand 
+# the tree to such a level that at most the specified number of entries are 
+# visible (unless a fully collapsed tree already exceeds this amount). 
+# So setting the number of entries 1 will produce a full collapsed tree by 
+# default. 0 is a special value representing an infinite number of entries 
+# and will result in a full expanded tree by default.
+
+HTML_INDEX_NUM_ENTRIES = 100
+
 # If the GENERATE_DOCSET tag is set to YES, additional index files 
 # will be generated that can be used as input for Apple's Xcode 3 
 # integrated development environment, introduced with OSX 10.5 (Leopard). 
@@ -1146,11 +1143,6 @@ GENERATE_TREEVIEW      = NO
 
 ENUM_VALUES_PER_LINE   = 4
 
-# By enabling USE_INLINE_TREES, doxygen will generate the Groups, Directories, 
-# and Class Hierarchy pages using a tree view instead of an ordered list.
-
-USE_INLINE_TREES       = NO
-
 # If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be 
 # used to set the initial width (in pixels) of the frame in which the tree 
 # is shown.
@@ -1425,7 +1417,7 @@ XML_DTD                =
 # and cross-referencing information) to the XML output. Note that 
 # enabling this will significantly increase the size of the XML output.
 
-XML_PROGRAMLISTING     = YES
+XML_PROGRAMLISTING     = NO
 
 #---------------------------------------------------------------------------
 # configuration options for the AutoGen Definitions output
@@ -1713,7 +1705,7 @@ CALLER_GRAPH           = NO
 
 GRAPHICAL_HIERARCHY    = YES
 
-# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES 
+# If the DIRECTORY_GRAPH and HAVE_DOT tags are set to YES 
 # then doxygen will show the dependencies a directory has on other directories 
 # in a graphical way. The dependency relations are determined by the #include 
 # relations between the files in the directories.

+ 3 - 0
gameplay.xcworkspace/contents.xcworkspacedata

@@ -19,4 +19,7 @@
    <FileRef
       location = "group:gameplay-samples/sample04-particles/sample04-particles.xcodeproj">
    </FileRef>
+   <FileRef
+      location = "group:gameplay-samples/sample05-lua/sample05-lua.xcodeproj">
+   </FileRef>
 </Workspace>

+ 38 - 4
gameplay/.cproject

@@ -25,11 +25,15 @@
 									<listOptionValue builtIn="false" value="_FORTIFY_SOURCE=2"/>
 								</option>
 								<option id="com.qnx.qcc.option.compiler.includePath.2133604142" name="Include Directories (-I)" superClass="com.qnx.qcc.option.compiler.includePath" valueType="includePath">
+									<listOptionValue builtIn="false" value="&quot;../../external-deps/lua/include&quot;"/>
+									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/src}&quot;"/>
 									<listOptionValue builtIn="false" value="&quot;../../external-deps/bullet/include&quot;"/>
 									<listOptionValue builtIn="false" value="&quot;../../external-deps/oggvorbis/include&quot;"/>
 									<listOptionValue builtIn="false" value="${QNX_TARGET}/../target-override/usr/include"/>
 								</option>
-								<option id="com.qnx.qcc.option.compiler.qccoptions.1968057343" name="QCC Options" superClass="com.qnx.qcc.option.compiler.qccoptions"/>
+								<option id="com.qnx.qcc.option.compiler.qccoptions.1968057343" name="QCC Options" superClass="com.qnx.qcc.option.compiler.qccoptions" valueType="stringList">
+									<listOptionValue builtIn="false" value="-Wno-psabi"/>
+								</option>
 								<option id="com.qnx.qcc.option.compiler.ccoptions.1078137668" name="Compiler Options (-Wc,)" superClass="com.qnx.qcc.option.compiler.ccoptions" valueType="stringList">
 									<listOptionValue builtIn="false" value="-mfpu=neon"/>
 								</option>
@@ -83,12 +87,17 @@
 								</option>
 								<option id="com.qnx.qcc.option.compiler.includePath.1670164593" name="Include Directories (-I)" superClass="com.qnx.qcc.option.compiler.includePath" valueType="includePath">
 									<listOptionValue builtIn="false" value="&quot;../../external-deps/bullet/include&quot;"/>
+									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/src}&quot;"/>
+									<listOptionValue builtIn="false" value="&quot;../../external-deps/lua/include&quot;"/>
 									<listOptionValue builtIn="false" value="&quot;../../external-deps/oggvorbis/include&quot;"/>
 									<listOptionValue builtIn="false" value="${QNX_TARGET}/../target-override/usr/include"/>
 								</option>
 								<option id="com.qnx.qcc.option.compiler.ccoptions.1122311163" name="Compiler Options (-Wc,)" superClass="com.qnx.qcc.option.compiler.ccoptions" valueType="stringList">
 									<listOptionValue builtIn="false" value="-mfpu=neon"/>
 								</option>
+								<option id="com.qnx.qcc.option.compiler.qccoptions.1770609643" superClass="com.qnx.qcc.option.compiler.qccoptions" valueType="stringList">
+									<listOptionValue builtIn="false" value="-Wno-psabi"/>
+								</option>
 								<inputType id="com.qnx.qcc.inputType.compiler.1380846613" superClass="com.qnx.qcc.inputType.compiler"/>
 							</tool>
 							<tool id="com.qnx.qcc.tool.assembler.855139060" name="QCC Assembler" superClass="com.qnx.qcc.tool.assembler">
@@ -138,12 +147,17 @@
 								</option>
 								<option id="com.qnx.qcc.option.compiler.includePath.1503059677" name="Include Directories (-I)" superClass="com.qnx.qcc.option.compiler.includePath" valueType="includePath">
 									<listOptionValue builtIn="false" value="&quot;../../external-deps/bullet/include&quot;"/>
+									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/src}&quot;"/>
+									<listOptionValue builtIn="false" value="&quot;../../external-deps/lua/include&quot;"/>
 									<listOptionValue builtIn="false" value="&quot;../../external-deps/oggvorbis/include&quot;"/>
 									<listOptionValue builtIn="false" value="${QNX_TARGET}/../target-override/usr/include"/>
 								</option>
 								<option id="com.qnx.qcc.option.compiler.ccoptions.1956270067" name="Compiler Options (-Wc,)" superClass="com.qnx.qcc.option.compiler.ccoptions" valueType="stringList">
 									<listOptionValue builtIn="false" value="-mfpu=neon"/>
 								</option>
+								<option id="com.qnx.qcc.option.compiler.qccoptions.1366354884" superClass="com.qnx.qcc.option.compiler.qccoptions" valueType="stringList">
+									<listOptionValue builtIn="false" value="-Wno-psabi"/>
+								</option>
 								<inputType id="com.qnx.qcc.inputType.compiler.81809638" superClass="com.qnx.qcc.inputType.compiler"/>
 							</tool>
 							<tool id="com.qnx.qcc.tool.assembler.2145279747" name="QCC Assembler" superClass="com.qnx.qcc.tool.assembler">
@@ -196,12 +210,17 @@
 								</option>
 								<option id="com.qnx.qcc.option.compiler.includePath.1769677874" name="Include Directories (-I)" superClass="com.qnx.qcc.option.compiler.includePath" valueType="includePath">
 									<listOptionValue builtIn="false" value="&quot;../../external-deps/bullet/include&quot;"/>
+									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/src}&quot;"/>
+									<listOptionValue builtIn="false" value="&quot;../../external-deps/lua/include&quot;"/>
 									<listOptionValue builtIn="false" value="&quot;../../external-deps/oggvorbis/include&quot;"/>
 									<listOptionValue builtIn="false" value="${QNX_TARGET}/../target-override/usr/include"/>
 								</option>
 								<option id="com.qnx.qcc.option.compiler.ccoptions.47607907" name="Compiler Options (-Wc,)" superClass="com.qnx.qcc.option.compiler.ccoptions" valueType="stringList">
 									<listOptionValue builtIn="false" value="-mfpu=neon"/>
 								</option>
+								<option id="com.qnx.qcc.option.compiler.qccoptions.146547607" superClass="com.qnx.qcc.option.compiler.qccoptions" valueType="stringList">
+									<listOptionValue builtIn="false" value="-Wno-psabi"/>
+								</option>
 								<inputType id="com.qnx.qcc.inputType.compiler.2007171407" superClass="com.qnx.qcc.inputType.compiler"/>
 							</tool>
 							<tool id="com.qnx.qcc.tool.assembler.1537562121" name="QCC Assembler" superClass="com.qnx.qcc.tool.assembler">
@@ -252,10 +271,15 @@
 								</option>
 								<option id="com.qnx.qcc.option.compiler.includePath.847642559" name="Include Directories (-I)" superClass="com.qnx.qcc.option.compiler.includePath" valueType="includePath">
 									<listOptionValue builtIn="false" value="&quot;../../external-deps/bullet/include&quot;"/>
+									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/src}&quot;"/>
+									<listOptionValue builtIn="false" value="&quot;../../external-deps/lua/include&quot;"/>
 									<listOptionValue builtIn="false" value="&quot;../../external-deps/oggvorbis/include&quot;"/>
 									<listOptionValue builtIn="false" value="${QNX_TARGET}/../target-override/usr/include"/>
 								</option>
-								<option id="com.qnx.qcc.option.compiler.ccoptions.1432778691" name="Compiler Options (-Wc,)" superClass="com.qnx.qcc.option.compiler.ccoptions" valueType="stringList"/>
+								<option id="com.qnx.qcc.option.compiler.ccoptions.1432778691" name="Compiler Options (-Wc,)" superClass="com.qnx.qcc.option.compiler.ccoptions"/>
+								<option id="com.qnx.qcc.option.compiler.qccoptions.245518255" superClass="com.qnx.qcc.option.compiler.qccoptions" valueType="stringList">
+									<listOptionValue builtIn="false" value="-Wno-psabi"/>
+								</option>
 								<inputType id="com.qnx.qcc.inputType.compiler.1038720310" superClass="com.qnx.qcc.inputType.compiler"/>
 							</tool>
 							<tool id="com.qnx.qcc.tool.assembler.521146732" name="QCC Assembler" superClass="com.qnx.qcc.tool.assembler">
@@ -306,10 +330,15 @@
 								</option>
 								<option id="com.qnx.qcc.option.compiler.includePath.513622172" name="Include Directories (-I)" superClass="com.qnx.qcc.option.compiler.includePath" valueType="includePath">
 									<listOptionValue builtIn="false" value="&quot;../../external-deps/bullet/include&quot;"/>
+									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/src}&quot;"/>
+									<listOptionValue builtIn="false" value="&quot;../../external-deps/lua/include&quot;"/>
 									<listOptionValue builtIn="false" value="&quot;../../external-deps/oggvorbis/include&quot;"/>
 									<listOptionValue builtIn="false" value="${QNX_TARGET}/../target-override/usr/include"/>
 								</option>
-								<option id="com.qnx.qcc.option.compiler.ccoptions.663337616" name="Compiler Options (-Wc,)" superClass="com.qnx.qcc.option.compiler.ccoptions" valueType="stringList"/>
+								<option id="com.qnx.qcc.option.compiler.ccoptions.663337616" name="Compiler Options (-Wc,)" superClass="com.qnx.qcc.option.compiler.ccoptions"/>
+								<option id="com.qnx.qcc.option.compiler.qccoptions.288926109" superClass="com.qnx.qcc.option.compiler.qccoptions" valueType="stringList">
+									<listOptionValue builtIn="false" value="-Wno-psabi"/>
+								</option>
 								<inputType id="com.qnx.qcc.inputType.compiler.1961855927" superClass="com.qnx.qcc.inputType.compiler"/>
 							</tool>
 							<tool id="com.qnx.qcc.tool.assembler.1089440729" name="QCC Assembler" superClass="com.qnx.qcc.tool.assembler">
@@ -361,10 +390,15 @@
 								</option>
 								<option id="com.qnx.qcc.option.compiler.includePath.1685994750" name="Include Directories (-I)" superClass="com.qnx.qcc.option.compiler.includePath" valueType="includePath">
 									<listOptionValue builtIn="false" value="&quot;../../external-deps/bullet/include&quot;"/>
+									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/src}&quot;"/>
+									<listOptionValue builtIn="false" value="&quot;../../external-deps/lua/include&quot;"/>
 									<listOptionValue builtIn="false" value="&quot;../../external-deps/oggvorbis/include&quot;"/>
 									<listOptionValue builtIn="false" value="${QNX_TARGET}/../target-override/usr/include"/>
 								</option>
-								<option id="com.qnx.qcc.option.compiler.ccoptions.346770186" name="Compiler Options (-Wc,)" superClass="com.qnx.qcc.option.compiler.ccoptions" valueType="stringList"/>
+								<option id="com.qnx.qcc.option.compiler.ccoptions.346770186" name="Compiler Options (-Wc,)" superClass="com.qnx.qcc.option.compiler.ccoptions"/>
+								<option id="com.qnx.qcc.option.compiler.qccoptions.1085566269" superClass="com.qnx.qcc.option.compiler.qccoptions" valueType="stringList">
+									<listOptionValue builtIn="false" value="-Wno-psabi"/>
+								</option>
 								<inputType id="com.qnx.qcc.inputType.compiler.1658185881" superClass="com.qnx.qcc.inputType.compiler"/>
 							</tool>
 							<tool id="com.qnx.qcc.tool.assembler.746786008" name="QCC Assembler" superClass="com.qnx.qcc.tool.assembler">

+ 243 - 2
gameplay/android/jni/Android.mk

@@ -16,8 +16,249 @@ LOCAL_PATH := $(call my-dir)/../../src
 
 include $(CLEAR_VARS)
 LOCAL_MODULE    := libgameplay
-LOCAL_SRC_FILES := AbsoluteLayout.cpp Animation.cpp AnimationClip.cpp AnimationController.cpp AnimationTarget.cpp AnimationValue.cpp AudioBuffer.cpp AudioController.cpp AudioListener.cpp AudioSource.cpp BoundingBox.cpp BoundingSphere.cpp Bundle.cpp Button.cpp Camera.cpp CheckBox.cpp Container.cpp Control.cpp Curve.cpp DebugNew.cpp DepthStencilTarget.cpp Effect.cpp FileSystem.cpp FlowLayout.cpp Font.cpp Form.cpp FrameBuffer.cpp Frustum.cpp Game.cpp Gamepad.cpp gameplay-main-android.cpp Image.cpp Joint.cpp Joystick.cpp Label.cpp Layout.cpp Light.cpp Material.cpp MaterialParameter.cpp Matrix.cpp Mesh.cpp MeshBatch.cpp MeshPart.cpp MeshSkin.cpp Model.cpp Node.cpp ParticleEmitter.cpp Pass.cpp PhysicsCharacter.cpp PhysicsCollisionObject.cpp PhysicsCollisionShape.cpp PhysicsConstraint.cpp PhysicsController.cpp PhysicsFixedConstraint.cpp PhysicsGenericConstraint.cpp PhysicsGhostObject.cpp PhysicsHingeConstraint.cpp PhysicsRigidBody.cpp PhysicsSocketConstraint.cpp PhysicsSpringConstraint.cpp Plane.cpp PlatformAndroid.cpp Properties.cpp Quaternion.cpp RadioButton.cpp Ray.cpp Rectangle.cpp Ref.cpp RenderState.cpp RenderTarget.cpp Scene.cpp SceneLoader.cpp Slider.cpp SpriteBatch.cpp Technique.cpp TextBox.cpp Texture.cpp Theme.cpp ThemeStyle.cpp Transform.cpp Vector2.cpp Vector3.cpp Vector4.cpp VertexAttributeBinding.cpp VertexFormat.cpp VerticalLayout.cpp
-LOCAL_CFLAGS := -D__ANDROID__ -I"../../external-deps/bullet/include" -I"../../external-deps/libpng/include" -I"../../external-deps/oggvorbis/include" -I"../../external-deps/openal/include"
+LOCAL_SRC_FILES := \
+    AbsoluteLayout.cpp \
+    Animation.cpp \
+    AnimationClip.cpp \
+    AnimationController.cpp \
+    AnimationTarget.cpp \
+    AnimationValue.cpp \
+    AudioBuffer.cpp \
+    AudioController.cpp \
+    AudioListener.cpp \
+    AudioSource.cpp \
+    BoundingBox.cpp \
+    BoundingSphere.cpp \
+    Bundle.cpp \
+    Button.cpp \
+    Camera.cpp \
+    CheckBox.cpp \
+    Container.cpp \
+    Control.cpp \
+    Curve.cpp \
+    DebugNew.cpp \
+    DepthStencilTarget.cpp \
+    Effect.cpp \
+    FileSystem.cpp \
+    FlowLayout.cpp \
+    Font.cpp \
+    Form.cpp \
+    FrameBuffer.cpp \
+    Frustum.cpp \
+    Game.cpp \
+    Gamepad.cpp \
+    gameplay-main-android.cpp \
+    Image.cpp \
+    Joint.cpp \
+    Joystick.cpp \
+    Label.cpp \
+    Layout.cpp \
+    Light.cpp \
+    Material.cpp \
+    MaterialParameter.cpp \
+    Matrix.cpp \
+    Mesh.cpp \
+    MeshBatch.cpp \
+    MeshPart.cpp \
+    MeshSkin.cpp \
+    Model.cpp \
+    Node.cpp \
+    ParticleEmitter.cpp \
+    Pass.cpp \
+    PhysicsCharacter.cpp \
+    PhysicsCollisionObject.cpp \
+    PhysicsCollisionShape.cpp \
+    PhysicsConstraint.cpp \
+    PhysicsController.cpp \
+    PhysicsFixedConstraint.cpp \
+    PhysicsGenericConstraint.cpp \
+    PhysicsGhostObject.cpp \
+    PhysicsHingeConstraint.cpp \
+    PhysicsRigidBody.cpp \
+    PhysicsSocketConstraint.cpp \
+    PhysicsSpringConstraint.cpp \
+    Plane.cpp \
+    PlatformAndroid.cpp \
+    Properties.cpp \
+    Quaternion.cpp \
+    RadioButton.cpp \
+    Ray.cpp \
+    Rectangle.cpp \
+    Ref.cpp \
+    RenderState.cpp \
+    RenderTarget.cpp \
+    Scene.cpp \
+    SceneLoader.cpp \
+    ScreenDisplayer.cpp \
+    ScriptController.cpp \
+    ScriptListener.cpp \
+    Slider.cpp \
+    SpriteBatch.cpp \
+    Technique.cpp \
+    TextBox.cpp \
+    Texture.cpp \
+    Theme.cpp \
+    ThemeStyle.cpp \
+    Transform.cpp \
+    Vector2.cpp \
+    Vector3.cpp \
+    Vector4.cpp \
+    VertexAttributeBinding.cpp \
+    VertexFormat.cpp \
+    VerticalLayout.cpp \
+    lua/lua_AbsoluteLayout.cpp \
+    lua/lua_all_bindings.cpp \
+    lua/lua_Animation.cpp \
+    lua/lua_AnimationClip.cpp \
+    lua/lua_AnimationClipListener.cpp \
+    lua/lua_AnimationClipListenerEventType.cpp \
+    lua/lua_AnimationController.cpp \
+    lua/lua_AnimationTarget.cpp \
+    lua/lua_AnimationValue.cpp \
+    lua/lua_AudioBuffer.cpp \
+    lua/lua_AudioController.cpp \
+    lua/lua_AudioListener.cpp \
+    lua/lua_AudioSource.cpp \
+    lua/lua_AudioSourceState.cpp \
+    lua/lua_BoundingBox.cpp \
+    lua/lua_BoundingSphere.cpp \
+    lua/lua_Bundle.cpp \
+    lua/lua_Button.cpp \
+    lua/lua_Camera.cpp \
+    lua/lua_CameraType.cpp \
+    lua/lua_CheckBox.cpp \
+    lua/lua_Container.cpp \
+    lua/lua_ContainerScroll.cpp \
+    lua/lua_Control.cpp \
+    lua/lua_ControlAlignment.cpp \
+    lua/lua_ControlListener.cpp \
+    lua/lua_ControlListenerEventType.cpp \
+    lua/lua_ControlState.cpp \
+    lua/lua_Curve.cpp \
+    lua/lua_CurveInterpolationType.cpp \
+    lua/lua_DepthStencilTarget.cpp \
+    lua/lua_DepthStencilTargetFormat.cpp \
+    lua/lua_Effect.cpp \
+    lua/lua_FileSystem.cpp \
+    lua/lua_FlowLayout.cpp \
+    lua/lua_Font.cpp \
+    lua/lua_FontGlyph.cpp \
+    lua/lua_FontJustify.cpp \
+    lua/lua_FontStyle.cpp \
+    lua/lua_FontText.cpp \
+    lua/lua_Form.cpp \
+    lua/lua_FrameBuffer.cpp \
+    lua/lua_Frustum.cpp \
+    lua/lua_Game.cpp \
+    lua/lua_GameClearFlags.cpp \
+    lua/lua_Gamepad.cpp \
+    lua/lua_GamepadButtonState.cpp \
+    lua/lua_GamepadGamepadEvent.cpp \
+    lua/lua_GameState.cpp \
+    lua/lua_Global.cpp \
+    lua/lua_Image.cpp \
+    lua/lua_ImageFormat.cpp \
+    lua/lua_Joint.cpp \
+    lua/lua_Joystick.cpp \
+    lua/lua_Keyboard.cpp \
+    lua/lua_KeyboardKey.cpp \
+    lua/lua_KeyboardKeyEvent.cpp \
+    lua/lua_Label.cpp \
+    lua/lua_Layout.cpp \
+    lua/lua_LayoutType.cpp \
+    lua/lua_Light.cpp \
+    lua/lua_LightType.cpp \
+    lua/lua_Material.cpp \
+    lua/lua_MaterialParameter.cpp \
+    lua/lua_MathUtil.cpp \
+    lua/lua_Matrix.cpp \
+    lua/lua_Mesh.cpp \
+    lua/lua_MeshBatch.cpp \
+    lua/lua_MeshIndexFormat.cpp \
+    lua/lua_MeshPart.cpp \
+    lua/lua_MeshPrimitiveType.cpp \
+    lua/lua_MeshSkin.cpp \
+    lua/lua_Model.cpp \
+    lua/lua_Mouse.cpp \
+    lua/lua_MouseMouseEvent.cpp \
+    lua/lua_Node.cpp \
+    lua/lua_NodeCloneContext.cpp \
+    lua/lua_NodeType.cpp \
+    lua/lua_ParticleEmitter.cpp \
+    lua/lua_ParticleEmitterTextureBlending.cpp \
+    lua/lua_Pass.cpp \
+    lua/lua_PhysicsCharacter.cpp \
+    lua/lua_PhysicsCollisionObject.cpp \
+    lua/lua_PhysicsCollisionObjectCollisionListener.cpp \
+    lua/lua_PhysicsCollisionObjectCollisionListenerEventType.cpp \
+    lua/lua_PhysicsCollisionObjectCollisionPair.cpp \
+    lua/lua_PhysicsCollisionObjectType.cpp \
+    lua/lua_PhysicsCollisionShape.cpp \
+    lua/lua_PhysicsCollisionShapeDefinition.cpp \
+    lua/lua_PhysicsCollisionShapeType.cpp \
+    lua/lua_PhysicsConstraint.cpp \
+    lua/lua_PhysicsController.cpp \
+    lua/lua_PhysicsControllerHitFilter.cpp \
+    lua/lua_PhysicsControllerHitResult.cpp \
+    lua/lua_PhysicsControllerListener.cpp \
+    lua/lua_PhysicsControllerListenerEventType.cpp \
+    lua/lua_PhysicsFixedConstraint.cpp \
+    lua/lua_PhysicsGenericConstraint.cpp \
+    lua/lua_PhysicsGhostObject.cpp \
+    lua/lua_PhysicsHingeConstraint.cpp \
+    lua/lua_PhysicsRigidBody.cpp \
+    lua/lua_PhysicsRigidBodyParameters.cpp \
+    lua/lua_PhysicsSocketConstraint.cpp \
+    lua/lua_PhysicsSpringConstraint.cpp \
+    lua/lua_Plane.cpp \
+    lua/lua_Platform.cpp \
+    lua/lua_Properties.cpp \
+    lua/lua_PropertiesType.cpp \
+    lua/lua_Quaternion.cpp \
+    lua/lua_RadioButton.cpp \
+    lua/lua_Ray.cpp \
+    lua/lua_Rectangle.cpp \
+    lua/lua_Ref.cpp \
+    lua/lua_RenderState.cpp \
+    lua/lua_RenderStateAutoBinding.cpp \
+    lua/lua_RenderStateBlend.cpp \
+    lua/lua_RenderStateStateBlock.cpp \
+    lua/lua_RenderTarget.cpp \
+    lua/lua_Scene.cpp \
+    lua/lua_SceneDebugFlags.cpp \
+    lua/lua_SceneLoader.cpp \
+    lua/lua_ScreenDisplayer.cpp \
+    lua/lua_ScriptController.cpp \
+    lua/lua_Slider.cpp \
+    lua/lua_SpriteBatch.cpp \
+    lua/lua_Technique.cpp \
+    lua/lua_TextBox.cpp \
+    lua/lua_Texture.cpp \
+    lua/lua_TextureFilter.cpp \
+    lua/lua_TextureFormat.cpp \
+    lua/lua_TextureSampler.cpp \
+    lua/lua_TextureWrap.cpp \
+    lua/lua_Theme.cpp \
+    lua/lua_ThemeSideRegions.cpp \
+    lua/lua_ThemeStyle.cpp \
+    lua/lua_ThemeThemeImage.cpp \
+    lua/lua_ThemeUVs.cpp \
+    lua/lua_Touch.cpp \
+    lua/lua_TouchTouchEvent.cpp \
+    lua/lua_Transform.cpp \
+    lua/lua_TransformListener.cpp \
+    lua/lua_Uniform.cpp \
+    lua/lua_Vector2.cpp \
+    lua/lua_Vector3.cpp \
+    lua/lua_Vector4.cpp \
+    lua/lua_VertexAttributeBinding.cpp \
+    lua/lua_VertexFormat.cpp \
+    lua/lua_VertexFormatElement.cpp \
+    lua/lua_VertexFormatUsage.cpp \
+    lua/lua_VerticalLayout.cpp
+
+    
+LOCAL_CFLAGS := -D__ANDROID__ -I"../../external-deps/lua/include" -I"../../external-deps/bullet/include" -I"../../external-deps/libpng/include" -I"../../external-deps/oggvorbis/include" -I"../../external-deps/openal/include"
 LOCAL_STATIC_LIBRARIES := android_native_app_glue
 
 include $(BUILD_STATIC_LIBRARY)

+ 309 - 4
gameplay/gameplay.vcxproj

@@ -58,6 +58,156 @@
     <ClCompile Include="src\Label.cpp" />
     <ClCompile Include="src\Layout.cpp" />
     <ClCompile Include="src\Light.cpp" />
+    <ClCompile Include="src\lua\lua_AbsoluteLayout.cpp" />
+    <ClCompile Include="src\lua\lua_all_bindings.cpp" />
+    <ClCompile Include="src\lua\lua_Animation.cpp" />
+    <ClCompile Include="src\lua\lua_AnimationClip.cpp" />
+    <ClCompile Include="src\lua\lua_AnimationClipListener.cpp" />
+    <ClCompile Include="src\lua\lua_AnimationClipListenerEventType.cpp" />
+    <ClCompile Include="src\lua\lua_AnimationController.cpp" />
+    <ClCompile Include="src\lua\lua_AnimationTarget.cpp" />
+    <ClCompile Include="src\lua\lua_AnimationValue.cpp" />
+    <ClCompile Include="src\lua\lua_AudioBuffer.cpp" />
+    <ClCompile Include="src\lua\lua_AudioController.cpp" />
+    <ClCompile Include="src\lua\lua_AudioListener.cpp" />
+    <ClCompile Include="src\lua\lua_AudioSource.cpp" />
+    <ClCompile Include="src\lua\lua_AudioSourceState.cpp" />
+    <ClCompile Include="src\lua\lua_BoundingBox.cpp" />
+    <ClCompile Include="src\lua\lua_BoundingSphere.cpp" />
+    <ClCompile Include="src\lua\lua_Bundle.cpp" />
+    <ClCompile Include="src\lua\lua_Button.cpp" />
+    <ClCompile Include="src\lua\lua_Camera.cpp" />
+    <ClCompile Include="src\lua\lua_CameraType.cpp" />
+    <ClCompile Include="src\lua\lua_CheckBox.cpp" />
+    <ClCompile Include="src\lua\lua_Container.cpp" />
+    <ClCompile Include="src\lua\lua_ContainerScroll.cpp" />
+    <ClCompile Include="src\lua\lua_Control.cpp" />
+    <ClCompile Include="src\lua\lua_ControlAlignment.cpp" />
+    <ClCompile Include="src\lua\lua_ControlListener.cpp" />
+    <ClCompile Include="src\lua\lua_ControlListenerEventType.cpp" />
+    <ClCompile Include="src\lua\lua_ControlState.cpp" />
+    <ClCompile Include="src\lua\lua_Curve.cpp" />
+    <ClCompile Include="src\lua\lua_CurveInterpolationType.cpp" />
+    <ClCompile Include="src\lua\lua_DepthStencilTarget.cpp" />
+    <ClCompile Include="src\lua\lua_DepthStencilTargetFormat.cpp" />
+    <ClCompile Include="src\lua\lua_Effect.cpp" />
+    <ClCompile Include="src\lua\lua_FileSystem.cpp" />
+    <ClCompile Include="src\lua\lua_FlowLayout.cpp" />
+    <ClCompile Include="src\lua\lua_Font.cpp" />
+    <ClCompile Include="src\lua\lua_FontGlyph.cpp" />
+    <ClCompile Include="src\lua\lua_FontJustify.cpp" />
+    <ClCompile Include="src\lua\lua_FontStyle.cpp" />
+    <ClCompile Include="src\lua\lua_FontText.cpp" />
+    <ClCompile Include="src\lua\lua_Form.cpp" />
+    <ClCompile Include="src\lua\lua_FrameBuffer.cpp" />
+    <ClCompile Include="src\lua\lua_Frustum.cpp" />
+    <ClCompile Include="src\lua\lua_Game.cpp" />
+    <ClCompile Include="src\lua\lua_GameClearFlags.cpp" />
+    <ClCompile Include="src\lua\lua_Gamepad.cpp" />
+    <ClCompile Include="src\lua\lua_GamepadButtonState.cpp" />
+    <ClCompile Include="src\lua\lua_GamepadGamepadEvent.cpp" />
+    <ClCompile Include="src\lua\lua_GameState.cpp" />
+    <ClCompile Include="src\lua\lua_Global.cpp" />
+    <ClCompile Include="src\lua\lua_Image.cpp" />
+    <ClCompile Include="src\lua\lua_ImageFormat.cpp" />
+    <ClCompile Include="src\lua\lua_Joint.cpp" />
+    <ClCompile Include="src\lua\lua_Joystick.cpp" />
+    <ClCompile Include="src\lua\lua_Keyboard.cpp" />
+    <ClCompile Include="src\lua\lua_KeyboardKey.cpp" />
+    <ClCompile Include="src\lua\lua_KeyboardKeyEvent.cpp" />
+    <ClCompile Include="src\lua\lua_Label.cpp" />
+    <ClCompile Include="src\lua\lua_Layout.cpp" />
+    <ClCompile Include="src\lua\lua_LayoutType.cpp" />
+    <ClCompile Include="src\lua\lua_Light.cpp" />
+    <ClCompile Include="src\lua\lua_LightType.cpp" />
+    <ClCompile Include="src\lua\lua_Material.cpp" />
+    <ClCompile Include="src\lua\lua_MaterialParameter.cpp" />
+    <ClCompile Include="src\lua\lua_MathUtil.cpp" />
+    <ClCompile Include="src\lua\lua_Matrix.cpp" />
+    <ClCompile Include="src\lua\lua_Mesh.cpp" />
+    <ClCompile Include="src\lua\lua_MeshBatch.cpp" />
+    <ClCompile Include="src\lua\lua_MeshIndexFormat.cpp" />
+    <ClCompile Include="src\lua\lua_MeshPart.cpp" />
+    <ClCompile Include="src\lua\lua_MeshPrimitiveType.cpp" />
+    <ClCompile Include="src\lua\lua_MeshSkin.cpp" />
+    <ClCompile Include="src\lua\lua_Model.cpp" />
+    <ClCompile Include="src\lua\lua_Mouse.cpp" />
+    <ClCompile Include="src\lua\lua_MouseMouseEvent.cpp" />
+    <ClCompile Include="src\lua\lua_Node.cpp" />
+    <ClCompile Include="src\lua\lua_NodeCloneContext.cpp" />
+    <ClCompile Include="src\lua\lua_NodeType.cpp" />
+    <ClCompile Include="src\lua\lua_ParticleEmitter.cpp" />
+    <ClCompile Include="src\lua\lua_ParticleEmitterTextureBlending.cpp" />
+    <ClCompile Include="src\lua\lua_Pass.cpp" />
+    <ClCompile Include="src\lua\lua_PhysicsCharacter.cpp" />
+    <ClCompile Include="src\lua\lua_PhysicsCollisionObject.cpp" />
+    <ClCompile Include="src\lua\lua_PhysicsCollisionObjectCollisionListener.cpp" />
+    <ClCompile Include="src\lua\lua_PhysicsCollisionObjectCollisionListenerEventType.cpp" />
+    <ClCompile Include="src\lua\lua_PhysicsCollisionObjectCollisionPair.cpp" />
+    <ClCompile Include="src\lua\lua_PhysicsCollisionObjectType.cpp" />
+    <ClCompile Include="src\lua\lua_PhysicsCollisionShape.cpp" />
+    <ClCompile Include="src\lua\lua_PhysicsCollisionShapeDefinition.cpp" />
+    <ClCompile Include="src\lua\lua_PhysicsCollisionShapeType.cpp" />
+    <ClCompile Include="src\lua\lua_PhysicsConstraint.cpp" />
+    <ClCompile Include="src\lua\lua_PhysicsController.cpp" />
+    <ClCompile Include="src\lua\lua_PhysicsControllerHitFilter.cpp" />
+    <ClCompile Include="src\lua\lua_PhysicsControllerHitResult.cpp" />
+    <ClCompile Include="src\lua\lua_PhysicsControllerListener.cpp" />
+    <ClCompile Include="src\lua\lua_PhysicsControllerListenerEventType.cpp" />
+    <ClCompile Include="src\lua\lua_PhysicsFixedConstraint.cpp" />
+    <ClCompile Include="src\lua\lua_PhysicsGenericConstraint.cpp" />
+    <ClCompile Include="src\lua\lua_PhysicsGhostObject.cpp" />
+    <ClCompile Include="src\lua\lua_PhysicsHingeConstraint.cpp" />
+    <ClCompile Include="src\lua\lua_PhysicsRigidBody.cpp" />
+    <ClCompile Include="src\lua\lua_PhysicsRigidBodyParameters.cpp" />
+    <ClCompile Include="src\lua\lua_PhysicsSocketConstraint.cpp" />
+    <ClCompile Include="src\lua\lua_PhysicsSpringConstraint.cpp" />
+    <ClCompile Include="src\lua\lua_Plane.cpp" />
+    <ClCompile Include="src\lua\lua_Platform.cpp" />
+    <ClCompile Include="src\lua\lua_Properties.cpp" />
+    <ClCompile Include="src\lua\lua_PropertiesType.cpp" />
+    <ClCompile Include="src\lua\lua_Quaternion.cpp" />
+    <ClCompile Include="src\lua\lua_RadioButton.cpp" />
+    <ClCompile Include="src\lua\lua_Ray.cpp" />
+    <ClCompile Include="src\lua\lua_Rectangle.cpp" />
+    <ClCompile Include="src\lua\lua_Ref.cpp" />
+    <ClCompile Include="src\lua\lua_RenderState.cpp" />
+    <ClCompile Include="src\lua\lua_RenderStateAutoBinding.cpp" />
+    <ClCompile Include="src\lua\lua_RenderStateBlend.cpp" />
+    <ClCompile Include="src\lua\lua_RenderStateStateBlock.cpp" />
+    <ClCompile Include="src\lua\lua_RenderTarget.cpp" />
+    <ClCompile Include="src\lua\lua_Scene.cpp" />
+    <ClCompile Include="src\lua\lua_SceneDebugFlags.cpp" />
+    <ClCompile Include="src\lua\lua_SceneLoader.cpp" />
+    <ClCompile Include="src\lua\lua_ScreenDisplayer.cpp" />
+    <ClCompile Include="src\lua\lua_ScriptController.cpp" />
+    <ClCompile Include="src\lua\lua_Slider.cpp" />
+    <ClCompile Include="src\lua\lua_SpriteBatch.cpp" />
+    <ClCompile Include="src\lua\lua_Technique.cpp" />
+    <ClCompile Include="src\lua\lua_TextBox.cpp" />
+    <ClCompile Include="src\lua\lua_Texture.cpp" />
+    <ClCompile Include="src\lua\lua_TextureFilter.cpp" />
+    <ClCompile Include="src\lua\lua_TextureFormat.cpp" />
+    <ClCompile Include="src\lua\lua_TextureSampler.cpp" />
+    <ClCompile Include="src\lua\lua_TextureWrap.cpp" />
+    <ClCompile Include="src\lua\lua_Theme.cpp" />
+    <ClCompile Include="src\lua\lua_ThemeSideRegions.cpp" />
+    <ClCompile Include="src\lua\lua_ThemeStyle.cpp" />
+    <ClCompile Include="src\lua\lua_ThemeThemeImage.cpp" />
+    <ClCompile Include="src\lua\lua_ThemeUVs.cpp" />
+    <ClCompile Include="src\lua\lua_Touch.cpp" />
+    <ClCompile Include="src\lua\lua_TouchTouchEvent.cpp" />
+    <ClCompile Include="src\lua\lua_Transform.cpp" />
+    <ClCompile Include="src\lua\lua_TransformListener.cpp" />
+    <ClCompile Include="src\lua\lua_Uniform.cpp" />
+    <ClCompile Include="src\lua\lua_Vector2.cpp" />
+    <ClCompile Include="src\lua\lua_Vector3.cpp" />
+    <ClCompile Include="src\lua\lua_Vector4.cpp" />
+    <ClCompile Include="src\lua\lua_VertexAttributeBinding.cpp" />
+    <ClCompile Include="src\lua\lua_VertexFormat.cpp" />
+    <ClCompile Include="src\lua\lua_VertexFormatElement.cpp" />
+    <ClCompile Include="src\lua\lua_VertexFormatUsage.cpp" />
+    <ClCompile Include="src\lua\lua_VerticalLayout.cpp" />
     <ClCompile Include="src\Material.cpp" />
     <ClCompile Include="src\MeshBatch.cpp" />
     <ClCompile Include="src\Pass.cpp" />
@@ -96,6 +246,9 @@
     <ClCompile Include="src\RenderTarget.cpp" />
     <ClCompile Include="src\Scene.cpp" />
     <ClCompile Include="src\SceneLoader.cpp" />
+    <ClCompile Include="src\ScreenDisplayer.cpp" />
+    <ClCompile Include="src\ScriptController.cpp" />
+    <ClCompile Include="src\ScriptListener.cpp" />
     <ClCompile Include="src\Slider.cpp" />
     <ClCompile Include="src\SpriteBatch.cpp" />
     <ClCompile Include="src\Technique.cpp" />
@@ -155,6 +308,156 @@
     <ClInclude Include="src\Label.h" />
     <ClInclude Include="src\Layout.h" />
     <ClInclude Include="src\Light.h" />
+    <ClInclude Include="src\lua\lua_AbsoluteLayout.h" />
+    <ClInclude Include="src\lua\lua_all_bindings.h" />
+    <ClInclude Include="src\lua\lua_Animation.h" />
+    <ClInclude Include="src\lua\lua_AnimationClip.h" />
+    <ClInclude Include="src\lua\lua_AnimationClipListener.h" />
+    <ClInclude Include="src\lua\lua_AnimationClipListenerEventType.h" />
+    <ClInclude Include="src\lua\lua_AnimationController.h" />
+    <ClInclude Include="src\lua\lua_AnimationTarget.h" />
+    <ClInclude Include="src\lua\lua_AnimationValue.h" />
+    <ClInclude Include="src\lua\lua_AudioBuffer.h" />
+    <ClInclude Include="src\lua\lua_AudioController.h" />
+    <ClInclude Include="src\lua\lua_AudioListener.h" />
+    <ClInclude Include="src\lua\lua_AudioSource.h" />
+    <ClInclude Include="src\lua\lua_AudioSourceState.h" />
+    <ClInclude Include="src\lua\lua_BoundingBox.h" />
+    <ClInclude Include="src\lua\lua_BoundingSphere.h" />
+    <ClInclude Include="src\lua\lua_Bundle.h" />
+    <ClInclude Include="src\lua\lua_Button.h" />
+    <ClInclude Include="src\lua\lua_Camera.h" />
+    <ClInclude Include="src\lua\lua_CameraType.h" />
+    <ClInclude Include="src\lua\lua_CheckBox.h" />
+    <ClInclude Include="src\lua\lua_Container.h" />
+    <ClInclude Include="src\lua\lua_ContainerScroll.h" />
+    <ClInclude Include="src\lua\lua_Control.h" />
+    <ClInclude Include="src\lua\lua_ControlAlignment.h" />
+    <ClInclude Include="src\lua\lua_ControlListener.h" />
+    <ClInclude Include="src\lua\lua_ControlListenerEventType.h" />
+    <ClInclude Include="src\lua\lua_ControlState.h" />
+    <ClInclude Include="src\lua\lua_Curve.h" />
+    <ClInclude Include="src\lua\lua_CurveInterpolationType.h" />
+    <ClInclude Include="src\lua\lua_DepthStencilTarget.h" />
+    <ClInclude Include="src\lua\lua_DepthStencilTargetFormat.h" />
+    <ClInclude Include="src\lua\lua_Effect.h" />
+    <ClInclude Include="src\lua\lua_FileSystem.h" />
+    <ClInclude Include="src\lua\lua_FlowLayout.h" />
+    <ClInclude Include="src\lua\lua_Font.h" />
+    <ClInclude Include="src\lua\lua_FontGlyph.h" />
+    <ClInclude Include="src\lua\lua_FontJustify.h" />
+    <ClInclude Include="src\lua\lua_FontStyle.h" />
+    <ClInclude Include="src\lua\lua_FontText.h" />
+    <ClInclude Include="src\lua\lua_Form.h" />
+    <ClInclude Include="src\lua\lua_FrameBuffer.h" />
+    <ClInclude Include="src\lua\lua_Frustum.h" />
+    <ClInclude Include="src\lua\lua_Game.h" />
+    <ClInclude Include="src\lua\lua_GameClearFlags.h" />
+    <ClInclude Include="src\lua\lua_Gamepad.h" />
+    <ClInclude Include="src\lua\lua_GamepadButtonState.h" />
+    <ClInclude Include="src\lua\lua_GamepadGamepadEvent.h" />
+    <ClInclude Include="src\lua\lua_GameState.h" />
+    <ClInclude Include="src\lua\lua_Global.h" />
+    <ClInclude Include="src\lua\lua_Image.h" />
+    <ClInclude Include="src\lua\lua_ImageFormat.h" />
+    <ClInclude Include="src\lua\lua_Joint.h" />
+    <ClInclude Include="src\lua\lua_Joystick.h" />
+    <ClInclude Include="src\lua\lua_Keyboard.h" />
+    <ClInclude Include="src\lua\lua_KeyboardKey.h" />
+    <ClInclude Include="src\lua\lua_KeyboardKeyEvent.h" />
+    <ClInclude Include="src\lua\lua_Label.h" />
+    <ClInclude Include="src\lua\lua_Layout.h" />
+    <ClInclude Include="src\lua\lua_LayoutType.h" />
+    <ClInclude Include="src\lua\lua_Light.h" />
+    <ClInclude Include="src\lua\lua_LightType.h" />
+    <ClInclude Include="src\lua\lua_Material.h" />
+    <ClInclude Include="src\lua\lua_MaterialParameter.h" />
+    <ClInclude Include="src\lua\lua_MathUtil.h" />
+    <ClInclude Include="src\lua\lua_Matrix.h" />
+    <ClInclude Include="src\lua\lua_Mesh.h" />
+    <ClInclude Include="src\lua\lua_MeshBatch.h" />
+    <ClInclude Include="src\lua\lua_MeshIndexFormat.h" />
+    <ClInclude Include="src\lua\lua_MeshPart.h" />
+    <ClInclude Include="src\lua\lua_MeshPrimitiveType.h" />
+    <ClInclude Include="src\lua\lua_MeshSkin.h" />
+    <ClInclude Include="src\lua\lua_Model.h" />
+    <ClInclude Include="src\lua\lua_Mouse.h" />
+    <ClInclude Include="src\lua\lua_MouseMouseEvent.h" />
+    <ClInclude Include="src\lua\lua_Node.h" />
+    <ClInclude Include="src\lua\lua_NodeCloneContext.h" />
+    <ClInclude Include="src\lua\lua_NodeType.h" />
+    <ClInclude Include="src\lua\lua_ParticleEmitter.h" />
+    <ClInclude Include="src\lua\lua_ParticleEmitterTextureBlending.h" />
+    <ClInclude Include="src\lua\lua_Pass.h" />
+    <ClInclude Include="src\lua\lua_PhysicsCharacter.h" />
+    <ClInclude Include="src\lua\lua_PhysicsCollisionObject.h" />
+    <ClInclude Include="src\lua\lua_PhysicsCollisionObjectCollisionListener.h" />
+    <ClInclude Include="src\lua\lua_PhysicsCollisionObjectCollisionListenerEventType.h" />
+    <ClInclude Include="src\lua\lua_PhysicsCollisionObjectCollisionPair.h" />
+    <ClInclude Include="src\lua\lua_PhysicsCollisionObjectType.h" />
+    <ClInclude Include="src\lua\lua_PhysicsCollisionShape.h" />
+    <ClInclude Include="src\lua\lua_PhysicsCollisionShapeDefinition.h" />
+    <ClInclude Include="src\lua\lua_PhysicsCollisionShapeType.h" />
+    <ClInclude Include="src\lua\lua_PhysicsConstraint.h" />
+    <ClInclude Include="src\lua\lua_PhysicsController.h" />
+    <ClInclude Include="src\lua\lua_PhysicsControllerHitFilter.h" />
+    <ClInclude Include="src\lua\lua_PhysicsControllerHitResult.h" />
+    <ClInclude Include="src\lua\lua_PhysicsControllerListener.h" />
+    <ClInclude Include="src\lua\lua_PhysicsControllerListenerEventType.h" />
+    <ClInclude Include="src\lua\lua_PhysicsFixedConstraint.h" />
+    <ClInclude Include="src\lua\lua_PhysicsGenericConstraint.h" />
+    <ClInclude Include="src\lua\lua_PhysicsGhostObject.h" />
+    <ClInclude Include="src\lua\lua_PhysicsHingeConstraint.h" />
+    <ClInclude Include="src\lua\lua_PhysicsRigidBody.h" />
+    <ClInclude Include="src\lua\lua_PhysicsRigidBodyParameters.h" />
+    <ClInclude Include="src\lua\lua_PhysicsSocketConstraint.h" />
+    <ClInclude Include="src\lua\lua_PhysicsSpringConstraint.h" />
+    <ClInclude Include="src\lua\lua_Plane.h" />
+    <ClInclude Include="src\lua\lua_Platform.h" />
+    <ClInclude Include="src\lua\lua_Properties.h" />
+    <ClInclude Include="src\lua\lua_PropertiesType.h" />
+    <ClInclude Include="src\lua\lua_Quaternion.h" />
+    <ClInclude Include="src\lua\lua_RadioButton.h" />
+    <ClInclude Include="src\lua\lua_Ray.h" />
+    <ClInclude Include="src\lua\lua_Rectangle.h" />
+    <ClInclude Include="src\lua\lua_Ref.h" />
+    <ClInclude Include="src\lua\lua_RenderState.h" />
+    <ClInclude Include="src\lua\lua_RenderStateAutoBinding.h" />
+    <ClInclude Include="src\lua\lua_RenderStateBlend.h" />
+    <ClInclude Include="src\lua\lua_RenderStateStateBlock.h" />
+    <ClInclude Include="src\lua\lua_RenderTarget.h" />
+    <ClInclude Include="src\lua\lua_Scene.h" />
+    <ClInclude Include="src\lua\lua_SceneDebugFlags.h" />
+    <ClInclude Include="src\lua\lua_SceneLoader.h" />
+    <ClInclude Include="src\lua\lua_ScreenDisplayer.h" />
+    <ClInclude Include="src\lua\lua_ScriptController.h" />
+    <ClInclude Include="src\lua\lua_Slider.h" />
+    <ClInclude Include="src\lua\lua_SpriteBatch.h" />
+    <ClInclude Include="src\lua\lua_Technique.h" />
+    <ClInclude Include="src\lua\lua_TextBox.h" />
+    <ClInclude Include="src\lua\lua_Texture.h" />
+    <ClInclude Include="src\lua\lua_TextureFilter.h" />
+    <ClInclude Include="src\lua\lua_TextureFormat.h" />
+    <ClInclude Include="src\lua\lua_TextureSampler.h" />
+    <ClInclude Include="src\lua\lua_TextureWrap.h" />
+    <ClInclude Include="src\lua\lua_Theme.h" />
+    <ClInclude Include="src\lua\lua_ThemeSideRegions.h" />
+    <ClInclude Include="src\lua\lua_ThemeStyle.h" />
+    <ClInclude Include="src\lua\lua_ThemeThemeImage.h" />
+    <ClInclude Include="src\lua\lua_ThemeUVs.h" />
+    <ClInclude Include="src\lua\lua_Touch.h" />
+    <ClInclude Include="src\lua\lua_TouchTouchEvent.h" />
+    <ClInclude Include="src\lua\lua_Transform.h" />
+    <ClInclude Include="src\lua\lua_TransformListener.h" />
+    <ClInclude Include="src\lua\lua_Uniform.h" />
+    <ClInclude Include="src\lua\lua_Vector2.h" />
+    <ClInclude Include="src\lua\lua_Vector3.h" />
+    <ClInclude Include="src\lua\lua_Vector4.h" />
+    <ClInclude Include="src\lua\lua_VertexAttributeBinding.h" />
+    <ClInclude Include="src\lua\lua_VertexFormat.h" />
+    <ClInclude Include="src\lua\lua_VertexFormatElement.h" />
+    <ClInclude Include="src\lua\lua_VertexFormatUsage.h" />
+    <ClInclude Include="src\lua\lua_VerticalLayout.h" />
     <ClInclude Include="src\Material.h" />
     <ClInclude Include="src\MathUtil.h" />
     <ClInclude Include="src\MeshBatch.h" />
@@ -194,6 +497,8 @@
     <ClInclude Include="src\Scene.h" />
     <ClInclude Include="src\SceneLoader.h" />
     <ClInclude Include="src\ScreenDisplayer.h" />
+    <ClInclude Include="src\ScriptController.h" />
+    <ClInclude Include="src\ScriptListener.h" />
     <ClInclude Include="src\Slider.h" />
     <ClInclude Include="src\SpriteBatch.h" />
     <ClInclude Include="src\Technique.h" />
@@ -237,7 +542,6 @@
     <None Include="res\shaders\textured.vert" />
     <None Include="src\BoundingBox.inl" />
     <None Include="src\BoundingSphere.inl" />
-    <None Include="src\Curve.inl" />
     <None Include="src\Game.inl" />
     <None Include="src\gameplay-main-ios.mm" />
     <None Include="src\gameplay-main-macosx.mm" />
@@ -252,6 +556,7 @@
     <None Include="src\PlatformMacOSX.mm" />
     <None Include="src\Quaternion.inl" />
     <None Include="src\Ray.inl" />
+    <None Include="src\ScriptController.inl" />
     <None Include="src\Vector2.inl" />
     <None Include="src\Vector3.inl" />
     <None Include="src\Vector4.inl" />
@@ -323,7 +628,7 @@
       <WarningLevel>Level3</WarningLevel>
       <Optimization>Disabled</Optimization>
       <PreprocessorDefinitions>_ITERATOR_DEBUG_LEVEL=0;WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories>..\external-deps\bullet\include;..\external-deps\openal\include\AL;..\external-deps\alut\include\AL;..\external-deps\oggvorbis\include;..\external-deps\glew\include;..\external-deps\libpng\include;..\external-deps\zlib\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>$(ProjectDir)src;..\external-deps\lua\include;..\external-deps\bullet\include;..\external-deps\openal\include\AL;..\external-deps\alut\include\AL;..\external-deps\oggvorbis\include;..\external-deps\glew\include;..\external-deps\libpng\include;..\external-deps\zlib\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <RuntimeTypeInfo>
       </RuntimeTypeInfo>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
@@ -340,7 +645,7 @@
       <WarningLevel>Level3</WarningLevel>
       <Optimization>Disabled</Optimization>
       <PreprocessorDefinitions>_ITERATOR_DEBUG_LEVEL=0;WIN32;_DEBUG;_LIB;GAMEPLAY_MEM_LEAK_DETECTION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories>..\external-deps\bullet\include;..\external-deps\openal\include\AL;..\external-deps\alut\include\AL;..\external-deps\oggvorbis\include;..\external-deps\glew\include;..\external-deps\libpng\include;..\external-deps\zlib\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>$(ProjectDir)src;..\external-deps\lua\include;..\external-deps\bullet\include;..\external-deps\openal\include\AL;..\external-deps\alut\include\AL;..\external-deps\oggvorbis\include;..\external-deps\glew\include;..\external-deps\libpng\include;..\external-deps\zlib\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <RuntimeTypeInfo>true</RuntimeTypeInfo>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
     </ClCompile>
@@ -362,7 +667,7 @@
       <FunctionLevelLinking>true</FunctionLevelLinking>
       <IntrinsicFunctions>true</IntrinsicFunctions>
       <PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories>..\external-deps\bullet\include;..\external-deps\openal\include\AL;..\external-deps\alut\include\AL;..\external-deps\oggvorbis\include;..\external-deps\glew\include;..\external-deps\libpng\include;..\external-deps\zlib\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>$(ProjectDir)src;..\external-deps\lua\include;..\external-deps\bullet\include;..\external-deps\openal\include\AL;..\external-deps\alut\include\AL;..\external-deps\oggvorbis\include;..\external-deps\glew\include;..\external-deps\libpng\include;..\external-deps\zlib\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
     </ClCompile>
     <Link>
       <SubSystem>Windows</SubSystem>

+ 955 - 40
gameplay/gameplay.vcxproj.filters

@@ -10,8 +10,8 @@
     <Filter Include="res\shaders">
       <UniqueIdentifier>{be0b36f1-49ed-4a06-9f1f-57c654a554fe}</UniqueIdentifier>
     </Filter>
-    <Filter Include="res\shaders\lib">
-      <UniqueIdentifier>{ab587dd0-fd08-4b5e-a38d-7b3a706ab53b}</UniqueIdentifier>
+    <Filter Include="lua">
+      <UniqueIdentifier>{21cf31c6-9c10-44cb-a864-d46a0e7bfe5e}</UniqueIdentifier>
     </Filter>
   </ItemGroup>
   <ItemGroup>
@@ -282,24 +282,483 @@
     <ClCompile Include="src\Joystick.cpp">
       <Filter>src</Filter>
     </ClCompile>
-    <ClCompile Include="src\Gamepad.cpp">
+    <ClCompile Include="src\ScriptController.cpp">
       <Filter>src</Filter>
     </ClCompile>
-    <ClCompile Include="src\AIController.cpp">
+    <ClCompile Include="src\lua\lua_AbsoluteLayout.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_all_bindings.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_Animation.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_AnimationClip.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_AnimationClipListener.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_AnimationController.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_AnimationTarget.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_AnimationValue.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_AudioBuffer.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_AudioController.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_AudioListener.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_AudioSource.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_BoundingBox.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_BoundingSphere.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_Bundle.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_Button.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_Camera.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_CheckBox.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_Container.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_Control.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_ControlListener.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_Curve.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_DepthStencilTarget.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_Effect.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_FileSystem.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_FlowLayout.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_Font.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_FontGlyph.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_FontText.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_Form.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_FrameBuffer.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_Frustum.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_Game.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_Global.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_Image.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_Joint.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_Joystick.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_Keyboard.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_Label.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_Layout.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_Light.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_Material.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_MaterialParameter.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_MathUtil.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_Matrix.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_Mesh.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_MeshBatch.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_MeshPart.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_MeshSkin.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_Model.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_Mouse.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_Node.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_NodeCloneContext.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_ParticleEmitter.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_Pass.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_PhysicsCharacter.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_PhysicsCollisionObject.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_PhysicsCollisionObjectCollisionListener.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_PhysicsCollisionObjectCollisionPair.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_PhysicsCollisionShape.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_PhysicsCollisionShapeDefinition.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_PhysicsConstraint.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_PhysicsController.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_PhysicsControllerHitResult.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_PhysicsControllerListener.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_PhysicsFixedConstraint.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_PhysicsGenericConstraint.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_PhysicsGhostObject.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_PhysicsHingeConstraint.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_PhysicsRigidBody.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_PhysicsRigidBodyParameters.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_PhysicsSocketConstraint.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_PhysicsSpringConstraint.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_Plane.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_Platform.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_Properties.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_Quaternion.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_RadioButton.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_Ray.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_Rectangle.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_Ref.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_RenderState.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_RenderStateStateBlock.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_RenderTarget.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_Scene.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_SceneLoader.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_ScreenDisplayer.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_ScriptController.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_Slider.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_SpriteBatch.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_Technique.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_TextBox.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_Texture.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_TextureSampler.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_Theme.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_ThemeSideRegions.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_ThemeStyle.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_ThemeThemeImage.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_ThemeUVs.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_Touch.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_Transform.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_TransformListener.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_Uniform.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_Vector2.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_Vector3.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_Vector4.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_VertexAttributeBinding.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_VertexFormat.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_VertexFormatElement.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_VerticalLayout.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_PhysicsControllerHitFilter.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_Gamepad.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\Gamepad.cpp">
       <Filter>src</Filter>
     </ClCompile>
-    <ClCompile Include="src\AIState.cpp">
+    <ClCompile Include="src\ScreenDisplayer.cpp">
       <Filter>src</Filter>
     </ClCompile>
-    <ClCompile Include="src\AIStateMachine.cpp">
+    <ClCompile Include="src\lua\lua_AnimationClipListenerEventType.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_AudioSourceState.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_CameraType.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_ContainerScroll.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_ControlAlignment.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_ControlListenerEventType.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_ControlState.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_CurveInterpolationType.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_DepthStencilTargetFormat.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_FontJustify.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_FontStyle.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_GameClearFlags.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_GamepadButtonState.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_GamepadGamepadEvent.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_GameState.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_ImageFormat.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_KeyboardKey.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_KeyboardKeyEvent.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_LayoutType.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_LightType.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_MeshIndexFormat.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_MeshPrimitiveType.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_MouseMouseEvent.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_NodeType.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_ParticleEmitterTextureBlending.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_PhysicsCollisionObjectCollisionListenerEventType.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_PhysicsCollisionObjectType.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_PhysicsCollisionShapeType.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_PhysicsControllerListenerEventType.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_PropertiesType.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_RenderStateAutoBinding.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_RenderStateBlend.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_SceneDebugFlags.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_TextureFilter.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_TextureFormat.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_TextureWrap.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_TouchTouchEvent.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_VertexFormatUsage.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\ScriptListener.cpp">
       <Filter>src</Filter>
     </ClCompile>
     <ClCompile Include="src\AIAgent.cpp">
       <Filter>src</Filter>
     </ClCompile>
+    <ClCompile Include="src\AIController.cpp">
+      <Filter>src</Filter>
+    </ClCompile>
     <ClCompile Include="src\AIMessage.cpp">
       <Filter>src</Filter>
     </ClCompile>
+    <ClCompile Include="src\AIState.cpp">
+      <Filter>src</Filter>
+    </ClCompile>
+    <ClCompile Include="src\AIStateMachine.cpp">
+      <Filter>src</Filter>
+    </ClCompile>
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="src\Animation.h">
@@ -578,24 +1037,480 @@
     <ClInclude Include="src\MathUtil.h">
       <Filter>src</Filter>
     </ClInclude>
+    <ClInclude Include="src\ScriptController.h">
+      <Filter>src</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_AbsoluteLayout.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_all_bindings.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_Animation.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_AnimationClip.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_AnimationClipListener.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_AnimationController.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_AnimationTarget.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_AnimationValue.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_AudioBuffer.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_AudioController.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_AudioListener.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_AudioSource.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_BoundingBox.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_BoundingSphere.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_Bundle.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_Button.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_Camera.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_CheckBox.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_Container.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_Control.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_ControlListener.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_Curve.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_DepthStencilTarget.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_Effect.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_FileSystem.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_FlowLayout.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_Font.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_FontGlyph.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_FontText.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_Form.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_FrameBuffer.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_Frustum.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_Game.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_Global.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_Image.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_Joint.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_Joystick.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_Keyboard.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_Label.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_Layout.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_Light.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_Material.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_MaterialParameter.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_MathUtil.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_Matrix.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_Mesh.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_MeshBatch.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_MeshPart.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_MeshSkin.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_Model.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_Mouse.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_Node.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_NodeCloneContext.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_ParticleEmitter.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_Pass.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_PhysicsCharacter.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_PhysicsCollisionObject.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_PhysicsCollisionObjectCollisionListener.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_PhysicsCollisionObjectCollisionPair.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_PhysicsCollisionShape.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_PhysicsCollisionShapeDefinition.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_PhysicsConstraint.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_PhysicsController.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_PhysicsControllerHitResult.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_PhysicsControllerListener.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_PhysicsFixedConstraint.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_PhysicsGenericConstraint.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_PhysicsGhostObject.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_PhysicsHingeConstraint.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_PhysicsRigidBody.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_PhysicsRigidBodyParameters.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_PhysicsSocketConstraint.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_PhysicsSpringConstraint.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_Plane.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_Platform.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_Properties.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_Quaternion.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_RadioButton.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_Ray.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_Rectangle.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_Ref.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_RenderState.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_RenderStateStateBlock.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_RenderTarget.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_Scene.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_SceneLoader.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_ScreenDisplayer.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_ScriptController.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_Slider.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_SpriteBatch.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_Technique.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_TextBox.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_Texture.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_TextureSampler.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_Theme.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_ThemeSideRegions.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_ThemeStyle.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_ThemeThemeImage.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_ThemeUVs.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_Touch.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_Transform.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_TransformListener.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_Uniform.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_Vector2.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_Vector3.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_Vector4.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_VertexAttributeBinding.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_VertexFormat.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_VertexFormatElement.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_VerticalLayout.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_PhysicsControllerHitFilter.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_Gamepad.h">
+      <Filter>lua</Filter>
+    </ClInclude>
     <ClInclude Include="src\Gamepad.h">
       <Filter>src</Filter>
     </ClInclude>
-    <ClInclude Include="src\AIAgent.h">
+    <ClInclude Include="src\lua\lua_AnimationClipListenerEventType.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_AudioSourceState.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_CameraType.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_ContainerScroll.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_ControlAlignment.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_ControlListenerEventType.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_ControlState.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_CurveInterpolationType.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_DepthStencilTargetFormat.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_FontJustify.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_FontStyle.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_GameClearFlags.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_GamepadButtonState.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_GamepadGamepadEvent.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_GameState.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_ImageFormat.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_KeyboardKey.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_KeyboardKeyEvent.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_LayoutType.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_LightType.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_MeshIndexFormat.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_MeshPrimitiveType.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_MouseMouseEvent.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_NodeType.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_ParticleEmitterTextureBlending.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_PhysicsCollisionObjectCollisionListenerEventType.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_PhysicsCollisionObjectType.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_PhysicsCollisionShapeType.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_PhysicsControllerListenerEventType.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_PropertiesType.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_RenderStateAutoBinding.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_RenderStateBlend.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_SceneDebugFlags.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_TextureFilter.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_TextureFormat.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_TextureWrap.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_TouchTouchEvent.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_VertexFormatUsage.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\ScriptListener.h">
       <Filter>src</Filter>
     </ClInclude>
-    <ClInclude Include="src\AIController.h">
+    <ClInclude Include="src\AIStateMachine.h">
       <Filter>src</Filter>
     </ClInclude>
-    <ClInclude Include="src\AIState.h">
+    <ClInclude Include="src\AIAgent.h">
       <Filter>src</Filter>
     </ClInclude>
-    <ClInclude Include="src\AIStateMachine.h">
+    <ClInclude Include="src\AIController.h">
       <Filter>src</Filter>
     </ClInclude>
     <ClInclude Include="src\AIMessage.h">
       <Filter>src</Filter>
     </ClInclude>
+    <ClInclude Include="src\AIState.h">
+      <Filter>src</Filter>
+    </ClInclude>
   </ItemGroup>
   <ItemGroup>
     <None Include="src\gameplay-main-macosx.mm">
@@ -604,9 +1519,6 @@
     <None Include="src\PlatformMacOSX.mm">
       <Filter>src</Filter>
     </None>
-    <None Include="src\Curve.inl">
-      <Filter>src</Filter>
-    </None>
     <None Include="src\Game.inl">
       <Filter>src</Filter>
     </None>
@@ -643,61 +1555,64 @@
     <None Include="src\Joystick.inl">
       <Filter>src</Filter>
     </None>
-    <None Include="res\shaders\textured.vert">
-      <Filter>res\shaders</Filter>
+    <None Include="src\ScriptController.inl">
+      <Filter>src</Filter>
     </None>
-    <None Include="res\shaders\textured.frag">
+    <None Include="res\shaders\lib\attributes-skinning.vert">
       <Filter>res\shaders</Filter>
     </None>
-    <None Include="res\shaders\textured-unlit.vert">
+    <None Include="res\shaders\lib\attributes.vert">
       <Filter>res\shaders</Filter>
     </None>
-    <None Include="res\shaders\textured-unlit.frag">
+    <None Include="res\shaders\colored-unlit.frag">
       <Filter>res\shaders</Filter>
     </None>
-    <None Include="res\shaders\colored.vert">
+    <None Include="res\shaders\colored-unlit.vert">
       <Filter>res\shaders</Filter>
     </None>
     <None Include="res\shaders\colored.frag">
       <Filter>res\shaders</Filter>
     </None>
-    <None Include="res\shaders\colored-unlit.vert">
+    <None Include="res\shaders\colored.vert">
       <Filter>res\shaders</Filter>
     </None>
-    <None Include="res\shaders\colored-unlit.frag">
+    <None Include="res\shaders\lib\lighting-directional.frag">
       <Filter>res\shaders</Filter>
     </None>
-    <None Include="res\shaders\lib\lighting.frag">
-      <Filter>res\shaders\lib</Filter>
+    <None Include="res\shaders\lib\lighting-directional.vert">
+      <Filter>res\shaders</Filter>
     </None>
-    <None Include="res\shaders\lib\lighting-spot.vert">
-      <Filter>res\shaders\lib</Filter>
+    <None Include="res\shaders\lib\lighting-point.frag">
+      <Filter>res\shaders</Filter>
+    </None>
+    <None Include="res\shaders\lib\lighting-point.vert">
+      <Filter>res\shaders</Filter>
     </None>
     <None Include="res\shaders\lib\lighting-spot.frag">
-      <Filter>res\shaders\lib</Filter>
+      <Filter>res\shaders</Filter>
     </None>
-    <None Include="res\shaders\lib\lighting-point.vert">
-      <Filter>res\shaders\lib</Filter>
+    <None Include="res\shaders\lib\lighting-spot.vert">
+      <Filter>res\shaders</Filter>
     </None>
-    <None Include="res\shaders\lib\lighting-point.frag">
-      <Filter>res\shaders\lib</Filter>
+    <None Include="res\shaders\lib\lighting.frag">
+      <Filter>res\shaders</Filter>
     </None>
-    <None Include="res\shaders\lib\lighting-directional.vert">
-      <Filter>res\shaders\lib</Filter>
+    <None Include="res\shaders\textured-bumped.frag">
+      <Filter>res\shaders</Filter>
     </None>
-    <None Include="res\shaders\lib\lighting-directional.frag">
-      <Filter>res\shaders\lib</Filter>
+    <None Include="res\shaders\textured-bumped.vert">
+      <Filter>res\shaders</Filter>
     </None>
-    <None Include="res\shaders\lib\attributes.vert">
-      <Filter>res\shaders\lib</Filter>
+    <None Include="res\shaders\textured-unlit.frag">
+      <Filter>res\shaders</Filter>
     </None>
-    <None Include="res\shaders\lib\attributes-skinning.vert">
-      <Filter>res\shaders\lib</Filter>
+    <None Include="res\shaders\textured-unlit.vert">
+      <Filter>res\shaders</Filter>
     </None>
-    <None Include="res\shaders\textured-bumped.frag">
+    <None Include="res\shaders\textured.frag">
       <Filter>res\shaders</Filter>
     </None>
-    <None Include="res\shaders\textured-bumped.vert">
+    <None Include="res\shaders\textured.vert">
       <Filter>res\shaders</Filter>
     </None>
   </ItemGroup>

Разлика између датотеке није приказан због своје велике величине
+ 1237 - 8
gameplay/gameplay.xcodeproj/project.pbxproj


+ 3 - 3
gameplay/res/shaders/colored-unlit.frag

@@ -15,7 +15,7 @@ uniform sampler2D u_lightmapTexture;     	// Lightmap texture
 #if defined(MODULATE_COLOR)
 uniform vec4 u_modulateColor;               // Modulation color
 #endif
-#if defined(MODULTE_ALPHA)
+#if defined(MODULATE_ALPHA)
 uniform float u_modulateAlpha;              // Modulation alpha
 #endif
 
@@ -36,7 +36,7 @@ void main()
 	#if defined(MODULATE_COLOR)
 	gl_FragColor *= u_modulateColor;
 	#endif
-	#if defined(MODULTE_ALPHA)
+	#if defined(MODULATE_ALPHA)
     gl_FragColor.a *= u_modulateAlpha;
     #endif
-}
+}

+ 1 - 1
gameplay/res/shaders/textured.frag

@@ -36,7 +36,7 @@ uniform vec4 u_modulateColor;               	// Modulation color
 #if defined(MODULATE_ALPHA)
 uniform float u_modulateAlpha;              	// Modulation alpha
 #endif
-#include "/lib/lighting.frag"
+#include "lib/lighting.frag"
 #if defined(POINT_LIGHT)
 #include "lib/lighting-point.frag"
 #elif defined(SPOT_LIGHT)

+ 41 - 1
gameplay/src/AnimationClip.cpp

@@ -4,6 +4,7 @@
 #include "AnimationTarget.h"
 #include "Game.h"
 #include "Quaternion.h"
+#include "ScriptListener.h"
 
 namespace gameplay
 {
@@ -12,7 +13,7 @@ AnimationClip::AnimationClip(const char* id, Animation* animation, unsigned long
     : _id(id), _animation(animation), _startTime(startTime), _endTime(endTime), _duration(_endTime - _startTime), 
       _stateBits(0x00), _repeatCount(1.0f), _activeDuration(_duration * _repeatCount), _speed(1.0f), _timeStarted(0), 
       _elapsedTime(0), _crossFadeToClip(NULL), _crossFadeOutElapsed(0), _crossFadeOutDuration(0), _blendWeight(1.0f), 
-      _beginListeners(NULL), _endListeners(NULL), _listeners(NULL), _listenerItr(NULL)
+      _beginListeners(NULL), _endListeners(NULL), _listeners(NULL), _scriptListeners(NULL), _listenerItr(NULL)
 {
     GP_ASSERT(_animation);
     GP_ASSERT(0 <= startTime && startTime <= _animation->_duration && 0 <= endTime && endTime <= _animation->_duration);
@@ -40,6 +41,15 @@ AnimationClip::~AnimationClip()
     SAFE_DELETE(_beginListeners);
     SAFE_DELETE(_endListeners);
 
+    if (_scriptListeners)
+    {
+        for (unsigned int i = 0; i < _scriptListeners->size(); i++)
+        {
+            SAFE_DELETE((*_scriptListeners)[i]);
+        }
+        SAFE_DELETE(_scriptListeners);
+    }
+
     if (_listeners)
     {
         *_listenerItr = _listeners->begin();
@@ -313,6 +323,36 @@ void AnimationClip::addEndListener(AnimationClip::Listener* listener)
     _endListeners->push_back(listener);
 }
 
+void AnimationClip::addBeginListener(const char* function)
+{
+    if (!_scriptListeners)
+        _scriptListeners = new std::vector<ScriptListener*>;
+
+    ScriptListener* listener = new ScriptListener(function);
+    _scriptListeners->push_back(listener);
+    addBeginListener(listener);
+}
+
+void AnimationClip::addEndListener(const char* function)
+{
+    if (!_scriptListeners)
+        _scriptListeners = new std::vector<ScriptListener*>;
+
+    ScriptListener* listener = new ScriptListener(function);
+    _scriptListeners->push_back(listener);
+    addEndListener(listener);
+}
+
+void AnimationClip::addListener(const char* function, unsigned long eventTime)
+{
+    if (!_scriptListeners)
+        _scriptListeners = new std::vector<ScriptListener*>;
+
+    ScriptListener* listener = new ScriptListener(function);
+    _scriptListeners->push_back(listener);
+    addListener(listener, eventTime);
+}
+
 bool AnimationClip::update(float elapsedTime)
 {
     if (isClipStateBitSet(CLIP_IS_PAUSED_BIT))

+ 38 - 0
gameplay/src/AnimationClip.h

@@ -11,6 +11,7 @@ namespace gameplay
 
 class Animation;
 class AnimationValue;
+class ScriptListener;
 
 /**
  * Defines the runtime session of an Animation to be played.
@@ -63,6 +64,11 @@ public:
              */
             END
         };
+        
+        /*
+         * Destructor.
+         */
+        virtual ~Listener() { }
 
         /**
          * Handles when animation event occurs.
@@ -227,6 +233,37 @@ public:
      */
     void addListener(AnimationClip::Listener* listener, unsigned long eventTime);
 
+    /**
+     * Adds an animation begin listener.
+     * 
+     * Note: the given Lua function must have the same function signature as AnimationClip::Listener::animationEvent.
+     *
+     * @param function The Lua script function to be called when an AnimationClip begins.
+     */
+    void addBeginListener(const char* function);
+
+    /**
+     * Adds an animation end listener.
+     * 
+     * Note: the given Lua function must have the same function signature as AnimationClip::Listener::animationEvent.
+     *
+     * @param function The Lua script function to be called when an AnimationClip ends.
+     */
+    void addEndListener(const char* function);
+
+    /**
+     * Adds an animation listener to be called back at the specified eventTime during the playback 
+     * of the AnimationClip.
+     * 
+     * Note: the given Lua function must have the same function signature as AnimationClip::Listener::animationEvent.
+     * 
+     * @param function The Lua script function to be called when an AnimationClip reaches the 
+     *      specified time in its playback.
+     * @param eventTime The time the listener will be called during the playback of the AnimationClip. 
+     *      Must be between 0 and the duration of the AnimationClip.
+     */
+    void addListener(const char* function, unsigned long eventTime);
+
 private:
     
     static const unsigned char CLIP_IS_PLAYING_BIT = 0x01;             // Bit representing whether AnimationClip is a running clip in AnimationController
@@ -349,6 +386,7 @@ private:
     std::vector<Listener*>* _endListeners;              // Collection of end listeners on the clip.
     std::list<ListenerEvent*>* _listeners;              // Ordered collection of listeners on the clip.
     std::list<ListenerEvent*>::iterator* _listenerItr;  // Iterator that points to the next listener event to be triggered.
+    std::vector<ScriptListener*>* _scriptListeners;     // Collection of listeners that are bound to Lua script functions.
 };
 
 }

+ 1 - 0
gameplay/src/AudioListener.h

@@ -73,6 +73,7 @@ public:
      * Orientation is represented as 6 floats. (forward.x, forward.y, forward.z, up.x, up.y, up.z).
      * 
      * @return Pointer to the 6 orientation float values.
+     * @script{ignore}
      */
     const float* getOrientation() const;
 

+ 11 - 1
gameplay/src/Base.h

@@ -46,9 +46,9 @@ using std::modf;
 #define NULL     0
 #endif
 
-// Print logging (implemented per platform)
 namespace gameplay
 {
+/** Print logging (implemented per platform). */
 extern void printError(const char* format, ...);
 }
 
@@ -167,6 +167,10 @@ extern void printError(const char* format, ...);
 // Image
 #include <png.h>
 
+// Scripting
+using std::va_list;
+#include <lua.hpp>
+
 #define WINDOW_VSYNC        1
 
 // Graphics (OpenGL)
@@ -242,11 +246,17 @@ extern void printError(const char* format, ...);
 // Hardware buffer
 namespace gameplay
 {
+/** Vertex attribute. */
 typedef GLint VertexAttribute;
+/** Vertex buffer handle. */
 typedef GLuint VertexBufferHandle;
+/** Index buffer handle. */
 typedef GLuint IndexBufferHandle;
+/** Texture handle. */
 typedef GLuint TextureHandle;
+/** Frame buffer handle. */
 typedef GLuint FrameBufferHandle;
+/** Render buffer handle. */
 typedef GLuint RenderBufferHandle;
 }
 

+ 1 - 1
gameplay/src/BoundingBox.cpp

@@ -247,7 +247,7 @@ void BoundingBox::set(const Vector3& min, const Vector3& max)
     this->max = max;
 }
 
-void updateMinMax(Vector3* point, Vector3* min, Vector3* max)
+static void updateMinMax(Vector3* point, Vector3* min, Vector3* max)
 {
     GP_ASSERT(point);
     GP_ASSERT(min);

+ 0 - 8
gameplay/src/BoundingSphere.h

@@ -36,14 +36,6 @@ public:
      */
     BoundingSphere(const Vector3& center, float radius);
 
-    /**
-     * Constructs a new bounding sphere that contains all of the specified points.
-     *
-     * @param points The points to enclose inside the new bounding sphere.
-     * @param count The number of points.
-     */
-    BoundingSphere(Vector3* points, unsigned int count);
-
     /**
      * Constructs a bounding sphere from the given bounding sphere.
      *

+ 2 - 2
gameplay/src/Bundle.cpp

@@ -128,7 +128,7 @@ bool Bundle::readArray(unsigned int* length, std::vector<T>* values, unsigned in
     return true;
 }
 
-std::string readString(FILE* fp)
+static std::string readString(FILE* fp)
 {
     GP_ASSERT(fp);
 
@@ -1373,7 +1373,7 @@ Mesh* Bundle::loadMesh(const char* id, const char* nodeId)
     mesh->_url += "#";
     mesh->_url += id;
 
-    mesh->setVertexData(meshData->vertexData, 0, meshData->vertexCount);
+    mesh->setVertexData((float*)meshData->vertexData, 0, meshData->vertexCount);
 
     mesh->_boundingBox.set(meshData->boundingBox);
     mesh->_boundingSphere.set(meshData->boundingSphere);

+ 1 - 1
gameplay/src/Bundle.h

@@ -388,7 +388,7 @@ private:
      * Reads the animation channel data at the current file position into the given animation
      * (with the given animation target and target attribute).
      * 
-     * Note: this is used by #loadNode(const char*, Scene*) and #readAnimationChannel(Scene*, Animation*, const char*).
+     * Note: this is used by Bundle::loadNode(const char*, Scene*) and Bundle::readAnimationChannel(Scene*, Animation*, const char*).
      * 
      * @param animation The animation to the load channel into.
      * @param id The ID of the animation that this channel is loaded into.

+ 14 - 5
gameplay/src/Container.cpp

@@ -21,6 +21,15 @@ static const long SCROLL_INERTIA_DELAY = 100L;
 // Factor to multiply friction by before applying to velocity.
 static const float SCROLL_FRICTION_FACTOR = 5.0f;
 
+/**
+ * Sort function for use with _controls.sort(), based on Z-Order.
+ * 
+ * @param c1 The first control
+ * @param c2 The second control
+ * return true if the first controls z index is less than the second.
+ */
+static bool sortControlsByZOrder(Control* c1, Control* c2);
+
 Container::Container()
     : _layout(NULL), _scrollBarTopCap(NULL), _scrollBarVertical(NULL), _scrollBarBottomCap(NULL),
       _scrollBarLeftCap(NULL), _scrollBarHorizontal(NULL), _scrollBarRightCap(NULL),
@@ -388,9 +397,9 @@ void Container::draw(SpriteBatch* spriteBatch, const Rectangle& clip, bool needs
         needsClear = true;
     }
 
-    spriteBatch->begin();
+    spriteBatch->start();
     Control::drawBorder(spriteBatch, clip);
-    spriteBatch->end();
+    spriteBatch->finish();
 
     std::vector<Control*>::const_iterator it;
     Rectangle boundsUnion = Rectangle::empty();
@@ -410,7 +419,7 @@ void Container::draw(SpriteBatch* spriteBatch, const Rectangle& clip, bool needs
         // Draw scroll bars.
         Rectangle clipRegion(_viewportClipBounds);
 
-        spriteBatch->begin();
+        spriteBatch->start();
 
         if (_scrollBarBounds.height > 0 &&
             ((_scroll & SCROLL_VERTICAL) == SCROLL_VERTICAL))
@@ -476,7 +485,7 @@ void Container::draw(SpriteBatch* spriteBatch, const Rectangle& clip, bool needs
             spriteBatch->draw(bounds.x, bounds.y, bounds.width, bounds.height, rightUVs.u1, rightUVs.v1, rightUVs.u2, rightUVs.v2, rightColor, clipRegion);
         }
 
-        spriteBatch->end();
+        spriteBatch->finish();
 
         if (_scrollingVelocity.isZero())
         {
@@ -1045,7 +1054,7 @@ Container::Scroll Container::getScroll(const char* scroll)
     return Container::SCROLL_NONE;
 }
 
-bool sortControlsByZOrder(Control* c1, Control* c2)
+static bool sortControlsByZOrder(Control* c1, Control* c2)
 {
     if (c1->getZIndex() < c2->getZIndex())
         return true;

+ 31 - 14
gameplay/src/Container.h

@@ -141,6 +141,7 @@ public:
      * Get the vector of controls within this container.
      *
      * @return The vector of the controls within this container.
+     * @script{ignore}
      */
     const std::vector<Control*>& getControls() const;
 
@@ -173,7 +174,7 @@ public:
     bool isScrollBarsAutoHide() const;
 
     /**
-     * @see AnimationTarget#getAnimation
+     * @see AnimationTarget::getAnimation
      */
     Animation* getAnimation(const char* id = NULL) const;
 
@@ -188,17 +189,17 @@ public:
     const char* getType() const;
 
     /**
-     * @see AnimationTarget#getAnimationPropertyComponentCount
+     * @see AnimationTarget::getAnimationPropertyComponentCount
      */
     virtual unsigned int getAnimationPropertyComponentCount(int propertyId) const;
 
     /**
-     * @see AnimationTarget#getAnimationProperty
+     * @see AnimationTarget::getAnimationProperty
      */
     virtual void getAnimationPropertyValue(int propertyId, AnimationValue* value);
 
     /**
-     * @see AnimationTarget#setAnimationProperty
+     * @see AnimationTarget::setAnimationProperty
      */
     virtual void setAnimationPropertyValue(int propertyId, AnimationValue* value, float blendWeight = 1.0f);
 
@@ -338,8 +339,34 @@ protected:
      */
     bool touchEventScroll(Touch::TouchEvent evt, int x, int y, unsigned int contactIndex);
 
+    /**
+     * Mouse scroll event callback.
+     *
+     * @param evt The mouse scroll event that occurred.
+     * @param x The x position of the scroll in pixels. Left edge is zero.
+     * @param y The y position of the scroll in pixels. Top edge is zero.
+     * @param wheelDelta The value change of the mouse's scroll wheel.
+     *
+     * @return Whether the scroll event was consumed by scrolling within this container.
+     *
+     * @see Mouse::MouseEvent
+     */
     bool mouseEventScroll(Mouse::MouseEvent evt, int x, int y, int wheelDelta);
 
+    /**
+     * Mouse pointer event callback.
+     *
+     * @param mouse Whether to treat the event as a mouse event or a touch event.
+     * @param evt The pointer event (either a Mouse::MouseEvent or a Touch::TouchEvent).
+     * @param x The x position of the pointer event in pixels. Left edge is zero.
+     * @param y The y position of the pointer event in pixels. Top edge is zero.
+     * @param data The event's data (depends on whether it is a mouse event or a touch event).
+     *
+     * @return Whether the pointer event was consumed by this container.
+     * 
+     * @see Mouse::MouseEvent
+     * @see Touch::TouchEvent
+     */
     bool pointerEvent(bool mouse, char evt, int x, int y, int data);
 
     /**
@@ -478,16 +505,6 @@ private:
     float _totalHeight;
 };
 
-
-/**
- * Sort funtion for use with _controls.sort(), based on Z-Order.
- * 
- * @param c1 The first control
- * @param c2 The second control
- * return true if the first controls z index is less than the second.
- */
-bool sortControlsByZOrder(Control* c1, Control* c2);
-
 }
 
 #endif

+ 29 - 16
gameplay/src/Control.cpp

@@ -1,14 +1,15 @@
 #include "Base.h"
 #include "Game.h"
 #include "Control.h"
+#include "ScriptListener.h"
 
 namespace gameplay
 {
 
 Control::Control()
     : _id(""), _state(Control::NORMAL), _bounds(Rectangle::empty()), _clipBounds(Rectangle::empty()), _viewportClipBounds(Rectangle::empty()),
-    _clearBounds(Rectangle::empty()), _dirty(true), _consumeInputEvents(true), _listeners(NULL), _contactIndex(INVALID_CONTACT_INDEX),
-    _styleOverridden(false), _skin(NULL)
+    _clearBounds(Rectangle::empty()), _dirty(true), _consumeInputEvents(true), _listeners(NULL), _scriptListeners(NULL),
+    _contactIndex(INVALID_CONTACT_INDEX), _styleOverridden(false), _skin(NULL)
 {
 }
 
@@ -24,6 +25,15 @@ Control::~Control()
         SAFE_DELETE(_listeners);
     }
 
+    if (_scriptListeners)
+    {
+        for (unsigned int i = 0; i < _scriptListeners->size(); i++)
+        {
+            SAFE_DELETE((*_scriptListeners)[i]);
+        }
+        SAFE_DELETE(_scriptListeners);
+    }
+
     if (_styleOverridden)
     {
         SAFE_DELETE(_style);
@@ -125,11 +135,6 @@ void Control::initialize(Theme::Style* style, Properties* properties)
     }
 }
 
-void initialize(const char* id, Theme::Style* style, const Vector2& position, const Vector2& size)
-{
-
-}
-
 const char* Control::getId() const
 {
     return _id.c_str();
@@ -222,6 +227,11 @@ void Control::setAutoHeight(bool autoHeight)
     }
 }
 
+bool Control::getAutoHeight() const
+{
+    return _autoHeight;
+}
+
 void Control::setOpacity(float opacity, unsigned char states)
 {
     overrideStyle();
@@ -285,13 +295,6 @@ const Rectangle& Control::getSkinRegion(State state) const
     return overlay->getSkinRegion();
 }
 
-const Theme::UVs& Control::getSkinUVs(Theme::Skin::SkinArea area, State state) const
-{
-    Theme::Style::Overlay* overlay = getOverlay(state);
-    GP_ASSERT(overlay);
-    return overlay->getSkinUVs(area);
-}
-
 void Control::setSkinColor(const Vector4& color, unsigned char states)
 {
     overrideStyle();
@@ -680,6 +683,16 @@ void Control::addListener(Control::Listener* listener, int eventFlags)
     }
 }
 
+void Control::addListener(const char* function, int eventFlags)
+{
+    if (!_scriptListeners)
+        _scriptListeners = new std::vector<ScriptListener*>();
+
+    ScriptListener* listener = new ScriptListener(function);
+    _scriptListeners->push_back(listener);
+    addListener(listener, eventFlags);
+}
+
 void Control::addSpecificListener(Control::Listener* listener, Listener::EventType eventType)
 {
     GP_ASSERT(listener);
@@ -978,10 +991,10 @@ void Control::draw(SpriteBatch* spriteBatch, const Rectangle& clip, bool needsCl
         GL_ASSERT( glDisable(GL_SCISSOR_TEST) );
     }
 
-    spriteBatch->begin();
+    spriteBatch->start();
     drawBorder(spriteBatch, clip);
     drawImages(spriteBatch, clip);
-    spriteBatch->end();
+    spriteBatch->finish();
 
     drawText(clip);
     _dirty = false;

+ 30 - 13
gameplay/src/Control.h

@@ -14,6 +14,8 @@
 namespace gameplay
 {
 
+class ScriptListener;
+
 /**
  * Base class for UI controls.
  */
@@ -83,6 +85,7 @@ public:
     };
 
     /**
+     * @script{ignore}
      * A constant used for setting themed attributes on all control states simultaneously.
      */
     static const unsigned char STATE_ALL = NORMAL | FOCUS | ACTIVE | DISABLED;
@@ -137,6 +140,11 @@ public:
              */
             RIGHT_CLICK     = 0x40,
         };
+    
+        /*
+         * Destructor.
+         */
+        virtual ~Listener() { }
 
         /**
          * Method called by controls when an event is triggered.
@@ -330,16 +338,6 @@ public:
      */
     const Rectangle& getSkinRegion(State state = NORMAL) const;
 
-    /**
-     * Get the texture coordinates of an area of this control's skin for a given state.
-     *
-     * @param area The area of the skin to get the coordinates of.
-     * @param state The state to get this property from.
-     *
-     * @return The texture coordinates of an area of this control's skin.
-     */
-    const Theme::UVs& getSkinUVs(Theme::Skin::SkinArea area, State state = NORMAL) const;
-
     /**
      * Set the blend color of this control's skin.
      *
@@ -724,17 +722,31 @@ public:
     virtual void addListener(Control::Listener* listener, int eventFlags);
 
     /**
-     * @see AnimationTarget#getAnimationPropertyComponentCount
+     * Add a listener to be notified of specific events affecting
+     * this control.  Event types can be OR'ed together.
+     * E.g. To listen to touch-press and touch-release events,
+     * pass <code>Control::Listener::TOUCH | Control::Listener::RELEASE</code>
+     * as the second parameter.
+     * 
+     * Note: the given Lua function must have the same function signature as Control::Listener::controlEvent.
+     *
+     * @param function The name of the Lua script function to add as a listener callback.
+     * @param eventFlags The events to listen for.
+     */
+    virtual void addListener(const char* function, int eventFlags);
+
+    /**
+     * @see AnimationTarget::getAnimationPropertyComponentCount
      */
     virtual unsigned int getAnimationPropertyComponentCount(int propertyId) const;
 
     /**
-     * @see AnimationTarget#getAnimationProperty
+     * @see AnimationTarget::getAnimationProperty
      */
     virtual void getAnimationPropertyValue(int propertyId, AnimationValue* value);
 
     /**
-     * @see AnimationTarget#setAnimationProperty
+     * @see AnimationTarget::setAnimationProperty
      */
     virtual void setAnimationPropertyValue(int propertyId, AnimationValue* value, float blendWeight = 1.0f);
 
@@ -967,6 +979,11 @@ protected:
      * Listeners map of EventType's to a list of Listeners.
      */
     std::map<Listener::EventType, std::list<Listener*>*>* _listeners;
+
+    /**
+     * Script listener objects.
+     */
+    std::vector<ScriptListener*>* _scriptListeners;
     
     /**
      * The Control's Theme::Style.

+ 29 - 0
gameplay/src/Curve.cpp

@@ -50,6 +50,35 @@ using std::strcmp;
     }
 #endif
 
+static inline float bezier(float eq0, float eq1, float eq2, float eq3, float from, float out, float to, float in)
+{
+    return from * eq0 + out * eq1 + in * eq2 + to * eq3;
+}
+
+static inline float bspline(float eq0, float eq1, float eq2, float eq3, float c0, float c1, float c2, float c3)
+{
+    return c0 * eq0 + c1 * eq1 + c2 * eq2 + c3 * eq3;
+}
+
+static inline float hermite(float h00, float h01, float h10, float h11, float from, float out, float to, float in)
+{
+    return h00 * from + h01 * to + h10 * out + h11 * in;
+}
+
+static inline float hermiteFlat(float h00, float h01, float from, float to)
+{
+    return h00 * from + h01 * to;
+}
+
+static inline float hermiteSmooth(float h00, float h01, float h10, float h11, float from, float out, float to, float in)
+{
+    return h00 * from + h01 * to + h10 * out + h11 * in;
+}
+
+static inline float lerpInl(float s, float from, float to)
+{
+    return from + (to - from) * s;
+}
 
 namespace gameplay
 {

+ 0 - 14
gameplay/src/Curve.h

@@ -485,20 +485,6 @@ private:
     Point* _points;                     // The points on the curve.
 };
 
-inline static float bezier(float eq0, float eq1, float eq2, float eq3, float from, float out, float to, float in);
-
-inline static float bspline(float eq0, float eq1, float eq2, float eq3, float c0, float c1, float c2, float c3);
-
-inline static float hermite(float h00, float h01, float h10, float h11, float from, float out, float to, float in);
-
-inline static float hermiteFlat(float h00, float h01, float from, float to);
-
-inline static float hermiteSmooth(float h00, float h01, float h10, float h11, float from, float out, float to, float in);
-
-inline static float lerpInl(float s, float from, float to);
-
 }
 
-#include "Curve.inl"
-
 #endif

+ 0 - 36
gameplay/src/Curve.inl

@@ -1,36 +0,0 @@
-#include "Curve.h"
-
-namespace gameplay
-{
-
-inline float bezier(float eq0, float eq1, float eq2, float eq3, float from, float out, float to, float in)
-{
-    return from * eq0 + out * eq1 + in * eq2 + to * eq3;
-}
-
-inline float bspline(float eq0, float eq1, float eq2, float eq3, float c0, float c1, float c2, float c3)
-{
-    return c0 * eq0 + c1 * eq1 + c2 * eq2 + c3 * eq3;
-}
-
-inline float hermite(float h00, float h01, float h10, float h11, float from, float out, float to, float in)
-{
-    return h00 * from + h01 * to + h10 * out + h11 * in;
-}
-
-inline float hermiteFlat(float h00, float h01, float from, float to)
-{
-    return h00 * from + h01 * to;
-}
-
-inline float hermiteSmooth(float h00, float h01, float h10, float h11, float from, float out, float to, float in)
-{
-    return h00 * from + h01 * to + h10 * out + h11 * in;
-}
-
-inline float lerpInl(float s, float from, float to)
-{
-    return from + (to - from) * s;
-}
-
-}

+ 3 - 3
gameplay/src/Effect.cpp

@@ -103,7 +103,7 @@ Effect* Effect::createFromSource(const char* vshSource, const char* fshSource, c
 }
 
 
-void replaceDefines(const char* defines, std::string& out)
+static void replaceDefines(const char* defines, std::string& out)
 {
     if (defines && strlen(defines) != 0)
     {
@@ -121,7 +121,7 @@ void replaceDefines(const char* defines, std::string& out)
 #endif
 }
 
-void replaceIncludes(const char* filepath, const char* source, std::string& out)
+static void replaceIncludes(const char* filepath, const char* source, std::string& out)
 {
     // Replace the #include "xxxx.xxx" with the sourced file contents of "filepath/xxxx.xxx"
     std::string str = source;
@@ -197,7 +197,7 @@ void replaceIncludes(const char* filepath, const char* source, std::string& out)
     }
 }
 
-void writeShaderToErrorFile(const char* filePath, const char* source)
+static void writeShaderToErrorFile(const char* filePath, const char* source)
 {
     std::string path = filePath;
     path += ".err";

+ 1 - 0
gameplay/src/FileSystem.cpp

@@ -68,6 +68,7 @@ void makepath(std::string path, int mode)
 }
 #endif
 
+/** @script{ignore} */
 static std::string __resourcePath("./");
 static std::map<std::string, std::string> __aliases;
 

+ 2 - 0
gameplay/src/FileSystem.h

@@ -89,6 +89,7 @@ public:
      * @param files The vector to append the files to.
      * 
      * @return True if successful, false if error.
+     * @script{ignore}
      */
     static bool listFiles(const char* dirPath, std::vector<std::string>& files);
 
@@ -110,6 +111,7 @@ public:
      * @param mode The mode used to open the file, passed directly to fopen.
      * 
      * @see setResourcePath(const char*)
+     * @script{ignore}
      */
     static FILE* openFile(const char* filePath, const char* mode);
 

+ 4 - 4
gameplay/src/Font.cpp

@@ -172,10 +172,10 @@ unsigned int Font::getSize()
     return _size;
 }
 
-void Font::begin()
+void Font::start()
 {
     GP_ASSERT(_batch);
-    _batch->begin();
+    _batch->start();
 }
 
 Font::Text* Font::createText(const char* text, const Rectangle& area, const Vector4& color, unsigned int size, Justify justify,
@@ -733,10 +733,10 @@ void Font::drawText(const char* text, const Rectangle& area, const Vector4& colo
     }
 }
 
-void Font::end()
+void Font::finish()
 {
     GP_ASSERT(_batch);
-    _batch->end();
+    _batch->finish();
 }
 
 void Font::measureText(const char* text, unsigned int size, unsigned int* width, unsigned int* height)

+ 4 - 4
gameplay/src/Font.h

@@ -155,14 +155,14 @@ public:
     unsigned int getSize();
 
     /**
-     * Begins text drawing for this font.
+     * Starts text drawing for this font.
      */
-    void begin();
+    void start();
 
     /**
-     * Ends text batching for this font and renders all drawn text.
+     * Finishes text batching for this font and renders all drawn text.
      */
-    void end();
+    void finish();
 
     /**
      * Draws the specified text in a solid color, with a scaling factor.

+ 3 - 3
gameplay/src/Form.cpp

@@ -311,7 +311,7 @@ void Form::setAutoHeight(bool autoHeight)
     }
 }
 
-Effect* createEffect()
+static Effect* createEffect()
 {
     Effect* effect = NULL;
     if (__formEffect == NULL)
@@ -564,9 +564,9 @@ void Form::draw()
             _spriteBatch = SpriteBatch::create(_frameBuffer->getRenderTarget()->getTexture());
             GP_ASSERT(_spriteBatch);
         }
-        _spriteBatch->begin();
+        _spriteBatch->start();
         _spriteBatch->draw(_bounds.x, _bounds.y, 0, _bounds.width, _bounds.height, 0, _v1, _u2, 0, Vector4::one());
-        _spriteBatch->end();
+        _spriteBatch->finish();
     }
 }
 

+ 1 - 1
gameplay/src/Form.h

@@ -196,7 +196,7 @@ private:
      *
      * @return The next highest power of two after x, or x if it is already a power of two.
      */
-    static unsigned int nextPowerOfTwo(unsigned int v);
+    static unsigned int nextPowerOfTwo(unsigned int x);
 
     /**
      * Unproject a point (from a mouse or touch event) into the scene and then project it onto the form.

+ 104 - 7
gameplay/src/Game.cpp

@@ -4,6 +4,8 @@
 #include "RenderState.h"
 #include "FileSystem.h"
 #include "FrameBuffer.h"
+#include "SceneLoader.h"
+#include "ScriptListener.h"
 
 GLenum __gl_error_code = GL_NO_ERROR;
 ALenum __al_error_code = AL_NO_ERROR;
@@ -19,15 +21,33 @@ Game::Game()
     : _initialized(false), _state(UNINITIALIZED), 
       _frameLastFPS(0), _frameCount(0), _frameRate(0), 
       _clearDepth(1.0f), _clearStencil(0), _properties(NULL),
-      _animationController(NULL), _audioController(NULL), _physicsController(NULL), _aiController(NULL), _audioListener(NULL)
+      _animationController(NULL), _audioController(NULL), 
+      _physicsController(NULL), _aiController(NULL), _audioListener(NULL), 
+      _gamepads(NULL), _timeEvents(NULL), _scriptController(NULL), _scriptListeners(NULL)
 {
     GP_ASSERT(__gameInstance == NULL);
     __gameInstance = this;
+    _gamepads = new std::vector<Gamepad*>;
     _timeEvents = new std::priority_queue<TimeEvent, std::vector<TimeEvent>, std::less<TimeEvent> >();
 }
 
 Game::~Game()
 {
+    if (_scriptListeners)
+    {
+        for (unsigned int i = 0; i < _scriptListeners->size(); i++)
+        {
+            SAFE_DELETE((*_scriptListeners)[i]);
+        }
+        SAFE_DELETE(_scriptListeners);
+    }
+
+    if (_scriptController)
+    {
+        _scriptController->finalize();
+        SAFE_DELETE(_scriptController);
+    }
+
     // Do not call any virtual functions from the destructor.
     // Finalization is done from outside this class.
     SAFE_DELETE(_timeEvents);
@@ -105,6 +125,44 @@ bool Game::startup()
 
     loadGamepads();
     
+    _scriptController = new ScriptController();
+    _scriptController->initialize();
+
+    // Set the script callback functions.
+    if (_properties)
+    {
+        Properties* scripts = _properties->getNamespace("scripts", true);
+        if (scripts)
+        {
+            const char* name;
+            while ((name = scripts->getNextProperty()) != NULL)
+            {
+                ScriptController::ScriptCallback callback = ScriptController::toCallback(name);
+                if (callback != ScriptController::INVALID_CALLBACK)
+                {
+                    std::string url = scripts->getString();
+                    std::string file;
+                    std::string id;
+                    splitURL(url, &file, &id);
+
+                    if (file.size() <= 0 || id.size() <= 0)
+                    {
+                        GP_ERROR("Invalid %s script callback function '%s'.", name, url.c_str());
+                    }
+                    else
+                    {
+                        _scriptController->loadScript(file.c_str());
+                        _scriptController->registerCallback(callback, id);
+                    }
+                }
+                else
+                {
+                    // Ignore everything else.
+                }
+            }
+        }
+    }
+
     _state = RUNNING;
 
     return true;
@@ -122,13 +180,20 @@ void Game::shutdown()
 
         Platform::signalShutdown();
         finalize();
+
         
-        for (std::vector<Gamepad*>::iterator itr = _gamepads.begin(); itr != _gamepads.end(); itr++)
+        std::vector<Gamepad*>::iterator itr = _gamepads->begin();
+        std::vector<Gamepad*>::iterator end = _gamepads->end();
+        while (itr != end)
         {
-            SAFE_DELETE((*itr));
+            SAFE_DELETE(*itr);
+            itr++;
         }
-        _gamepads.clear();
+        _gamepads->clear();
+        SAFE_DELETE(_gamepads);
         
+        _scriptController->finalizeGame();
+
         _animationController->finalize();
         SAFE_DELETE(_animationController);
 
@@ -137,10 +202,12 @@ void Game::shutdown()
 
         _physicsController->finalize();
         SAFE_DELETE(_physicsController);
-
         _aiController->finalize();
         SAFE_DELETE(_aiController);
 
+        // Note: we do not clean up the script controller here
+        // because users can call Game::exit() from a script.
+
         SAFE_DELETE(_audioListener);
 
         RenderState::finalize();
@@ -195,6 +262,7 @@ void Game::frame()
     if (!_initialized)
     {
         initialize();
+        _scriptController->initializeGame();
         _initialized = true;
     }
 
@@ -226,12 +294,18 @@ void Game::frame()
         // Application Update.
         update(elapsedTime);
 
+        // Run script update.
+        _scriptController->update(elapsedTime);
+
         // Audio Rendering.
         _audioController->update(elapsedTime);
 
         // Graphics Rendering.
         render(elapsedTime);
-        
+
+        // Run script render.
+        _scriptController->render(elapsedTime);
+
         // Update FPS.
         ++_frameCount;
         if ((Game::getGameTime() - _frameLastFPS) >= 1000)
@@ -246,11 +320,23 @@ void Game::frame()
         // Application Update.
         update(0);
 
+        // Script update.
+        _scriptController->update(0);
+
         // Graphics Rendering.
         render(0);
+
+        // Script render.
+        _scriptController->render(0);
     }
 }
 
+void Game::renderOnce(const char* function)
+{
+    _scriptController->executeFunction<void>(function, NULL);
+    Platform::swapBuffers();
+}
+
 void Game::updateOnce()
 {
     GP_ASSERT(_animationController);
@@ -269,6 +355,7 @@ void Game::updateOnce()
     _physicsController->update(elapsedTime);
     _aiController->update(elapsedTime);
     _audioController->update(elapsedTime);
+    _scriptController->update(elapsedTime);
 }
 
 void Game::setViewport(const Rectangle& viewport)
@@ -357,6 +444,16 @@ void Game::schedule(float timeOffset, TimeListener* timeListener, void* cookie)
     _timeEvents->push(timeEvent);
 }
 
+void Game::schedule(float timeOffset, const char* function)
+{
+    if (!_scriptListeners)
+        _scriptListeners = new std::vector<ScriptListener*>();
+
+    ScriptListener* listener = new ScriptListener(function);
+    _scriptListeners->push_back(listener);
+    schedule(timeOffset, listener, NULL);
+}
+
 void Game::fireTimeEvents(double frameTime)
 {
     while (_timeEvents->size() > 0)
@@ -434,7 +531,7 @@ Gamepad* Game::createGamepad(const char* gamepadId, const char* gamepadFormPath)
     GP_ASSERT(gamepadFormPath);
     Gamepad* gamepad = new Gamepad(gamepadId, gamepadFormPath);
     GP_ASSERT(gamepad);
-    _gamepads.push_back(gamepad);
+    _gamepads->push_back(gamepad);
 
     return gamepad;
 }

+ 37 - 1
gameplay/src/Game.h

@@ -19,6 +19,8 @@
 namespace gameplay
 {
 
+class ScriptController;
+
 /**
  * Defines the basic game initialization, logic and platform delegates.
  */
@@ -226,6 +228,14 @@ public:
      */
     inline AIController* getAIController() const;
 
+    /**
+     * Gets the script controller for managing control of Lua scripts
+     * associated with the game.
+     * 
+     * @return The script controller for this game.
+     */
+    inline ScriptController* getScriptController() const;
+
     /**
      * Gets the audio listener for 3D audio.
      * 
@@ -376,9 +386,22 @@ public:
      * @param timeOffset The number of game milliseconds in the future to schedule the event to be fired.
      * @param timeListener The TimeListener that will receive the event.
      * @param cookie The cookie data that the time event will contain.
+     * @script{ignore}
      */
     void schedule(float timeOffset, TimeListener* timeListener, void* cookie = 0);
 
+    /**
+     * Schedules a time event to be sent to the given TimeListener a given number of game milliseconds from now.
+     * Game time stops while the game is paused. A time offset of zero will fire the time event in the next frame.
+     * 
+     * Note: the given Lua function must take a single floating point number, which is the difference between the
+     * current game time and the target time (see TimeListener::timeEvent).
+     * 
+     * @param timeOffset The number of game milliseconds in the future to schedule the event to be fired.
+     * @param function The Lua script function that will receive the event.
+     */
+    void schedule(float timeOffset, const char* function);
+
 protected:
 
     /**
@@ -424,6 +447,14 @@ protected:
     template <class T>
     void renderOnce(T* instance, void (T::*method)(void*), void* cookie);
 
+    /**
+     * Renders a single frame once and then swaps it to the display.
+     * This calls the given Lua function, which should take no parameters and return nothing (void).
+     *
+     * This is useful for rendering splash screens.
+     */
+    void renderOnce(const char* function);
+
     /**
      * Updates the game's internal systems (audio, animation, physics) once.
      * 
@@ -485,6 +516,9 @@ private:
 
     /** 
      * Creates a Gamepad object from a .form file.
+     *
+     * @param gamepadId The gamepad id (typically equal to the corresponding player's number).
+     * @param gamepadFormPath The path to the .form file.
      */
     Gamepad* createGamepad(const char* gamepadId, const char* gamepadFormPath);
 
@@ -507,8 +541,10 @@ private:
     PhysicsController* _physicsController;      // Controls the simulation of a physics scene and entities.
     AIController* _aiController;                // Controls AI siulation.
     AudioListener* _audioListener;              // The audio listener in 3D space.
-    std::vector<Gamepad*> _gamepads;            // The connected gamepads.
+    std::vector<Gamepad*>* _gamepads;           // The connected gamepads.
     std::priority_queue<TimeEvent, std::vector<TimeEvent>, std::less<TimeEvent> >* _timeEvents;     // Contains the scheduled time events.
+    ScriptController* _scriptController;            // Controls the scripting engine.
+    std::vector<ScriptListener*>* _scriptListeners; // Lua script listeners.
 
     // Note: Do not add STL object member variables on the stack; this will cause false memory leaks to be reported.
 

+ 10 - 4
gameplay/src/Game.inl

@@ -49,6 +49,10 @@ inline PhysicsController* Game::getPhysicsController() const
     return _physicsController;
 }
 
+inline ScriptController* Game::getScriptController() const
+{
+    return _scriptController;
+}
 inline AIController* Game::getAIController() const
 {
     return _aiController;
@@ -62,6 +66,8 @@ void Game::renderOnce(T* instance, void (T::*method)(void*), void* cookie)
     Platform::swapBuffers();
 }
 
+
+
 inline bool Game::hasMouse()
 {
     return Platform::hasMouse();
@@ -109,15 +115,15 @@ inline void Game::displayKeyboard(bool display)
 
 inline unsigned int Game::getGamepadCount() const
 {
-    return _gamepads.size();
+    return _gamepads->size();
 }
 
 inline Gamepad* Game::getGamepad(unsigned int index) const
 {
-    GP_ASSERT(index < _gamepads.size());
+    GP_ASSERT(index < _gamepads->size());
 
-    if (!_gamepads.empty())
-        return _gamepads[index];
+    if (!_gamepads->empty())
+        return _gamepads->at(index);
     else
         return NULL;
 }

+ 3 - 2
gameplay/src/Gamepad.cpp

@@ -56,14 +56,15 @@ Gamepad::~Gamepad()
     {
         SAFE_RELEASE((*itr));
     }
+    _joysticks.clear();
 
     for (std::vector<Button*>::iterator itr = _buttons.begin(); itr!= _buttons.end(); itr++)
     {
         SAFE_RELEASE((*itr));
     }
+    _buttons.clear();
 
-    if (_gamepadForm)
-        SAFE_RELEASE(_gamepadForm);
+    SAFE_RELEASE(_gamepadForm);
 }
 
 const char* Gamepad::getId() const

+ 5 - 3
gameplay/src/Gamepad.h

@@ -112,14 +112,16 @@ private:
 
     /**
      * Constructor.
+     * 
+     * @param id The gamepad's id.
      */
     Gamepad(const char* id);
     
     /**
-     * Constructor.
-     * Create a gamepad from the specified formPath.
+     * Constructs a gamepad from the specified .form file.
      *
-     * @param formPath
+     * @param id The gamepad's id.
+     * @param formPath The path the the .form file.
      */ 
     Gamepad(const char* id, const char* formPath);
 

+ 1 - 0
gameplay/src/Image.h

@@ -34,6 +34,7 @@ public:
      * Gets the image's raw pixel data.
      * 
      * @return The image's pixel data.
+     * @script{ignore}
      */
     inline unsigned char* getData() const;
 

+ 2 - 2
gameplay/src/Joystick.cpp

@@ -195,7 +195,7 @@ void Joystick::update(const Control* container, const Vector2& offset)
 void Joystick::drawImages(SpriteBatch* spriteBatch, const Rectangle& clip)
 {
     GP_ASSERT(spriteBatch);
-    spriteBatch->begin();
+    spriteBatch->start();
 
     // If the joystick is not absolute, then only draw if it is active.
     if (_absolute || (!_absolute && _state == ACTIVE))
@@ -242,7 +242,7 @@ void Joystick::drawImages(SpriteBatch* spriteBatch, const Rectangle& clip)
             spriteBatch->draw(region.x, region.y, _region.width, _region.height, uvs.u1, uvs.v1, uvs.u2, uvs.v2, color);
         }
     }
-    spriteBatch->end();
+    spriteBatch->finish();
 }
 
 const char* Joystick::getType() const

+ 2 - 2
gameplay/src/Joystick.h

@@ -49,7 +49,7 @@ public:
      * Sets the region within which the joystick will be spontaneously created on a user's touch.
      * 
      * Note: This does not actually enable spontaneous joystick creation on touch input.
-     * To enable (or disable) absolute position explicitly, use #setAbsolute.
+     * To enable (or disable) absolute position explicitly, use setAbsolute(bool).
      * 
      * @param region The region to use.
      */
@@ -60,7 +60,7 @@ public:
      * 
      * Note: just because the returned region is not empty does not mean that it is necessarily
      * being used. If absolute positioning is not enabled, then it will be used (to check if
-     * absolute positioning is enabled, call #isAbsolute).
+     * absolute positioning is enabled, call isAbsolute()).
      * 
      * @return The region within which the joystick will be spontaneously created on a user's touch.
      */

+ 2 - 2
gameplay/src/Label.cpp

@@ -100,9 +100,9 @@ void Label::drawText(const Rectangle& clip)
     // Draw the text.
     if (_font)
     {
-        _font->begin();
+        _font->start();
         _font->drawText(_text.c_str(), _textBounds, _textColor, getFontSize(_state), getTextAlignment(_state), true, getTextRightToLeft(_state), &_viewportClipBounds);
-        _font->end();
+        _font->finish();
     }
 
     _dirty = false;

+ 3 - 0
gameplay/src/Light.h

@@ -239,8 +239,11 @@ private:
     
     union
     {
+        /** @script{ignore} */
         Directional* _directional;
+        /** @script{ignore} */
         Point* _point;
+        /** @script{ignore} */
         Spot* _spot;
     };
     Node* _node;

+ 3 - 3
gameplay/src/Material.cpp

@@ -256,7 +256,7 @@ bool Material::loadPass(Technique* technique, Properties* passProperties)
     return true;
 }
 
-bool isMaterialKeyword(const char* str)
+static bool isMaterialKeyword(const char* str)
 {
     GP_ASSERT(str);
 
@@ -277,7 +277,7 @@ bool isMaterialKeyword(const char* str)
     return false;
 }
 
-Texture::Filter parseTextureFilterMode(const char* str, Texture::Filter defaultValue)
+static Texture::Filter parseTextureFilterMode(const char* str, Texture::Filter defaultValue)
 {
     if (str == NULL || strlen(str) == 0)
     {
@@ -315,7 +315,7 @@ Texture::Filter parseTextureFilterMode(const char* str, Texture::Filter defaultV
     }
 }
 
-Texture::Wrap parseTextureWrapMode(const char* str, Texture::Wrap defaultValue)
+static Texture::Wrap parseTextureWrapMode(const char* str, Texture::Wrap defaultValue)
 {
     if (str == NULL || strlen(str) == 0)
     {

+ 91 - 0
gameplay/src/MaterialParameter.cpp

@@ -1,5 +1,6 @@
 #include "Base.h"
 #include "MaterialParameter.h"
+#include "Node.h"
 
 namespace gameplay
 {
@@ -295,6 +296,96 @@ void MaterialParameter::bind(Effect* effect)
     }
 }
 
+void MaterialParameter::bindValue(Node* node, const char* binding)
+{
+    GP_ASSERT(binding);
+
+    if (strcmp(binding, "&Node::getBackVector") == 0)
+    {
+        bindValue<Node, Vector3>(node, &Node::getBackVector);
+    }
+    else if (strcmp(binding, "&Node::getDownVector") == 0)
+    {
+        bindValue<Node, Vector3>(node, &Node::getDownVector);
+    }
+    else if (strcmp(binding, "&Node::getTranslationWorld") == 0)
+    {
+        bindValue<Node, Vector3>(node, &Node::getTranslationWorld);
+    }
+    else if (strcmp(binding, "&Node::getTranslationView") == 0)
+    {
+        bindValue<Node, Vector3>(node, &Node::getTranslationView);
+    }
+    else if (strcmp(binding, "&Node::getForwardVector") == 0)
+    {
+        bindValue<Node, Vector3>(node, &Node::getForwardVector);
+    }
+    else if (strcmp(binding, "&Node::getForwardVectorWorld") == 0)
+    {
+        bindValue<Node, Vector3>(node, &Node::getForwardVectorWorld);
+    }
+    else if (strcmp(binding, "&Node::getForwardVectorView") == 0)
+    {
+        bindValue<Node, Vector3>(node, &Node::getForwardVectorView);
+    }
+    else if (strcmp(binding, "&Node::getLeftVector") == 0)
+    {
+        bindValue<Node, Vector3>(node, &Node::getLeftVector);
+    }
+    else if (strcmp(binding, "&Node::getRightVector") == 0)
+    {
+        bindValue<Node, Vector3>(node, &Node::getRightVector);
+    }
+    else if (strcmp(binding, "&Node::getRightVectorWorld") == 0)
+    {
+        bindValue<Node, Vector3>(node, &Node::getRightVectorWorld);
+    }
+    else if (strcmp(binding, "&Node::getUpVector") == 0)
+    {
+        bindValue<Node, Vector3>(node, &Node::getUpVector);
+    }
+    else if (strcmp(binding, "&Node::getUpVectorWorld") == 0)
+    {
+        bindValue<Node, Vector3>(node, &Node::getUpVectorWorld);
+    }
+    else if (strcmp(binding, "&Node::getActiveCameraTranslationWorld") == 0)
+    {
+        bindValue<Node, Vector3>(node, &Node::getActiveCameraTranslationWorld);
+    }
+    else if (strcmp(binding, "&Node::getActiveCameraTranslationView") == 0)
+    {
+        bindValue<Node, Vector3>(node, &Node::getActiveCameraTranslationView);
+    }
+    else if (strcmp(binding, "&Node::getScaleX") == 0)
+    {
+        bindValue<Node, float>(node, &Node::getScaleX);
+    }
+    else if (strcmp(binding, "&Node::getScaleY") == 0)
+    {
+        bindValue<Node, float>(node, &Node::getScaleY);
+    }
+    else if (strcmp(binding, "&Node::getScaleZ") == 0)
+    {
+        bindValue<Node, float>(node, &Node::getScaleZ);
+    }
+    else if (strcmp(binding, "&Node::getTranslationX") == 0)
+    {
+        bindValue<Node, float>(node, &Node::getTranslationX);
+    }
+    else if (strcmp(binding, "&Node::getTranslationY") == 0)
+    {
+        bindValue<Node, float>(node, &Node::getTranslationY);
+    }
+    else if (strcmp(binding, "&Node::getTranslationZ") == 0)
+    {
+        bindValue<Node, float>(node, &Node::getTranslationZ);
+    }
+    else
+    {
+        GP_ERROR("Unsupported material parameter binding '%s'.", binding);
+    }
+}
+
 unsigned int MaterialParameter::getAnimationPropertyComponentCount(int propertyId) const
 {
     switch (propertyId)

+ 41 - 3
gameplay/src/MaterialParameter.h

@@ -11,6 +11,7 @@
 
 namespace gameplay
 {
+    class Node;
 
 /**
  * Defines a material parameter.
@@ -152,17 +153,48 @@ public:
     void bindValue(ClassType* classInstance, ParameterType (ClassType::*valueMethod)() const, unsigned int (ClassType::*countMethod)() const);
 
     /**
-     * @see AnimationTarget#getAnimationPropertyComponentCount
+     * Binds the return value of the supported class method for the given node to this material parameter.
+     * 
+     * Note: intended for use from Lua scripts.
+     * 
+     * @param node The node containing the the member method to bind.
+     * @param binding The name of the class method to bind (in the format '&class::method').
+     *      Note: this name must be one of the following supported methods:
+     *      - "&Node::getBackVector"
+     *      - "&Node::getDownVector"
+     *      - "&Node::getTranslationWorld"
+     *      - "&Node::getTranslationView"
+     *      - "&Node::getForwardVector"
+     *      - "&Node::getForwardVectorWorld"
+     *      - "&Node::getForwardVectorView"
+     *      - "&Node::getLeftVector"
+     *      - "&Node::getRightVector"
+     *      - "&Node::getRightVectorWorld"
+     *      - "&Node::getUpVector"
+     *      - "&Node::getUpVectorWorld"
+     *      - "&Node::getActiveCameraTranslationWorld"
+     *      - "&Node::getActiveCameraTranslationView"
+     *      - "&Node::getScaleX"
+     *      - "&Node::getScaleY"
+     *      - "&Node::getScaleZ"
+     *      - "&Node::getTranslationX"
+     *      - "&Node::getTranslationY"
+     *      - "&Node::getTranslationZ"
+     */
+    void bindValue(Node* node, const char* binding);
+
+    /**
+     * @see AnimationTarget::getAnimationPropertyComponentCount
      */
     unsigned int getAnimationPropertyComponentCount(int propertyId) const;
 
     /**
-     * @see AnimationTarget#getAnimationProperty
+     * @see AnimationTarget::getAnimationProperty
      */
     void getAnimationPropertyValue(int propertyId, AnimationValue* value);
 
     /**
-     * @see AnimationTarget#setAnimationProperty
+     * @see AnimationTarget::setAnimationProperty
      */
     void setAnimationPropertyValue(int propertyId, AnimationValue* value, float blendWeight = 1.0f);
 
@@ -248,11 +280,17 @@ private:
     
     union
     {
+        /** @script{ignore} */
         float floatValue;
+        /** @script{ignore} */
         int intValue;
+        /** @script{ignore} */
         float* floatPtrValue;
+        /** @script{ignore} */
         int* intPtrValue;
+        /** @script{ignore} */
         const Texture::Sampler* samplerValue;
+        /** @script{ignore} */
         MethodBinding* method;
     } _value;
     

+ 1 - 1
gameplay/src/Mesh.cpp

@@ -282,7 +282,7 @@ void Mesh::setPrimitiveType(PrimitiveType type)
     _primitiveType = type;
 }
 
-void Mesh::setVertexData(void* vertexData, unsigned int vertexStart, unsigned int vertexCount)
+void Mesh::setVertexData(float* vertexData, unsigned int vertexStart, unsigned int vertexCount)
 {
     GL_ASSERT( glBindBuffer(GL_ARRAY_BUFFER, _vertexBuffer) );
 

+ 1 - 1
gameplay/src/Mesh.h

@@ -197,7 +197,7 @@ public:
      * @param vertexStart The index of the starting vertex (0 by default).
      * @param vertexCount The number of vertices to be set (default is 0, for all vertices).
      */
-    void setVertexData(void* vertexData, unsigned int vertexStart = 0, unsigned int vertexCount = 0);
+    void setVertexData(float* vertexData, unsigned int vertexStart = 0, unsigned int vertexCount = 0);
 
     /**
      * Creates and adds a new part of primitive data defining how the vertices are connected.

+ 3 - 3
gameplay/src/MeshBatch.cpp

@@ -114,7 +114,7 @@ bool MeshBatch::resize(unsigned int capacity)
     // (we only know how many indices will be stored). Assume the worst case
     // for now, which is the same number of vertices as indices.
     unsigned int indexCapacity = vertexCapacity;
-    if (indexCapacity > USHRT_MAX)
+    if (_indexed && indexCapacity > USHRT_MAX)
     {
         GP_ERROR("Index capacity is greater than the maximum unsigned short value (%d > %d).", indexCapacity, USHRT_MAX);
         return false;
@@ -156,7 +156,7 @@ bool MeshBatch::resize(unsigned int capacity)
     return true;
 }
     
-void MeshBatch::begin()
+void MeshBatch::start()
 {
     _vertexCount = 0;
     _indexCount = 0;
@@ -164,7 +164,7 @@ void MeshBatch::begin()
     _indicesPtr = _indices;
 }
 
-void MeshBatch::end()
+void MeshBatch::finish()
 {
 }
 

+ 4 - 4
gameplay/src/MeshBatch.h

@@ -91,21 +91,21 @@ public:
     void add(T* vertices, unsigned int vertexCount, unsigned short* indices = NULL, unsigned int indexCount = 0);
 
     /**
-     * Begins batching.
+     * Starts batching.
      *
      * This method should be called before calling add() to add primitives to the batch.
-     * After all primitives have been added to the batch, call the end() method to
+     * After all primitives have been added to the batch, call the finish() method to
      * complete the batch.
      *
      * Calling this method will clear any primitives currently in the batch and set the
      * position of the batch back to the beginning.
      */
-    void begin();
+    void start();
 
     /**
      * Indicates that batching is complete and prepares the batch for drawing.
      */
-    void end();
+    void finish();
 
     /**
      * Draws the primitives currently in batch.

+ 1 - 0
gameplay/src/MeshPart.h

@@ -70,6 +70,7 @@ public:
      * @param indexData The index data to be set.
      * @param indexStart The index to start from.
      * @param indexCount The number of indices to be set.
+     * @script{ignore}
      */
     void setIndexData(void* indexData, unsigned int indexStart, unsigned int indexCount);
 

+ 1 - 0
gameplay/src/Node.cpp

@@ -1,4 +1,5 @@
 #include "Base.h"
+#include "AudioSource.h"
 #include "Node.h"
 #include "Scene.h"
 #include "Joint.h"

+ 4 - 1
gameplay/src/Node.h

@@ -6,7 +6,6 @@
 #include "Light.h"
 #include "Model.h"
 #include "Form.h"
-#include "AudioSource.h"
 #include "ParticleEmitter.h"
 #include "PhysicsRigidBody.h"
 #include "PhysicsCollisionObject.h"
@@ -17,6 +16,7 @@
 namespace gameplay
 {
 
+class AudioSource;
 class Bundle;
 class Scene;
 class Form;
@@ -174,6 +174,7 @@ public:
      *
      * @return The user pointer for this node.
      * @see setUserPointer(void*)
+     * @script{ignore}
      */
     void* getUserPointer() const;
 
@@ -195,6 +196,7 @@ public:
      *      Node is being destroyed (or when the user pointer changes),
      *      to allow the user to cleanup any memory associated with the
      *      user pointer.
+     * @script{ignore}
      */
     void setUserPointer(void* pointer, void (*cleanupCallback)(void*) = NULL);
 
@@ -231,6 +233,7 @@ public:
      *        or false if nodes that start with the given ID are returned.
      * 
      * @return The number of matches found.
+     * @script{ignore}
      */
     unsigned int findNodes(const char* id, std::vector<Node*>& nodes, bool recursive = true, bool exactMatch = true) const;
 

+ 7 - 2
gameplay/src/ParticleEmitter.cpp

@@ -356,6 +356,11 @@ void ParticleEmitter::setEllipsoid(bool ellipsoid)
     _ellipsoid = ellipsoid;
 }
 
+bool ParticleEmitter::isEllipsoid() const
+{
+    return _ellipsoid;
+}
+
 void ParticleEmitter::setSize(float startMin, float startMax, float endMin, float endMax)
 {
     _sizeStartMin = startMin;
@@ -929,7 +934,7 @@ void ParticleEmitter::draw()
         }
 
         // Begin sprite batch drawing
-        _spriteBatch->begin();
+        _spriteBatch->start();
 
         // 2D Rotation.
         static const Vector2 pivot(0.5f, 0.5f);
@@ -956,7 +961,7 @@ void ParticleEmitter::draw()
         }
 
         // Render.
-        _spriteBatch->end();
+        _spriteBatch->finish();
     }
 }
 

+ 1 - 0
gameplay/src/Pass.h

@@ -37,6 +37,7 @@ public:
 
     /**
      * Get a list of properties to be auto-bound.
+     * @script{ignore}
      */
     const std::vector<std::string>* getAutoBindProperties() const;
 

+ 6 - 3
gameplay/src/PhysicsCharacter.cpp

@@ -13,6 +13,9 @@
 namespace gameplay
 {
 
+/**
+ * @script{ignore}
+ */
 class ClosestNotMeConvexResultCallback : public btCollisionWorld::ClosestConvexResultCallback
 {
 public:
@@ -560,7 +563,7 @@ void PhysicsCharacter::stepDown(btCollisionWorld* collisionWorld, btScalar time)
 /*
  * Returns the reflection direction of a ray going 'direction' hitting a surface with normal 'normal'.
  */
-btVector3 computeReflectionDirection(const btVector3& direction, const btVector3& normal)
+static btVector3 computeReflectionDirection(const btVector3& direction, const btVector3& normal)
 {
     return direction - (btScalar(2.0) * direction.dot(normal)) * normal;
 }
@@ -568,7 +571,7 @@ btVector3 computeReflectionDirection(const btVector3& direction, const btVector3
 /*
  * Returns the portion of 'direction' that is parallel to 'normal'.
  */
-btVector3 parallelComponent(const btVector3& direction, const btVector3& normal)
+static btVector3 parallelComponent(const btVector3& direction, const btVector3& normal)
 {
     btScalar magnitude = direction.dot(normal);
     return normal * magnitude;
@@ -577,7 +580,7 @@ btVector3 parallelComponent(const btVector3& direction, const btVector3& normal)
 /*
  * Returns the portion of 'direction' that is perpindicular to 'normal'.
  */
-btVector3 perpindicularComponent(const btVector3& direction, const btVector3& normal)
+static btVector3 perpindicularComponent(const btVector3& direction, const btVector3& normal)
 {
     return direction - parallelComponent(direction, normal);
 }

+ 3 - 1
gameplay/src/PhysicsCharacter.h

@@ -26,7 +26,7 @@ class PhysicsCharacter : public PhysicsGhostObject, public btActionInterface
 public:
 
     /**
-     * @see PhysicsCollisionObject#getType
+     * @see PhysicsCollisionObject::getType
      */
     PhysicsCollisionObject::Type getType() const;
 
@@ -167,11 +167,13 @@ public:
 
     /**
      * @see btActionInterface::updateAction
+     * @script{ignore}
      */
     void updateAction(btCollisionWorld* collisionWorld, btScalar deltaTimeStep);
 
     /**
      * @see btActionInterface::debugDraw
+     * @script{ignore}
      */
     void debugDraw(btIDebugDraw* debugDrawer);
 

+ 42 - 2
gameplay/src/PhysicsCollisionObject.cpp

@@ -3,12 +3,14 @@
 #include "PhysicsController.h"
 #include "Game.h"
 #include "Node.h"
+#include "ScriptListener.h"
 
 namespace gameplay
 {
 
 /**
  * Internal class used to implement the collidesWith(PhysicsCollisionObject*) function.
+ * @script{ignore}
  */
 struct CollidesWithCallback : public btCollisionWorld::ContactResultCallback
 {
@@ -28,7 +30,7 @@ struct CollidesWithCallback : public btCollisionWorld::ContactResultCallback
 };
 
 PhysicsCollisionObject::PhysicsCollisionObject(Node* node)
-    : _node(node), _motionState(NULL), _collisionShape(NULL), _enabled(true)
+    : _node(node), _motionState(NULL), _collisionShape(NULL), _enabled(true), _scriptListeners(NULL)
 {
 }
 
@@ -36,6 +38,15 @@ PhysicsCollisionObject::~PhysicsCollisionObject()
 {
     SAFE_DELETE(_motionState);
 
+    if (_scriptListeners)
+    {
+        for (unsigned int i = 0; i < _scriptListeners->size(); i++)
+        {
+            SAFE_DELETE((*_scriptListeners)[i]);
+        }
+        SAFE_DELETE(_scriptListeners);
+    }
+
     GP_ASSERT(Game::getInstance()->getPhysicsController());
     Game::getInstance()->getPhysicsController()->destroyShape(_collisionShape);
 }
@@ -87,6 +98,7 @@ void PhysicsCollisionObject::setEnabled(bool enable)
         if (!_enabled)
         {
             Game::getInstance()->getPhysicsController()->addCollisionObject(this);
+            _motionState->updateTransformFromNode();
             _enabled = true;
         }
     }
@@ -94,7 +106,7 @@ void PhysicsCollisionObject::setEnabled(bool enable)
     {
         if (_enabled)
         {
-            Game::getInstance()->getPhysicsController()->removeCollisionObject(this);
+            Game::getInstance()->getPhysicsController()->removeCollisionObject(this, false);
             _enabled = false;
         }
     }
@@ -112,6 +124,34 @@ void PhysicsCollisionObject::removeCollisionListener(CollisionListener* listener
     Game::getInstance()->getPhysicsController()->removeCollisionListener(listener, this, object);
 }
 
+void PhysicsCollisionObject::addCollisionListener(const char* function, PhysicsCollisionObject* object)
+{
+    if (!_scriptListeners)
+        _scriptListeners = new std::vector<ScriptListener*>();
+
+    ScriptListener* listener = new ScriptListener(function);
+    _scriptListeners->push_back(listener);
+    addCollisionListener(listener, object);
+}
+
+void PhysicsCollisionObject::removeCollisionListener(const char* function, PhysicsCollisionObject* object)
+{
+    if (!_scriptListeners)
+        return;
+
+    std::string functionStr = function;
+    for (unsigned int i = 0; i < _scriptListeners->size(); i++)
+    {
+        if ((*_scriptListeners)[i]->_function == functionStr)
+        {
+            removeCollisionListener((*_scriptListeners)[i], object);
+            SAFE_DELETE((*_scriptListeners)[i]);
+            _scriptListeners->erase(_scriptListeners->begin() + i);
+            return;
+        }
+    }
+}
+
 bool PhysicsCollisionObject::collidesWith(PhysicsCollisionObject* object) const
 {
     GP_ASSERT(Game::getInstance()->getPhysicsController() && Game::getInstance()->getPhysicsController()->_world);

+ 29 - 3
gameplay/src/PhysicsCollisionObject.h

@@ -8,6 +8,7 @@ namespace gameplay
 {
 
 class Node;
+class ScriptListener;
 
 /**
  * Base class for all gameplay physics objects that support collision events.
@@ -110,6 +111,9 @@ public:
         /**
          * Called when a collision occurs between two objects in the physics world.
          * 
+         * NOTE: You are not permitted to disable physics objects from within this callback. Disabling physics on a collision object
+         *  removes the object from the physics world. This is not permitted during the PhysicsController::update.
+         *
          * @param type The type of collision event.
          * @param collisionPair The two collision objects involved in the collision.
          * @param contactPointA The contact point with the first object (in world space).
@@ -176,7 +180,7 @@ public:
     bool isEnabled() const;
 
     /**
-     * Sets the collision object be enabled or disabled.
+     * Sets the collision object to be enabled or disabled.
      *
      * @param enable true enables the collision object, false disables it.
      */
@@ -198,6 +202,24 @@ public:
      */
     void removeCollisionListener(CollisionListener* listener, PhysicsCollisionObject* object = NULL);
 
+    /**
+     * Adds a collision listener for this collision object.
+     * 
+     * Note: the given Lua function must match the function signature of PhysicsCollisionObject::CollisionListener::collisionEvent.
+     * 
+     * @param function The Lua script function to add as a listener callback.
+     * @param object Optional collision object used to filter the collision event.
+     */
+    void addCollisionListener(const char* function, PhysicsCollisionObject* object = NULL);
+
+    /**
+     * Removes a collision listener.
+     *
+     * @param function The Lua function (used as a listener callback) to remove.
+     * @param object Optional collision object used to filter the collision event.
+     */
+    void removeCollisionListener(const char* function, PhysicsCollisionObject* object = NULL);
+
     /**
      * Checks if this collision object collides with the given object.
      * 
@@ -235,12 +257,12 @@ protected:
         virtual ~PhysicsMotionState();
 
         /**
-         * @see btMotionState#getWorldTransform
+         * @see btMotionState::getWorldTransform
          */
         virtual void getWorldTransform(btTransform &transform) const;
 
         /**
-         * @see btMotionState#setWorldTransform
+         * @see btMotionState::setWorldTransform
          */
         virtual void setWorldTransform(const btTransform &transform);
 
@@ -288,6 +310,10 @@ protected:
      */
     bool _enabled;
 
+    /**
+     * Lua script collision listeners.
+     */
+    std::vector<ScriptListener*>* _scriptListeners;
 };
 
 }

+ 1 - 0
gameplay/src/PhysicsCollisionShape.cpp

@@ -34,6 +34,7 @@ PhysicsCollisionShape::~PhysicsCollisionShape()
             if (_shapeData.heightfieldData)
             {
                 SAFE_DELETE_ARRAY(_shapeData.heightfieldData->heightData);
+                SAFE_DELETE_ARRAY(_shapeData.heightfieldData->normalData);
                 SAFE_DELETE(_shapeData.heightfieldData);
             }
             break;

+ 12 - 3
gameplay/src/PhysicsCollisionShape.h

@@ -76,11 +76,11 @@ public:
     private:
 
         /**
-         * Creates a PhysicsCollisionShape#Definition object from the given properties object (for the given node).
+         * Creates a PhysicsCollisionShape::Definition object from the given properties object (for the given node).
          * 
          * @param node The node to create the PhysicsCollisionShape::Definition object for.
-         * @param properties The properties object to create the PhysicsCollisionShape#Definition object from.
-         * @return A PhysicsCollisionShape#Definition object.
+         * @param properties The properties object to create the PhysicsCollisionShape::Definition object from.
+         * @return A PhysicsCollisionShape::Definition object.
          */
         static Definition* create(Node* node, Properties* properties);
 
@@ -94,10 +94,15 @@ public:
 
         union
         {
+            /** @script{ignore} */
             BoxData box;
+            /** @script{ignore} */
             SphereData sphere;
+            /** @script{ignore} */
             CapsuleData capsule;
+            /** @script{ignore} */
             Image* heightfield;
+            /** @script{ignore} */
             Mesh* mesh;
         } data;
 
@@ -119,6 +124,7 @@ public:
      * Returns the internal bullet physics shape object.
      *
      * @return The bullet shape object.
+     * @script{ignore}
      */
     btCollisionShape* getShape() const
     {
@@ -211,6 +217,7 @@ private:
     struct HeightfieldData
     {
         float* heightData;
+        Vector3* normalData;
         unsigned int width;
         unsigned int height;
         mutable Matrix inverse;
@@ -241,7 +248,9 @@ private:
     // Shape specific cached data
     union
     {
+        /** @script{ignore} */
         MeshData* meshData;
+        /** @script{ignore} */
         HeightfieldData* heightfieldData;
     } _shapeData;
 

+ 128 - 18
gameplay/src/PhysicsController.cpp

@@ -5,6 +5,7 @@
 #include "Game.h"
 #include "MeshPart.h"
 #include "Bundle.h"
+#include "ScriptListener.h"
 
 #include "BulletCollision/CollisionShapes/btHeightfieldTerrainShape.h"
 
@@ -20,10 +21,10 @@ const int PhysicsController::REGISTERED    = 0x04;
 const int PhysicsController::REMOVE        = 0x08;
 
 PhysicsController::PhysicsController()
-  : _collisionConfiguration(NULL), _dispatcher(NULL),
+  : _isUpdating(false), _collisionConfiguration(NULL), _dispatcher(NULL),
     _overlappingPairCache(NULL), _solver(NULL), _world(NULL), _ghostPairCallback(NULL),
     _debugDrawer(NULL), _status(PhysicsController::Listener::DEACTIVATED), _listeners(NULL),
-    _gravity(btScalar(0.0), btScalar(-9.8), btScalar(0.0)), _collisionCallback(NULL)
+    _gravity(btScalar(0.0), btScalar(-9.8), btScalar(0.0)), _collisionCallback(NULL), _scriptListeners(NULL)
 {
     // Default gravity is 9.8 along the negative Y axis.
     _collisionCallback = new CollisionCallback(this);
@@ -35,6 +36,15 @@ PhysicsController::~PhysicsController()
     SAFE_DELETE(_ghostPairCallback);
     SAFE_DELETE(_debugDrawer);
     SAFE_DELETE(_listeners);
+
+    if (_scriptListeners)
+    {
+        for (unsigned int i = 0; i < _scriptListeners->size(); i++)
+        {
+            SAFE_DELETE((*_scriptListeners)[i]);
+        }
+        SAFE_DELETE(_scriptListeners);
+    }
 }
 
 void PhysicsController::addStatusListener(Listener* listener)
@@ -62,6 +72,34 @@ void PhysicsController::removeStatusListener(Listener* listener)
     }
 }
 
+void PhysicsController::addStatusListener(const char* function)
+{
+    if (!_scriptListeners)
+        _scriptListeners = new std::vector<ScriptListener*>();
+
+    ScriptListener* listener = new ScriptListener(function);
+    _scriptListeners->push_back(listener);
+    addStatusListener(listener);
+}
+
+void PhysicsController::removeStatusListener(const char* function)
+{
+    if (!_scriptListeners)
+        return;
+
+    std::string functionStr = function;
+    for (unsigned int i = 0; i < _scriptListeners->size(); i++)
+    {
+        if ((*_scriptListeners)[i]->_function == functionStr)
+        {
+            removeStatusListener((*_scriptListeners)[i]);
+            SAFE_DELETE((*_scriptListeners)[i]);
+            _scriptListeners->erase(_scriptListeners->begin() + i);
+            return;
+        }
+    }
+}
+
 PhysicsFixedConstraint* PhysicsController::createFixedConstraint(PhysicsRigidBody* a, PhysicsRigidBody* b)
 {
     checkConstraintRigidBodies(a, b);
@@ -464,6 +502,7 @@ void PhysicsController::resume()
 void PhysicsController::update(float elapsedTime)
 {
     GP_ASSERT(_world);
+    _isUpdating = true;
 
     // Update the physics simulation, with a maximum
     // of 10 simulation steps being performed in a given frame.
@@ -575,6 +614,8 @@ void PhysicsController::update(float elapsedTime)
             iter->second._status &= ~COLLISION;
         }
     }
+
+    _isUpdating = false;
 }
 
 void PhysicsController::addCollisionListener(PhysicsCollisionObject::CollisionListener* listener, PhysicsCollisionObject* objectA, PhysicsCollisionObject* objectB)
@@ -634,10 +675,11 @@ void PhysicsController::addCollisionObject(PhysicsCollisionObject* object)
     }
 }
 
-void PhysicsController::removeCollisionObject(PhysicsCollisionObject* object)
+void PhysicsController::removeCollisionObject(PhysicsCollisionObject* object, bool removeListeners)
 {
     GP_ASSERT(object);
     GP_ASSERT(_world);
+    GP_ASSERT(!_isUpdating);
 
     // Remove the collision object from the world.
     if (object->getCollisionObject())
@@ -660,11 +702,14 @@ void PhysicsController::removeCollisionObject(PhysicsCollisionObject* object)
     }
 
     // Find all references to the object in the collision status cache and mark them for removal.
-    std::map<PhysicsCollisionObject::CollisionPair, CollisionInfo>::iterator iter = _collisionStatus.begin();
-    for (; iter != _collisionStatus.end(); iter++)
+    if (removeListeners)
     {
-        if (iter->first.objectA == object || iter->first.objectB == object)
-            iter->second._status |= REMOVE;
+        std::map<PhysicsCollisionObject::CollisionPair, CollisionInfo>::iterator iter = _collisionStatus.begin();
+        for (; iter != _collisionStatus.end(); iter++)
+        {
+            if (iter->first.objectA == object || iter->first.objectB == object)
+                iter->second._status |= REMOVE;
+        }
     }
 }
 
@@ -675,7 +720,7 @@ PhysicsCollisionObject* PhysicsController::getCollisionObject(const btCollisionO
     return reinterpret_cast<PhysicsCollisionObject*>(collisionObject->getUserPointer());
 }
 
-void getBoundingBox(Node* node, BoundingBox* out, bool merge = false)
+static void getBoundingBox(Node* node, BoundingBox* out, bool merge = false)
 {
     GP_ASSERT(node);
     GP_ASSERT(out);
@@ -701,7 +746,7 @@ void getBoundingBox(Node* node, BoundingBox* out, bool merge = false)
     }
 }
 
-void getBoundingSphere(Node* node, BoundingSphere* out, bool merge = false)
+static void getBoundingSphere(Node* node, BoundingSphere* out, bool merge = false)
 {
     GP_ASSERT(node);
     GP_ASSERT(out);
@@ -727,7 +772,7 @@ void getBoundingSphere(Node* node, BoundingSphere* out, bool merge = false)
     }
 }
 
-void computeCenterOfMass(const Vector3& center, const Vector3& scale, Vector3* centerOfMassOffset)
+static void computeCenterOfMass(const Vector3& center, const Vector3& scale, Vector3* centerOfMassOffset)
 {
     GP_ASSERT(centerOfMassOffset);
 
@@ -1020,6 +1065,7 @@ PhysicsCollisionShape* PhysicsController::createHeightfield(Node* node, Image* i
 
     PhysicsCollisionShape::HeightfieldData* heightfieldData = new PhysicsCollisionShape::HeightfieldData();
     heightfieldData->heightData = NULL;
+    heightfieldData->normalData = NULL;
     heightfieldData->inverseIsDirty = true;
 
     unsigned int sizeWidth = width;
@@ -1031,17 +1077,52 @@ PhysicsCollisionShape* PhysicsController::createHeightfield(Node* node, Image* i
     heightfieldData->width = sizeWidth + 1;
     heightfieldData->height = sizeHeight + 1;
     heightfieldData->heightData = new float[heightfieldData->width * heightfieldData->height];
-    unsigned int heightIndex = 0;
+    heightfieldData->normalData = new Vector3[heightfieldData->width * heightfieldData->height];
+    unsigned int heightIndex = 0, prevRowIndex = 0, prevColIndex = 0;
     float widthImageFactor = (float)(image->getWidth() - 1) / sizeWidth;
     float heightImageFactor = (float)(image->getHeight() - 1) / sizeHeight;
     float x = 0.0f;
     float z = 0.0f;
-    for (unsigned int row = 0, z = 0.0f; row <= sizeHeight; row++, z += 1.0f)
+    const float horizStepsize = 1.0f;
+    for (unsigned int row = 0, z = 0.0f; row <= sizeHeight; row++, z += horizStepsize)
     {
-        for (unsigned int col = 0, x = 0.0f; col <= sizeWidth; col++, x += 1.0f)
+        for (unsigned int col = 0, x = 0.0f; col <= sizeWidth; col++, x += horizStepsize)
         {
             heightIndex = row * heightfieldData->width + col;
+            prevRowIndex = heightIndex - heightfieldData->width; // ignored if row<1
+            prevColIndex = heightIndex - 1; // ignored if col<1
+
             heightfieldData->heightData[heightIndex] = calculateHeight(heights, image->getWidth(), image->getHeight(), x * widthImageFactor, (sizeHeight - z) * heightImageFactor);
+
+            //
+            // Normal calculation based on height data using a backward difference.
+            //
+            if (row == 0 || col == 0)
+            {
+                // This is just a safe default value.
+                heightfieldData->normalData[heightIndex].set(Vector3::unitY());
+            }
+            else
+            {
+                heightfieldData->normalData[heightIndex].set(
+                    heightfieldData->heightData[prevColIndex] - heightfieldData->heightData[heightIndex],
+                    horizStepsize,
+                    heightfieldData->heightData[prevRowIndex] - heightfieldData->heightData[heightIndex]);
+                heightfieldData->normalData[heightIndex].normalize();
+            }
+
+            // For the starting row, just copy from the second row (i.e., a forward difference).
+            if (row == 1)
+            {
+                heightfieldData->normalData[prevRowIndex].set(heightfieldData->normalData[heightIndex]);
+            }
+
+            // For the starting column, just copy from the second column (i.e., a forward difference).
+            // (We don't care which of the 2 valid sources heightfieldData->normalData[0] ultimately comes from).
+            if (col == 1)
+            {
+                heightfieldData->normalData[prevColIndex].set(heightfieldData->normalData[heightIndex]);
+            }
         }
     }
     SAFE_DELETE_ARRAY(heights);
@@ -1239,7 +1320,8 @@ void PhysicsController::destroyShape(PhysicsCollisionShape* shape)
     }
 }
 
-float PhysicsController::calculateHeight(float* data, unsigned int width, unsigned int height, float x, float y)
+float PhysicsController::calculateHeight(float* data, unsigned int width, unsigned int height, float x, float y,
+    const Matrix* worldMatrix, Vector3* normalData, Vector3* normalResult)
 {
     GP_ASSERT(data);
 
@@ -1255,20 +1337,48 @@ float PhysicsController::calculateHeight(float* data, unsigned int width, unsign
 
     if (x2 >= width && y2 >= height)
     {
+        if (normalResult)
+        {
+            normalResult->set(normalData[x1 + y1 * width]);
+            worldMatrix->transformVector(normalResult);
+        }
         return data[x1 + y1 * width];
     }
     else if (x2 >= width)
     {
+        if (normalResult)
+        {
+            normalResult->set(normalData[x1 + y1 * width] * yFactorI + normalData[x1 + y2 * width] * yFactor);
+            normalResult->normalize();
+            worldMatrix->transformVector(normalResult);
+        }
         return data[x1 + y1 * width] * yFactorI + data[x1 + y2 * width] * yFactor;
     }
     else if (y2 >= height)
     {
+        if (normalResult)
+        {
+            normalResult->set(normalData[x1 + y1 * width] * xFactorI + normalData[x2 + y1 * width] * xFactor);
+            normalResult->normalize();
+            worldMatrix->transformVector(normalResult);
+        }
         return data[x1 + y1 * width] * xFactorI + data[x2 + y1 * width] * xFactor;
     }
     else
     {
-        return data[x1 + y1 * width] * xFactorI * yFactorI + data[x1 + y2 * width] * xFactorI * yFactor + 
-            data[x2 + y2 * width] * xFactor * yFactor + data[x2 + y1 * width] * xFactor * yFactorI;
+        float a = xFactorI * yFactorI;
+        float b = xFactorI * yFactor;
+        float c = xFactor * yFactor;
+        float d = xFactor * yFactorI;
+        if (normalResult)
+        {
+            normalResult->set(normalData[x1 + y1 * width] * a + normalData[x1 + y2 * width] * b +
+                normalData[x2 + y2 * width] * c + normalData[x2 + y1 * width] * d);
+            normalResult->normalize();
+            worldMatrix->transformVector(normalResult);
+        }
+        return data[x1 + y1 * width] * a + data[x1 + y2 * width] * b +
+            data[x2 + y2 * width] * c + data[x2 + y1 * width] * d;
     }
 }
 
@@ -1379,13 +1489,13 @@ void PhysicsController::DebugDrawer::begin(const Matrix& viewProjection)
 {
     GP_ASSERT(_meshBatch);
     _viewProjection = &viewProjection;
-    _meshBatch->begin();
+    _meshBatch->start();
 }
 
 void PhysicsController::DebugDrawer::end()
 {
     GP_ASSERT(_meshBatch && _meshBatch->getMaterial() && _meshBatch->getMaterial()->getParameter("u_viewProjectionMatrix"));
-    _meshBatch->end();
+    _meshBatch->finish();
     _meshBatch->getMaterial()->getParameter("u_viewProjectionMatrix")->setValue(_viewProjection);
     _meshBatch->draw();
 }

+ 29 - 4
gameplay/src/PhysicsController.h

@@ -13,6 +13,8 @@
 namespace gameplay
 {
 
+class ScriptListener;
+
 /**
  * Defines a class for controlling game physics.
  */
@@ -151,6 +153,22 @@ public:
      */
     void removeStatusListener(Listener* listener);
 
+    /**
+     * Adds a listener to the physics controller.
+     * 
+     * Note: the given Lua function must have the same function signature as PhysicsController::Listener::statusEvent.
+     * 
+     * @param function The Lua script function to use as the listener callback.
+     */
+    void addStatusListener(const char* function);
+
+    /**
+     * Removes a listener to the physics controller.
+     * 
+     * @param function The Lua script function (used as a listener callback) to remove.
+     */
+    void removeStatusListener(const char* function);
+
     /**
      * Creates a fixed constraint.
      * 
@@ -407,7 +425,7 @@ private:
     void addCollisionObject(PhysicsCollisionObject* object);
     
     // Removes the given collision object from the simulated physics world.
-    void removeCollisionObject(PhysicsCollisionObject* object);
+    void removeCollisionObject(PhysicsCollisionObject* object, bool removeListeners);
     
     // Gets the corresponding GamePlay object for the given Bullet object.
     PhysicsCollisionObject* getCollisionObject(const btCollisionObject* collisionObject) const;
@@ -435,7 +453,9 @@ private:
     void destroyShape(PhysicsCollisionShape* shape);
 
     // Helper function for calculating heights from heightmap (image) or heightfield data.
-    static float calculateHeight(float* data, unsigned int width, unsigned int height, float x, float y);
+    // The worldMatrix and normalData arguments are ignored if normalResult is NULL.
+    static float calculateHeight(float* data, unsigned int width, unsigned int height, float x, float y,
+        const Matrix* worldMatrix = NULL, Vector3* normalData = NULL, Vector3* normalResult = NULL);
 
     // Sets up the given constraint for the given two rigid bodies.
     void addConstraint(PhysicsRigidBody* a, PhysicsRigidBody* b, PhysicsConstraint* constraint);
@@ -446,13 +466,17 @@ private:
     // Removes the given constraint from the simulated physics world.
     void removeConstraint(PhysicsConstraint* constraint);
     
-    // Draws Bullet debug information.
+    /**
+     * Draws Bullet debug information.
+     * @script{ignore}
+     */
     class DebugDrawer : public btIDebugDraw
     {
     public:
 
         /** 
          * DebugVertex.
+         * @script{ignore}
          */
         struct DebugVertex
         {
@@ -521,6 +545,7 @@ private:
         MeshBatch* _meshBatch;
     };
 
+    bool _isUpdating;
     btDefaultCollisionConfiguration* _collisionConfiguration;
     btCollisionDispatcher* _dispatcher;
     btBroadphaseInterface* _overlappingPairCache;
@@ -534,7 +559,7 @@ private:
     Vector3 _gravity;
     std::map<PhysicsCollisionObject::CollisionPair, CollisionInfo> _collisionStatus;
     CollisionCallback* _collisionCallback;
-
+    std::vector<ScriptListener*>* _scriptListeners;
 };
 
 }

+ 1 - 1
gameplay/src/PhysicsGhostObject.cpp

@@ -39,7 +39,7 @@ PhysicsGhostObject::~PhysicsGhostObject()
     _node->removeListener(this);
 
     GP_ASSERT(Game::getInstance()->getPhysicsController());
-    Game::getInstance()->getPhysicsController()->removeCollisionObject(this);
+    Game::getInstance()->getPhysicsController()->removeCollisionObject(this, true);
 
     SAFE_DELETE(_ghostObject);
 }

+ 1 - 1
gameplay/src/PhysicsGhostObject.h

@@ -21,7 +21,7 @@ class PhysicsGhostObject : public PhysicsCollisionObject, public Transform::List
 public:
 
     /**
-     * @see PhysicsCollisionObject#getType
+     * @see PhysicsCollisionObject::getType
      */
     PhysicsCollisionObject::Type getType() const;
 

+ 11 - 3
gameplay/src/PhysicsRigidBody.cpp

@@ -73,7 +73,7 @@ PhysicsRigidBody::~PhysicsRigidBody()
     }
 
     // Remove collision object from physics controller.
-    Game::getInstance()->getPhysicsController()->removeCollisionObject(this);
+    Game::getInstance()->getPhysicsController()->removeCollisionObject(this, true);
 
     // Clean up the rigid body and its related objects.
     SAFE_DELETE(_body);
@@ -258,7 +258,14 @@ void PhysicsRigidBody::setKinematic(bool kinematic)
     }
 }
 
-float PhysicsRigidBody::getHeight(float x, float y) const
+void PhysicsRigidBody::setEnabled(bool enable)
+{
+    PhysicsCollisionObject::setEnabled(enable);
+    if (enable)
+        _body->setMotionState(_motionState);
+}
+
+float PhysicsRigidBody::getHeight(float x, float y, Vector3* normal) const
 {
     GP_ASSERT(_collisionShape);
 
@@ -296,7 +303,8 @@ float PhysicsRigidBody::getHeight(float x, float y) const
         return 0.0f;
     }
 
-    return PhysicsController::calculateHeight(_collisionShape->_shapeData.heightfieldData->heightData, w, h, x, y);
+    return PhysicsController::calculateHeight(_collisionShape->_shapeData.heightfieldData->heightData, w, h, x, y,
+        &_node->getWorldMatrix(), _collisionShape->_shapeData.heightfieldData->normalData, normal);
 }
 
 void PhysicsRigidBody::addConstraint(PhysicsConstraint* constraint)

+ 15 - 3
gameplay/src/PhysicsRigidBody.h

@@ -93,7 +93,7 @@ public:
     };
 
     /**
-     * @see PhysicsCollisionObject#getType
+     * @see PhysicsCollisionObject::getType
      */
     PhysicsCollisionObject::Type getType() const;
 
@@ -198,7 +198,7 @@ public:
 
     /**
      * Gets the gravity that affects the rigid body (this can
-     * be different from the global gravity; @see #setGravity).
+     * be different from the global gravity; @see setGravity(Vector3)).
      * 
      * @return The gravity.
      */
@@ -218,14 +218,26 @@ public:
      */
     void setKinematic(bool kinematic);
 
+    /**
+<<<<<<< HEAD
+     * Sets whether the rigid body is enabled or disabled in the physics world.
+     *
+     * @param enable true enables the collision object, false disables it.
+     */
+    void setEnabled(bool enable);
+
     /**
      * Gets the height at the given point (only for rigid bodies of type HEIGHTFIELD).
+=======
+     * Gets the height and normal at the given point (only for rigid bodies of type HEIGHTFIELD).
+>>>>>>> 0d45c907dd0ead0b5318d9a32bc78b367c01e532
      * 
      * @param x The x position.
      * @param y The y position.
+     * @param normal If non-null, the surface normal at the given point.
      * @return The height at the given point, or zero if this is not a heightfield rigid body.
      */
-    float getHeight(float x, float y) const;
+    float getHeight(float x, float y, Vector3* normal = NULL) const;
 
     /**
      * Gets whether the rigid body is a static rigid body or not.

+ 1 - 0
gameplay/src/Plane.cpp

@@ -9,6 +9,7 @@ namespace gameplay
 {
 
 Plane::Plane()
+    : _normal(0, 1, 0), _distance(0)
 {
 }
 

+ 1 - 1
gameplay/src/Plane.h

@@ -37,7 +37,7 @@ public:
     static const int INTERSECTS_BACK = -1;
 
     /**
-     * Constructor.
+     * Constructs a new plane with normal (0, 1, 0) and distance 0.
      */
     Plane();
 

+ 3 - 0
gameplay/src/Platform.h

@@ -29,6 +29,7 @@ public:
      * @param attachToWindow The native window handle to optionally attach to.
      * 
      * @return The created platform interface.
+     * @script{ignore}
      */
     static Platform* create(Game* game, void* attachToWindow = NULL);
 
@@ -238,4 +239,6 @@ private:
 
 }
 
+#include "Game.h"
+
 #endif

+ 12 - 1
gameplay/src/PlatformAndroid.cpp

@@ -5,6 +5,7 @@
 #include "FileSystem.h"
 #include "Game.h"
 #include "Form.h"
+#include "ScriptController.h"
 #include <unistd.h>
 
 #include <android/sensor.h>
@@ -963,13 +964,19 @@ void Platform::displayKeyboard(bool display)
 void Platform::touchEventInternal(Touch::TouchEvent evt, int x, int y, unsigned int contactIndex)
 {
     if (!Form::touchEventInternal(evt, x, y, contactIndex))
+    {
         Game::getInstance()->touchEvent(evt, x, y, contactIndex);
+        Game::getInstance()->getScriptController()->touchEvent(evt, x, y, contactIndex);
+    }
 }
 
 void Platform::keyEventInternal(Keyboard::KeyEvent evt, int key)
 {
     if (!Form::keyEventInternal(evt, key))
+    {
         Game::getInstance()->keyEvent(evt, key);
+        Game::getInstance()->getScriptController()->keyEvent(evt, key);
+    }
 }
 
 bool Platform::mouseEventInternal(Mouse::MouseEvent evt, int x, int y, int wheelDelta)
@@ -978,9 +985,13 @@ bool Platform::mouseEventInternal(Mouse::MouseEvent evt, int x, int y, int wheel
     {
         return true;
     }
+    else if (Game::getInstance()->mouseEvent(evt, x, y, wheelDelta))
+    {
+        return true;
+    }
     else
     {
-        return Game::getInstance()->mouseEvent(evt, x, y, wheelDelta);
+        return Game::getInstance()->getScriptController()->mouseEvent(evt, x, y, wheelDelta);
     }
 }
 

+ 12 - 1
gameplay/src/PlatformMacOSX.mm

@@ -5,6 +5,7 @@
 #include "FileSystem.h"
 #include "Game.h"
 #include "Form.h"
+#include "ScriptController.h"
 #include <unistd.h>
 #import <Cocoa/Cocoa.h>
 #import <QuartzCore/CVDisplayLink.h>
@@ -842,13 +843,19 @@ void Platform::displayKeyboard(bool display)
 void Platform::touchEventInternal(Touch::TouchEvent evt, int x, int y, unsigned int contactIndex)
 {
     if (!Form::touchEventInternal(evt, x, y, contactIndex))
+    {
         Game::getInstance()->touchEvent(evt, x, y, contactIndex);
+        Game::getInstance()->getScriptController()->touchEvent(evt, x, y, contactIndex);
+    }
 }
     
 void Platform::keyEventInternal(Keyboard::KeyEvent evt, int key)
 {
     if (!Form::keyEventInternal(evt, key))
+    {
         Game::getInstance()->keyEvent(evt, key);
+        Game::getInstance()->getScriptController()->keyEvent(evt, key);
+    }
 }
 
 bool Platform::mouseEventInternal(Mouse::MouseEvent evt, int x, int y, int wheelDelta)
@@ -857,9 +864,13 @@ bool Platform::mouseEventInternal(Mouse::MouseEvent evt, int x, int y, int wheel
     {
         return true;
     }
+    else if (Game::getInstance()->mouseEvent(evt, x, y, wheelDelta))
+    {
+        return true;
+    }
     else
     {
-        return Game::getInstance()->mouseEvent(evt, x, y, wheelDelta);
+        return Game::getInstance()->getScriptController()->mouseEvent(evt, x, y, wheelDelta);
     }
 }
 

+ 12 - 1
gameplay/src/PlatformQNX.cpp

@@ -5,6 +5,7 @@
 #include "FileSystem.h"
 #include "Game.h"
 #include "Form.h"
+#include "ScriptController.h"
 #include <unistd.h>
 #include <sys/keycodes.h>
 #include <screen/screen.h>
@@ -1159,13 +1160,19 @@ void Platform::displayKeyboard(bool display)
 void Platform::touchEventInternal(Touch::TouchEvent evt, int x, int y, unsigned int contactIndex)
 {
     if (!Form::touchEventInternal(evt, x, y, contactIndex))
+    {
         Game::getInstance()->touchEvent(evt, x, y, contactIndex);
+        Game::getInstance()->getScriptController()->touchEvent(evt, x, y, contactIndex);
+    }
 }
 
 void Platform::keyEventInternal(Keyboard::KeyEvent evt, int key)
 {
     if (!Form::keyEventInternal(evt, key))
+    {
         Game::getInstance()->keyEvent(evt, key);
+        Game::getInstance()->getScriptController()->keyEvent(evt, key);
+    }
 }
 
 bool Platform::mouseEventInternal(Mouse::MouseEvent evt, int x, int y, int wheelDelta)
@@ -1174,9 +1181,13 @@ bool Platform::mouseEventInternal(Mouse::MouseEvent evt, int x, int y, int wheel
     {
         return true;
     }
+    else if (Game::getInstance()->mouseEvent(evt, x, y, wheelDelta))
+    {
+        return true;
+    }
     else
     {
-        return Game::getInstance()->mouseEvent(evt, x, y, wheelDelta);
+        return Game::getInstance()->getScriptController()->mouseEvent(evt, x, y, wheelDelta);
     }
 }
 

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