Browse Source

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

Conflicts:
	gameplay/src/Form.cpp
	gameplay/src/Theme.cpp
sgrenier 12 years ago
parent
commit
963e51d860
100 changed files with 6767 additions and 2326 deletions
  1. 0 25
      .gitignore
  2. 10 0
      CHANGES.md
  3. 2 1
      CMakeLists.txt
  4. 11 12
      README.md
  5. 48 179
      gameplay.sln
  6. 0 3
      gameplay.xcworkspace/contents.xcworkspacedata
  7. 7 0
      gameplay/.cproject
  8. 11 1
      gameplay/CMakeLists.txt
  9. 1 1
      gameplay/android/AndroidManifest.xml
  10. 33 0
      gameplay/android/java/.project
  11. 9 0
      gameplay/android/java/AndroidManifest.xml
  12. 19 31
      gameplay/android/java/build.xml
  13. 190 0
      gameplay/android/java/src/org/gameplay3d/lib/BaseGameActivity.java
  14. 1149 0
      gameplay/android/java/src/org/gameplay3d/lib/GameHelper.java
  15. 118 0
      gameplay/android/java/src/org/gameplay3d/lib/GoogleGamesSocial.java
  16. 12 0
      gameplay/android/java/src/org/gameplay3d/lib/TestClass.java
  17. 8 1
      gameplay/android/jni/Android.mk
  18. 42 19
      gameplay/gameplay.vcxproj
  19. 54 0
      gameplay/gameplay.vcxproj.filters
  20. 132 42
      gameplay/gameplay.xcodeproj/project.pbxproj
  21. 0 7
      gameplay/gameplay.xcodeproj/project.xcworkspace/contents.xcworkspacedata
  22. BIN
      gameplay/gameplay.xcodeproj/project.xcworkspace/xcuserdata/mozeal.xcuserdatad/UserInterfaceState.xcuserstate
  23. 1 1
      gameplay/gameplay.xcodeproj/xcshareddata/xcschemes/gameplay-ios.xcscheme
  24. 1 1
      gameplay/gameplay.xcodeproj/xcshareddata/xcschemes/gameplay-macosx.xcscheme
  25. 0 0
      gameplay/res/arial.ttf
  26. 14 1
      gameplay/res/shaders/font.frag
  27. 0 1
      gameplay/res/shaders/font.vert
  28. 1 1
      gameplay/src/Animation.h
  29. 31 12
      gameplay/src/Base.h
  30. 38 7
      gameplay/src/Bundle.cpp
  31. 16 1
      gameplay/src/Bundle.h
  32. 1 1
      gameplay/src/Curve.cpp
  33. 1 1
      gameplay/src/DebugNew.cpp
  34. 14 14
      gameplay/src/DebugNew.h
  35. 22 4
      gameplay/src/Font.cpp
  36. 19 2
      gameplay/src/Font.h
  37. 17 9
      gameplay/src/Game.cpp
  38. 12 7
      gameplay/src/Game.h
  39. 7 2
      gameplay/src/Game.inl
  40. 1 2
      gameplay/src/Image.cpp
  41. 8 8
      gameplay/src/Image.h
  42. 2 2
      gameplay/src/PhysicsController.cpp
  43. 3 4
      gameplay/src/Platform.h
  44. 3 4
      gameplay/src/PlatformAndroid.cpp
  45. 1643 1634
      gameplay/src/PlatformBlackBerry.cpp
  46. 2 4
      gameplay/src/PlatformLinux.cpp
  47. 2 4
      gameplay/src/PlatformMacOSX.mm
  48. 46 65
      gameplay/src/PlatformWindows.cpp
  49. 7 2
      gameplay/src/PlatformiOS.mm
  50. 1 1
      gameplay/src/Properties.cpp
  51. 5 5
      gameplay/src/Ref.cpp
  52. 2 2
      gameplay/src/Ref.h
  53. 10 10
      gameplay/src/RenderState.cpp
  54. 1 1
      gameplay/src/Slider.cpp
  55. 18 0
      gameplay/src/SocialAchievement.cpp
  56. 63 0
      gameplay/src/SocialAchievement.h
  57. 16 0
      gameplay/src/SocialChallenge.cpp
  58. 84 0
      gameplay/src/SocialChallenge.h
  59. 92 0
      gameplay/src/SocialController.cpp
  60. 101 0
      gameplay/src/SocialController.h
  61. 17 0
      gameplay/src/SocialPlayer.cpp
  62. 40 0
      gameplay/src/SocialPlayer.h
  63. 18 0
      gameplay/src/SocialScore.cpp
  64. 52 0
      gameplay/src/SocialScore.h
  65. 111 0
      gameplay/src/SocialSession.h
  66. 92 0
      gameplay/src/SocialSessionListener.cpp
  67. 93 0
      gameplay/src/SocialSessionListener.h
  68. 1 0
      gameplay/src/Theme.cpp
  69. 9 1
      gameplay/src/gameplay.h
  70. 4 37
      gameplay/src/lua/lua_Game.cpp
  71. 1 2
      gameplay/src/lua/lua_Game.h
  72. 192 0
      gameplay/src/social/GoogleGamesSocialSession.cpp
  73. 201 0
      gameplay/src/social/GoogleGamesSocialSession.h
  74. 1394 0
      gameplay/src/social/ScoreloopSocialSession.cpp
  75. 231 0
      gameplay/src/social/ScoreloopSocialSession.h
  76. 2 1
      install.bat
  77. 2 3
      samples/CMakeLists.txt
  78. 13 3
      samples/browser/.cproject
  79. 2 2
      samples/browser/CMakeLists.txt
  80. 3 3
      samples/browser/android/jni/Android.mk
  81. BIN
      samples/browser/android/res/drawable/icon.png
  82. 5 21
      samples/browser/bar-descriptor.xml
  83. 1 0
      samples/browser/game.config
  84. BIN
      samples/browser/icon.png
  85. BIN
      samples/browser/res/common/arial-distance.gpb
  86. BIN
      samples/browser/res/common/arial.gpb
  87. BIN
      samples/browser/res/common/arial18.gpb
  88. BIN
      samples/browser/res/common/badaboom.gpb
  89. BIN
      samples/browser/res/common/baroque.gpb
  90. BIN
      samples/browser/res/common/custom.gpb
  91. 8 8
      samples/browser/res/common/default.theme
  92. BIN
      samples/browser/res/common/dynamic.gpb
  93. BIN
      samples/browser/res/common/fishfingers.gpb
  94. BIN
      samples/browser/res/common/neuropol.gpb
  95. BIN
      samples/browser/res/common/squarehead.gpb
  96. 4 4
      samples/browser/res/common/text.form
  97. 5 1
      samples/browser/sample-browser-ios.plist
  98. 1 1
      samples/browser/sample-browser-macosx.plist
  99. 41 37
      samples/browser/sample-browser.vcxproj
  100. 63 67
      samples/browser/sample-browser.xcodeproj/project.pbxproj

+ 0 - 25
.gitignore

@@ -115,31 +115,6 @@ Thumbs.db
 /samples/character/res/gamepad.xcf
 /samples/character/res/gamepad.xcf
 /samples/character/sample-character.xcodeproj/xcuserdata
 /samples/character/sample-character.xcodeproj/xcuserdata
 
 
-/samples/longboard/Debug
-/samples/longboard/DebugMem
-/samples/longboard/Release
-/samples/longboard/Simulator
-/samples/longboard/Simulator-Coverage
-/samples/longboard/Simulator-Profile
-/samples/longboard/Device-Debug
-/samples/longboard/Device-Coverage
-/samples/longboard/Device-Profile
-/samples/longboard/Device-Release
-/samples/longboard/res/shaders
-/samples/longboard/res/logo_powered_white.png
-/samples/longboard/NUL
-/samples/longboard/android/NUL
-/samples/longboard/android/src
-/samples/longboard/android/assets
-/samples/longboard/android/bin
-/samples/longboard/android/gen
-/samples/longboard/android/libs
-/samples/longboard/android/obj
-/samples/longboard/android/proguard.cfg
-/samples/longboard/android/project.properties
-/samples/longboard/android/local.properties
-/samples/longboard/sample-longboard.xcodeproj/xcuserdata
-
 /samples/lua/Debug
 /samples/lua/Debug
 /samples/lua/DebugMem
 /samples/lua/DebugMem
 /samples/lua/Release
 /samples/lua/Release

+ 10 - 0
CHANGES.md

@@ -1,3 +1,13 @@
+## v2.0.0
+
+- Adds support for Visual Studio 2012
+- Adds support for iOS 7, MacOS 10.8 and XCode 5.
+- Adds support for BlackBerry NDK 10.2.
+- Adds support for social achievements, leaderboard and challenges.
+- Adds password mode on textbox controls.
+- Adds collision object group mask filtering.
+- Fixes Mesh Collision shapes.
+
 ## v1.7.0
 ## v1.7.0
 
 
 - Adds -m parameter to encoder to support exporting Material from FBX scenes.
 - Adds -m parameter to encoder to support exporting Material from FBX scenes.

+ 2 - 1
CMakeLists.txt

@@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 2.6)
 
 
 project(GamePlay)
 project(GamePlay)
 
 
-set(GAMEPLAY_VERSION 1.7.0)
+set(GAMEPLAY_VERSION 2.0.0)
 set(CMAKE_C_COMPILER_INIT g++)
 set(CMAKE_C_COMPILER_INIT g++)
 
 
 # debug
 # debug
@@ -27,4 +27,5 @@ add_subdirectory(samples)
 # gameplay encoder
 # gameplay encoder
 # A pre-compiled executable can be found in 'gameplay/bin'
 # A pre-compiled executable can be found in 'gameplay/bin'
 # Uncomment out this line if you want to build the encoder instead of using the pre-compiled gameplay-encoder.
 # Uncomment out this line if you want to build the encoder instead of using the pre-compiled gameplay-encoder.
+
 #add_subdirectory(tools/encoder)
 #add_subdirectory(tools/encoder)

+ 11 - 12
README.md

@@ -1,27 +1,26 @@
-## gameplay v1.8.0
+## GamePlay v2.0.0
 
 
 GamePlay3D is an open-source, cross-platform 3D native C++ game framework making it easy to learn and write mobile and desktop games. 
 GamePlay3D is an open-source, cross-platform 3D native C++ game framework making it easy to learn and write mobile and desktop games. 
 
 
-<img align="right" src="https://raw.github.com/wiki/blackberry/GamePlay/img/logo.png" alt="gameplay" />
+<img align="right" src="https://raw.github.com/wiki/blackberry/GamePlay/img/logo.png" alt="gameplay3d" />
 
 
 - [Website](http://www.gameplay3d.org/)
 - [Website](http://www.gameplay3d.org/)
 - [Forums](http://www.gameplay3d.org/forums/)
 - [Forums](http://www.gameplay3d.org/forums/)
 - [Wiki](https://github.com/blackberry/GamePlay/wiki)
 - [Wiki](https://github.com/blackberry/GamePlay/wiki)
-- [API Reference](http://www.gameplay3d.org/api.php)
+- [API Reference](http://blackberry.github.io/GamePlay/api/index.html)
 - [Development Guide](https://github.com/blackberry/GamePlay/wiki#wiki-Development_Guide)
 - [Development Guide](https://github.com/blackberry/GamePlay/wiki#wiki-Development_Guide)
 
 
-## Supported Mobile Platforms
-- [BlackBerry 10 and PlayBook](https://github.com/blackberry/GamePlay/wiki/BlackBerry-Setup) (using BlackBerry Native SDK)
-- [Apple iOS 5+](https://github.com/blackberry/GamePlay/wiki/Apple-Xcode-Setup) (using Apple XCode 4)
-- [Google Android 2.3+](https://github.com/blackberry/GamePlay/wiki/Android-NDK-Setup) (using Google Android NDK)
-
-## Supported Desktop Platforms
-- [Microsoft Windows 7](https://github.com/blackberry/GamePlay/wiki/Visual-Studio-Setup) (using Microsoft Visual Studio 2012)
-- [Apple MacOS X](https://github.com/blackberry/GamePlay/wiki/Apple-Xcode-Setup) (using Apple XCode 4)
+## Supported Platforms
+- [Microsoft Windows](https://github.com/blackberry/GamePlay/wiki/Visual-Studio-Setup) (using Microsoft Visual Studio)
+- [Apple MacOS X](https://github.com/blackberry/GamePlay/wiki/Apple-Xcode-Setup) (using Apple XCode)
 - [Linux](https://github.com/blackberry/GamePlay/wiki/Linux-Setup) (using CMake)
 - [Linux](https://github.com/blackberry/GamePlay/wiki/Linux-Setup) (using CMake)
+- [BlackBerry](https://github.com/blackberry/GamePlay/wiki/BlackBerry-Setup) (using BlackBerry Native SDK)
+- [Apple iOS](https://github.com/blackberry/GamePlay/wiki/Apple-Xcode-Setup) (using Apple XCode)
+- [Google Android](https://github.com/blackberry/GamePlay/wiki/Android-NDK-Setup) (using Google Android NDK)
 
 
 ## Roadmap for 'next' branch
 ## Roadmap for 'next' branch
-- [backlog](https://github.com/blackberry/GamePlay/issues?milestone=7)
+- [2.0.0](https://github.com/blackberry/GamePlay/issues?milestone=6&page=1&state=open)
+- [backlog](https://github.com/blackberry/GamePlay/issues?milestone=5&page=1&state=open)
 
 
 ## License
 ## License
 The project is open sourced under the [Apache 2.0 license](http://www.tldrlegal.com/license/apache-license-2.0-%28apache-2.0%29).
 The project is open sourced under the [Apache 2.0 license](http://www.tldrlegal.com/license/apache-license-2.0-%28apache-2.0%29).

+ 48 - 179
gameplay.sln

@@ -18,11 +18,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sample-lua", "samples\lua\s
 		{1032BA4B-57EB-4348-9E03-29DD63E80E4A} = {1032BA4B-57EB-4348-9E03-29DD63E80E4A}
 		{1032BA4B-57EB-4348-9E03-29DD63E80E4A} = {1032BA4B-57EB-4348-9E03-29DD63E80E4A}
 	EndProjectSection
 	EndProjectSection
 EndProject
 EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sample-longboard", "samples\longboard\sample-longboard.vcxproj", "{9A515C8B-3320-4C5C-9754-211E91206C9D}"
-	ProjectSection(ProjectDependencies) = postProject
-		{1032BA4B-57EB-4348-9E03-29DD63E80E4A} = {1032BA4B-57EB-4348-9E03-29DD63E80E4A}
-	EndProjectSection
-EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sample-spaceship", "samples\spaceship\sample-spaceship.vcxproj", "{CC37B8E9-6402-4841-8D6A-5D908A5909B3}"
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sample-spaceship", "samples\spaceship\sample-spaceship.vcxproj", "{CC37B8E9-6402-4841-8D6A-5D908A5909B3}"
 	ProjectSection(ProjectDependencies) = postProject
 	ProjectSection(ProjectDependencies) = postProject
 		{1032BA4B-57EB-4348-9E03-29DD63E80E4A} = {1032BA4B-57EB-4348-9E03-29DD63E80E4A}
 		{1032BA4B-57EB-4348-9E03-29DD63E80E4A} = {1032BA4B-57EB-4348-9E03-29DD63E80E4A}
@@ -59,272 +54,146 @@ Global
 		Release|x64 = Release|x64
 		Release|x64 = Release|x64
 	EndGlobalSection
 	EndGlobalSection
 	GlobalSection(ProjectConfigurationPlatforms) = postSolution
 	GlobalSection(ProjectConfigurationPlatforms) = postSolution
-		{1032BA4B-57EB-4348-9E03-29DD63E80E4A}.Debug|BlackBerry.ActiveCfg = Debug|BlackBerry
-		{1032BA4B-57EB-4348-9E03-29DD63E80E4A}.Debug|BlackBerry.Build.0 = Debug|BlackBerry
-		{1032BA4B-57EB-4348-9E03-29DD63E80E4A}.Debug|BlackBerry.Deploy.0 = Debug|BlackBerry
-		{1032BA4B-57EB-4348-9E03-29DD63E80E4A}.Debug|BlackBerrySimulator.ActiveCfg = Debug|BlackBerrySimulator
-		{1032BA4B-57EB-4348-9E03-29DD63E80E4A}.Debug|BlackBerrySimulator.Build.0 = Debug|BlackBerrySimulator
-		{1032BA4B-57EB-4348-9E03-29DD63E80E4A}.Debug|BlackBerrySimulator.Deploy.0 = Debug|BlackBerrySimulator
+		{1032BA4B-57EB-4348-9E03-29DD63E80E4A}.Debug|BlackBerry.ActiveCfg = Debug|Win32
+		{1032BA4B-57EB-4348-9E03-29DD63E80E4A}.Debug|BlackBerrySimulator.ActiveCfg = Debug|Win32
 		{1032BA4B-57EB-4348-9E03-29DD63E80E4A}.Debug|Win32.ActiveCfg = Debug|Win32
 		{1032BA4B-57EB-4348-9E03-29DD63E80E4A}.Debug|Win32.ActiveCfg = Debug|Win32
 		{1032BA4B-57EB-4348-9E03-29DD63E80E4A}.Debug|Win32.Build.0 = Debug|Win32
 		{1032BA4B-57EB-4348-9E03-29DD63E80E4A}.Debug|Win32.Build.0 = Debug|Win32
 		{1032BA4B-57EB-4348-9E03-29DD63E80E4A}.Debug|x64.ActiveCfg = Debug|x64
 		{1032BA4B-57EB-4348-9E03-29DD63E80E4A}.Debug|x64.ActiveCfg = Debug|x64
 		{1032BA4B-57EB-4348-9E03-29DD63E80E4A}.Debug|x64.Build.0 = Debug|x64
 		{1032BA4B-57EB-4348-9E03-29DD63E80E4A}.Debug|x64.Build.0 = Debug|x64
-		{1032BA4B-57EB-4348-9E03-29DD63E80E4A}.DebugMem|BlackBerry.ActiveCfg = DebugMem|BlackBerry
-		{1032BA4B-57EB-4348-9E03-29DD63E80E4A}.DebugMem|BlackBerry.Build.0 = DebugMem|BlackBerry
-		{1032BA4B-57EB-4348-9E03-29DD63E80E4A}.DebugMem|BlackBerry.Deploy.0 = DebugMem|BlackBerry
-		{1032BA4B-57EB-4348-9E03-29DD63E80E4A}.DebugMem|BlackBerrySimulator.ActiveCfg = DebugMem|BlackBerrySimulator
-		{1032BA4B-57EB-4348-9E03-29DD63E80E4A}.DebugMem|BlackBerrySimulator.Build.0 = DebugMem|BlackBerrySimulator
-		{1032BA4B-57EB-4348-9E03-29DD63E80E4A}.DebugMem|BlackBerrySimulator.Deploy.0 = DebugMem|BlackBerrySimulator
+		{1032BA4B-57EB-4348-9E03-29DD63E80E4A}.DebugMem|BlackBerry.ActiveCfg = DebugMem|Win32
+		{1032BA4B-57EB-4348-9E03-29DD63E80E4A}.DebugMem|BlackBerrySimulator.ActiveCfg = DebugMem|Win32
 		{1032BA4B-57EB-4348-9E03-29DD63E80E4A}.DebugMem|Win32.ActiveCfg = DebugMem|Win32
 		{1032BA4B-57EB-4348-9E03-29DD63E80E4A}.DebugMem|Win32.ActiveCfg = DebugMem|Win32
 		{1032BA4B-57EB-4348-9E03-29DD63E80E4A}.DebugMem|Win32.Build.0 = DebugMem|Win32
 		{1032BA4B-57EB-4348-9E03-29DD63E80E4A}.DebugMem|Win32.Build.0 = DebugMem|Win32
 		{1032BA4B-57EB-4348-9E03-29DD63E80E4A}.DebugMem|x64.ActiveCfg = DebugMem|x64
 		{1032BA4B-57EB-4348-9E03-29DD63E80E4A}.DebugMem|x64.ActiveCfg = DebugMem|x64
 		{1032BA4B-57EB-4348-9E03-29DD63E80E4A}.DebugMem|x64.Build.0 = DebugMem|x64
 		{1032BA4B-57EB-4348-9E03-29DD63E80E4A}.DebugMem|x64.Build.0 = DebugMem|x64
-		{1032BA4B-57EB-4348-9E03-29DD63E80E4A}.Release|BlackBerry.ActiveCfg = Release|BlackBerry
-		{1032BA4B-57EB-4348-9E03-29DD63E80E4A}.Release|BlackBerry.Build.0 = Release|BlackBerry
-		{1032BA4B-57EB-4348-9E03-29DD63E80E4A}.Release|BlackBerry.Deploy.0 = Release|BlackBerry
-		{1032BA4B-57EB-4348-9E03-29DD63E80E4A}.Release|BlackBerrySimulator.ActiveCfg = Release|BlackBerrySimulator
-		{1032BA4B-57EB-4348-9E03-29DD63E80E4A}.Release|BlackBerrySimulator.Build.0 = Release|BlackBerrySimulator
-		{1032BA4B-57EB-4348-9E03-29DD63E80E4A}.Release|BlackBerrySimulator.Deploy.0 = Release|BlackBerrySimulator
+		{1032BA4B-57EB-4348-9E03-29DD63E80E4A}.Release|BlackBerry.ActiveCfg = Release|Win32
+		{1032BA4B-57EB-4348-9E03-29DD63E80E4A}.Release|BlackBerrySimulator.ActiveCfg = Release|Win32
 		{1032BA4B-57EB-4348-9E03-29DD63E80E4A}.Release|Win32.ActiveCfg = Release|Win32
 		{1032BA4B-57EB-4348-9E03-29DD63E80E4A}.Release|Win32.ActiveCfg = Release|Win32
 		{1032BA4B-57EB-4348-9E03-29DD63E80E4A}.Release|Win32.Build.0 = Release|Win32
 		{1032BA4B-57EB-4348-9E03-29DD63E80E4A}.Release|Win32.Build.0 = Release|Win32
 		{1032BA4B-57EB-4348-9E03-29DD63E80E4A}.Release|x64.ActiveCfg = Release|x64
 		{1032BA4B-57EB-4348-9E03-29DD63E80E4A}.Release|x64.ActiveCfg = Release|x64
 		{1032BA4B-57EB-4348-9E03-29DD63E80E4A}.Release|x64.Build.0 = Release|x64
 		{1032BA4B-57EB-4348-9E03-29DD63E80E4A}.Release|x64.Build.0 = Release|x64
-		{0F27C8C4-58B2-E367-8D1F-01B714FDBF1B}.Debug|BlackBerry.ActiveCfg = Debug|BlackBerry
-		{0F27C8C4-58B2-E367-8D1F-01B714FDBF1B}.Debug|BlackBerry.Build.0 = Debug|BlackBerry
-		{0F27C8C4-58B2-E367-8D1F-01B714FDBF1B}.Debug|BlackBerry.Deploy.0 = Debug|BlackBerry
-		{0F27C8C4-58B2-E367-8D1F-01B714FDBF1B}.Debug|BlackBerrySimulator.ActiveCfg = Debug|BlackBerrySimulator
-		{0F27C8C4-58B2-E367-8D1F-01B714FDBF1B}.Debug|BlackBerrySimulator.Build.0 = Debug|BlackBerrySimulator
-		{0F27C8C4-58B2-E367-8D1F-01B714FDBF1B}.Debug|BlackBerrySimulator.Deploy.0 = Debug|BlackBerrySimulator
+		{0F27C8C4-58B2-E367-8D1F-01B714FDBF1B}.Debug|BlackBerry.ActiveCfg = Debug|Win32
+		{0F27C8C4-58B2-E367-8D1F-01B714FDBF1B}.Debug|BlackBerrySimulator.ActiveCfg = Debug|Win32
 		{0F27C8C4-58B2-E367-8D1F-01B714FDBF1B}.Debug|Win32.ActiveCfg = Debug|Win32
 		{0F27C8C4-58B2-E367-8D1F-01B714FDBF1B}.Debug|Win32.ActiveCfg = Debug|Win32
 		{0F27C8C4-58B2-E367-8D1F-01B714FDBF1B}.Debug|Win32.Build.0 = Debug|Win32
 		{0F27C8C4-58B2-E367-8D1F-01B714FDBF1B}.Debug|Win32.Build.0 = Debug|Win32
 		{0F27C8C4-58B2-E367-8D1F-01B714FDBF1B}.Debug|x64.ActiveCfg = Debug|x64
 		{0F27C8C4-58B2-E367-8D1F-01B714FDBF1B}.Debug|x64.ActiveCfg = Debug|x64
 		{0F27C8C4-58B2-E367-8D1F-01B714FDBF1B}.Debug|x64.Build.0 = Debug|x64
 		{0F27C8C4-58B2-E367-8D1F-01B714FDBF1B}.Debug|x64.Build.0 = Debug|x64
-		{0F27C8C4-58B2-E367-8D1F-01B714FDBF1B}.DebugMem|BlackBerry.ActiveCfg = DebugMem|BlackBerry
-		{0F27C8C4-58B2-E367-8D1F-01B714FDBF1B}.DebugMem|BlackBerry.Build.0 = DebugMem|BlackBerry
-		{0F27C8C4-58B2-E367-8D1F-01B714FDBF1B}.DebugMem|BlackBerry.Deploy.0 = DebugMem|BlackBerry
-		{0F27C8C4-58B2-E367-8D1F-01B714FDBF1B}.DebugMem|BlackBerrySimulator.ActiveCfg = DebugMem|BlackBerrySimulator
-		{0F27C8C4-58B2-E367-8D1F-01B714FDBF1B}.DebugMem|BlackBerrySimulator.Build.0 = DebugMem|BlackBerrySimulator
-		{0F27C8C4-58B2-E367-8D1F-01B714FDBF1B}.DebugMem|BlackBerrySimulator.Deploy.0 = DebugMem|BlackBerrySimulator
+		{0F27C8C4-58B2-E367-8D1F-01B714FDBF1B}.DebugMem|BlackBerry.ActiveCfg = DebugMem|Win32
+		{0F27C8C4-58B2-E367-8D1F-01B714FDBF1B}.DebugMem|BlackBerrySimulator.ActiveCfg = DebugMem|Win32
 		{0F27C8C4-58B2-E367-8D1F-01B714FDBF1B}.DebugMem|Win32.ActiveCfg = DebugMem|Win32
 		{0F27C8C4-58B2-E367-8D1F-01B714FDBF1B}.DebugMem|Win32.ActiveCfg = DebugMem|Win32
 		{0F27C8C4-58B2-E367-8D1F-01B714FDBF1B}.DebugMem|Win32.Build.0 = DebugMem|Win32
 		{0F27C8C4-58B2-E367-8D1F-01B714FDBF1B}.DebugMem|Win32.Build.0 = DebugMem|Win32
 		{0F27C8C4-58B2-E367-8D1F-01B714FDBF1B}.DebugMem|x64.ActiveCfg = DebugMem|x64
 		{0F27C8C4-58B2-E367-8D1F-01B714FDBF1B}.DebugMem|x64.ActiveCfg = DebugMem|x64
 		{0F27C8C4-58B2-E367-8D1F-01B714FDBF1B}.DebugMem|x64.Build.0 = DebugMem|x64
 		{0F27C8C4-58B2-E367-8D1F-01B714FDBF1B}.DebugMem|x64.Build.0 = DebugMem|x64
-		{0F27C8C4-58B2-E367-8D1F-01B714FDBF1B}.Release|BlackBerry.ActiveCfg = Release|BlackBerry
-		{0F27C8C4-58B2-E367-8D1F-01B714FDBF1B}.Release|BlackBerry.Build.0 = Release|BlackBerry
-		{0F27C8C4-58B2-E367-8D1F-01B714FDBF1B}.Release|BlackBerry.Deploy.0 = Release|BlackBerry
-		{0F27C8C4-58B2-E367-8D1F-01B714FDBF1B}.Release|BlackBerrySimulator.ActiveCfg = Release|BlackBerrySimulator
-		{0F27C8C4-58B2-E367-8D1F-01B714FDBF1B}.Release|BlackBerrySimulator.Build.0 = Release|BlackBerrySimulator
-		{0F27C8C4-58B2-E367-8D1F-01B714FDBF1B}.Release|BlackBerrySimulator.Deploy.0 = Release|BlackBerrySimulator
+		{0F27C8C4-58B2-E367-8D1F-01B714FDBF1B}.Release|BlackBerry.ActiveCfg = Release|Win32
+		{0F27C8C4-58B2-E367-8D1F-01B714FDBF1B}.Release|BlackBerrySimulator.ActiveCfg = Release|Win32
 		{0F27C8C4-58B2-E367-8D1F-01B714FDBF1B}.Release|Win32.ActiveCfg = Release|Win32
 		{0F27C8C4-58B2-E367-8D1F-01B714FDBF1B}.Release|Win32.ActiveCfg = Release|Win32
 		{0F27C8C4-58B2-E367-8D1F-01B714FDBF1B}.Release|Win32.Build.0 = Release|Win32
 		{0F27C8C4-58B2-E367-8D1F-01B714FDBF1B}.Release|Win32.Build.0 = Release|Win32
 		{0F27C8C4-58B2-E367-8D1F-01B714FDBF1B}.Release|x64.ActiveCfg = Release|x64
 		{0F27C8C4-58B2-E367-8D1F-01B714FDBF1B}.Release|x64.ActiveCfg = Release|x64
 		{0F27C8C4-58B2-E367-8D1F-01B714FDBF1B}.Release|x64.Build.0 = Release|x64
 		{0F27C8C4-58B2-E367-8D1F-01B714FDBF1B}.Release|x64.Build.0 = Release|x64
-		{D672DC66-3CE0-4878-B0D2-813CA731012F}.Debug|BlackBerry.ActiveCfg = Debug|BlackBerry
-		{D672DC66-3CE0-4878-B0D2-813CA731012F}.Debug|BlackBerry.Build.0 = Debug|BlackBerry
-		{D672DC66-3CE0-4878-B0D2-813CA731012F}.Debug|BlackBerry.Deploy.0 = Debug|BlackBerry
-		{D672DC66-3CE0-4878-B0D2-813CA731012F}.Debug|BlackBerrySimulator.ActiveCfg = Debug|BlackBerrySimulator
-		{D672DC66-3CE0-4878-B0D2-813CA731012F}.Debug|BlackBerrySimulator.Build.0 = Debug|BlackBerrySimulator
-		{D672DC66-3CE0-4878-B0D2-813CA731012F}.Debug|BlackBerrySimulator.Deploy.0 = Debug|BlackBerrySimulator
+		{D672DC66-3CE0-4878-B0D2-813CA731012F}.Debug|BlackBerry.ActiveCfg = Debug|Win32
+		{D672DC66-3CE0-4878-B0D2-813CA731012F}.Debug|BlackBerrySimulator.ActiveCfg = Debug|Win32
 		{D672DC66-3CE0-4878-B0D2-813CA731012F}.Debug|Win32.ActiveCfg = Debug|Win32
 		{D672DC66-3CE0-4878-B0D2-813CA731012F}.Debug|Win32.ActiveCfg = Debug|Win32
 		{D672DC66-3CE0-4878-B0D2-813CA731012F}.Debug|Win32.Build.0 = Debug|Win32
 		{D672DC66-3CE0-4878-B0D2-813CA731012F}.Debug|Win32.Build.0 = Debug|Win32
 		{D672DC66-3CE0-4878-B0D2-813CA731012F}.Debug|x64.ActiveCfg = Debug|x64
 		{D672DC66-3CE0-4878-B0D2-813CA731012F}.Debug|x64.ActiveCfg = Debug|x64
 		{D672DC66-3CE0-4878-B0D2-813CA731012F}.Debug|x64.Build.0 = Debug|x64
 		{D672DC66-3CE0-4878-B0D2-813CA731012F}.Debug|x64.Build.0 = Debug|x64
-		{D672DC66-3CE0-4878-B0D2-813CA731012F}.DebugMem|BlackBerry.ActiveCfg = DebugMem|BlackBerry
-		{D672DC66-3CE0-4878-B0D2-813CA731012F}.DebugMem|BlackBerry.Build.0 = DebugMem|BlackBerry
-		{D672DC66-3CE0-4878-B0D2-813CA731012F}.DebugMem|BlackBerry.Deploy.0 = DebugMem|BlackBerry
-		{D672DC66-3CE0-4878-B0D2-813CA731012F}.DebugMem|BlackBerrySimulator.ActiveCfg = DebugMem|BlackBerrySimulator
-		{D672DC66-3CE0-4878-B0D2-813CA731012F}.DebugMem|BlackBerrySimulator.Build.0 = DebugMem|BlackBerrySimulator
-		{D672DC66-3CE0-4878-B0D2-813CA731012F}.DebugMem|BlackBerrySimulator.Deploy.0 = DebugMem|BlackBerrySimulator
+		{D672DC66-3CE0-4878-B0D2-813CA731012F}.DebugMem|BlackBerry.ActiveCfg = DebugMem|Win32
+		{D672DC66-3CE0-4878-B0D2-813CA731012F}.DebugMem|BlackBerrySimulator.ActiveCfg = DebugMem|Win32
 		{D672DC66-3CE0-4878-B0D2-813CA731012F}.DebugMem|Win32.ActiveCfg = DebugMem|Win32
 		{D672DC66-3CE0-4878-B0D2-813CA731012F}.DebugMem|Win32.ActiveCfg = DebugMem|Win32
 		{D672DC66-3CE0-4878-B0D2-813CA731012F}.DebugMem|Win32.Build.0 = DebugMem|Win32
 		{D672DC66-3CE0-4878-B0D2-813CA731012F}.DebugMem|Win32.Build.0 = DebugMem|Win32
 		{D672DC66-3CE0-4878-B0D2-813CA731012F}.DebugMem|x64.ActiveCfg = DebugMem|x64
 		{D672DC66-3CE0-4878-B0D2-813CA731012F}.DebugMem|x64.ActiveCfg = DebugMem|x64
 		{D672DC66-3CE0-4878-B0D2-813CA731012F}.DebugMem|x64.Build.0 = DebugMem|x64
 		{D672DC66-3CE0-4878-B0D2-813CA731012F}.DebugMem|x64.Build.0 = DebugMem|x64
-		{D672DC66-3CE0-4878-B0D2-813CA731012F}.Release|BlackBerry.ActiveCfg = Release|BlackBerry
-		{D672DC66-3CE0-4878-B0D2-813CA731012F}.Release|BlackBerry.Build.0 = Release|BlackBerry
-		{D672DC66-3CE0-4878-B0D2-813CA731012F}.Release|BlackBerry.Deploy.0 = Release|BlackBerry
-		{D672DC66-3CE0-4878-B0D2-813CA731012F}.Release|BlackBerrySimulator.ActiveCfg = Release|BlackBerrySimulator
-		{D672DC66-3CE0-4878-B0D2-813CA731012F}.Release|BlackBerrySimulator.Build.0 = Release|BlackBerrySimulator
-		{D672DC66-3CE0-4878-B0D2-813CA731012F}.Release|BlackBerrySimulator.Deploy.0 = Release|BlackBerrySimulator
+		{D672DC66-3CE0-4878-B0D2-813CA731012F}.Release|BlackBerry.ActiveCfg = Release|Win32
+		{D672DC66-3CE0-4878-B0D2-813CA731012F}.Release|BlackBerrySimulator.ActiveCfg = Release|Win32
 		{D672DC66-3CE0-4878-B0D2-813CA731012F}.Release|Win32.ActiveCfg = Release|Win32
 		{D672DC66-3CE0-4878-B0D2-813CA731012F}.Release|Win32.ActiveCfg = Release|Win32
 		{D672DC66-3CE0-4878-B0D2-813CA731012F}.Release|Win32.Build.0 = Release|Win32
 		{D672DC66-3CE0-4878-B0D2-813CA731012F}.Release|Win32.Build.0 = Release|Win32
 		{D672DC66-3CE0-4878-B0D2-813CA731012F}.Release|x64.ActiveCfg = Release|x64
 		{D672DC66-3CE0-4878-B0D2-813CA731012F}.Release|x64.ActiveCfg = Release|x64
 		{D672DC66-3CE0-4878-B0D2-813CA731012F}.Release|x64.Build.0 = Release|x64
 		{D672DC66-3CE0-4878-B0D2-813CA731012F}.Release|x64.Build.0 = Release|x64
-		{04EAF3E5-0F9E-AF4D-53F9-269CE114211F}.Debug|BlackBerry.ActiveCfg = Debug|BlackBerry
-		{04EAF3E5-0F9E-AF4D-53F9-269CE114211F}.Debug|BlackBerry.Build.0 = Debug|BlackBerry
-		{04EAF3E5-0F9E-AF4D-53F9-269CE114211F}.Debug|BlackBerry.Deploy.0 = Debug|BlackBerry
-		{04EAF3E5-0F9E-AF4D-53F9-269CE114211F}.Debug|BlackBerrySimulator.ActiveCfg = Debug|BlackBerrySimulator
-		{04EAF3E5-0F9E-AF4D-53F9-269CE114211F}.Debug|BlackBerrySimulator.Build.0 = Debug|BlackBerrySimulator
-		{04EAF3E5-0F9E-AF4D-53F9-269CE114211F}.Debug|BlackBerrySimulator.Deploy.0 = Debug|BlackBerrySimulator
+		{04EAF3E5-0F9E-AF4D-53F9-269CE114211F}.Debug|BlackBerry.ActiveCfg = Debug|Win32
+		{04EAF3E5-0F9E-AF4D-53F9-269CE114211F}.Debug|BlackBerrySimulator.ActiveCfg = Debug|Win32
 		{04EAF3E5-0F9E-AF4D-53F9-269CE114211F}.Debug|Win32.ActiveCfg = Debug|Win32
 		{04EAF3E5-0F9E-AF4D-53F9-269CE114211F}.Debug|Win32.ActiveCfg = Debug|Win32
 		{04EAF3E5-0F9E-AF4D-53F9-269CE114211F}.Debug|Win32.Build.0 = Debug|Win32
 		{04EAF3E5-0F9E-AF4D-53F9-269CE114211F}.Debug|Win32.Build.0 = Debug|Win32
 		{04EAF3E5-0F9E-AF4D-53F9-269CE114211F}.Debug|x64.ActiveCfg = Debug|x64
 		{04EAF3E5-0F9E-AF4D-53F9-269CE114211F}.Debug|x64.ActiveCfg = Debug|x64
 		{04EAF3E5-0F9E-AF4D-53F9-269CE114211F}.Debug|x64.Build.0 = Debug|x64
 		{04EAF3E5-0F9E-AF4D-53F9-269CE114211F}.Debug|x64.Build.0 = Debug|x64
-		{04EAF3E5-0F9E-AF4D-53F9-269CE114211F}.DebugMem|BlackBerry.ActiveCfg = DebugMem|BlackBerry
-		{04EAF3E5-0F9E-AF4D-53F9-269CE114211F}.DebugMem|BlackBerry.Build.0 = DebugMem|BlackBerry
-		{04EAF3E5-0F9E-AF4D-53F9-269CE114211F}.DebugMem|BlackBerry.Deploy.0 = DebugMem|BlackBerry
-		{04EAF3E5-0F9E-AF4D-53F9-269CE114211F}.DebugMem|BlackBerrySimulator.ActiveCfg = DebugMem|BlackBerrySimulator
-		{04EAF3E5-0F9E-AF4D-53F9-269CE114211F}.DebugMem|BlackBerrySimulator.Build.0 = DebugMem|BlackBerrySimulator
-		{04EAF3E5-0F9E-AF4D-53F9-269CE114211F}.DebugMem|BlackBerrySimulator.Deploy.0 = DebugMem|BlackBerrySimulator
+		{04EAF3E5-0F9E-AF4D-53F9-269CE114211F}.DebugMem|BlackBerry.ActiveCfg = DebugMem|Win32
+		{04EAF3E5-0F9E-AF4D-53F9-269CE114211F}.DebugMem|BlackBerrySimulator.ActiveCfg = DebugMem|Win32
 		{04EAF3E5-0F9E-AF4D-53F9-269CE114211F}.DebugMem|Win32.ActiveCfg = DebugMem|Win32
 		{04EAF3E5-0F9E-AF4D-53F9-269CE114211F}.DebugMem|Win32.ActiveCfg = DebugMem|Win32
 		{04EAF3E5-0F9E-AF4D-53F9-269CE114211F}.DebugMem|Win32.Build.0 = DebugMem|Win32
 		{04EAF3E5-0F9E-AF4D-53F9-269CE114211F}.DebugMem|Win32.Build.0 = DebugMem|Win32
 		{04EAF3E5-0F9E-AF4D-53F9-269CE114211F}.DebugMem|x64.ActiveCfg = DebugMem|x64
 		{04EAF3E5-0F9E-AF4D-53F9-269CE114211F}.DebugMem|x64.ActiveCfg = DebugMem|x64
 		{04EAF3E5-0F9E-AF4D-53F9-269CE114211F}.DebugMem|x64.Build.0 = DebugMem|x64
 		{04EAF3E5-0F9E-AF4D-53F9-269CE114211F}.DebugMem|x64.Build.0 = DebugMem|x64
-		{04EAF3E5-0F9E-AF4D-53F9-269CE114211F}.Release|BlackBerry.ActiveCfg = Release|BlackBerry
-		{04EAF3E5-0F9E-AF4D-53F9-269CE114211F}.Release|BlackBerry.Build.0 = Release|BlackBerry
-		{04EAF3E5-0F9E-AF4D-53F9-269CE114211F}.Release|BlackBerry.Deploy.0 = Release|BlackBerry
-		{04EAF3E5-0F9E-AF4D-53F9-269CE114211F}.Release|BlackBerrySimulator.ActiveCfg = Release|BlackBerrySimulator
-		{04EAF3E5-0F9E-AF4D-53F9-269CE114211F}.Release|BlackBerrySimulator.Build.0 = Release|BlackBerrySimulator
-		{04EAF3E5-0F9E-AF4D-53F9-269CE114211F}.Release|BlackBerrySimulator.Deploy.0 = Release|BlackBerrySimulator
+		{04EAF3E5-0F9E-AF4D-53F9-269CE114211F}.Release|BlackBerry.ActiveCfg = Release|Win32
+		{04EAF3E5-0F9E-AF4D-53F9-269CE114211F}.Release|BlackBerrySimulator.ActiveCfg = Release|Win32
 		{04EAF3E5-0F9E-AF4D-53F9-269CE114211F}.Release|Win32.ActiveCfg = Release|Win32
 		{04EAF3E5-0F9E-AF4D-53F9-269CE114211F}.Release|Win32.ActiveCfg = Release|Win32
 		{04EAF3E5-0F9E-AF4D-53F9-269CE114211F}.Release|Win32.Build.0 = Release|Win32
 		{04EAF3E5-0F9E-AF4D-53F9-269CE114211F}.Release|Win32.Build.0 = Release|Win32
 		{04EAF3E5-0F9E-AF4D-53F9-269CE114211F}.Release|x64.ActiveCfg = Release|x64
 		{04EAF3E5-0F9E-AF4D-53F9-269CE114211F}.Release|x64.ActiveCfg = Release|x64
 		{04EAF3E5-0F9E-AF4D-53F9-269CE114211F}.Release|x64.Build.0 = Release|x64
 		{04EAF3E5-0F9E-AF4D-53F9-269CE114211F}.Release|x64.Build.0 = Release|x64
-		{9A515C8B-3320-4C5C-9754-211E91206C9D}.Debug|BlackBerry.ActiveCfg = Debug|BlackBerry
-		{9A515C8B-3320-4C5C-9754-211E91206C9D}.Debug|BlackBerry.Build.0 = Debug|BlackBerry
-		{9A515C8B-3320-4C5C-9754-211E91206C9D}.Debug|BlackBerry.Deploy.0 = Debug|BlackBerry
-		{9A515C8B-3320-4C5C-9754-211E91206C9D}.Debug|BlackBerrySimulator.ActiveCfg = Debug|BlackBerrySimulator
-		{9A515C8B-3320-4C5C-9754-211E91206C9D}.Debug|BlackBerrySimulator.Build.0 = Debug|BlackBerrySimulator
-		{9A515C8B-3320-4C5C-9754-211E91206C9D}.Debug|BlackBerrySimulator.Deploy.0 = Debug|BlackBerrySimulator
-		{9A515C8B-3320-4C5C-9754-211E91206C9D}.Debug|Win32.ActiveCfg = Debug|Win32
-		{9A515C8B-3320-4C5C-9754-211E91206C9D}.Debug|Win32.Build.0 = Debug|Win32
-		{9A515C8B-3320-4C5C-9754-211E91206C9D}.Debug|x64.ActiveCfg = Debug|x64
-		{9A515C8B-3320-4C5C-9754-211E91206C9D}.Debug|x64.Build.0 = Debug|x64
-		{9A515C8B-3320-4C5C-9754-211E91206C9D}.DebugMem|BlackBerry.ActiveCfg = DebugMem|BlackBerry
-		{9A515C8B-3320-4C5C-9754-211E91206C9D}.DebugMem|BlackBerry.Build.0 = DebugMem|BlackBerry
-		{9A515C8B-3320-4C5C-9754-211E91206C9D}.DebugMem|BlackBerry.Deploy.0 = DebugMem|BlackBerry
-		{9A515C8B-3320-4C5C-9754-211E91206C9D}.DebugMem|BlackBerrySimulator.ActiveCfg = DebugMem|BlackBerrySimulator
-		{9A515C8B-3320-4C5C-9754-211E91206C9D}.DebugMem|BlackBerrySimulator.Build.0 = DebugMem|BlackBerrySimulator
-		{9A515C8B-3320-4C5C-9754-211E91206C9D}.DebugMem|BlackBerrySimulator.Deploy.0 = DebugMem|BlackBerrySimulator
-		{9A515C8B-3320-4C5C-9754-211E91206C9D}.DebugMem|Win32.ActiveCfg = DebugMem|Win32
-		{9A515C8B-3320-4C5C-9754-211E91206C9D}.DebugMem|Win32.Build.0 = DebugMem|Win32
-		{9A515C8B-3320-4C5C-9754-211E91206C9D}.DebugMem|x64.ActiveCfg = DebugMem|x64
-		{9A515C8B-3320-4C5C-9754-211E91206C9D}.DebugMem|x64.Build.0 = DebugMem|x64
-		{9A515C8B-3320-4C5C-9754-211E91206C9D}.Release|BlackBerry.ActiveCfg = Release|BlackBerry
-		{9A515C8B-3320-4C5C-9754-211E91206C9D}.Release|BlackBerry.Build.0 = Release|BlackBerry
-		{9A515C8B-3320-4C5C-9754-211E91206C9D}.Release|BlackBerry.Deploy.0 = Release|BlackBerry
-		{9A515C8B-3320-4C5C-9754-211E91206C9D}.Release|BlackBerrySimulator.ActiveCfg = Release|BlackBerrySimulator
-		{9A515C8B-3320-4C5C-9754-211E91206C9D}.Release|BlackBerrySimulator.Build.0 = Release|BlackBerrySimulator
-		{9A515C8B-3320-4C5C-9754-211E91206C9D}.Release|BlackBerrySimulator.Deploy.0 = Release|BlackBerrySimulator
-		{9A515C8B-3320-4C5C-9754-211E91206C9D}.Release|Win32.ActiveCfg = Release|Win32
-		{9A515C8B-3320-4C5C-9754-211E91206C9D}.Release|Win32.Build.0 = Release|Win32
-		{9A515C8B-3320-4C5C-9754-211E91206C9D}.Release|x64.ActiveCfg = Release|x64
-		{9A515C8B-3320-4C5C-9754-211E91206C9D}.Release|x64.Build.0 = Release|x64
-		{CC37B8E9-6402-4841-8D6A-5D908A5909B3}.Debug|BlackBerry.ActiveCfg = Debug|BlackBerry
-		{CC37B8E9-6402-4841-8D6A-5D908A5909B3}.Debug|BlackBerry.Build.0 = Debug|BlackBerry
-		{CC37B8E9-6402-4841-8D6A-5D908A5909B3}.Debug|BlackBerry.Deploy.0 = Debug|BlackBerry
-		{CC37B8E9-6402-4841-8D6A-5D908A5909B3}.Debug|BlackBerrySimulator.ActiveCfg = Debug|BlackBerrySimulator
-		{CC37B8E9-6402-4841-8D6A-5D908A5909B3}.Debug|BlackBerrySimulator.Build.0 = Debug|BlackBerrySimulator
-		{CC37B8E9-6402-4841-8D6A-5D908A5909B3}.Debug|BlackBerrySimulator.Deploy.0 = Debug|BlackBerrySimulator
+		{CC37B8E9-6402-4841-8D6A-5D908A5909B3}.Debug|BlackBerry.ActiveCfg = Debug|Win32
+		{CC37B8E9-6402-4841-8D6A-5D908A5909B3}.Debug|BlackBerrySimulator.ActiveCfg = Debug|Win32
 		{CC37B8E9-6402-4841-8D6A-5D908A5909B3}.Debug|Win32.ActiveCfg = Debug|Win32
 		{CC37B8E9-6402-4841-8D6A-5D908A5909B3}.Debug|Win32.ActiveCfg = Debug|Win32
 		{CC37B8E9-6402-4841-8D6A-5D908A5909B3}.Debug|Win32.Build.0 = Debug|Win32
 		{CC37B8E9-6402-4841-8D6A-5D908A5909B3}.Debug|Win32.Build.0 = Debug|Win32
 		{CC37B8E9-6402-4841-8D6A-5D908A5909B3}.Debug|x64.ActiveCfg = Debug|x64
 		{CC37B8E9-6402-4841-8D6A-5D908A5909B3}.Debug|x64.ActiveCfg = Debug|x64
 		{CC37B8E9-6402-4841-8D6A-5D908A5909B3}.Debug|x64.Build.0 = Debug|x64
 		{CC37B8E9-6402-4841-8D6A-5D908A5909B3}.Debug|x64.Build.0 = Debug|x64
-		{CC37B8E9-6402-4841-8D6A-5D908A5909B3}.DebugMem|BlackBerry.ActiveCfg = DebugMem|BlackBerry
-		{CC37B8E9-6402-4841-8D6A-5D908A5909B3}.DebugMem|BlackBerry.Build.0 = DebugMem|BlackBerry
-		{CC37B8E9-6402-4841-8D6A-5D908A5909B3}.DebugMem|BlackBerry.Deploy.0 = DebugMem|BlackBerry
-		{CC37B8E9-6402-4841-8D6A-5D908A5909B3}.DebugMem|BlackBerrySimulator.ActiveCfg = DebugMem|BlackBerrySimulator
-		{CC37B8E9-6402-4841-8D6A-5D908A5909B3}.DebugMem|BlackBerrySimulator.Build.0 = DebugMem|BlackBerrySimulator
-		{CC37B8E9-6402-4841-8D6A-5D908A5909B3}.DebugMem|BlackBerrySimulator.Deploy.0 = DebugMem|BlackBerrySimulator
+		{CC37B8E9-6402-4841-8D6A-5D908A5909B3}.DebugMem|BlackBerry.ActiveCfg = DebugMem|Win32
+		{CC37B8E9-6402-4841-8D6A-5D908A5909B3}.DebugMem|BlackBerrySimulator.ActiveCfg = DebugMem|Win32
 		{CC37B8E9-6402-4841-8D6A-5D908A5909B3}.DebugMem|Win32.ActiveCfg = DebugMem|Win32
 		{CC37B8E9-6402-4841-8D6A-5D908A5909B3}.DebugMem|Win32.ActiveCfg = DebugMem|Win32
 		{CC37B8E9-6402-4841-8D6A-5D908A5909B3}.DebugMem|Win32.Build.0 = DebugMem|Win32
 		{CC37B8E9-6402-4841-8D6A-5D908A5909B3}.DebugMem|Win32.Build.0 = DebugMem|Win32
 		{CC37B8E9-6402-4841-8D6A-5D908A5909B3}.DebugMem|x64.ActiveCfg = DebugMem|x64
 		{CC37B8E9-6402-4841-8D6A-5D908A5909B3}.DebugMem|x64.ActiveCfg = DebugMem|x64
 		{CC37B8E9-6402-4841-8D6A-5D908A5909B3}.DebugMem|x64.Build.0 = DebugMem|x64
 		{CC37B8E9-6402-4841-8D6A-5D908A5909B3}.DebugMem|x64.Build.0 = DebugMem|x64
-		{CC37B8E9-6402-4841-8D6A-5D908A5909B3}.Release|BlackBerry.ActiveCfg = Release|BlackBerry
-		{CC37B8E9-6402-4841-8D6A-5D908A5909B3}.Release|BlackBerry.Build.0 = Release|BlackBerry
-		{CC37B8E9-6402-4841-8D6A-5D908A5909B3}.Release|BlackBerry.Deploy.0 = Release|BlackBerry
-		{CC37B8E9-6402-4841-8D6A-5D908A5909B3}.Release|BlackBerrySimulator.ActiveCfg = Release|BlackBerrySimulator
-		{CC37B8E9-6402-4841-8D6A-5D908A5909B3}.Release|BlackBerrySimulator.Build.0 = Release|BlackBerrySimulator
-		{CC37B8E9-6402-4841-8D6A-5D908A5909B3}.Release|BlackBerrySimulator.Deploy.0 = Release|BlackBerrySimulator
+		{CC37B8E9-6402-4841-8D6A-5D908A5909B3}.Release|BlackBerry.ActiveCfg = Release|Win32
+		{CC37B8E9-6402-4841-8D6A-5D908A5909B3}.Release|BlackBerrySimulator.ActiveCfg = Release|Win32
 		{CC37B8E9-6402-4841-8D6A-5D908A5909B3}.Release|Win32.ActiveCfg = Release|Win32
 		{CC37B8E9-6402-4841-8D6A-5D908A5909B3}.Release|Win32.ActiveCfg = Release|Win32
 		{CC37B8E9-6402-4841-8D6A-5D908A5909B3}.Release|Win32.Build.0 = Release|Win32
 		{CC37B8E9-6402-4841-8D6A-5D908A5909B3}.Release|Win32.Build.0 = Release|Win32
 		{CC37B8E9-6402-4841-8D6A-5D908A5909B3}.Release|x64.ActiveCfg = Release|x64
 		{CC37B8E9-6402-4841-8D6A-5D908A5909B3}.Release|x64.ActiveCfg = Release|x64
 		{CC37B8E9-6402-4841-8D6A-5D908A5909B3}.Release|x64.Build.0 = Release|x64
 		{CC37B8E9-6402-4841-8D6A-5D908A5909B3}.Release|x64.Build.0 = Release|x64
-		{87388E8B-F3CF-428F-BC2C-C1886248C111}.Debug|BlackBerry.ActiveCfg = Debug|BlackBerry
-		{87388E8B-F3CF-428F-BC2C-C1886248C111}.Debug|BlackBerry.Build.0 = Debug|BlackBerry
-		{87388E8B-F3CF-428F-BC2C-C1886248C111}.Debug|BlackBerry.Deploy.0 = Debug|BlackBerry
-		{87388E8B-F3CF-428F-BC2C-C1886248C111}.Debug|BlackBerrySimulator.ActiveCfg = Debug|BlackBerrySimulator
-		{87388E8B-F3CF-428F-BC2C-C1886248C111}.Debug|BlackBerrySimulator.Build.0 = Debug|BlackBerrySimulator
-		{87388E8B-F3CF-428F-BC2C-C1886248C111}.Debug|BlackBerrySimulator.Deploy.0 = Debug|BlackBerrySimulator
+		{87388E8B-F3CF-428F-BC2C-C1886248C111}.Debug|BlackBerry.ActiveCfg = Debug|Win32
+		{87388E8B-F3CF-428F-BC2C-C1886248C111}.Debug|BlackBerrySimulator.ActiveCfg = Debug|Win32
 		{87388E8B-F3CF-428F-BC2C-C1886248C111}.Debug|Win32.ActiveCfg = Debug|Win32
 		{87388E8B-F3CF-428F-BC2C-C1886248C111}.Debug|Win32.ActiveCfg = Debug|Win32
 		{87388E8B-F3CF-428F-BC2C-C1886248C111}.Debug|Win32.Build.0 = Debug|Win32
 		{87388E8B-F3CF-428F-BC2C-C1886248C111}.Debug|Win32.Build.0 = Debug|Win32
 		{87388E8B-F3CF-428F-BC2C-C1886248C111}.Debug|x64.ActiveCfg = Debug|x64
 		{87388E8B-F3CF-428F-BC2C-C1886248C111}.Debug|x64.ActiveCfg = Debug|x64
 		{87388E8B-F3CF-428F-BC2C-C1886248C111}.Debug|x64.Build.0 = Debug|x64
 		{87388E8B-F3CF-428F-BC2C-C1886248C111}.Debug|x64.Build.0 = Debug|x64
-		{87388E8B-F3CF-428F-BC2C-C1886248C111}.DebugMem|BlackBerry.ActiveCfg = DebugMem|BlackBerry
-		{87388E8B-F3CF-428F-BC2C-C1886248C111}.DebugMem|BlackBerry.Build.0 = DebugMem|BlackBerry
-		{87388E8B-F3CF-428F-BC2C-C1886248C111}.DebugMem|BlackBerry.Deploy.0 = DebugMem|BlackBerry
-		{87388E8B-F3CF-428F-BC2C-C1886248C111}.DebugMem|BlackBerrySimulator.ActiveCfg = DebugMem|BlackBerrySimulator
-		{87388E8B-F3CF-428F-BC2C-C1886248C111}.DebugMem|BlackBerrySimulator.Build.0 = DebugMem|BlackBerrySimulator
-		{87388E8B-F3CF-428F-BC2C-C1886248C111}.DebugMem|BlackBerrySimulator.Deploy.0 = DebugMem|BlackBerrySimulator
+		{87388E8B-F3CF-428F-BC2C-C1886248C111}.DebugMem|BlackBerry.ActiveCfg = DebugMem|Win32
+		{87388E8B-F3CF-428F-BC2C-C1886248C111}.DebugMem|BlackBerrySimulator.ActiveCfg = DebugMem|Win32
 		{87388E8B-F3CF-428F-BC2C-C1886248C111}.DebugMem|Win32.ActiveCfg = DebugMem|Win32
 		{87388E8B-F3CF-428F-BC2C-C1886248C111}.DebugMem|Win32.ActiveCfg = DebugMem|Win32
 		{87388E8B-F3CF-428F-BC2C-C1886248C111}.DebugMem|Win32.Build.0 = DebugMem|Win32
 		{87388E8B-F3CF-428F-BC2C-C1886248C111}.DebugMem|Win32.Build.0 = DebugMem|Win32
 		{87388E8B-F3CF-428F-BC2C-C1886248C111}.DebugMem|x64.ActiveCfg = DebugMem|x64
 		{87388E8B-F3CF-428F-BC2C-C1886248C111}.DebugMem|x64.ActiveCfg = DebugMem|x64
 		{87388E8B-F3CF-428F-BC2C-C1886248C111}.DebugMem|x64.Build.0 = DebugMem|x64
 		{87388E8B-F3CF-428F-BC2C-C1886248C111}.DebugMem|x64.Build.0 = DebugMem|x64
-		{87388E8B-F3CF-428F-BC2C-C1886248C111}.Release|BlackBerry.ActiveCfg = Release|BlackBerry
-		{87388E8B-F3CF-428F-BC2C-C1886248C111}.Release|BlackBerry.Build.0 = Release|BlackBerry
-		{87388E8B-F3CF-428F-BC2C-C1886248C111}.Release|BlackBerry.Deploy.0 = Release|BlackBerry
-		{87388E8B-F3CF-428F-BC2C-C1886248C111}.Release|BlackBerrySimulator.ActiveCfg = Release|BlackBerrySimulator
-		{87388E8B-F3CF-428F-BC2C-C1886248C111}.Release|BlackBerrySimulator.Build.0 = Release|BlackBerrySimulator
-		{87388E8B-F3CF-428F-BC2C-C1886248C111}.Release|BlackBerrySimulator.Deploy.0 = Release|BlackBerrySimulator
+		{87388E8B-F3CF-428F-BC2C-C1886248C111}.Release|BlackBerry.ActiveCfg = Release|Win32
+		{87388E8B-F3CF-428F-BC2C-C1886248C111}.Release|BlackBerrySimulator.ActiveCfg = Release|Win32
 		{87388E8B-F3CF-428F-BC2C-C1886248C111}.Release|Win32.ActiveCfg = Release|Win32
 		{87388E8B-F3CF-428F-BC2C-C1886248C111}.Release|Win32.ActiveCfg = Release|Win32
 		{87388E8B-F3CF-428F-BC2C-C1886248C111}.Release|Win32.Build.0 = Release|Win32
 		{87388E8B-F3CF-428F-BC2C-C1886248C111}.Release|Win32.Build.0 = Release|Win32
 		{87388E8B-F3CF-428F-BC2C-C1886248C111}.Release|x64.ActiveCfg = Release|x64
 		{87388E8B-F3CF-428F-BC2C-C1886248C111}.Release|x64.ActiveCfg = Release|x64
 		{87388E8B-F3CF-428F-BC2C-C1886248C111}.Release|x64.Build.0 = Release|x64
 		{87388E8B-F3CF-428F-BC2C-C1886248C111}.Release|x64.Build.0 = Release|x64
-		{CB5ABFAA-EA69-E439-5A4D-3B9359916C71}.Debug|BlackBerry.ActiveCfg = Debug|BlackBerry
-		{CB5ABFAA-EA69-E439-5A4D-3B9359916C71}.Debug|BlackBerry.Build.0 = Debug|BlackBerry
-		{CB5ABFAA-EA69-E439-5A4D-3B9359916C71}.Debug|BlackBerry.Deploy.0 = Debug|BlackBerry
-		{CB5ABFAA-EA69-E439-5A4D-3B9359916C71}.Debug|BlackBerrySimulator.ActiveCfg = Debug|BlackBerrySimulator
-		{CB5ABFAA-EA69-E439-5A4D-3B9359916C71}.Debug|BlackBerrySimulator.Build.0 = Debug|BlackBerrySimulator
-		{CB5ABFAA-EA69-E439-5A4D-3B9359916C71}.Debug|BlackBerrySimulator.Deploy.0 = Debug|BlackBerrySimulator
+		{CB5ABFAA-EA69-E439-5A4D-3B9359916C71}.Debug|BlackBerry.ActiveCfg = Debug|Win32
+		{CB5ABFAA-EA69-E439-5A4D-3B9359916C71}.Debug|BlackBerrySimulator.ActiveCfg = Debug|Win32
 		{CB5ABFAA-EA69-E439-5A4D-3B9359916C71}.Debug|Win32.ActiveCfg = Debug|Win32
 		{CB5ABFAA-EA69-E439-5A4D-3B9359916C71}.Debug|Win32.ActiveCfg = Debug|Win32
 		{CB5ABFAA-EA69-E439-5A4D-3B9359916C71}.Debug|Win32.Build.0 = Debug|Win32
 		{CB5ABFAA-EA69-E439-5A4D-3B9359916C71}.Debug|Win32.Build.0 = Debug|Win32
 		{CB5ABFAA-EA69-E439-5A4D-3B9359916C71}.Debug|x64.ActiveCfg = Debug|x64
 		{CB5ABFAA-EA69-E439-5A4D-3B9359916C71}.Debug|x64.ActiveCfg = Debug|x64
 		{CB5ABFAA-EA69-E439-5A4D-3B9359916C71}.Debug|x64.Build.0 = Debug|x64
 		{CB5ABFAA-EA69-E439-5A4D-3B9359916C71}.Debug|x64.Build.0 = Debug|x64
-		{CB5ABFAA-EA69-E439-5A4D-3B9359916C71}.DebugMem|BlackBerry.ActiveCfg = DebugMem|BlackBerry
-		{CB5ABFAA-EA69-E439-5A4D-3B9359916C71}.DebugMem|BlackBerry.Build.0 = DebugMem|BlackBerry
-		{CB5ABFAA-EA69-E439-5A4D-3B9359916C71}.DebugMem|BlackBerry.Deploy.0 = DebugMem|BlackBerry
-		{CB5ABFAA-EA69-E439-5A4D-3B9359916C71}.DebugMem|BlackBerrySimulator.ActiveCfg = DebugMem|BlackBerrySimulator
-		{CB5ABFAA-EA69-E439-5A4D-3B9359916C71}.DebugMem|BlackBerrySimulator.Build.0 = DebugMem|BlackBerrySimulator
-		{CB5ABFAA-EA69-E439-5A4D-3B9359916C71}.DebugMem|BlackBerrySimulator.Deploy.0 = DebugMem|BlackBerrySimulator
+		{CB5ABFAA-EA69-E439-5A4D-3B9359916C71}.DebugMem|BlackBerry.ActiveCfg = DebugMem|Win32
+		{CB5ABFAA-EA69-E439-5A4D-3B9359916C71}.DebugMem|BlackBerrySimulator.ActiveCfg = DebugMem|Win32
 		{CB5ABFAA-EA69-E439-5A4D-3B9359916C71}.DebugMem|Win32.ActiveCfg = DebugMem|Win32
 		{CB5ABFAA-EA69-E439-5A4D-3B9359916C71}.DebugMem|Win32.ActiveCfg = DebugMem|Win32
 		{CB5ABFAA-EA69-E439-5A4D-3B9359916C71}.DebugMem|Win32.Build.0 = DebugMem|Win32
 		{CB5ABFAA-EA69-E439-5A4D-3B9359916C71}.DebugMem|Win32.Build.0 = DebugMem|Win32
 		{CB5ABFAA-EA69-E439-5A4D-3B9359916C71}.DebugMem|x64.ActiveCfg = DebugMem|x64
 		{CB5ABFAA-EA69-E439-5A4D-3B9359916C71}.DebugMem|x64.ActiveCfg = DebugMem|x64
 		{CB5ABFAA-EA69-E439-5A4D-3B9359916C71}.DebugMem|x64.Build.0 = DebugMem|x64
 		{CB5ABFAA-EA69-E439-5A4D-3B9359916C71}.DebugMem|x64.Build.0 = DebugMem|x64
-		{CB5ABFAA-EA69-E439-5A4D-3B9359916C71}.Release|BlackBerry.ActiveCfg = Release|BlackBerry
-		{CB5ABFAA-EA69-E439-5A4D-3B9359916C71}.Release|BlackBerry.Build.0 = Release|BlackBerry
-		{CB5ABFAA-EA69-E439-5A4D-3B9359916C71}.Release|BlackBerry.Deploy.0 = Release|BlackBerry
-		{CB5ABFAA-EA69-E439-5A4D-3B9359916C71}.Release|BlackBerrySimulator.ActiveCfg = Release|BlackBerrySimulator
-		{CB5ABFAA-EA69-E439-5A4D-3B9359916C71}.Release|BlackBerrySimulator.Build.0 = Release|BlackBerrySimulator
-		{CB5ABFAA-EA69-E439-5A4D-3B9359916C71}.Release|BlackBerrySimulator.Deploy.0 = Release|BlackBerrySimulator
+		{CB5ABFAA-EA69-E439-5A4D-3B9359916C71}.Release|BlackBerry.ActiveCfg = Release|Win32
+		{CB5ABFAA-EA69-E439-5A4D-3B9359916C71}.Release|BlackBerrySimulator.ActiveCfg = Release|Win32
 		{CB5ABFAA-EA69-E439-5A4D-3B9359916C71}.Release|Win32.ActiveCfg = Release|Win32
 		{CB5ABFAA-EA69-E439-5A4D-3B9359916C71}.Release|Win32.ActiveCfg = Release|Win32
 		{CB5ABFAA-EA69-E439-5A4D-3B9359916C71}.Release|Win32.Build.0 = Release|Win32
 		{CB5ABFAA-EA69-E439-5A4D-3B9359916C71}.Release|Win32.Build.0 = Release|Win32
 		{CB5ABFAA-EA69-E439-5A4D-3B9359916C71}.Release|x64.ActiveCfg = Release|x64
 		{CB5ABFAA-EA69-E439-5A4D-3B9359916C71}.Release|x64.ActiveCfg = Release|x64
 		{CB5ABFAA-EA69-E439-5A4D-3B9359916C71}.Release|x64.Build.0 = Release|x64
 		{CB5ABFAA-EA69-E439-5A4D-3B9359916C71}.Release|x64.Build.0 = Release|x64
-		{82522888-E09A-ED48-AD7D-247237B37B3A}.Debug|BlackBerry.ActiveCfg = Debug|BlackBerry
-		{82522888-E09A-ED48-AD7D-247237B37B3A}.Debug|BlackBerry.Build.0 = Debug|BlackBerry
-		{82522888-E09A-ED48-AD7D-247237B37B3A}.Debug|BlackBerry.Deploy.0 = Debug|BlackBerry
-		{82522888-E09A-ED48-AD7D-247237B37B3A}.Debug|BlackBerrySimulator.ActiveCfg = Debug|BlackBerrySimulator
-		{82522888-E09A-ED48-AD7D-247237B37B3A}.Debug|BlackBerrySimulator.Build.0 = Debug|BlackBerrySimulator
-		{82522888-E09A-ED48-AD7D-247237B37B3A}.Debug|BlackBerrySimulator.Deploy.0 = Debug|BlackBerrySimulator
+		{82522888-E09A-ED48-AD7D-247237B37B3A}.Debug|BlackBerry.ActiveCfg = Debug|Win32
+		{82522888-E09A-ED48-AD7D-247237B37B3A}.Debug|BlackBerrySimulator.ActiveCfg = Debug|Win32
 		{82522888-E09A-ED48-AD7D-247237B37B3A}.Debug|Win32.ActiveCfg = Debug|Win32
 		{82522888-E09A-ED48-AD7D-247237B37B3A}.Debug|Win32.ActiveCfg = Debug|Win32
 		{82522888-E09A-ED48-AD7D-247237B37B3A}.Debug|Win32.Build.0 = Debug|Win32
 		{82522888-E09A-ED48-AD7D-247237B37B3A}.Debug|Win32.Build.0 = Debug|Win32
 		{82522888-E09A-ED48-AD7D-247237B37B3A}.Debug|x64.ActiveCfg = Debug|x64
 		{82522888-E09A-ED48-AD7D-247237B37B3A}.Debug|x64.ActiveCfg = Debug|x64
 		{82522888-E09A-ED48-AD7D-247237B37B3A}.Debug|x64.Build.0 = Debug|x64
 		{82522888-E09A-ED48-AD7D-247237B37B3A}.Debug|x64.Build.0 = Debug|x64
-		{82522888-E09A-ED48-AD7D-247237B37B3A}.DebugMem|BlackBerry.ActiveCfg = DebugMem|BlackBerry
-		{82522888-E09A-ED48-AD7D-247237B37B3A}.DebugMem|BlackBerry.Build.0 = DebugMem|BlackBerry
-		{82522888-E09A-ED48-AD7D-247237B37B3A}.DebugMem|BlackBerry.Deploy.0 = DebugMem|BlackBerry
-		{82522888-E09A-ED48-AD7D-247237B37B3A}.DebugMem|BlackBerrySimulator.ActiveCfg = DebugMem|BlackBerrySimulator
-		{82522888-E09A-ED48-AD7D-247237B37B3A}.DebugMem|BlackBerrySimulator.Build.0 = DebugMem|BlackBerrySimulator
-		{82522888-E09A-ED48-AD7D-247237B37B3A}.DebugMem|BlackBerrySimulator.Deploy.0 = DebugMem|BlackBerrySimulator
+		{82522888-E09A-ED48-AD7D-247237B37B3A}.DebugMem|BlackBerry.ActiveCfg = DebugMem|Win32
+		{82522888-E09A-ED48-AD7D-247237B37B3A}.DebugMem|BlackBerrySimulator.ActiveCfg = DebugMem|Win32
 		{82522888-E09A-ED48-AD7D-247237B37B3A}.DebugMem|Win32.ActiveCfg = DebugMem|Win32
 		{82522888-E09A-ED48-AD7D-247237B37B3A}.DebugMem|Win32.ActiveCfg = DebugMem|Win32
 		{82522888-E09A-ED48-AD7D-247237B37B3A}.DebugMem|Win32.Build.0 = DebugMem|Win32
 		{82522888-E09A-ED48-AD7D-247237B37B3A}.DebugMem|Win32.Build.0 = DebugMem|Win32
 		{82522888-E09A-ED48-AD7D-247237B37B3A}.DebugMem|x64.ActiveCfg = DebugMem|x64
 		{82522888-E09A-ED48-AD7D-247237B37B3A}.DebugMem|x64.ActiveCfg = DebugMem|x64
 		{82522888-E09A-ED48-AD7D-247237B37B3A}.DebugMem|x64.Build.0 = DebugMem|x64
 		{82522888-E09A-ED48-AD7D-247237B37B3A}.DebugMem|x64.Build.0 = DebugMem|x64
-		{82522888-E09A-ED48-AD7D-247237B37B3A}.Release|BlackBerry.ActiveCfg = Release|BlackBerry
-		{82522888-E09A-ED48-AD7D-247237B37B3A}.Release|BlackBerry.Build.0 = Release|BlackBerry
-		{82522888-E09A-ED48-AD7D-247237B37B3A}.Release|BlackBerry.Deploy.0 = Release|BlackBerry
-		{82522888-E09A-ED48-AD7D-247237B37B3A}.Release|BlackBerrySimulator.ActiveCfg = Release|BlackBerrySimulator
-		{82522888-E09A-ED48-AD7D-247237B37B3A}.Release|BlackBerrySimulator.Build.0 = Release|BlackBerrySimulator
-		{82522888-E09A-ED48-AD7D-247237B37B3A}.Release|BlackBerrySimulator.Deploy.0 = Release|BlackBerrySimulator
+		{82522888-E09A-ED48-AD7D-247237B37B3A}.Release|BlackBerry.ActiveCfg = Release|Win32
+		{82522888-E09A-ED48-AD7D-247237B37B3A}.Release|BlackBerrySimulator.ActiveCfg = Release|Win32
 		{82522888-E09A-ED48-AD7D-247237B37B3A}.Release|Win32.ActiveCfg = Release|Win32
 		{82522888-E09A-ED48-AD7D-247237B37B3A}.Release|Win32.ActiveCfg = Release|Win32
 		{82522888-E09A-ED48-AD7D-247237B37B3A}.Release|Win32.Build.0 = Release|Win32
 		{82522888-E09A-ED48-AD7D-247237B37B3A}.Release|Win32.Build.0 = Release|Win32
 		{82522888-E09A-ED48-AD7D-247237B37B3A}.Release|x64.ActiveCfg = Release|x64
 		{82522888-E09A-ED48-AD7D-247237B37B3A}.Release|x64.ActiveCfg = Release|x64

+ 0 - 3
gameplay.xcworkspace/contents.xcworkspacedata

@@ -10,9 +10,6 @@
    <FileRef
    <FileRef
       location = "group:samples/character/sample-character.xcodeproj">
       location = "group:samples/character/sample-character.xcodeproj">
    </FileRef>
    </FileRef>
-   <FileRef
-      location = "group:samples/longboard/sample-longboard.xcodeproj">
-   </FileRef>
    <FileRef
    <FileRef
       location = "group:samples/lua/sample-lua.xcodeproj">
       location = "group:samples/lua/sample-lua.xcodeproj">
    </FileRef>  
    </FileRef>  

+ 7 - 0
gameplay/.cproject

@@ -24,6 +24,8 @@
 								<option id="com.qnx.qcc.option.compiler.defines.1481323494" name="Defines (-D)" superClass="com.qnx.qcc.option.compiler.defines" valueType="definedSymbols">
 								<option id="com.qnx.qcc.option.compiler.defines.1481323494" name="Defines (-D)" superClass="com.qnx.qcc.option.compiler.defines" valueType="definedSymbols">
 									<listOptionValue builtIn="false" value="_FORTIFY_SOURCE=2"/>
 									<listOptionValue builtIn="false" value="_FORTIFY_SOURCE=2"/>
 									<listOptionValue builtIn="false" value="BT_USE_NEON"/>
 									<listOptionValue builtIn="false" value="BT_USE_NEON"/>
+									<listOptionValue builtIn="false" value="GP_USE_SOCIAL"/>
+									<listOptionValue builtIn="false" value="GP_USE_GAMEPAD"/>
 								</option>
 								</option>
 								<option id="com.qnx.qcc.option.compiler.includePath.2133604142" name="Include Directories (-I)" superClass="com.qnx.qcc.option.compiler.includePath" valueType="includePath">
 								<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;../../external-deps/lua/include&quot;"/>
@@ -87,6 +89,8 @@
 								<option id="com.qnx.qcc.option.compiler.defines.398688299" name="Defines (-D)" superClass="com.qnx.qcc.option.compiler.defines" valueType="definedSymbols">
 								<option id="com.qnx.qcc.option.compiler.defines.398688299" name="Defines (-D)" superClass="com.qnx.qcc.option.compiler.defines" valueType="definedSymbols">
 									<listOptionValue builtIn="false" value="_FORTIFY_SOURCE=2"/>
 									<listOptionValue builtIn="false" value="_FORTIFY_SOURCE=2"/>
 									<listOptionValue builtIn="false" value="BT_USE_NEON"/>
 									<listOptionValue builtIn="false" value="BT_USE_NEON"/>
+									<listOptionValue builtIn="false" value="GP_USE_SOCIAL"/>
+									<listOptionValue builtIn="false" value="GP_USE_GAMEPAD"/>
 								</option>
 								</option>
 								<option id="com.qnx.qcc.option.compiler.includePath.1670164593" name="Include Directories (-I)" superClass="com.qnx.qcc.option.compiler.includePath" valueType="includePath">
 								<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;../../external-deps/bullet/include&quot;"/>
@@ -145,6 +149,8 @@
 								<option id="com.qnx.qcc.option.compiler.security.1671403331" name="Enhanced Security (-fstack-protector-strong)" superClass="com.qnx.qcc.option.compiler.security" value="false" valueType="boolean"/>
 								<option id="com.qnx.qcc.option.compiler.security.1671403331" name="Enhanced Security (-fstack-protector-strong)" superClass="com.qnx.qcc.option.compiler.security" value="false" valueType="boolean"/>
 								<option id="com.qnx.qcc.option.compiler.defines.1863269886" name="Defines (-D)" superClass="com.qnx.qcc.option.compiler.defines" valueType="definedSymbols">
 								<option id="com.qnx.qcc.option.compiler.defines.1863269886" name="Defines (-D)" superClass="com.qnx.qcc.option.compiler.defines" valueType="definedSymbols">
 									<listOptionValue builtIn="false" value="_FORTIFY_SOURCE=2"/>
 									<listOptionValue builtIn="false" value="_FORTIFY_SOURCE=2"/>
+									<listOptionValue builtIn="false" value="GP_USE_SOCIAL"/>
+									<listOptionValue builtIn="false" value="GP_USE_GAMEPAD"/>
 								</option>
 								</option>
 								<option id="com.qnx.qcc.option.compiler.includePath.847642559" name="Include Directories (-I)" superClass="com.qnx.qcc.option.compiler.includePath" valueType="includePath">
 								<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;../../external-deps/bullet/include&quot;"/>
@@ -215,4 +221,5 @@
 	</storageModule>
 	</storageModule>
 	<storageModule moduleId="com.qnx.tools.ide.qde.core.QNXProjectProperties"/>
 	<storageModule moduleId="com.qnx.tools.ide.qde.core.QNXProjectProperties"/>
 	<storageModule moduleId="org.eclipse.cdt.make.core.buildtargets"/>
 	<storageModule moduleId="org.eclipse.cdt.make.core.buildtargets"/>
+	<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
 </cproject>
 </cproject>

+ 11 - 1
gameplay/CMakeLists.txt

@@ -194,6 +194,16 @@ set(GAMEPLAY_SRC
     src/ScriptTarget.h
     src/ScriptTarget.h
     src/Slider.cpp
     src/Slider.cpp
     src/Slider.h
     src/Slider.h
+    src/SocialAchievement.cpp
+    src/SocialAchievement.h
+    src/SocialChallenge.cpp
+    src/SocialChallenge.h
+    src/SocialController.cpp
+    src/SocialController.h
+    src/SocialPlayer.cpp
+    src/SocialPlayer.h
+    src/SocialSessionListener.cpp
+    src/SocialSessionListener.h
     src/SpriteBatch.cpp
     src/SpriteBatch.cpp
     src/SpriteBatch.h
     src/SpriteBatch.h
     src/Technique.cpp
     src/Technique.cpp
@@ -615,7 +625,7 @@ include_directories(
     src
     src
     ../external-deps/lua/include
     ../external-deps/lua/include
     ../external-deps/bullet/include
     ../external-deps/bullet/include
-    ../external-deps/libpng/include
+    ../external-deps/png/include
     ../external-deps/zlib/include
     ../external-deps/zlib/include
     ../external-deps/oggvorbis/include
     ../external-deps/oggvorbis/include
     ../external-deps/openal/include
     ../external-deps/openal/include

+ 1 - 1
gameplay/android/AndroidManifest.xml

@@ -2,7 +2,7 @@
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
     package="org.gameplay3d.gameplay"
     package="org.gameplay3d.gameplay"
     android:versionCode="1"
     android:versionCode="1"
-    android:versionName="1.0" >
+    android:versionName="2.0" >
 
 
     <uses-sdk android:minSdkVersion="9" />
     <uses-sdk android:minSdkVersion="9" />
 
 

+ 33 - 0
gameplay/android/java/.project

@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>libgameplay3d</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>com.android.ide.eclipse.adt.PreCompilerBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>com.android.ide.eclipse.adt.ApkBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>com.android.ide.eclipse.adt.AndroidNature</nature>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+	</natures>
+</projectDescription>

+ 9 - 0
gameplay/android/java/AndroidManifest.xml

@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+    package="org.gameplay3d.lib"
+    android:versionCode="1"
+    android:versionName="1.0">
+
+    <uses-sdk android:minSdkVersion="8"/>
+
+</manifest> 

+ 19 - 31
samples/longboard/android/build.xml → gameplay/android/java/build.xml

@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <?xml version="1.0" encoding="UTF-8"?>
-<project name="sample-longboard" default="help">
+<project name="gameplay3dandroid" default="help">
 
 
     <!-- The local.properties file is created and updated by the 'android' tool.
     <!-- The local.properties file is created and updated by the 'android' tool.
          It contains the path to the SDK. It should *NOT* be checked into
          It contains the path to the SDK. It should *NOT* be checked into
@@ -40,36 +40,24 @@
     <loadproperties srcFile="project.properties" />
     <loadproperties srcFile="project.properties" />
 
 
     <!-- quick check on sdk.dir -->
     <!-- quick check on sdk.dir -->
-    <fail message="sdk.dir is missing. Make sure to generate local.properties using 'android update project' or to inject it through an env var"
-          unless="sdk.dir" />
-
-
-<!-- extension targets. Uncomment the ones where you want to do custom work
-     in between standard targets -->
-    <target name="-pre-build">
-		<mkdir dir="src"/>
-    </target>
-	 
-<!--
-    <target name="-pre-compile">
-    </target>
-
-    /* This is typically used for code obfuscation.
-       Compiled code location: ${out.classes.absolute.dir}
-       If this is not done in place, override ${out.dex.input.absolute.dir} */
-       -->
-    <target name="-post-compile">
-        <copy file="../res/asphalt.png" tofile="assets/res/asphalt.png"/>
-		<copy file="../res/longboard.png" tofile="assets/res/longboard.png"/>
-        <copy file="../res/longboard.wav" tofile="assets/res/longboard.wav"/>
-        <copy file="../res/longboard_wheels.png" tofile="assets/res/longboard_wheels.png"/>
-        <copy file="../res/overlay_gradient.png" tofile="assets/res/overlay_gradient.png"/>
-        <copy file="../../../gameplay/res/logo_powered_white.png" tofile="assets/res/logo_powered_white.png"/>
-        <copy todir="assets/res/shaders">
-            <fileset dir="../../../gameplay/res/shaders"/>
-        </copy>
-    </target>
-
+    <fail
+            message="sdk.dir is missing. Make sure to generate local.properties using 'android update project' or to inject it through an env var"
+            unless="sdk.dir"
+    />
+
+    <!--
+        Import per project custom build rules if present at the root of the project.
+        This is the place to put custom intermediary targets such as:
+            -pre-build
+            -pre-compile
+            -post-compile (This is typically used for code obfuscation.
+                           Compiled code location: ${out.classes.absolute.dir}
+                           If this is not done in place, override ${out.dex.input.absolute.dir})
+            -post-package
+            -post-build
+            -pre-clean
+    -->
+    <import file="custom_rules.xml" optional="true" />
 
 
     <!-- Import the actual build file.
     <!-- Import the actual build file.
 
 

+ 190 - 0
gameplay/android/java/src/org/gameplay3d/lib/BaseGameActivity.java

@@ -0,0 +1,190 @@
+/*
+ * Copyright (C) 2013 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.gameplay3d.sample_spaceship.basegameutils;
+
+import android.content.Intent;
+import android.os.Bundle;
+import android.support.v4.app.FragmentActivity;
+
+import com.google.android.gms.appstate.AppStateClient;
+import com.google.android.gms.common.ConnectionResult;
+import com.google.android.gms.games.GamesClient;
+import com.google.android.gms.plus.PlusClient;
+
+/**
+ * Example base class for games. This implementation takes care of setting up
+ * the GamesClient object and managing its lifecycle. Subclasses only need to
+ * override the @link{#onSignInSucceeded} and @link{#onSignInFailed} abstract
+ * methods. To initiate the sign-in flow when the user clicks the sign-in
+ * button, subclasses should call @link{#beginUserInitiatedSignIn}. By default,
+ * this class only instantiates the GamesClient object. If the PlusClient or
+ * AppStateClient objects are also wanted, call the BaseGameActivity(int)
+ * constructor and specify the requested clients. For example, to request
+ * PlusClient and GamesClient, use BaseGameActivity(CLIENT_GAMES | CLIENT_PLUS).
+ * To request all available clients, use BaseGameActivity(CLIENT_ALL).
+ * Alternatively, you can also specify the requested clients via
+ * @link{#setRequestedClients}, but you must do so before @link{#onCreate}
+ * gets called, otherwise the call will have no effect.
+ *
+ * @author Bruno Oliveira (Google)
+ */
+public abstract class BaseGameActivity extends FragmentActivity implements
+        GameHelper.GameHelperListener {
+
+    // The game helper object. This class is mainly a wrapper around this object.
+    protected GameHelper mHelper;
+
+    // We expose these constants here because we don't want users of this class
+    // to have to know about GameHelper at all.
+    public static final int CLIENT_GAMES = GameHelper.CLIENT_GAMES;
+    public static final int CLIENT_APPSTATE = GameHelper.CLIENT_APPSTATE;
+    public static final int CLIENT_PLUS = GameHelper.CLIENT_PLUS;
+    public static final int CLIENT_ALL = GameHelper.CLIENT_ALL;
+
+    // Requested clients. By default, that's just the games client.
+    protected int mRequestedClients = CLIENT_GAMES;
+
+    // stores any additional scopes.
+    private String[] mAdditionalScopes;
+
+    protected String mDebugTag = "BaseGameActivity";
+    protected boolean mDebugLog = false;
+
+    /** Constructs a BaseGameActivity with default client (GamesClient). */
+    protected BaseGameActivity() {
+        super();
+        mHelper = new GameHelper(this);
+    }
+
+    /**
+     * Constructs a BaseGameActivity with the requested clients.
+     * @param requestedClients The requested clients (a combination of CLIENT_GAMES,
+     *         CLIENT_PLUS and CLIENT_APPSTATE).
+     */
+    protected BaseGameActivity(int requestedClients) {
+        super();
+        setRequestedClients(requestedClients);
+    }
+
+    /**
+     * Sets the requested clients. The preferred way to set the requested clients is
+     * via the constructor, but this method is available if for some reason your code
+     * cannot do this in the constructor. This must be called before onCreate in order to
+     * have any effect. If called after onCreate, this method is a no-op.
+     *
+     * @param requestedClients A combination of the flags CLIENT_GAMES, CLIENT_PLUS
+     *         and CLIENT_APPSTATE, or CLIENT_ALL to request all available clients.
+     * @param additionalScopes.  Scopes that should also be requested when the auth
+     *         request is made.
+     */
+    protected void setRequestedClients(int requestedClients, String ... additionalScopes) {
+        mRequestedClients = requestedClients;
+        mAdditionalScopes = additionalScopes;
+    }
+
+    @Override
+    protected void onCreate(Bundle b) {
+        super.onCreate(b);
+        mHelper = new GameHelper(this);
+        if (mDebugLog) {
+            mHelper.enableDebugLog(mDebugLog, mDebugTag);
+        }
+        mHelper.setup(this, mRequestedClients, mAdditionalScopes);
+    }
+
+    @Override
+    protected void onStart() {
+        super.onStart();
+        mHelper.onStart(this);
+    }
+
+    @Override
+    protected void onStop() {
+        super.onStop();
+        mHelper.onStop();
+    }
+
+    @Override
+    protected void onActivityResult(int request, int response, Intent data) {
+        super.onActivityResult(request, response, data);
+        mHelper.onActivityResult(request, response, data);
+    }
+
+    protected GamesClient getGamesClient() {
+        return mHelper.getGamesClient();
+    }
+
+    protected AppStateClient getAppStateClient() {
+        return mHelper.getAppStateClient();
+    }
+
+    protected PlusClient getPlusClient() {
+        return mHelper.getPlusClient();
+    }
+
+    protected boolean isSignedIn() {
+        return mHelper.isSignedIn();
+    }
+
+    protected void beginUserInitiatedSignIn() {
+        mHelper.beginUserInitiatedSignIn();
+    }
+
+    protected void signOut() {
+        mHelper.signOut();
+    }
+
+    protected void showAlert(String title, String message) {
+        mHelper.showAlert(title, message);
+    }
+
+    protected void showAlert(String message) {
+        mHelper.showAlert(message);
+    }
+
+    protected void enableDebugLog(boolean enabled, String tag) {
+        mDebugLog = true;
+        mDebugTag = tag;
+        if (mHelper != null) {
+            mHelper.enableDebugLog(enabled, tag);
+        }
+    }
+
+    protected String getInvitationId() {
+        return mHelper.getInvitationId();
+    }
+
+    protected void reconnectClients(int whichClients) {
+        mHelper.reconnectClients(whichClients);
+    }
+
+    protected String getScopes() {
+        return mHelper.getScopes();
+    }
+
+    protected String[] getScopesArray() {
+        return mHelper.getScopesArray();
+    }
+
+    protected boolean hasSignInError() {
+        return mHelper.hasSignInError();
+    }
+
+    protected GameHelper.SignInFailureReason getSignInError() {
+        return mHelper.getSignInError();
+    }
+}

+ 1149 - 0
gameplay/android/java/src/org/gameplay3d/lib/GameHelper.java

@@ -0,0 +1,1149 @@
+/*
+ * Copyright (C) 2013 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.gameplay3d.sample_spaceship.basegameutils;
+
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+import java.util.Vector;
+
+import android.app.Activity;
+import android.app.AlertDialog;
+import android.app.Dialog;
+import android.content.Context;
+import android.content.Intent;
+import android.content.IntentSender.SendIntentException;
+import android.content.pm.PackageManager;
+import android.content.pm.Signature;
+import android.content.res.Resources;
+import android.os.Bundle;
+import android.util.Log;
+import android.view.Gravity;
+
+import com.google.android.gms.appstate.AppStateClient;
+import com.google.android.gms.common.ConnectionResult;
+import com.google.android.gms.common.GooglePlayServicesClient;
+import com.google.android.gms.common.GooglePlayServicesUtil;
+import com.google.android.gms.common.Scopes;
+import com.google.android.gms.games.GamesActivityResultCodes;
+import com.google.android.gms.games.GamesClient;
+import com.google.android.gms.games.multiplayer.Invitation;
+import com.google.android.gms.plus.PlusClient;
+
+public class GameHelper implements GooglePlayServicesClient.ConnectionCallbacks,
+        GooglePlayServicesClient.OnConnectionFailedListener {
+
+    /** Listener for sign-in success or failure events. */
+    public interface GameHelperListener {
+        /**
+         * Called when sign-in fails. As a result, a "Sign-In" button can be
+         * shown to the user; when that button is clicked, call
+         * @link{GamesHelper#beginUserInitiatedSignIn}. Note that not all calls to this
+         * method mean an error; it may be a result of the fact that automatic
+         * sign-in could not proceed because user interaction was required
+         * (consent dialogs). So implementations of this method should NOT
+         * display an error message unless a call to @link{GamesHelper#hasSignInError}
+         * indicates that an error indeed occurred.
+         */
+        void onSignInFailed();
+
+        /** Called when sign-in succeeds. */
+        void onSignInSucceeded();
+    }
+
+    // States we can be in
+    public static final int STATE_UNCONFIGURED = 0;
+    public static final int STATE_DISCONNECTED = 1;
+    public static final int STATE_CONNECTING = 2;
+    public static final int STATE_CONNECTED = 3;
+
+    // State names (for debug logging, etc)
+    public static final String[] STATE_NAMES = {
+            "UNCONFIGURED", "DISCONNECTED", "CONNECTING", "CONNECTED"
+    };
+
+    // State we are in right now
+    int mState = STATE_UNCONFIGURED;
+
+    // Are we expecting the result of a resolution flow?
+    boolean mExpectingResolution = false;
+
+    /**
+     * The Activity we are bound to. We need to keep a reference to the Activity
+     * because some games methods require an Activity (a Context won't do). We
+     * are careful not to leak these references: we release them on onStop().
+     */
+    Activity mActivity = null;
+
+    // OAuth scopes required for the clients. Initialized in setup().
+    String mScopes[];
+
+    // Request code we use when invoking other Activities to complete the
+    // sign-in flow.
+    final static int RC_RESOLVE = 9001;
+
+    // Request code when invoking Activities whose result we don't care about.
+    final static int RC_UNUSED = 9002;
+
+    // Client objects we manage. If a given client is not enabled, it is null.
+    GamesClient mGamesClient = null;
+    PlusClient mPlusClient = null;
+    AppStateClient mAppStateClient = null;
+
+    // What clients we manage (OR-able values, can be combined as flags)
+    public final static int CLIENT_NONE = 0x00;
+    public final static int CLIENT_GAMES = 0x01;
+    public final static int CLIENT_PLUS = 0x02;
+    public final static int CLIENT_APPSTATE = 0x04;
+    public final static int CLIENT_ALL = CLIENT_GAMES | CLIENT_PLUS | CLIENT_APPSTATE;
+
+    // What clients were requested? (bit flags)
+    int mRequestedClients = CLIENT_NONE;
+
+    // What clients are currently connected? (bit flags)
+    int mConnectedClients = CLIENT_NONE;
+
+    // What client are we currently connecting?
+    int mClientCurrentlyConnecting = CLIENT_NONE;
+
+    // Whether to automatically try to sign in on onStart().
+    boolean mAutoSignIn = true;
+
+    /*
+     * Whether user has specifically requested that the sign-in process begin.
+     * If mUserInitiatedSignIn is false, we're in the automatic sign-in attempt
+     * that we try once the Activity is started -- if true, then the user has
+     * already clicked a "Sign-In" button or something similar
+     */
+    boolean mUserInitiatedSignIn = false;
+
+    // The connection result we got from our last attempt to sign-in.
+    ConnectionResult mConnectionResult = null;
+
+    // The error that happened during sign-in.
+    SignInFailureReason mSignInFailureReason = null;
+
+    // Print debug logs?
+    boolean mDebugLog = false;
+    String mDebugTag = "GameHelper";
+
+    /*
+     * If we got an invitation id when we connected to the games client, it's
+     * here. Otherwise, it's null.
+     */
+    String mInvitationId;
+
+    // Listener
+    GameHelperListener mListener = null;
+
+    /**
+     * Construct a GameHelper object, initially tied to the given Activity.
+     * After constructing this object, call @link{setup} from the onCreate()
+     * method of your Activity.
+     */
+    public GameHelper(Activity activity) {
+        mActivity = activity;
+    }
+
+    static private final int TYPE_DEVELOPER_ERROR = 1001;
+    static private final int TYPE_GAMEHELPER_BUG = 1002;
+    boolean checkState(int type, String operation, String warning, int... expectedStates) {
+        for (int expectedState : expectedStates) {
+            if (mState == expectedState) {
+                return true;
+            }
+        }
+        StringBuilder sb = new StringBuilder();
+        if (type == TYPE_DEVELOPER_ERROR) {
+            sb.append("GameHelper: you attempted an operation at an invalid. ");
+        } else {
+            sb.append("GameHelper: bug detected. Please report it at our bug tracker ");
+            sb.append("https://github.com/playgameservices/android-samples/issues. ");
+            sb.append("Please include the last couple hundred lines of logcat output ");
+            sb.append("and describe the operation that caused this. ");
+        }
+        sb.append("Explanation: ").append(warning);
+        sb.append("Operation: ").append(operation).append(". ");
+        sb.append("State: ").append(STATE_NAMES[mState]).append(". ");
+        if (expectedStates.length == 1) {
+            sb.append("Expected state: ").append(STATE_NAMES[expectedStates[0]]).append(".");
+        } else {
+            sb.append("Expected states:");
+            for (int expectedState : expectedStates) {
+                sb.append(" " ).append(STATE_NAMES[expectedState]);
+            }
+            sb.append(".");
+        }
+
+        logWarn(sb.toString());
+        return false;
+    }
+
+    void assertConfigured(String operation) {
+        if (mState == STATE_UNCONFIGURED) {
+            String error = "GameHelper error: Operation attempted without setup: " + operation +
+                    ". The setup() method must be called before attempting any other operation.";
+            logError(error);
+            throw new IllegalStateException(error);
+        }
+    }
+
+    /**
+     * Same as calling @link{setup(GameHelperListener, int)} requesting only the
+     * CLIENT_GAMES client.
+     */
+    public void setup(GameHelperListener listener) {
+        setup(listener, CLIENT_GAMES);
+    }
+
+    /**
+     * Performs setup on this GameHelper object. Call this from the onCreate()
+     * method of your Activity. This will create the clients and do a few other
+     * initialization tasks. Next, call @link{#onStart} from the onStart()
+     * method of your Activity.
+     *
+     * @param listener The listener to be notified of sign-in events.
+     * @param clientsToUse The clients to use. Use a combination of
+     *            CLIENT_GAMES, CLIENT_PLUS and CLIENT_APPSTATE, or CLIENT_ALL
+     *            to request all clients.
+     * @param additionalScopes Any scopes to be used that are outside of the ones defined
+     *            in the Scopes class.
+     *            I.E. for YouTube uploads one would add
+     *            "https://www.googleapis.com/auth/youtube.upload"
+     */
+    public void setup(GameHelperListener listener, int clientsToUse, String ... additionalScopes) {
+        if (mState != STATE_UNCONFIGURED) {
+            String error = "GameHelper: you called GameHelper.setup() twice. You can only call " +
+                    "it once.";
+            logError(error);
+            throw new IllegalStateException(error);
+        }
+        mListener = listener;
+        mRequestedClients = clientsToUse;
+
+        debugLog("Setup: requested clients: " + mRequestedClients);
+
+        Vector<String> scopesVector = new Vector<String>();
+        if (0 != (clientsToUse & CLIENT_GAMES)) {
+            scopesVector.add(Scopes.GAMES);
+        }
+        if (0 != (clientsToUse & CLIENT_PLUS)) {
+            scopesVector.add(Scopes.PLUS_LOGIN);
+        }
+        if (0 != (clientsToUse & CLIENT_APPSTATE)) {
+            scopesVector.add(Scopes.APP_STATE);
+        }
+
+        if (null != additionalScopes) {
+            for (String scope : additionalScopes) {
+                scopesVector.add(scope);
+            }
+        }
+
+        mScopes = new String[scopesVector.size()];
+        scopesVector.copyInto(mScopes);
+
+        debugLog("setup: scopes:");
+        for (String scope : mScopes) {
+            debugLog("  - " + scope);
+        }
+
+        if (0 != (clientsToUse & CLIENT_GAMES)) {
+            debugLog("setup: creating GamesClient");
+            mGamesClient = new GamesClient.Builder(getContext(), this, this)
+                    .setGravityForPopups(Gravity.TOP | Gravity.CENTER_HORIZONTAL)
+                    .setScopes(mScopes)
+                    .create();
+        }
+
+        if (0 != (clientsToUse & CLIENT_PLUS)) {
+            debugLog("setup: creating GamesPlusClient");
+            mPlusClient = new PlusClient.Builder(getContext(), this, this)
+                    .setScopes(mScopes)
+                    .build();
+        }
+
+        if (0 != (clientsToUse & CLIENT_APPSTATE)) {
+            debugLog("setup: creating AppStateClient");
+            mAppStateClient = new AppStateClient.Builder(getContext(), this, this)
+                    .setScopes(mScopes)
+                    .create();
+        }
+        setState(STATE_DISCONNECTED);
+    }
+
+    void setState(int newState) {
+        String oldStateName = STATE_NAMES[mState];
+        String newStateName = STATE_NAMES[newState];
+        mState = newState;
+        debugLog("State change " + oldStateName + " -> " + newStateName);
+    }
+
+    /**
+     * Returns the GamesClient object. In order to call this method, you must have
+     * called @link{setup} with a set of clients that includes CLIENT_GAMES.
+     */
+    public GamesClient getGamesClient() {
+        if (mGamesClient == null) {
+            throw new IllegalStateException("No GamesClient. Did you request it at setup?");
+        }
+        return mGamesClient;
+    }
+
+    /**
+     * Returns the AppStateClient object. In order to call this method, you must have
+     * called @link{#setup} with a set of clients that includes CLIENT_APPSTATE.
+     */
+    public AppStateClient getAppStateClient() {
+        if (mAppStateClient == null) {
+            throw new IllegalStateException("No AppStateClient. Did you request it at setup?");
+        }
+        return mAppStateClient;
+    }
+
+    /**
+     * Returns the PlusClient object. In order to call this method, you must have
+     * called @link{#setup} with a set of clients that includes CLIENT_PLUS.
+     */
+    public PlusClient getPlusClient() {
+        if (mPlusClient == null) {
+            throw new IllegalStateException("No PlusClient. Did you request it at setup?");
+        }
+        return mPlusClient;
+    }
+
+    /** Returns whether or not the user is signed in. */
+    public boolean isSignedIn() {
+        return mState == STATE_CONNECTED;
+    }
+
+    /**
+     * Returns whether or not there was a (non-recoverable) error during the
+     * sign-in process.
+     */
+    public boolean hasSignInError() {
+        return mSignInFailureReason != null;
+    }
+
+    /**
+     * Returns the error that happened during the sign-in process, null if no
+     * error occurred.
+     */
+    public SignInFailureReason getSignInError() {
+        return mSignInFailureReason;
+    }
+
+    /** Call this method from your Activity's onStart(). */
+    public void onStart(Activity act) {
+        mActivity = act;
+
+        debugLog("onStart, state = " + STATE_NAMES[mState]);
+        assertConfigured("onStart");
+
+        switch (mState) {
+            case STATE_DISCONNECTED:
+                // we are not connected, so attempt to connect
+                if (mAutoSignIn) {
+                    debugLog("onStart: Now connecting clients.");
+                    startConnections();
+                } else {
+                    debugLog("onStart: Not connecting (user specifically signed out).");
+                }
+                break;
+            case STATE_CONNECTING:
+                // connection process is in progress; no action required
+                debugLog("onStart: connection process in progress, no action taken.");
+                break;
+            case STATE_CONNECTED:
+                // already connected (for some strange reason). No complaints :-)
+                debugLog("onStart: already connected (unusual, but ok).");
+                break;
+            default:
+                String msg =  "onStart: BUG: unexpected state " + STATE_NAMES[mState];
+                logError(msg);
+                throw new IllegalStateException(msg);
+        }
+    }
+
+    /** Call this method from your Activity's onStop(). */
+    public void onStop() {
+        debugLog("onStop, state = " + STATE_NAMES[mState]);
+        assertConfigured("onStop");
+        switch (mState) {
+            case STATE_CONNECTED:
+            case STATE_CONNECTING:
+                // kill connections
+                debugLog("onStop: Killing connections");
+                killConnections();
+                break;
+            case STATE_DISCONNECTED:
+                debugLog("onStop: not connected, so no action taken.");
+                break;
+            default:
+                String msg =  "onStop: BUG: unexpected state " + STATE_NAMES[mState];
+                logError(msg);
+                throw new IllegalStateException(msg);
+        }
+
+        // let go of the Activity reference
+        mActivity = null;
+    }
+
+    /** Convenience method to show an alert dialog. */
+    public void showAlert(String title, String message) {
+        (new AlertDialog.Builder(getContext())).setTitle(title).setMessage(message)
+                .setNeutralButton(android.R.string.ok, null).create().show();
+    }
+
+    /** Convenience method to show an alert dialog. */
+    public void showAlert(String message) {
+        (new AlertDialog.Builder(getContext())).setMessage(message)
+                .setNeutralButton(android.R.string.ok, null).create().show();
+    }
+
+    /**
+     * Returns the invitation ID received through an invitation notification.
+     * This should be called from your GameHelperListener's
+     *
+     * @link{GameHelperListener#onSignInSucceeded} method, to check if there's an
+     * invitation available. In that case, accept the invitation.
+     * @return The id of the invitation, or null if none was received.
+     */
+    public String getInvitationId() {
+        if (!checkState(TYPE_DEVELOPER_ERROR, "getInvitationId",
+                "Invitation ID is only available when connected " +
+                "(after getting the onSignInSucceeded callback).", STATE_CONNECTED)) {
+            return null;
+        }
+        return mInvitationId;
+    }
+
+    /** Enables debug logging */
+    public void enableDebugLog(boolean enabled, String tag) {
+        mDebugLog = enabled;
+        mDebugTag = tag;
+        if (enabled) {
+            debugLog("Debug log enabled, tag: " + tag);
+        }
+    }
+
+    /**
+     * Returns the current requested scopes. This is not valid until setup() has
+     * been called.
+     *
+     * @return the requested scopes, including the oauth2: prefix
+     */
+    public String getScopes() {
+        StringBuilder scopeStringBuilder = new StringBuilder();
+        if (null != mScopes) {
+            for (String scope: mScopes) {
+                addToScope(scopeStringBuilder, scope);
+            }
+        }
+        return scopeStringBuilder.toString();
+    }
+
+    /**
+     * Returns an array of the current requested scopes. This is not valid until
+     * setup() has been called
+     *
+     * @return the requested scopes, including the oauth2: prefix
+     */
+    public String[] getScopesArray() {
+        return mScopes;
+    }
+
+    /** Sign out and disconnect from the APIs. */
+    public void signOut() {
+        if (mState == STATE_DISCONNECTED) {
+            // nothing to do
+            debugLog("signOut: state was already DISCONNECTED, ignoring.");
+            return;
+        }
+
+        // for the PlusClient, "signing out" means clearing the default account and
+        // then disconnecting
+        if (mPlusClient != null && mPlusClient.isConnected()) {
+            debugLog("Clearing default account on PlusClient.");
+            mPlusClient.clearDefaultAccount();
+        }
+
+        // For the games client, signing out means calling signOut and disconnecting
+        if (mGamesClient != null && mGamesClient.isConnected()) {
+            debugLog("Signing out from GamesClient.");
+            mGamesClient.signOut();
+        }
+
+        // Ready to disconnect
+        debugLog("Proceeding with disconnection.");
+        killConnections();
+    }
+
+    void killConnections() {
+        if (!checkState(TYPE_GAMEHELPER_BUG, "killConnections", "killConnections() should only " +
+                "get called while connected or connecting.", STATE_CONNECTED, STATE_CONNECTING)) {
+            return;
+        }
+        debugLog("killConnections: killing connections.");
+
+        mConnectionResult = null;
+        mSignInFailureReason = null;
+
+        if (mGamesClient != null && mGamesClient.isConnected()) {
+            debugLog("Disconnecting GamesClient.");
+            mGamesClient.disconnect();
+        }
+        if (mPlusClient != null && mPlusClient.isConnected()) {
+            debugLog("Disconnecting PlusClient.");
+            mPlusClient.disconnect();
+        }
+        if (mAppStateClient != null && mAppStateClient.isConnected()) {
+            debugLog("Disconnecting AppStateClient.");
+            mAppStateClient.disconnect();
+        }
+        mConnectedClients = CLIENT_NONE;
+        debugLog("killConnections: all clients disconnected.");
+        setState(STATE_DISCONNECTED);
+    }
+
+    static String activityResponseCodeToString(int respCode) {
+        switch (respCode) {
+            case Activity.RESULT_OK:
+                return "RESULT_OK";
+            case Activity.RESULT_CANCELED:
+                return "RESULT_CANCELED";
+            case GamesActivityResultCodes.RESULT_APP_MISCONFIGURED:
+                return "RESULT_APP_MISCONFIGURED";
+            case GamesActivityResultCodes.RESULT_LEFT_ROOM:
+                return "RESULT_LEFT_ROOM";
+            case GamesActivityResultCodes.RESULT_LICENSE_FAILED:
+                return "RESULT_LICENSE_FAILED";
+            case GamesActivityResultCodes.RESULT_RECONNECT_REQUIRED:
+                return "RESULT_RECONNECT_REQUIRED";
+            case GamesActivityResultCodes.RESULT_SIGN_IN_FAILED:
+                return "SIGN_IN_FAILED";
+            default:
+                return String.valueOf(respCode);
+        }
+    }
+
+    /**
+     * Handle activity result. Call this method from your Activity's
+     * onActivityResult callback. If the activity result pertains to the sign-in
+     * process, processes it appropriately.
+     */
+    public void onActivityResult(int requestCode, int responseCode, Intent intent) {
+        debugLog("onActivityResult: req=" + (requestCode == RC_RESOLVE ? "RC_RESOLVE" :
+                String.valueOf(requestCode)) + ", resp=" +
+                activityResponseCodeToString(responseCode));
+        if (requestCode != RC_RESOLVE) {
+            debugLog("onActivityResult: request code not meant for us. Ignoring.");
+            return;
+        }
+
+        // no longer expecting a resolution
+        mExpectingResolution = false;
+
+        if (mState != STATE_CONNECTING) {
+            debugLog("onActivityResult: ignoring because state isn't STATE_CONNECTING (" +
+                    "it's " + STATE_NAMES[mState] + ")");
+            return;
+        }
+
+        // We're coming back from an activity that was launched to resolve a
+        // connection problem. For example, the sign-in UI.
+        if (responseCode == Activity.RESULT_OK) {
+            // Ready to try to connect again.
+            debugLog("onAR: Resolution was RESULT_OK, so connecting current client again.");
+            connectCurrentClient();
+        } else if (responseCode == GamesActivityResultCodes.RESULT_RECONNECT_REQUIRED) {
+            debugLog("onAR: Resolution was RECONNECT_REQUIRED, so reconnecting.");
+            connectCurrentClient();
+        } else if (responseCode == Activity.RESULT_CANCELED) {
+            // User cancelled.
+            debugLog("onAR: Got a cancellation result, so disconnecting.");
+            mAutoSignIn = false;
+            mUserInitiatedSignIn = false;
+            mSignInFailureReason = null; // cancelling is not a failure!
+            killConnections();
+            notifyListener(false);
+        } else {
+            // Whatever the problem we were trying to solve, it was not
+            // solved. So give up and show an error message.
+            debugLog("onAR: responseCode="  + activityResponseCodeToString(responseCode) +
+                        ", so giving up.");
+            giveUp(new SignInFailureReason(mConnectionResult.getErrorCode(), responseCode));
+        }
+    }
+
+    void notifyListener(boolean success) {
+        debugLog("Notifying LISTENER of sign-in " + (success ? "SUCCESS" :
+                mSignInFailureReason != null ? "FAILURE (error)" : "FAILURE (no error)"));
+        if (mListener != null) {
+            if (success) {
+                mListener.onSignInSucceeded();
+            } else {
+                mListener.onSignInFailed();
+            }
+        }
+    }
+
+    /**
+     * Starts a user-initiated sign-in flow. This should be called when the user
+     * clicks on a "Sign In" button. As a result, authentication/consent dialogs
+     * may show up. At the end of the process, the GameHelperListener's
+     * onSignInSucceeded() or onSignInFailed() methods will be called.
+     */
+    public void beginUserInitiatedSignIn() {
+        if (mState == STATE_CONNECTED) {
+            // nothing to do
+            logWarn("beginUserInitiatedSignIn() called when already connected. " +
+                    "Calling listener directly to notify of success.");
+            notifyListener(true);
+            return;
+        } else if (mState == STATE_CONNECTING) {
+            logWarn("beginUserInitiatedSignIn() called when already connecting. " +
+                    "Be patient! You can only call this method after you get an " +
+                    "onSignInSucceeded() or onSignInFailed() callback. Suggestion: disable " +
+                    "the sign-in button on startup and also when it's clicked, and re-enable " +
+                    "when you get the callback.");
+            // ignore call (listener will get a callback when the connection process finishes)
+            return;
+        }
+
+        debugLog("Starting USER-INITIATED sign-in flow.");
+
+        // sign in automatically on onStart()
+        mAutoSignIn = true;
+
+        // Is Google Play services available?
+        int result = GooglePlayServicesUtil.isGooglePlayServicesAvailable(getContext());
+        debugLog("isGooglePlayServicesAvailable returned " + result);
+        if (result != ConnectionResult.SUCCESS) {
+            // Google Play services is not available.
+            debugLog("Google Play services not available. Show error dialog.");
+            mSignInFailureReason = new SignInFailureReason(result, 0);
+            showFailureDialog();
+            notifyListener(false);
+            return;
+        }
+
+        // indicate that user is actively trying to sign in (so we know to resolve
+        // connection problems by showing dialogs)
+        mUserInitiatedSignIn = true;
+
+        if (mConnectionResult != null) {
+            // We have a pending connection result from a previous failure, so
+            // start with that.
+            debugLog("beginUserInitiatedSignIn: continuing pending sign-in flow.");
+            setState(STATE_CONNECTING);
+            resolveConnectionResult();
+        } else {
+            // We don't have a pending connection result, so start anew.
+            debugLog("beginUserInitiatedSignIn: starting new sign-in flow.");
+            startConnections();
+        }
+    }
+
+    Context getContext() {
+        return mActivity;
+    }
+
+    void addToScope(StringBuilder scopeStringBuilder, String scope) {
+        if (scopeStringBuilder.length() == 0) {
+            scopeStringBuilder.append("oauth2:");
+        } else {
+            scopeStringBuilder.append(" ");
+        }
+        scopeStringBuilder.append(scope);
+    }
+
+    void startConnections() {
+        if (!checkState(TYPE_GAMEHELPER_BUG, "startConnections", "startConnections should " +
+                "only get called when disconnected.", STATE_DISCONNECTED)) {
+            return;
+        }
+        debugLog("Starting connections.");
+        setState(STATE_CONNECTING);
+        mInvitationId = null;
+        connectNextClient();
+    }
+
+    void connectNextClient() {
+        // do we already have all the clients we need?
+        debugLog("connectNextClient: requested clients: " + mRequestedClients +
+                    ", connected clients: " + mConnectedClients);
+
+        // failsafe, in case we somehow lost track of what clients are connected or not.
+        if (mGamesClient != null && mGamesClient.isConnected() &&
+                (0 == (mConnectedClients & CLIENT_GAMES))) {
+            logWarn("GamesClient was already connected. Fixing.");
+            mConnectedClients |= CLIENT_GAMES;
+        }
+        if (mPlusClient != null && mPlusClient.isConnected() &&
+                (0 == (mConnectedClients & CLIENT_PLUS))) {
+            logWarn("PlusClient was already connected. Fixing.");
+            mConnectedClients |= CLIENT_PLUS;
+        }
+        if (mAppStateClient != null && mAppStateClient.isConnected() &&
+                (0 == (mConnectedClients & CLIENT_APPSTATE))) {
+            logWarn("AppStateClient was already connected. Fixing");
+            mConnectedClients |= CLIENT_APPSTATE;
+        }
+
+        int pendingClients = mRequestedClients & ~mConnectedClients;
+        debugLog("Pending clients: " + pendingClients);
+
+        if (pendingClients == 0) {
+            debugLog("All clients now connected. Sign-in successful!");
+            succeedSignIn();
+            return;
+        }
+
+        // which client should be the next one to connect?
+        if (mGamesClient != null && (0 != (pendingClients & CLIENT_GAMES))) {
+            debugLog("Connecting GamesClient.");
+            mClientCurrentlyConnecting = CLIENT_GAMES;
+        } else if (mPlusClient != null && (0 != (pendingClients & CLIENT_PLUS))) {
+            debugLog("Connecting PlusClient.");
+            mClientCurrentlyConnecting = CLIENT_PLUS;
+        } else if (mAppStateClient != null && (0 != (pendingClients & CLIENT_APPSTATE))) {
+            debugLog("Connecting AppStateClient.");
+            mClientCurrentlyConnecting = CLIENT_APPSTATE;
+        } else {
+            // hmmm, getting here would be a bug.
+            throw new AssertionError("Not all clients connected, yet no one is next. R="
+                    + mRequestedClients + ", C=" + mConnectedClients);
+        }
+
+        connectCurrentClient();
+    }
+
+    void connectCurrentClient() {
+        if (mState == STATE_DISCONNECTED) {
+            // we got disconnected during the connection process, so abort
+            logWarn("GameHelper got disconnected during connection process. Aborting.");
+            return;
+        }
+        if (!checkState(TYPE_GAMEHELPER_BUG, "connectCurrentClient", "connectCurrentClient " +
+                "should only get called when connecting.", STATE_CONNECTING)) {
+            return;
+        }
+
+        switch (mClientCurrentlyConnecting) {
+            case CLIENT_GAMES:
+                mGamesClient.connect();
+                break;
+            case CLIENT_APPSTATE:
+                mAppStateClient.connect();
+                break;
+            case CLIENT_PLUS:
+                mPlusClient.connect();
+                break;
+        }
+    }
+
+    /**
+     * Disconnects the indicated clients, then connects them again.
+     * @param whatClients Indicates which clients to reconnect.
+     */
+    public void reconnectClients(int whatClients) {
+        checkState(TYPE_DEVELOPER_ERROR, "reconnectClients", "reconnectClients should " +
+                "only be called when connected. Proceeding anyway.", STATE_CONNECTED);
+        boolean actuallyReconnecting = false;
+
+        if ((whatClients & CLIENT_GAMES) != 0 && mGamesClient != null
+                && mGamesClient.isConnected()) {
+            debugLog("Reconnecting GamesClient.");
+            actuallyReconnecting = true;
+            mConnectedClients &= ~CLIENT_GAMES;
+            mGamesClient.reconnect();
+        }
+        if ((whatClients & CLIENT_APPSTATE) != 0 && mAppStateClient != null
+                && mAppStateClient.isConnected()) {
+            debugLog("Reconnecting AppStateClient.");
+            actuallyReconnecting = true;
+            mConnectedClients &= ~CLIENT_APPSTATE;
+            mAppStateClient.reconnect();
+        }
+        if ((whatClients & CLIENT_PLUS) != 0 && mPlusClient != null
+                && mPlusClient.isConnected()) {
+            // PlusClient doesn't need reconnections.
+            logWarn("GameHelper is ignoring your request to reconnect " +
+                    "PlusClient because this is unnecessary.");
+        }
+
+        if (actuallyReconnecting) {
+            setState(STATE_CONNECTING);
+        } else {
+            // No reconnections are to take place, so for consistency we call the listener
+            // as if sign in had just succeeded.
+            debugLog("No reconnections needed, so behaving as if sign in just succeeded");
+            notifyListener(true);
+        }
+    }
+
+    /** Called when we successfully obtain a connection to a client. */
+    @Override
+    public void onConnected(Bundle connectionHint) {
+        debugLog("onConnected: connected! client=" + mClientCurrentlyConnecting);
+
+        // Mark the current client as connected
+        mConnectedClients |= mClientCurrentlyConnecting;
+        debugLog("Connected clients updated to: " + mConnectedClients);
+
+        // If this was the games client and it came with an invite, store it for
+        // later retrieval.
+        if (mClientCurrentlyConnecting == CLIENT_GAMES && connectionHint != null) {
+            debugLog("onConnected: connection hint provided. Checking for invite.");
+            Invitation inv = connectionHint.getParcelable(GamesClient.EXTRA_INVITATION);
+            if (inv != null && inv.getInvitationId() != null) {
+                // accept invitation
+                debugLog("onConnected: connection hint has a room invite!");
+                mInvitationId = inv.getInvitationId();
+                debugLog("Invitation ID: " + mInvitationId);
+            }
+        }
+
+        // connect the next client in line, if any.
+        connectNextClient();
+    }
+
+    void succeedSignIn() {
+        checkState(TYPE_GAMEHELPER_BUG, "succeedSignIn", "succeedSignIn should only " +
+                "get called in the connecting or connected state. Proceeding anyway.",
+                STATE_CONNECTING, STATE_CONNECTED);
+        debugLog("All requested clients connected. Sign-in succeeded!");
+        setState(STATE_CONNECTED);
+        mSignInFailureReason = null;
+        mAutoSignIn = true;
+        mUserInitiatedSignIn = false;
+        notifyListener(true);
+    }
+
+    /** Handles a connection failure reported by a client. */
+    @Override
+    public void onConnectionFailed(ConnectionResult result) {
+        // save connection result for later reference
+        debugLog("onConnectionFailed");
+
+        mConnectionResult = result;
+        debugLog("Connection failure:");
+        debugLog("   - code: " +  errorCodeToString(mConnectionResult.getErrorCode()));
+        debugLog("   - resolvable: " + mConnectionResult.hasResolution());
+        debugLog("   - details: " + mConnectionResult.toString());
+
+        if (!mUserInitiatedSignIn) {
+            // If the user didn't initiate the sign-in, we don't try to resolve
+            // the connection problem automatically -- instead, we fail and wait
+            // for the user to want to sign in. That way, they won't get an
+            // authentication (or other) popup unless they are actively trying
+            // to
+            // sign in.
+            debugLog("onConnectionFailed: since user didn't initiate sign-in, failing now.");
+            mConnectionResult = result;
+            setState(STATE_DISCONNECTED);
+            notifyListener(false);
+            return;
+        }
+
+        debugLog("onConnectionFailed: since user initiated sign-in, resolving problem.");
+
+        // Resolve the connection result. This usually means showing a dialog or
+        // starting an Activity that will allow the user to give the appropriate
+        // consents so that sign-in can be successful.
+        resolveConnectionResult();
+    }
+
+    /**
+     * Attempts to resolve a connection failure. This will usually involve
+     * starting a UI flow that lets the user give the appropriate consents
+     * necessary for sign-in to work.
+     */
+    void resolveConnectionResult() {
+        // Try to resolve the problem
+        checkState(TYPE_GAMEHELPER_BUG, "resolveConnectionResult",
+                "resolveConnectionResult should only be called when connecting. Proceeding anyway.",
+                STATE_CONNECTING);
+
+        if (mExpectingResolution) {
+            debugLog("We're already expecting the result of a previous resolution.");
+            return;
+        }
+
+        debugLog("resolveConnectionResult: trying to resolve result: " + mConnectionResult);
+        if (mConnectionResult.hasResolution()) {
+            // This problem can be fixed. So let's try to fix it.
+            debugLog("Result has resolution. Starting it.");
+            try {
+                // launch appropriate UI flow (which might, for example, be the
+                // sign-in flow)
+                mExpectingResolution = true;
+                mConnectionResult.startResolutionForResult(mActivity, RC_RESOLVE);
+            } catch (SendIntentException e) {
+                // Try connecting again
+                debugLog("SendIntentException, so connecting again.");
+                connectCurrentClient();
+            }
+        } else {
+            // It's not a problem what we can solve, so give up and show an
+            // error.
+            debugLog("resolveConnectionResult: result has no resolution. Giving up.");
+            giveUp(new SignInFailureReason(mConnectionResult.getErrorCode()));
+        }
+    }
+
+    /**
+     * Give up on signing in due to an error. Shows the appropriate error
+     * message to the user, using a standard error dialog as appropriate to the
+     * cause of the error. That dialog will indicate to the user how the problem
+     * can be solved (for example, re-enable Google Play Services, upgrade to a
+     * new version, etc).
+     */
+    void giveUp(SignInFailureReason reason) {
+        checkState(TYPE_GAMEHELPER_BUG, "giveUp", "giveUp should only be called when " +
+                "connecting. Proceeding anyway.", STATE_CONNECTING);
+        mAutoSignIn = false;
+        killConnections();
+        mSignInFailureReason = reason;
+        showFailureDialog();
+        notifyListener(false);
+    }
+
+    /** Called when we are disconnected from a client. */
+    @Override
+    public void onDisconnected() {
+        debugLog("onDisconnected.");
+        if (mState == STATE_DISCONNECTED) {
+            // This is expected.
+            debugLog("onDisconnected is expected, so no action taken.");
+            return;
+        }
+
+        // Unexpected disconnect (rare!)
+        logWarn("Unexpectedly disconnected. Severing remaining connections.");
+
+        // kill the other connections too, and revert to DISCONNECTED state.
+        killConnections();
+        mSignInFailureReason = null;
+
+        // call the sign in failure callback
+        debugLog("Making extraordinary call to onSignInFailed callback");
+        notifyListener(false);
+    }
+
+    /** Shows an error dialog that's appropriate for the failure reason. */
+    void showFailureDialog() {
+        Context ctx = getContext();
+        if (ctx == null) {
+            debugLog("*** No context. Can't show failure dialog.");
+            return;
+        }
+        debugLog("Making error dialog for failure: " + mSignInFailureReason);
+        Dialog errorDialog = null;
+        int errorCode = mSignInFailureReason.getServiceErrorCode();
+        int actResp = mSignInFailureReason.getActivityResultCode();
+
+        switch (actResp) {
+            case GamesActivityResultCodes.RESULT_APP_MISCONFIGURED:
+                errorDialog = makeSimpleDialog(ctx.getString(
+                        R.string.gamehelper_app_misconfigured));
+                printMisconfiguredDebugInfo();
+                break;
+            case GamesActivityResultCodes.RESULT_SIGN_IN_FAILED:
+                errorDialog = makeSimpleDialog(ctx.getString(
+                        R.string.gamehelper_sign_in_failed));
+                break;
+            case GamesActivityResultCodes.RESULT_LICENSE_FAILED:
+                errorDialog = makeSimpleDialog(ctx.getString(
+                        R.string.gamehelper_license_failed));
+                break;
+            default:
+                // No meaningful Activity response code, so generate default Google
+                // Play services dialog
+                errorDialog = GooglePlayServicesUtil.getErrorDialog(errorCode, mActivity,
+                        RC_UNUSED, null);
+                if (errorDialog == null) {
+                    // get fallback dialog
+                    debugLog("No standard error dialog available. Making fallback dialog.");
+                    errorDialog = makeSimpleDialog(ctx.getString(R.string.gamehelper_unknown_error)
+                            + " " + errorCodeToString(errorCode));
+                }
+        }
+
+        debugLog("Showing error dialog.");
+        errorDialog.show();
+    }
+
+    Dialog makeSimpleDialog(String text) {
+        return (new AlertDialog.Builder(getContext())).setMessage(text)
+                .setNeutralButton(android.R.string.ok, null).create();
+    }
+
+    void debugLog(String message) {
+        if (mDebugLog) {
+            Log.d(mDebugTag, "GameHelper: " + message);
+        }
+    }
+
+    void logWarn(String message) {
+        Log.w(mDebugTag, "!!! GameHelper WARNING: " + message);
+    }
+
+    void logError(String message) {
+        Log.e(mDebugTag, "*** GameHelper ERROR: " + message);
+    }
+
+    static String errorCodeToString(int errorCode) {
+        switch (errorCode) {
+            case ConnectionResult.DEVELOPER_ERROR:
+                return "DEVELOPER_ERROR(" + errorCode + ")";
+            case ConnectionResult.INTERNAL_ERROR:
+                return "INTERNAL_ERROR(" + errorCode + ")";
+            case ConnectionResult.INVALID_ACCOUNT:
+                return "INVALID_ACCOUNT(" + errorCode + ")";
+            case ConnectionResult.LICENSE_CHECK_FAILED:
+                return "LICENSE_CHECK_FAILED(" + errorCode + ")";
+            case ConnectionResult.NETWORK_ERROR:
+                return "NETWORK_ERROR(" + errorCode + ")";
+            case ConnectionResult.RESOLUTION_REQUIRED:
+                return "RESOLUTION_REQUIRED(" + errorCode + ")";
+            case ConnectionResult.SERVICE_DISABLED:
+                return "SERVICE_DISABLED(" + errorCode + ")";
+            case ConnectionResult.SERVICE_INVALID:
+                return "SERVICE_INVALID(" + errorCode + ")";
+            case ConnectionResult.SERVICE_MISSING:
+                return "SERVICE_MISSING(" + errorCode + ")";
+            case ConnectionResult.SERVICE_VERSION_UPDATE_REQUIRED:
+                return "SERVICE_VERSION_UPDATE_REQUIRED(" + errorCode + ")";
+            case ConnectionResult.SIGN_IN_REQUIRED:
+                return "SIGN_IN_REQUIRED(" + errorCode + ")";
+            case ConnectionResult.SUCCESS:
+                return "SUCCESS(" + errorCode + ")";
+            default:
+                return "Unknown error code " + errorCode;
+        }
+    }
+
+    // Represents the reason for a sign-in failure
+    public static class SignInFailureReason {
+        public static final int NO_ACTIVITY_RESULT_CODE = -100;
+        int mServiceErrorCode = 0;
+        int mActivityResultCode = NO_ACTIVITY_RESULT_CODE;
+        public int getServiceErrorCode() {
+            return mServiceErrorCode;
+        }
+        public int getActivityResultCode() {
+            return mActivityResultCode;
+        }
+        public SignInFailureReason(int serviceErrorCode, int activityResultCode) {
+            mServiceErrorCode = serviceErrorCode;
+            mActivityResultCode = activityResultCode;
+        }
+        public SignInFailureReason(int serviceErrorCode) {
+            this(serviceErrorCode, NO_ACTIVITY_RESULT_CODE);
+        }
+        @Override
+        public String toString() {
+            return "SignInFailureReason(serviceErrorCode:" +
+                    errorCodeToString(mServiceErrorCode) +
+                    ((mActivityResultCode == NO_ACTIVITY_RESULT_CODE) ? ")" :
+                    (",activityResultCode:" +
+                    activityResponseCodeToString(mActivityResultCode) + ")"));
+        }
+    }
+
+    void printMisconfiguredDebugInfo() {
+        debugLog("****");
+        debugLog("****");
+        debugLog("**** APP NOT CORRECTLY CONFIGURED TO USE GOOGLE PLAY GAME SERVICES");
+        debugLog("**** This is usually caused by one of these reasons:");
+        debugLog("**** (1) Your package name and certificate fingerprint do not match");
+        debugLog("****     the client ID you registered in Developer Console.");
+        debugLog("**** (2) Your App ID was incorrectly entered.");
+        debugLog("**** (3) Your game settings have not been published and you are ");
+        debugLog("****     trying to log in with an account that is not listed as");
+        debugLog("****     a test account.");
+        debugLog("****");
+        Context ctx = getContext();
+        if (ctx == null) {
+            debugLog("*** (no Context, so can't print more debug info)");
+            return;
+        }
+
+        debugLog("**** To help you debug, here is the information about this app");
+        debugLog("**** Package name         : " + getContext().getPackageName());
+        debugLog("**** Cert SHA1 fingerprint: " + getSHA1CertFingerprint());
+        debugLog("**** App ID from          : " + getAppIdFromResource());
+        debugLog("****");
+        debugLog("**** Check that the above information matches your setup in ");
+        debugLog("**** Developer Console. Also, check that you're logging in with the");
+        debugLog("**** right account (it should be listed in the Testers section if");
+        debugLog("**** your project is not yet published).");
+        debugLog("****");
+        debugLog("**** For more information, refer to the troubleshooting guide:");
+        debugLog("****   http://developers.google.com/games/services/android/troubleshooting");
+    }
+
+    String getAppIdFromResource() {
+        try {
+            Resources res = getContext().getResources();
+            String pkgName = getContext().getPackageName();
+            int res_id = res.getIdentifier("app_id", "string", pkgName);
+            return res.getString(res_id);
+        } catch (Exception ex) {
+            ex.printStackTrace();
+            return "??? (failed to retrieve APP ID)";
+        }
+    }
+
+    String getSHA1CertFingerprint() {
+        try {
+            Signature[] sigs = getContext().getPackageManager().getPackageInfo(
+                    getContext().getPackageName(), PackageManager.GET_SIGNATURES).signatures;
+            if (sigs.length == 0) {
+                return "ERROR: NO SIGNATURE.";
+            } else if (sigs.length > 1) {
+                return "ERROR: MULTIPLE SIGNATURES";
+            }
+            byte[] digest = MessageDigest.getInstance("SHA1").digest(sigs[0].toByteArray());
+            StringBuilder hexString = new StringBuilder();
+            for (int i = 0; i < digest.length; ++i) {
+                if (i > 0) {
+                    hexString.append(":");
+                }
+                byteToString(hexString, digest[i]);
+            }
+            return hexString.toString();
+
+        } catch (PackageManager.NameNotFoundException ex) {
+            ex.printStackTrace();
+            return "(ERROR: package not found)";
+        } catch (NoSuchAlgorithmException ex) {
+            ex.printStackTrace();
+            return "(ERROR: SHA1 algorithm not found)";
+        }
+    }
+
+    void byteToString(StringBuilder sb, byte b) {
+        int unsigned_byte = b < 0 ? b + 256 : b;
+        int hi = unsigned_byte / 16;
+        int lo = unsigned_byte % 16;
+        sb.append("0123456789ABCDEF".substring(hi, hi + 1));
+        sb.append("0123456789ABCDEF".substring(lo, lo + 1));
+    }
+
+}

+ 118 - 0
gameplay/android/java/src/org/gameplay3d/lib/GoogleGamesSocial.java

@@ -0,0 +1,118 @@
+    
+package org.gameplay3d.lib;
+
+import android.content.Context;
+import android.os.Bundle;
+import android.support.v4.app.Fragment;
+import android.util.Log;
+import android.widget.Toast;
+
+import com.google.android.gms.games.Player;
+import com.google.example.games.basegameutils.BaseGameActivity;
+
+public class GoogleGamesSocial extends BaseGameActivity {
+	
+	private static List<Player> mFriends = new ArrayList<Player>();
+    private static final int FRIENDS_PER_PAGE = 10;
+	
+	public static void gameServicesSignIn() 
+	{
+        ((appname)mContext).runOnUiThread(new Runnable() 
+		{
+            public void run() {
+                ((appname)mContext).beginUserInitiatedSignIn();
+            }
+        });
+    }
+
+    public static void updateTopScoreLeaderboard(int score) 
+	{
+		if (mContext.isSignedIn())
+			mContext.getGamesClient().submitScore("leaderboardid", score);
+    }
+
+	public static void submitAchievement(String achievementId)
+	{
+        if (mContext.isSignedIn())
+		{
+            mContext.getGamesClient().unlockAchievement(achievementId);
+        }
+    }
+	
+	public static void incrementAchievement(String achievementId, int percentage)
+	{
+        if (mContext.isSignedIn())
+		{
+            mContext.getGamesClient().incrementAchievement(achievementId, percentage);
+        }
+    }
+
+    public static void displayLeaderboards() 
+	{
+		if (mContext.isSignedIn())
+		{
+			((appname)mContext).runOnUiThread(new Runnable() 
+			{
+				public void run() {
+					((appname)mContext).startActivityForResult(((appname)mContext).getGamesClient().getLeaderboardIntent("leaderboardidfromgoogleplay"), 5001);
+				}
+			});
+		}
+		else
+		{
+			gameServicesSignIn();
+		}
+    }
+
+    public static void displayAchievements() 
+	{
+		if (mContext.isSignedIn())
+		{
+			((appname)mContext).runOnUiThread(new Runnable() 
+			{
+				public void run() {
+					((appname)mContext).startActivityForResult(((appname)mContext).getGamesClient().getAchievementsIntent(), 5001);
+				}
+			});
+		}
+		else
+		{
+			gameServicesSignIn();
+		}
+    }
+
+    public static void loadFriends() 
+	{
+        if (mFriends.size() > 0) {
+            mFriends.clear();
+        }
+
+        ((appname)mContext).runOnUiThread(new Runnable() 
+		{
+                public void run() 
+				{        
+            ((appname)mContext).getGamesClient().loadInvitablePlayers(new OnPlayersLoadedListener() {
+
+                @Override
+                public void onPlayersLoaded(int statusCode, PlayerBuffer playerBuffer) {
+
+                    if (statusCode == GamesClient.STATUS_OK) {
+                        for (Player player : playerBuffer) {
+                            mFriends.add(player);
+                        }
+
+                        if (playerBuffer.getCount() == FRIENDS_PER_PAGE) {
+                            ((appname)mContext).getGamesClient().loadMoreInvitablePlayers(this, FRIENDS_PER_PAGE);
+                        } else {
+                            // call out and return all the friends <more code to call into C++>
+
+                            for (Player friend : mFriends) {
+                                Log.i(TAG, String.format("Found player with id [%s] and display name [%s]", friend.getPlayerId(), friend.getDisplayName()));
+                            }
+                        }
+                    }
+                }
+            }, FRIENDS_PER_PAGE, false);
+        });
+    }
+}

+ 12 - 0
gameplay/android/java/src/org/gameplay3d/lib/TestClass.java

@@ -0,0 +1,12 @@
+
+package org.gameplay3d.lib;
+
+public class TestClass
+{
+   public TestClass() { }
+ 
+   public int ComputeMult(float a, float b)
+   {
+      return (int)(a * b);
+   }
+}

+ 8 - 1
gameplay/android/jni/Android.mk

@@ -91,6 +91,12 @@ LOCAL_SRC_FILES := \
     ScriptController.cpp \
     ScriptController.cpp \
     ScriptTarget.cpp \
     ScriptTarget.cpp \
     Slider.cpp \
     Slider.cpp \
+	SocialAchievement.cpp \
+	SocialChallenge.cpp \
+	SocialController.cpp \
+	SocialPlayer.cpp \
+	SocialScore.cpp \
+	SocialSessionListener.cpp \
     SpriteBatch.cpp \
     SpriteBatch.cpp \
     Technique.cpp \
     Technique.cpp \
     Terrain.cpp \
     Terrain.cpp \
@@ -106,6 +112,7 @@ LOCAL_SRC_FILES := \
     VertexAttributeBinding.cpp \
     VertexAttributeBinding.cpp \
     VertexFormat.cpp \
     VertexFormat.cpp \
     VerticalLayout.cpp \
     VerticalLayout.cpp \
+	social/GoogleGamesSocialSession.cpp \
     lua/lua_AbsoluteLayout.cpp \
     lua/lua_AbsoluteLayout.cpp \
     lua/lua_AIAgent.cpp \
     lua/lua_AIAgent.cpp \
     lua/lua_AIAgentListener.cpp \
     lua/lua_AIAgentListener.cpp \
@@ -281,7 +288,7 @@ LOCAL_SRC_FILES := \
     lua/lua_VerticalLayout.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_CFLAGS := -D__ANDROID__ -DGP_USE_SOCIAL -I"../../external-deps/lua/include" -I"../../external-deps/bullet/include" -I"../../external-deps/png/include" -I"../../external-deps/oggvorbis/include" -I"../../external-deps/openal/include"
 LOCAL_STATIC_LIBRARIES := android_native_app_glue
 LOCAL_STATIC_LIBRARIES := android_native_app_glue
 
 
 include $(BUILD_STATIC_LIBRARY)
 include $(BUILD_STATIC_LIBRARY)

+ 42 - 19
gameplay/gameplay.vcxproj

@@ -318,6 +318,14 @@
     <ClCompile Include="src\ScriptController.cpp" />
     <ClCompile Include="src\ScriptController.cpp" />
     <ClCompile Include="src\ScriptTarget.cpp" />
     <ClCompile Include="src\ScriptTarget.cpp" />
     <ClCompile Include="src\Slider.cpp" />
     <ClCompile Include="src\Slider.cpp" />
+    <ClCompile Include="src\SocialAchievement.cpp" />
+    <ClCompile Include="src\SocialChallenge.cpp" />
+    <ClCompile Include="src\SocialController.cpp" />
+    <ClCompile Include="src\SocialPlayer.cpp" />
+    <ClCompile Include="src\SocialScore.cpp" />
+    <ClCompile Include="src\SocialSessionListener.cpp" />
+    <ClCompile Include="src\social\GoogleGamesSocialSession.cpp" />
+    <ClCompile Include="src\social\ScoreloopSocialSession.cpp" />
     <ClCompile Include="src\SpriteBatch.cpp" />
     <ClCompile Include="src\SpriteBatch.cpp" />
     <ClCompile Include="src\Technique.cpp" />
     <ClCompile Include="src\Technique.cpp" />
     <ClCompile Include="src\Terrain.cpp" />
     <ClCompile Include="src\Terrain.cpp" />
@@ -599,6 +607,15 @@
     <ClInclude Include="src\ScriptController.h" />
     <ClInclude Include="src\ScriptController.h" />
     <ClInclude Include="src\ScriptTarget.h" />
     <ClInclude Include="src\ScriptTarget.h" />
     <ClInclude Include="src\Slider.h" />
     <ClInclude Include="src\Slider.h" />
+    <ClInclude Include="src\SocialAchievement.h" />
+    <ClInclude Include="src\SocialChallenge.h" />
+    <ClInclude Include="src\SocialController.h" />
+    <ClInclude Include="src\SocialPlayer.h" />
+    <ClInclude Include="src\SocialScore.h" />
+    <ClInclude Include="src\SocialSession.h" />
+    <ClInclude Include="src\SocialSessionListener.h" />
+    <ClInclude Include="src\social\GoogleGamesSocialSession.h" />
+    <ClInclude Include="src\social\ScoreloopSocialSession.h" />
     <ClInclude Include="src\SpriteBatch.h" />
     <ClInclude Include="src\SpriteBatch.h" />
     <ClInclude Include="src\Stream.h" />
     <ClInclude Include="src\Stream.h" />
     <ClInclude Include="src\Technique.h" />
     <ClInclude Include="src\Technique.h" />
@@ -875,10 +892,12 @@
       <WarningLevel>Level3</WarningLevel>
       <WarningLevel>Level3</WarningLevel>
       <Optimization>Disabled</Optimization>
       <Optimization>Disabled</Optimization>
       <PreprocessorDefinitions>_ITERATOR_DEBUG_LEVEL=0;WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <PreprocessorDefinitions>_ITERATOR_DEBUG_LEVEL=0;WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <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>
+      <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\png\include;..\external-deps\zlib\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <RuntimeTypeInfo>
       <RuntimeTypeInfo>
       </RuntimeTypeInfo>
       </RuntimeTypeInfo>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
+      <DisableSpecificWarnings>
+      </DisableSpecificWarnings>
     </ClCompile>
     </ClCompile>
     <Link>
     <Link>
       <SubSystem>Windows</SubSystem>
       <SubSystem>Windows</SubSystem>
@@ -895,7 +914,7 @@
       <WarningLevel>Level3</WarningLevel>
       <WarningLevel>Level3</WarningLevel>
       <Optimization>Disabled</Optimization>
       <Optimization>Disabled</Optimization>
       <PreprocessorDefinitions>_ITERATOR_DEBUG_LEVEL=0;WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <PreprocessorDefinitions>_ITERATOR_DEBUG_LEVEL=0;WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <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>
+      <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\png\include;..\external-deps\zlib\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <RuntimeTypeInfo>
       <RuntimeTypeInfo>
       </RuntimeTypeInfo>
       </RuntimeTypeInfo>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
@@ -914,8 +933,8 @@
       </PrecompiledHeader>
       </PrecompiledHeader>
       <WarningLevel>Level3</WarningLevel>
       <WarningLevel>Level3</WarningLevel>
       <Optimization>Disabled</Optimization>
       <Optimization>Disabled</Optimization>
-      <PreprocessorDefinitions>USE_BLACKBERRY_GAMEPAD;_ITERATOR_DEBUG_LEVEL=0;WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <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>
+      <PreprocessorDefinitions>_ITERATOR_DEBUG_LEVEL=0;WIN32;_DEBUG;_LIB;GP_USE_SOCIAL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <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\png\include;..\external-deps\zlib\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <RuntimeTypeInfo>
       <RuntimeTypeInfo>
       </RuntimeTypeInfo>
       </RuntimeTypeInfo>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
@@ -933,7 +952,7 @@
       <WarningLevel>Level3</WarningLevel>
       <WarningLevel>Level3</WarningLevel>
       <Optimization>Disabled</Optimization>
       <Optimization>Disabled</Optimization>
       <PreprocessorDefinitions>_ITERATOR_DEBUG_LEVEL=0;WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <PreprocessorDefinitions>_ITERATOR_DEBUG_LEVEL=0;WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <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>
+      <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\png\include;..\external-deps\zlib\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <RuntimeTypeInfo>
       <RuntimeTypeInfo>
       </RuntimeTypeInfo>
       </RuntimeTypeInfo>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
@@ -949,10 +968,12 @@
       </PrecompiledHeader>
       </PrecompiledHeader>
       <WarningLevel>Level3</WarningLevel>
       <WarningLevel>Level3</WarningLevel>
       <Optimization>Disabled</Optimization>
       <Optimization>Disabled</Optimization>
-      <PreprocessorDefinitions>_ITERATOR_DEBUG_LEVEL=0;WIN32;_DEBUG;_LIB;GAMEPLAY_MEM_LEAK_DETECTION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <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>
+      <PreprocessorDefinitions>_ITERATOR_DEBUG_LEVEL=0;WIN32;_DEBUG;_LIB;GP_USE_MEM_LEAK_DETECTION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <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\png\include;..\external-deps\zlib\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <RuntimeTypeInfo>true</RuntimeTypeInfo>
       <RuntimeTypeInfo>true</RuntimeTypeInfo>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
+      <DisableSpecificWarnings>
+      </DisableSpecificWarnings>
     </ClCompile>
     </ClCompile>
     <Link>
     <Link>
       <SubSystem>Windows</SubSystem>
       <SubSystem>Windows</SubSystem>
@@ -973,8 +994,8 @@
       </PrecompiledHeader>
       </PrecompiledHeader>
       <WarningLevel>Level3</WarningLevel>
       <WarningLevel>Level3</WarningLevel>
       <Optimization>Disabled</Optimization>
       <Optimization>Disabled</Optimization>
-      <PreprocessorDefinitions>_ITERATOR_DEBUG_LEVEL=0;WIN32;_DEBUG;_LIB;GAMEPLAY_MEM_LEAK_DETECTION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <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>
+      <PreprocessorDefinitions>_ITERATOR_DEBUG_LEVEL=0;WIN32;_DEBUG;_LIB;GP_USE_MEM_LEAK_DETECTION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <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\png\include;..\external-deps\zlib\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <RuntimeTypeInfo>true</RuntimeTypeInfo>
       <RuntimeTypeInfo>true</RuntimeTypeInfo>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
     </ClCompile>
     </ClCompile>
@@ -993,8 +1014,8 @@
       </PrecompiledHeader>
       </PrecompiledHeader>
       <WarningLevel>Level3</WarningLevel>
       <WarningLevel>Level3</WarningLevel>
       <Optimization>Disabled</Optimization>
       <Optimization>Disabled</Optimization>
-      <PreprocessorDefinitions>__BB10__;_ITERATOR_DEBUG_LEVEL=0;WIN32;_DEBUG;_LIB;GAMEPLAY_MEM_LEAK_DETECTION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <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>
+      <PreprocessorDefinitions>_ITERATOR_DEBUG_LEVEL=0;WIN32;_DEBUG;_LIB;GP_USE_MEM_LEAK_DETECTION;GP_USE_SOCIAL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <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\png\include;..\external-deps\zlib\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <RuntimeTypeInfo>true</RuntimeTypeInfo>
       <RuntimeTypeInfo>true</RuntimeTypeInfo>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
       <AdditionalOptions>-mfpu=neon %(AdditionalOptions)</AdditionalOptions>
       <AdditionalOptions>-mfpu=neon %(AdditionalOptions)</AdditionalOptions>
@@ -1014,8 +1035,8 @@
       </PrecompiledHeader>
       </PrecompiledHeader>
       <WarningLevel>Level3</WarningLevel>
       <WarningLevel>Level3</WarningLevel>
       <Optimization>Disabled</Optimization>
       <Optimization>Disabled</Optimization>
-      <PreprocessorDefinitions>_ITERATOR_DEBUG_LEVEL=0;WIN32;_DEBUG;_LIB;GAMEPLAY_MEM_LEAK_DETECTION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <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>
+      <PreprocessorDefinitions>_ITERATOR_DEBUG_LEVEL=0;WIN32;_DEBUG;_LIB;GP_USE_MEM_LEAK_DETECTION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <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\png\include;..\external-deps\zlib\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <RuntimeTypeInfo>true</RuntimeTypeInfo>
       <RuntimeTypeInfo>true</RuntimeTypeInfo>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
     </ClCompile>
     </ClCompile>
@@ -1037,9 +1058,11 @@
       <FunctionLevelLinking>true</FunctionLevelLinking>
       <FunctionLevelLinking>true</FunctionLevelLinking>
       <IntrinsicFunctions>true</IntrinsicFunctions>
       <IntrinsicFunctions>true</IntrinsicFunctions>
       <PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <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>
+      <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\png\include;..\external-deps\zlib\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <DebugInformationFormat>
       <DebugInformationFormat>
       </DebugInformationFormat>
       </DebugInformationFormat>
+      <DisableSpecificWarnings>
+      </DisableSpecificWarnings>
     </ClCompile>
     </ClCompile>
     <Link>
     <Link>
       <SubSystem>Windows</SubSystem>
       <SubSystem>Windows</SubSystem>
@@ -1057,7 +1080,7 @@
       <FunctionLevelLinking>true</FunctionLevelLinking>
       <FunctionLevelLinking>true</FunctionLevelLinking>
       <IntrinsicFunctions>true</IntrinsicFunctions>
       <IntrinsicFunctions>true</IntrinsicFunctions>
       <PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <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>
+      <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\png\include;..\external-deps\zlib\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <DebugInformationFormat>
       <DebugInformationFormat>
       </DebugInformationFormat>
       </DebugInformationFormat>
     </ClCompile>
     </ClCompile>
@@ -1076,8 +1099,8 @@
       <Optimization>MaxSpeed</Optimization>
       <Optimization>MaxSpeed</Optimization>
       <FunctionLevelLinking>true</FunctionLevelLinking>
       <FunctionLevelLinking>true</FunctionLevelLinking>
       <IntrinsicFunctions>true</IntrinsicFunctions>
       <IntrinsicFunctions>true</IntrinsicFunctions>
-      <PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <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>
+      <PreprocessorDefinitions>WIN32;NDEBUG;_LIB;GP_USE_SOCIAL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <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\png\include;..\external-deps\zlib\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <AdditionalOptions>-mfpu=neon %(AdditionalOptions)</AdditionalOptions>
       <AdditionalOptions>-mfpu=neon %(AdditionalOptions)</AdditionalOptions>
     </ClCompile>
     </ClCompile>
     <Link>
     <Link>
@@ -1095,8 +1118,8 @@
       <Optimization>MaxSpeed</Optimization>
       <Optimization>MaxSpeed</Optimization>
       <FunctionLevelLinking>true</FunctionLevelLinking>
       <FunctionLevelLinking>true</FunctionLevelLinking>
       <IntrinsicFunctions>true</IntrinsicFunctions>
       <IntrinsicFunctions>true</IntrinsicFunctions>
-      <PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <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>
+      <PreprocessorDefinitions>WIN32;NDEBUG;_LIB;GP_USE_SOCIAL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <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\png\include;..\external-deps\zlib\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
     </ClCompile>
     </ClCompile>
     <Link>
     <Link>
       <SubSystem>Windows</SubSystem>
       <SubSystem>Windows</SubSystem>

+ 54 - 0
gameplay/gameplay.vcxproj.filters

@@ -13,6 +13,9 @@
     <Filter Include="src\lua">
     <Filter Include="src\lua">
       <UniqueIdentifier>{21cf31c6-9c10-44cb-a864-d46a0e7bfe5e}</UniqueIdentifier>
       <UniqueIdentifier>{21cf31c6-9c10-44cb-a864-d46a0e7bfe5e}</UniqueIdentifier>
     </Filter>
     </Filter>
+    <Filter Include="src\social">
+      <UniqueIdentifier>{7bd5ee6c-c0cc-4ae3-b7a9-443fb391b944}</UniqueIdentifier>
+    </Filter>
   </ItemGroup>
   </ItemGroup>
   <ItemGroup>
   <ItemGroup>
     <ClCompile Include="src\Animation.cpp">
     <ClCompile Include="src\Animation.cpp">
@@ -861,6 +864,30 @@
     <ClCompile Include="src\lua\lua_RenderStateStencilOperation.cpp">
     <ClCompile Include="src\lua\lua_RenderStateStencilOperation.cpp">
       <Filter>src\lua</Filter>
       <Filter>src\lua</Filter>
     </ClCompile>
     </ClCompile>
+    <ClCompile Include="src\SocialController.cpp">
+      <Filter>src</Filter>
+    </ClCompile>
+    <ClCompile Include="src\social\ScoreloopSocialSession.cpp">
+      <Filter>src\social</Filter>
+    </ClCompile>
+    <ClCompile Include="src\social\GoogleGamesSocialSession.cpp">
+      <Filter>src\social</Filter>
+    </ClCompile>
+    <ClCompile Include="src\SocialAchievement.cpp">
+      <Filter>src</Filter>
+    </ClCompile>
+    <ClCompile Include="src\SocialPlayer.cpp">
+      <Filter>src</Filter>
+    </ClCompile>
+    <ClCompile Include="src\SocialScore.cpp">
+      <Filter>src</Filter>
+    </ClCompile>
+    <ClCompile Include="src\SocialChallenge.cpp">
+      <Filter>src</Filter>
+    </ClCompile>
+    <ClCompile Include="src\SocialSessionListener.cpp">
+      <Filter>src</Filter>
+    </ClCompile>
   </ItemGroup>
   </ItemGroup>
   <ItemGroup>
   <ItemGroup>
     <ClInclude Include="src\Animation.h">
     <ClInclude Include="src\Animation.h">
@@ -1709,6 +1736,33 @@
     <ClInclude Include="src\lua\lua_RenderStateStencilOperation.h">
     <ClInclude Include="src\lua\lua_RenderStateStencilOperation.h">
       <Filter>src\lua</Filter>
       <Filter>src\lua</Filter>
     </ClInclude>
     </ClInclude>
+    <ClInclude Include="src\SocialController.h">
+      <Filter>src</Filter>
+    </ClInclude>
+    <ClInclude Include="src\SocialSession.h">
+      <Filter>src</Filter>
+    </ClInclude>
+    <ClInclude Include="src\SocialAchievement.h">
+      <Filter>src</Filter>
+    </ClInclude>
+    <ClInclude Include="src\SocialPlayer.h">
+      <Filter>src</Filter>
+    </ClInclude>
+    <ClInclude Include="src\SocialSessionListener.h">
+      <Filter>src</Filter>
+    </ClInclude>
+    <ClInclude Include="src\SocialScore.h">
+      <Filter>src</Filter>
+    </ClInclude>
+    <ClInclude Include="src\social\ScoreloopSocialSession.h">
+      <Filter>src\social</Filter>
+    </ClInclude>
+    <ClInclude Include="src\social\GoogleGamesSocialSession.h">
+      <Filter>src\social</Filter>
+    </ClInclude>
+    <ClInclude Include="src\SocialChallenge.h">
+      <Filter>src</Filter>
+    </ClInclude>
   </ItemGroup>
   </ItemGroup>
   <ItemGroup>
   <ItemGroup>
     <None Include="src\Game.inl">
     <None Include="src\Game.inl">

+ 132 - 42
gameplay/gameplay.xcodeproj/project.pbxproj

@@ -54,6 +54,32 @@
 		42554EA2152BC35C000ED910 /* PhysicsCollisionShape.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 42554E9F152BC35C000ED910 /* PhysicsCollisionShape.cpp */; };
 		42554EA2152BC35C000ED910 /* PhysicsCollisionShape.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 42554E9F152BC35C000ED910 /* PhysicsCollisionShape.cpp */; };
 		42554EA3152BC35C000ED910 /* PhysicsCollisionShape.h in Headers */ = {isa = PBXBuildFile; fileRef = 42554EA0152BC35C000ED910 /* PhysicsCollisionShape.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		42554EA3152BC35C000ED910 /* PhysicsCollisionShape.h in Headers */ = {isa = PBXBuildFile; fileRef = 42554EA0152BC35C000ED910 /* PhysicsCollisionShape.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		42554EA4152BC35C000ED910 /* PhysicsCollisionShape.h in Headers */ = {isa = PBXBuildFile; fileRef = 42554EA0152BC35C000ED910 /* PhysicsCollisionShape.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		42554EA4152BC35C000ED910 /* PhysicsCollisionShape.h in Headers */ = {isa = PBXBuildFile; fileRef = 42554EA0152BC35C000ED910 /* PhysicsCollisionShape.h */; settings = {ATTRIBUTES = (Public, ); }; };
+		425EDA5D17FB260500AABF95 /* SocialAchievement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 425EDA5017FB260500AABF95 /* SocialAchievement.cpp */; };
+		425EDA5E17FB260500AABF95 /* SocialAchievement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 425EDA5017FB260500AABF95 /* SocialAchievement.cpp */; };
+		425EDA5F17FB260500AABF95 /* SocialAchievement.h in Headers */ = {isa = PBXBuildFile; fileRef = 425EDA5117FB260500AABF95 /* SocialAchievement.h */; };
+		425EDA6017FB260500AABF95 /* SocialAchievement.h in Headers */ = {isa = PBXBuildFile; fileRef = 425EDA5117FB260500AABF95 /* SocialAchievement.h */; };
+		425EDA6117FB260500AABF95 /* SocialChallenge.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 425EDA5217FB260500AABF95 /* SocialChallenge.cpp */; };
+		425EDA6217FB260500AABF95 /* SocialChallenge.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 425EDA5217FB260500AABF95 /* SocialChallenge.cpp */; };
+		425EDA6317FB260500AABF95 /* SocialChallenge.h in Headers */ = {isa = PBXBuildFile; fileRef = 425EDA5317FB260500AABF95 /* SocialChallenge.h */; };
+		425EDA6417FB260500AABF95 /* SocialChallenge.h in Headers */ = {isa = PBXBuildFile; fileRef = 425EDA5317FB260500AABF95 /* SocialChallenge.h */; };
+		425EDA6517FB260500AABF95 /* SocialController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 425EDA5417FB260500AABF95 /* SocialController.cpp */; };
+		425EDA6617FB260500AABF95 /* SocialController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 425EDA5417FB260500AABF95 /* SocialController.cpp */; };
+		425EDA6717FB260500AABF95 /* SocialController.h in Headers */ = {isa = PBXBuildFile; fileRef = 425EDA5517FB260500AABF95 /* SocialController.h */; };
+		425EDA6817FB260500AABF95 /* SocialController.h in Headers */ = {isa = PBXBuildFile; fileRef = 425EDA5517FB260500AABF95 /* SocialController.h */; };
+		425EDA6917FB260500AABF95 /* SocialPlayer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 425EDA5617FB260500AABF95 /* SocialPlayer.cpp */; };
+		425EDA6A17FB260500AABF95 /* SocialPlayer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 425EDA5617FB260500AABF95 /* SocialPlayer.cpp */; };
+		425EDA6B17FB260500AABF95 /* SocialPlayer.h in Headers */ = {isa = PBXBuildFile; fileRef = 425EDA5717FB260500AABF95 /* SocialPlayer.h */; };
+		425EDA6C17FB260500AABF95 /* SocialPlayer.h in Headers */ = {isa = PBXBuildFile; fileRef = 425EDA5717FB260500AABF95 /* SocialPlayer.h */; };
+		425EDA6D17FB260500AABF95 /* SocialScore.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 425EDA5817FB260500AABF95 /* SocialScore.cpp */; };
+		425EDA6E17FB260500AABF95 /* SocialScore.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 425EDA5817FB260500AABF95 /* SocialScore.cpp */; };
+		425EDA6F17FB260500AABF95 /* SocialScore.h in Headers */ = {isa = PBXBuildFile; fileRef = 425EDA5917FB260500AABF95 /* SocialScore.h */; };
+		425EDA7017FB260500AABF95 /* SocialScore.h in Headers */ = {isa = PBXBuildFile; fileRef = 425EDA5917FB260500AABF95 /* SocialScore.h */; };
+		425EDA7117FB260500AABF95 /* SocialSession.h in Headers */ = {isa = PBXBuildFile; fileRef = 425EDA5A17FB260500AABF95 /* SocialSession.h */; };
+		425EDA7217FB260500AABF95 /* SocialSession.h in Headers */ = {isa = PBXBuildFile; fileRef = 425EDA5A17FB260500AABF95 /* SocialSession.h */; };
+		425EDA7317FB260500AABF95 /* SocialSessionListener.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 425EDA5B17FB260500AABF95 /* SocialSessionListener.cpp */; };
+		425EDA7417FB260500AABF95 /* SocialSessionListener.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 425EDA5B17FB260500AABF95 /* SocialSessionListener.cpp */; };
+		425EDA7517FB260500AABF95 /* SocialSessionListener.h in Headers */ = {isa = PBXBuildFile; fileRef = 425EDA5C17FB260500AABF95 /* SocialSessionListener.h */; };
+		425EDA7617FB260500AABF95 /* SocialSessionListener.h in Headers */ = {isa = PBXBuildFile; fileRef = 425EDA5C17FB260500AABF95 /* SocialSessionListener.h */; };
 		426878AC153F4BB300844500 /* FlowLayout.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 426878AA153F4BB300844500 /* FlowLayout.cpp */; };
 		426878AC153F4BB300844500 /* FlowLayout.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 426878AA153F4BB300844500 /* FlowLayout.cpp */; };
 		426878AD153F4BB300844500 /* FlowLayout.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 426878AA153F4BB300844500 /* FlowLayout.cpp */; };
 		426878AD153F4BB300844500 /* FlowLayout.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 426878AA153F4BB300844500 /* FlowLayout.cpp */; };
 		426878AE153F4BB300844500 /* FlowLayout.h in Headers */ = {isa = PBXBuildFile; fileRef = 426878AB153F4BB300844500 /* FlowLayout.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		426878AE153F4BB300844500 /* FlowLayout.h in Headers */ = {isa = PBXBuildFile; fileRef = 426878AB153F4BB300844500 /* FlowLayout.h */; settings = {ATTRIBUTES = (Public, ); }; };
@@ -1215,6 +1241,19 @@
 		4251B130152D049B002F6199 /* ThemeStyle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ThemeStyle.h; path = src/ThemeStyle.h; sourceTree = SOURCE_ROOT; };
 		4251B130152D049B002F6199 /* ThemeStyle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ThemeStyle.h; path = src/ThemeStyle.h; sourceTree = SOURCE_ROOT; };
 		42554E9F152BC35C000ED910 /* PhysicsCollisionShape.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PhysicsCollisionShape.cpp; path = src/PhysicsCollisionShape.cpp; sourceTree = SOURCE_ROOT; };
 		42554E9F152BC35C000ED910 /* PhysicsCollisionShape.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PhysicsCollisionShape.cpp; path = src/PhysicsCollisionShape.cpp; sourceTree = SOURCE_ROOT; };
 		42554EA0152BC35C000ED910 /* PhysicsCollisionShape.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PhysicsCollisionShape.h; path = src/PhysicsCollisionShape.h; sourceTree = SOURCE_ROOT; };
 		42554EA0152BC35C000ED910 /* PhysicsCollisionShape.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PhysicsCollisionShape.h; path = src/PhysicsCollisionShape.h; sourceTree = SOURCE_ROOT; };
+		425EDA5017FB260500AABF95 /* SocialAchievement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SocialAchievement.cpp; path = src/SocialAchievement.cpp; sourceTree = SOURCE_ROOT; };
+		425EDA5117FB260500AABF95 /* SocialAchievement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SocialAchievement.h; path = src/SocialAchievement.h; sourceTree = SOURCE_ROOT; };
+		425EDA5217FB260500AABF95 /* SocialChallenge.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SocialChallenge.cpp; path = src/SocialChallenge.cpp; sourceTree = SOURCE_ROOT; };
+		425EDA5317FB260500AABF95 /* SocialChallenge.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SocialChallenge.h; path = src/SocialChallenge.h; sourceTree = SOURCE_ROOT; };
+		425EDA5417FB260500AABF95 /* SocialController.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SocialController.cpp; path = src/SocialController.cpp; sourceTree = SOURCE_ROOT; };
+		425EDA5517FB260500AABF95 /* SocialController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SocialController.h; path = src/SocialController.h; sourceTree = SOURCE_ROOT; };
+		425EDA5617FB260500AABF95 /* SocialPlayer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SocialPlayer.cpp; path = src/SocialPlayer.cpp; sourceTree = SOURCE_ROOT; };
+		425EDA5717FB260500AABF95 /* SocialPlayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SocialPlayer.h; path = src/SocialPlayer.h; sourceTree = SOURCE_ROOT; };
+		425EDA5817FB260500AABF95 /* SocialScore.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SocialScore.cpp; path = src/SocialScore.cpp; sourceTree = SOURCE_ROOT; };
+		425EDA5917FB260500AABF95 /* SocialScore.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SocialScore.h; path = src/SocialScore.h; sourceTree = SOURCE_ROOT; };
+		425EDA5A17FB260500AABF95 /* SocialSession.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SocialSession.h; path = src/SocialSession.h; sourceTree = SOURCE_ROOT; };
+		425EDA5B17FB260500AABF95 /* SocialSessionListener.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SocialSessionListener.cpp; path = src/SocialSessionListener.cpp; sourceTree = SOURCE_ROOT; };
+		425EDA5C17FB260500AABF95 /* SocialSessionListener.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SocialSessionListener.h; path = src/SocialSessionListener.h; sourceTree = SOURCE_ROOT; };
 		426878AA153F4BB300844500 /* FlowLayout.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = FlowLayout.cpp; path = src/FlowLayout.cpp; sourceTree = SOURCE_ROOT; };
 		426878AA153F4BB300844500 /* FlowLayout.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = FlowLayout.cpp; path = src/FlowLayout.cpp; sourceTree = SOURCE_ROOT; };
 		426878AB153F4BB300844500 /* FlowLayout.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FlowLayout.h; path = src/FlowLayout.h; sourceTree = SOURCE_ROOT; };
 		426878AB153F4BB300844500 /* FlowLayout.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FlowLayout.h; path = src/FlowLayout.h; sourceTree = SOURCE_ROOT; };
 		4271C08D15337C8200B89DA7 /* Layout.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Layout.cpp; path = src/Layout.cpp; sourceTree = SOURCE_ROOT; };
 		4271C08D15337C8200B89DA7 /* Layout.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Layout.cpp; path = src/Layout.cpp; sourceTree = SOURCE_ROOT; };
@@ -1237,7 +1276,7 @@
 		42A5031B16E8F0B800F0246C /* lua_TerrainListener.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = lua_TerrainListener.cpp; sourceTree = "<group>"; };
 		42A5031B16E8F0B800F0246C /* lua_TerrainListener.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = lua_TerrainListener.cpp; sourceTree = "<group>"; };
 		42A5031C16E8F0B800F0246C /* lua_TerrainListener.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = lua_TerrainListener.h; sourceTree = "<group>"; };
 		42A5031C16E8F0B800F0246C /* lua_TerrainListener.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = lua_TerrainListener.h; sourceTree = "<group>"; };
 		42B701F615B08177002BB8C3 /* liblua.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = liblua.a; path = "../external-deps/lua/lib/macosx/liblua.a"; sourceTree = "<group>"; };
 		42B701F615B08177002BB8C3 /* liblua.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = liblua.a; path = "../external-deps/lua/lib/macosx/liblua.a"; sourceTree = "<group>"; };
-		42B701F815B081B6002BB8C3 /* liblua.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = liblua.a; path = "../external-deps/lua/lib/ios/armv7/liblua.a"; sourceTree = "<group>"; };
+		42B701F815B081B6002BB8C3 /* liblua.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = liblua.a; path = "../external-deps/lua/lib/ios/armv7s/liblua.a"; sourceTree = "<group>"; };
 		42B7FADD15B08049002BB8C3 /* ScreenDisplayer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ScreenDisplayer.cpp; path = src/ScreenDisplayer.cpp; sourceTree = SOURCE_ROOT; };
 		42B7FADD15B08049002BB8C3 /* ScreenDisplayer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ScreenDisplayer.cpp; path = src/ScreenDisplayer.cpp; sourceTree = SOURCE_ROOT; };
 		42B7FADE15B08049002BB8C3 /* ScriptController.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ScriptController.cpp; path = src/ScriptController.cpp; sourceTree = SOURCE_ROOT; };
 		42B7FADE15B08049002BB8C3 /* ScriptController.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ScriptController.cpp; path = src/ScriptController.cpp; sourceTree = SOURCE_ROOT; };
 		42B7FADF15B08049002BB8C3 /* ScriptController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ScriptController.h; path = src/ScriptController.h; sourceTree = SOURCE_ROOT; };
 		42B7FADF15B08049002BB8C3 /* ScriptController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ScriptController.h; path = src/ScriptController.h; sourceTree = SOURCE_ROOT; };
@@ -1556,12 +1595,10 @@
 		42BCD45715EFD0F300C0E076 /* lua_VerticalLayout.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = lua_VerticalLayout.cpp; sourceTree = "<group>"; };
 		42BCD45715EFD0F300C0E076 /* lua_VerticalLayout.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = lua_VerticalLayout.cpp; sourceTree = "<group>"; };
 		42BCD45815EFD0F300C0E076 /* lua_VerticalLayout.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = lua_VerticalLayout.h; sourceTree = "<group>"; };
 		42BCD45815EFD0F300C0E076 /* lua_VerticalLayout.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = lua_VerticalLayout.h; sourceTree = "<group>"; };
 		42C932AF14919FD10098216A /* Game.inl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = Game.inl; path = src/Game.inl; sourceTree = SOURCE_ROOT; };
 		42C932AF14919FD10098216A /* Game.inl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = Game.inl; path = src/Game.inl; sourceTree = SOURCE_ROOT; };
-		42CCD555146EC1EB00353661 /* libpng.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libpng.a; path = "../external-deps/libpng/lib/macosx/libpng.a"; sourceTree = "<group>"; };
+		42CCD555146EC1EB00353661 /* libpng.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libpng.a; path = "../external-deps/png/lib/macosx/libpng.a"; sourceTree = "<group>"; };
 		42CD0DA6147D8EA80000361E /* libbullet.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libbullet.a; path = "../external-deps/bullet/lib/macosx/libbullet.a"; sourceTree = "<group>"; };
 		42CD0DA6147D8EA80000361E /* libbullet.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libbullet.a; path = "../external-deps/bullet/lib/macosx/libbullet.a"; sourceTree = "<group>"; };
 		42CD0DA7147D8EA80000361E /* libogg.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libogg.a; path = "../external-deps/oggvorbis/lib/macosx/libogg.a"; sourceTree = "<group>"; };
 		42CD0DA7147D8EA80000361E /* libogg.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libogg.a; path = "../external-deps/oggvorbis/lib/macosx/libogg.a"; sourceTree = "<group>"; };
 		42CD0DA8147D8EA80000361E /* libvorbis.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libvorbis.a; path = "../external-deps/oggvorbis/lib/macosx/libvorbis.a"; sourceTree = "<group>"; };
 		42CD0DA8147D8EA80000361E /* libvorbis.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libvorbis.a; path = "../external-deps/oggvorbis/lib/macosx/libvorbis.a"; sourceTree = "<group>"; };
-		42CD0DA9147D8EA80000361E /* libvorbisenc.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libvorbisenc.a; path = "../external-deps/oggvorbis/lib/macosx/libvorbisenc.a"; sourceTree = "<group>"; };
-		42CD0DAA147D8EA80000361E /* libvorbisfile.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libvorbisfile.a; path = "../external-deps/oggvorbis/lib/macosx/libvorbisfile.a"; sourceTree = "<group>"; };
 		42CD0DB1147D8FF50000361E /* Animation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Animation.cpp; path = src/Animation.cpp; sourceTree = SOURCE_ROOT; };
 		42CD0DB1147D8FF50000361E /* Animation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Animation.cpp; path = src/Animation.cpp; sourceTree = SOURCE_ROOT; };
 		42CD0DB2147D8FF50000361E /* Animation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Animation.h; path = src/Animation.h; sourceTree = SOURCE_ROOT; };
 		42CD0DB2147D8FF50000361E /* Animation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Animation.h; path = src/Animation.h; sourceTree = SOURCE_ROOT; };
 		42CD0DB3147D8FF50000361E /* AnimationClip.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = AnimationClip.cpp; path = src/AnimationClip.cpp; sourceTree = SOURCE_ROOT; };
 		42CD0DB3147D8FF50000361E /* AnimationClip.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = AnimationClip.cpp; path = src/AnimationClip.cpp; sourceTree = SOURCE_ROOT; };
@@ -1698,7 +1735,7 @@
 		42CD0E41147D8FF50000361E /* VertexAttributeBinding.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = VertexAttributeBinding.h; path = src/VertexAttributeBinding.h; sourceTree = SOURCE_ROOT; };
 		42CD0E41147D8FF50000361E /* VertexAttributeBinding.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = VertexAttributeBinding.h; path = src/VertexAttributeBinding.h; sourceTree = SOURCE_ROOT; };
 		42CD0E42147D8FF50000361E /* VertexFormat.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = VertexFormat.cpp; path = src/VertexFormat.cpp; sourceTree = SOURCE_ROOT; };
 		42CD0E42147D8FF50000361E /* VertexFormat.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = VertexFormat.cpp; path = src/VertexFormat.cpp; sourceTree = SOURCE_ROOT; };
 		42CD0E43147D8FF50000361E /* VertexFormat.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = VertexFormat.h; path = src/VertexFormat.h; sourceTree = SOURCE_ROOT; };
 		42CD0E43147D8FF50000361E /* VertexFormat.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = VertexFormat.h; path = src/VertexFormat.h; sourceTree = SOURCE_ROOT; };
-		42DFAB4F16AD8ECD0000F342 /* libz.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libz.dylib; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.0.sdk/usr/lib/libz.dylib; sourceTree = DEVELOPER_DIR; };
+		42DFAB4F16AD8ECD0000F342 /* libz.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libz.dylib; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/usr/lib/libz.dylib; sourceTree = DEVELOPER_DIR; };
 		42F4B7D515994CED00B5A78D /* Gamepad.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Gamepad.cpp; path = src/Gamepad.cpp; sourceTree = SOURCE_ROOT; };
 		42F4B7D515994CED00B5A78D /* Gamepad.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Gamepad.cpp; path = src/Gamepad.cpp; sourceTree = SOURCE_ROOT; };
 		42F4B7D615994CED00B5A78D /* Gamepad.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Gamepad.h; path = src/Gamepad.h; sourceTree = SOURCE_ROOT; };
 		42F4B7D615994CED00B5A78D /* Gamepad.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Gamepad.h; path = src/Gamepad.h; sourceTree = SOURCE_ROOT; };
 		5B04C5CA14BFCFE100EB0071 /* libgameplay.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libgameplay.a; sourceTree = BUILT_PRODUCTS_DIR; };
 		5B04C5CA14BFCFE100EB0071 /* libgameplay.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libgameplay.a; sourceTree = BUILT_PRODUCTS_DIR; };
@@ -1708,12 +1745,10 @@
 		5B2BC75E1512514500D176CD /* OpenGL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGL.framework; path = System/Library/Frameworks/OpenGL.framework; sourceTree = SDKROOT; };
 		5B2BC75E1512514500D176CD /* OpenGL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGL.framework; path = System/Library/Frameworks/OpenGL.framework; sourceTree = SDKROOT; };
 		5B2BC7611512514D00D176CD /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; };
 		5B2BC7611512514D00D176CD /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; };
 		5B2BC7631512516B00D176CD /* libz.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libz.dylib; path = /usr/lib/libz.dylib; sourceTree = "<absolute>"; };
 		5B2BC7631512516B00D176CD /* libz.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libz.dylib; path = /usr/lib/libz.dylib; sourceTree = "<absolute>"; };
-		5B5DB92D14C25B7B007755DB /* libbullet.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libbullet.a; path = "../external-deps/bullet/lib/ios/i386/libbullet.a"; sourceTree = "<group>"; };
-		5B5DB92F14C25B94007755DB /* libpng.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libpng.a; path = "../external-deps/libpng/lib/ios/armv7/libpng.a"; sourceTree = "<group>"; };
-		5B5DB93114C25BA5007755DB /* libogg.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libogg.a; path = "../external-deps/oggvorbis/lib/ios/armv7/libogg.a"; sourceTree = "<group>"; };
-		5B5DB93214C25BA5007755DB /* libvorbis.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libvorbis.a; path = "../external-deps/oggvorbis/lib/ios/armv7/libvorbis.a"; sourceTree = "<group>"; };
-		5B5DB93314C25BA5007755DB /* libvorbisenc.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libvorbisenc.a; path = "../external-deps/oggvorbis/lib/ios/armv7/libvorbisenc.a"; sourceTree = "<group>"; };
-		5B5DB93414C25BA5007755DB /* libvorbisfile.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libvorbisfile.a; path = "../external-deps/oggvorbis/lib/ios/armv7/libvorbisfile.a"; sourceTree = "<group>"; };
+		5B5DB92D14C25B7B007755DB /* libbullet.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libbullet.a; path = "../external-deps/bullet/lib/ios/armv7s/libbullet.a"; sourceTree = "<group>"; };
+		5B5DB92F14C25B94007755DB /* libpng.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libpng.a; path = "../external-deps/png/lib/ios/armv7s/libpng.a"; sourceTree = "<group>"; };
+		5B5DB93114C25BA5007755DB /* libogg.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libogg.a; path = "../external-deps/oggvorbis/lib/ios/armv7s/libogg.a"; sourceTree = "<group>"; };
+		5B5DB93214C25BA5007755DB /* libvorbis.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libvorbis.a; path = "../external-deps/oggvorbis/lib/ios/armv7s/libvorbis.a"; sourceTree = "<group>"; };
 		5BB0823C14C6FEC40019975F /* Mouse.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Mouse.h; path = src/Mouse.h; sourceTree = SOURCE_ROOT; };
 		5BB0823C14C6FEC40019975F /* Mouse.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Mouse.h; path = src/Mouse.h; sourceTree = SOURCE_ROOT; };
 		5BBAD0EF15F5251D004C9639 /* lua_Gesture.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = lua_Gesture.cpp; sourceTree = "<group>"; };
 		5BBAD0EF15F5251D004C9639 /* lua_Gesture.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = lua_Gesture.cpp; sourceTree = "<group>"; };
 		5BBAD0F015F5251D004C9639 /* lua_Gesture.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = lua_Gesture.h; sourceTree = "<group>"; };
 		5BBAD0F015F5251D004C9639 /* lua_Gesture.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = lua_Gesture.h; sourceTree = "<group>"; };
@@ -1776,12 +1811,12 @@
 		B67EC8EA161DFC8E000B4D12 /* lua_LoggerLevel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = lua_LoggerLevel.h; sourceTree = "<group>"; };
 		B67EC8EA161DFC8E000B4D12 /* lua_LoggerLevel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = lua_LoggerLevel.h; sourceTree = "<group>"; };
 		B67EC8F4161DFCA8000B4D12 /* Logger.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Logger.cpp; path = src/Logger.cpp; sourceTree = SOURCE_ROOT; };
 		B67EC8F4161DFCA8000B4D12 /* Logger.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Logger.cpp; path = src/Logger.cpp; sourceTree = SOURCE_ROOT; };
 		B67EC8F5161DFCA8000B4D12 /* Logger.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Logger.h; path = src/Logger.h; sourceTree = SOURCE_ROOT; };
 		B67EC8F5161DFCA8000B4D12 /* Logger.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Logger.h; path = src/Logger.h; sourceTree = SOURCE_ROOT; };
-		BD2636DF16CF5B7400CFE15F /* CoreMotion.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreMotion.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk/System/Library/Frameworks/CoreMotion.framework; sourceTree = DEVELOPER_DIR; };
-		BD2636E016CF5B7400CFE15F /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk/System/Library/Frameworks/Foundation.framework; sourceTree = DEVELOPER_DIR; };
-		BD2636E116CF5B7400CFE15F /* OpenAL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenAL.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk/System/Library/Frameworks/OpenAL.framework; sourceTree = DEVELOPER_DIR; };
-		BD2636E216CF5B7400CFE15F /* OpenGLES.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGLES.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk/System/Library/Frameworks/OpenGLES.framework; sourceTree = DEVELOPER_DIR; };
-		BD2636E316CF5B7400CFE15F /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk/System/Library/Frameworks/QuartzCore.framework; sourceTree = DEVELOPER_DIR; };
-		BD2636E416CF5B7400CFE15F /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk/System/Library/Frameworks/UIKit.framework; sourceTree = DEVELOPER_DIR; };
+		BD2636DF16CF5B7400CFE15F /* CoreMotion.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreMotion.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/System/Library/Frameworks/CoreMotion.framework; sourceTree = DEVELOPER_DIR; };
+		BD2636E016CF5B7400CFE15F /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/System/Library/Frameworks/Foundation.framework; sourceTree = DEVELOPER_DIR; };
+		BD2636E116CF5B7400CFE15F /* OpenAL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenAL.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/System/Library/Frameworks/OpenAL.framework; sourceTree = DEVELOPER_DIR; };
+		BD2636E216CF5B7400CFE15F /* OpenGLES.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGLES.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/System/Library/Frameworks/OpenGLES.framework; sourceTree = DEVELOPER_DIR; };
+		BD2636E316CF5B7400CFE15F /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/System/Library/Frameworks/QuartzCore.framework; sourceTree = DEVELOPER_DIR; };
+		BD2636E416CF5B7400CFE15F /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/System/Library/Frameworks/UIKit.framework; sourceTree = DEVELOPER_DIR; };
 		C01405111765345800B9FFB1 /* lua_RenderStateStencilFunction.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = lua_RenderStateStencilFunction.cpp; sourceTree = "<group>"; };
 		C01405111765345800B9FFB1 /* lua_RenderStateStencilFunction.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = lua_RenderStateStencilFunction.cpp; sourceTree = "<group>"; };
 		C01405121765345800B9FFB1 /* lua_RenderStateStencilFunction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = lua_RenderStateStencilFunction.h; sourceTree = "<group>"; };
 		C01405121765345800B9FFB1 /* lua_RenderStateStencilFunction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = lua_RenderStateStencilFunction.h; sourceTree = "<group>"; };
 		C01405131765345800B9FFB1 /* lua_RenderStateStencilOperation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = lua_RenderStateStencilOperation.cpp; sourceTree = "<group>"; };
 		C01405131765345800B9FFB1 /* lua_RenderStateStencilOperation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = lua_RenderStateStencilOperation.cpp; sourceTree = "<group>"; };
@@ -1850,6 +1885,7 @@
 			isa = PBXGroup;
 			isa = PBXGroup;
 			children = (
 			children = (
 				42BCD31E15EFD0F300C0E076 /* lua */,
 				42BCD31E15EFD0F300C0E076 /* lua */,
+				425EDA4F17FB25D300AABF95 /* social */,
 				5BD52634150F822A004C9099 /* AbsoluteLayout.cpp */,
 				5BD52634150F822A004C9099 /* AbsoluteLayout.cpp */,
 				5BD52635150F822A004C9099 /* AbsoluteLayout.h */,
 				5BD52635150F822A004C9099 /* AbsoluteLayout.h */,
 				42789FC215B0E83700866F5B /* AIAgent.cpp */,
 				42789FC215B0E83700866F5B /* AIAgent.cpp */,
@@ -2050,6 +2086,19 @@
 				421A233315B600E8004F97C3 /* ScriptTarget.h */,
 				421A233315B600E8004F97C3 /* ScriptTarget.h */,
 				5BD52646150F822A004C9099 /* Slider.cpp */,
 				5BD52646150F822A004C9099 /* Slider.cpp */,
 				5BD52647150F822A004C9099 /* Slider.h */,
 				5BD52647150F822A004C9099 /* Slider.h */,
+				425EDA5017FB260500AABF95 /* SocialAchievement.cpp */,
+				425EDA5117FB260500AABF95 /* SocialAchievement.h */,
+				425EDA5217FB260500AABF95 /* SocialChallenge.cpp */,
+				425EDA5317FB260500AABF95 /* SocialChallenge.h */,
+				425EDA5417FB260500AABF95 /* SocialController.cpp */,
+				425EDA5517FB260500AABF95 /* SocialController.h */,
+				425EDA5617FB260500AABF95 /* SocialPlayer.cpp */,
+				425EDA5717FB260500AABF95 /* SocialPlayer.h */,
+				425EDA5817FB260500AABF95 /* SocialScore.cpp */,
+				425EDA5917FB260500AABF95 /* SocialScore.h */,
+				425EDA5A17FB260500AABF95 /* SocialSession.h */,
+				425EDA5B17FB260500AABF95 /* SocialSessionListener.cpp */,
+				425EDA5C17FB260500AABF95 /* SocialSessionListener.h */,
 				42CD0E2F147D8FF50000361E /* SpriteBatch.cpp */,
 				42CD0E2F147D8FF50000361E /* SpriteBatch.cpp */,
 				42CD0E30147D8FF50000361E /* SpriteBatch.h */,
 				42CD0E30147D8FF50000361E /* SpriteBatch.h */,
 				9FC6EE721665304F00F39955 /* Stream.h */,
 				9FC6EE721665304F00F39955 /* Stream.h */,
@@ -2091,6 +2140,13 @@
 			path = gameplay;
 			path = gameplay;
 			sourceTree = "<group>";
 			sourceTree = "<group>";
 		};
 		};
+		425EDA4F17FB25D300AABF95 /* social */ = {
+			isa = PBXGroup;
+			children = (
+			);
+			name = social;
+			sourceTree = "<group>";
+		};
 		427D4F42147DC8DE0076760E /* Libraries */ = {
 		427D4F42147DC8DE0076760E /* Libraries */ = {
 			isa = PBXGroup;
 			isa = PBXGroup;
 			children = (
 			children = (
@@ -2493,11 +2549,9 @@
 			children = (
 			children = (
 				5B5DB92D14C25B7B007755DB /* libbullet.a */,
 				5B5DB92D14C25B7B007755DB /* libbullet.a */,
 				42B701F815B081B6002BB8C3 /* liblua.a */,
 				42B701F815B081B6002BB8C3 /* liblua.a */,
+				5B5DB92F14C25B94007755DB /* libpng.a */,
 				5B5DB93114C25BA5007755DB /* libogg.a */,
 				5B5DB93114C25BA5007755DB /* libogg.a */,
 				5B5DB93214C25BA5007755DB /* libvorbis.a */,
 				5B5DB93214C25BA5007755DB /* libvorbis.a */,
-				5B5DB93314C25BA5007755DB /* libvorbisenc.a */,
-				5B5DB93414C25BA5007755DB /* libvorbisfile.a */,
-				5B5DB92F14C25B94007755DB /* libpng.a */,
 				42DFAB4F16AD8ECD0000F342 /* libz.dylib */,
 				42DFAB4F16AD8ECD0000F342 /* libz.dylib */,
 			);
 			);
 			name = iOS;
 			name = iOS;
@@ -2508,11 +2562,9 @@
 			children = (
 			children = (
 				42CD0DA6147D8EA80000361E /* libbullet.a */,
 				42CD0DA6147D8EA80000361E /* libbullet.a */,
 				42B701F615B08177002BB8C3 /* liblua.a */,
 				42B701F615B08177002BB8C3 /* liblua.a */,
+				42CCD555146EC1EB00353661 /* libpng.a */,
 				42CD0DA7147D8EA80000361E /* libogg.a */,
 				42CD0DA7147D8EA80000361E /* libogg.a */,
 				42CD0DA8147D8EA80000361E /* libvorbis.a */,
 				42CD0DA8147D8EA80000361E /* libvorbis.a */,
-				42CD0DA9147D8EA80000361E /* libvorbisenc.a */,
-				42CD0DAA147D8EA80000361E /* libvorbisfile.a */,
-				42CCD555146EC1EB00353661 /* libpng.a */,
 				5B2BC7631512516B00D176CD /* libz.dylib */,
 				5B2BC7631512516B00D176CD /* libz.dylib */,
 			);
 			);
 			name = MacOSX;
 			name = MacOSX;
@@ -2538,6 +2590,8 @@
 				42CD0E5A147D8FF60000361E /* BoundingBox.h in Headers */,
 				42CD0E5A147D8FF60000361E /* BoundingBox.h in Headers */,
 				42CD0E5C147D8FF60000361E /* BoundingSphere.h in Headers */,
 				42CD0E5C147D8FF60000361E /* BoundingSphere.h in Headers */,
 				42CD0E5E147D8FF60000361E /* Camera.h in Headers */,
 				42CD0E5E147D8FF60000361E /* Camera.h in Headers */,
+				425EDA5F17FB260500AABF95 /* SocialAchievement.h in Headers */,
+				425EDA6F17FB260500AABF95 /* SocialScore.h in Headers */,
 				42CD0E60147D8FF60000361E /* Curve.h in Headers */,
 				42CD0E60147D8FF60000361E /* Curve.h in Headers */,
 				42CD0E62147D8FF60000361E /* DebugNew.h in Headers */,
 				42CD0E62147D8FF60000361E /* DebugNew.h in Headers */,
 				42CD0E64147D8FF60000361E /* DepthStencilTarget.h in Headers */,
 				42CD0E64147D8FF60000361E /* DepthStencilTarget.h in Headers */,
@@ -2619,6 +2673,7 @@
 				4239DDF4157545C1005EA3F6 /* MathUtil.h in Headers */,
 				4239DDF4157545C1005EA3F6 /* MathUtil.h in Headers */,
 				42F4B7D915994CED00B5A78D /* Gamepad.h in Headers */,
 				42F4B7D915994CED00B5A78D /* Gamepad.h in Headers */,
 				42B7FAE715B08049002BB8C3 /* ScriptController.h in Headers */,
 				42B7FAE715B08049002BB8C3 /* ScriptController.h in Headers */,
+				425EDA6717FB260500AABF95 /* SocialController.h in Headers */,
 				42789FCE15B0E83700866F5B /* AIAgent.h in Headers */,
 				42789FCE15B0E83700866F5B /* AIAgent.h in Headers */,
 				42789FD215B0E83700866F5B /* AIController.h in Headers */,
 				42789FD215B0E83700866F5B /* AIController.h in Headers */,
 				42789FD615B0E83700866F5B /* AIMessage.h in Headers */,
 				42789FD615B0E83700866F5B /* AIMessage.h in Headers */,
@@ -2631,6 +2686,7 @@
 				42BCD46615EFD0F300C0E076 /* lua_AIAgentListener.h in Headers */,
 				42BCD46615EFD0F300C0E076 /* lua_AIAgentListener.h in Headers */,
 				42BCD46A15EFD0F300C0E076 /* lua_AIController.h in Headers */,
 				42BCD46A15EFD0F300C0E076 /* lua_AIController.h in Headers */,
 				42BCD46E15EFD0F300C0E076 /* lua_AIMessage.h in Headers */,
 				42BCD46E15EFD0F300C0E076 /* lua_AIMessage.h in Headers */,
+				425EDA6B17FB260500AABF95 /* SocialPlayer.h in Headers */,
 				42BCD47215EFD0F300C0E076 /* lua_AIMessageParameterType.h in Headers */,
 				42BCD47215EFD0F300C0E076 /* lua_AIMessageParameterType.h in Headers */,
 				42BCD47615EFD0F300C0E076 /* lua_AIState.h in Headers */,
 				42BCD47615EFD0F300C0E076 /* lua_AIState.h in Headers */,
 				42BCD47A15EFD0F300C0E076 /* lua_AIStateListener.h in Headers */,
 				42BCD47A15EFD0F300C0E076 /* lua_AIStateListener.h in Headers */,
@@ -2649,7 +2705,9 @@
 				42BCD4AE15EFD0F300C0E076 /* lua_AudioSource.h in Headers */,
 				42BCD4AE15EFD0F300C0E076 /* lua_AudioSource.h in Headers */,
 				42BCD4B215EFD0F300C0E076 /* lua_AudioSourceState.h in Headers */,
 				42BCD4B215EFD0F300C0E076 /* lua_AudioSourceState.h in Headers */,
 				42BCD4B615EFD0F300C0E076 /* lua_BoundingBox.h in Headers */,
 				42BCD4B615EFD0F300C0E076 /* lua_BoundingBox.h in Headers */,
+				425EDA7117FB260500AABF95 /* SocialSession.h in Headers */,
 				42BCD4BA15EFD0F300C0E076 /* lua_BoundingSphere.h in Headers */,
 				42BCD4BA15EFD0F300C0E076 /* lua_BoundingSphere.h in Headers */,
+				425EDA6317FB260500AABF95 /* SocialChallenge.h in Headers */,
 				42BCD4BE15EFD0F300C0E076 /* lua_Bundle.h in Headers */,
 				42BCD4BE15EFD0F300C0E076 /* lua_Bundle.h in Headers */,
 				42BCD4C215EFD0F300C0E076 /* lua_Button.h in Headers */,
 				42BCD4C215EFD0F300C0E076 /* lua_Button.h in Headers */,
 				42BCD4C615EFD0F300C0E076 /* lua_Camera.h in Headers */,
 				42BCD4C615EFD0F300C0E076 /* lua_Camera.h in Headers */,
@@ -2669,6 +2727,7 @@
 				42BCD4FE15EFD0F300C0E076 /* lua_Effect.h in Headers */,
 				42BCD4FE15EFD0F300C0E076 /* lua_Effect.h in Headers */,
 				42BCD50215EFD0F300C0E076 /* lua_FileSystem.h in Headers */,
 				42BCD50215EFD0F300C0E076 /* lua_FileSystem.h in Headers */,
 				42BCD50615EFD0F300C0E076 /* lua_FlowLayout.h in Headers */,
 				42BCD50615EFD0F300C0E076 /* lua_FlowLayout.h in Headers */,
+				425EDA7517FB260500AABF95 /* SocialSessionListener.h in Headers */,
 				42BCD50A15EFD0F300C0E076 /* lua_Font.h in Headers */,
 				42BCD50A15EFD0F300C0E076 /* lua_Font.h in Headers */,
 				42BCD50E15EFD0F300C0E076 /* lua_FontJustify.h in Headers */,
 				42BCD50E15EFD0F300C0E076 /* lua_FontJustify.h in Headers */,
 				42BCD51215EFD0F300C0E076 /* lua_FontStyle.h in Headers */,
 				42BCD51215EFD0F300C0E076 /* lua_FontStyle.h in Headers */,
@@ -2848,6 +2907,8 @@
 				5B04C58B14BFCFE100EB0071 /* BoundingBox.h in Headers */,
 				5B04C58B14BFCFE100EB0071 /* BoundingBox.h in Headers */,
 				5B04C58C14BFCFE100EB0071 /* BoundingSphere.h in Headers */,
 				5B04C58C14BFCFE100EB0071 /* BoundingSphere.h in Headers */,
 				5B04C58D14BFCFE100EB0071 /* Camera.h in Headers */,
 				5B04C58D14BFCFE100EB0071 /* Camera.h in Headers */,
+				425EDA6017FB260500AABF95 /* SocialAchievement.h in Headers */,
+				425EDA7017FB260500AABF95 /* SocialScore.h in Headers */,
 				5B04C58E14BFCFE100EB0071 /* Curve.h in Headers */,
 				5B04C58E14BFCFE100EB0071 /* Curve.h in Headers */,
 				5B04C58F14BFCFE100EB0071 /* DebugNew.h in Headers */,
 				5B04C58F14BFCFE100EB0071 /* DebugNew.h in Headers */,
 				5B04C59014BFCFE100EB0071 /* DepthStencilTarget.h in Headers */,
 				5B04C59014BFCFE100EB0071 /* DepthStencilTarget.h in Headers */,
@@ -2929,6 +2990,7 @@
 				42F4B7DA15994CED00B5A78D /* Gamepad.h in Headers */,
 				42F4B7DA15994CED00B5A78D /* Gamepad.h in Headers */,
 				42B7FAE815B08049002BB8C3 /* ScriptController.h in Headers */,
 				42B7FAE815B08049002BB8C3 /* ScriptController.h in Headers */,
 				42789FCF15B0E83700866F5B /* AIAgent.h in Headers */,
 				42789FCF15B0E83700866F5B /* AIAgent.h in Headers */,
+				425EDA6817FB260500AABF95 /* SocialController.h in Headers */,
 				42789FD315B0E83700866F5B /* AIController.h in Headers */,
 				42789FD315B0E83700866F5B /* AIController.h in Headers */,
 				42789FD715B0E83700866F5B /* AIMessage.h in Headers */,
 				42789FD715B0E83700866F5B /* AIMessage.h in Headers */,
 				42789FDB15B0E83700866F5B /* AIState.h in Headers */,
 				42789FDB15B0E83700866F5B /* AIState.h in Headers */,
@@ -2941,6 +3003,7 @@
 				42BCD46B15EFD0F300C0E076 /* lua_AIController.h in Headers */,
 				42BCD46B15EFD0F300C0E076 /* lua_AIController.h in Headers */,
 				42BCD46F15EFD0F300C0E076 /* lua_AIMessage.h in Headers */,
 				42BCD46F15EFD0F300C0E076 /* lua_AIMessage.h in Headers */,
 				42BCD47315EFD0F300C0E076 /* lua_AIMessageParameterType.h in Headers */,
 				42BCD47315EFD0F300C0E076 /* lua_AIMessageParameterType.h in Headers */,
+				425EDA6C17FB260500AABF95 /* SocialPlayer.h in Headers */,
 				42BCD47715EFD0F300C0E076 /* lua_AIState.h in Headers */,
 				42BCD47715EFD0F300C0E076 /* lua_AIState.h in Headers */,
 				42BCD47B15EFD0F300C0E076 /* lua_AIStateListener.h in Headers */,
 				42BCD47B15EFD0F300C0E076 /* lua_AIStateListener.h in Headers */,
 				42BCD47F15EFD0F300C0E076 /* lua_AIStateMachine.h in Headers */,
 				42BCD47F15EFD0F300C0E076 /* lua_AIStateMachine.h in Headers */,
@@ -2959,7 +3022,9 @@
 				42BCD4B315EFD0F300C0E076 /* lua_AudioSourceState.h in Headers */,
 				42BCD4B315EFD0F300C0E076 /* lua_AudioSourceState.h in Headers */,
 				42BCD4B715EFD0F300C0E076 /* lua_BoundingBox.h in Headers */,
 				42BCD4B715EFD0F300C0E076 /* lua_BoundingBox.h in Headers */,
 				42BCD4BB15EFD0F300C0E076 /* lua_BoundingSphere.h in Headers */,
 				42BCD4BB15EFD0F300C0E076 /* lua_BoundingSphere.h in Headers */,
+				425EDA7217FB260500AABF95 /* SocialSession.h in Headers */,
 				42BCD4BF15EFD0F300C0E076 /* lua_Bundle.h in Headers */,
 				42BCD4BF15EFD0F300C0E076 /* lua_Bundle.h in Headers */,
+				425EDA6417FB260500AABF95 /* SocialChallenge.h in Headers */,
 				42BCD4C315EFD0F300C0E076 /* lua_Button.h in Headers */,
 				42BCD4C315EFD0F300C0E076 /* lua_Button.h in Headers */,
 				42BCD4C715EFD0F300C0E076 /* lua_Camera.h in Headers */,
 				42BCD4C715EFD0F300C0E076 /* lua_Camera.h in Headers */,
 				42BCD4CB15EFD0F300C0E076 /* lua_CameraType.h in Headers */,
 				42BCD4CB15EFD0F300C0E076 /* lua_CameraType.h in Headers */,
@@ -2979,6 +3044,7 @@
 				42BCD50315EFD0F300C0E076 /* lua_FileSystem.h in Headers */,
 				42BCD50315EFD0F300C0E076 /* lua_FileSystem.h in Headers */,
 				42BCD50715EFD0F300C0E076 /* lua_FlowLayout.h in Headers */,
 				42BCD50715EFD0F300C0E076 /* lua_FlowLayout.h in Headers */,
 				42BCD50B15EFD0F300C0E076 /* lua_Font.h in Headers */,
 				42BCD50B15EFD0F300C0E076 /* lua_Font.h in Headers */,
+				425EDA7617FB260500AABF95 /* SocialSessionListener.h in Headers */,
 				42BCD50F15EFD0F300C0E076 /* lua_FontJustify.h in Headers */,
 				42BCD50F15EFD0F300C0E076 /* lua_FontJustify.h in Headers */,
 				42BCD51315EFD0F300C0E076 /* lua_FontStyle.h in Headers */,
 				42BCD51315EFD0F300C0E076 /* lua_FontStyle.h in Headers */,
 				42BCD51715EFD0F300C0E076 /* lua_FontText.h in Headers */,
 				42BCD51715EFD0F300C0E076 /* lua_FontText.h in Headers */,
@@ -3186,7 +3252,7 @@
 		4234D98C14686BB6003031B3 /* Project object */ = {
 		4234D98C14686BB6003031B3 /* Project object */ = {
 			isa = PBXProject;
 			isa = PBXProject;
 			attributes = {
 			attributes = {
-				LastUpgradeCheck = 0440;
+				LastUpgradeCheck = 0500;
 			};
 			};
 			buildConfigurationList = 4234D98F14686BB6003031B3 /* Build configuration list for PBXProject "gameplay" */;
 			buildConfigurationList = 4234D98F14686BB6003031B3 /* Build configuration list for PBXProject "gameplay" */;
 			compatibilityVersion = "Xcode 3.2";
 			compatibilityVersion = "Xcode 3.2";
@@ -3276,6 +3342,7 @@
 				42CD0E91147D8FF60000361E /* PhysicsConstraint.cpp in Sources */,
 				42CD0E91147D8FF60000361E /* PhysicsConstraint.cpp in Sources */,
 				42CD0E93147D8FF60000361E /* PhysicsController.cpp in Sources */,
 				42CD0E93147D8FF60000361E /* PhysicsController.cpp in Sources */,
 				42CD0E95147D8FF60000361E /* PhysicsFixedConstraint.cpp in Sources */,
 				42CD0E95147D8FF60000361E /* PhysicsFixedConstraint.cpp in Sources */,
+				425EDA5D17FB260500AABF95 /* SocialAchievement.cpp in Sources */,
 				42CD0E97147D8FF60000361E /* PhysicsGenericConstraint.cpp in Sources */,
 				42CD0E97147D8FF60000361E /* PhysicsGenericConstraint.cpp in Sources */,
 				42CD0E99147D8FF60000361E /* PhysicsHingeConstraint.cpp in Sources */,
 				42CD0E99147D8FF60000361E /* PhysicsHingeConstraint.cpp in Sources */,
 				42CD0E9D147D8FF60000361E /* PhysicsRigidBody.cpp in Sources */,
 				42CD0E9D147D8FF60000361E /* PhysicsRigidBody.cpp in Sources */,
@@ -3303,6 +3370,7 @@
 				428390991489D6E800E2B2F5 /* SceneLoader.cpp in Sources */,
 				428390991489D6E800E2B2F5 /* SceneLoader.cpp in Sources */,
 				4208DEE914A4079F00D3C511 /* Image.cpp in Sources */,
 				4208DEE914A4079F00D3C511 /* Image.cpp in Sources */,
 				4201819014A41B18008C3F56 /* MeshBatch.cpp in Sources */,
 				4201819014A41B18008C3F56 /* MeshBatch.cpp in Sources */,
+				425EDA6917FB260500AABF95 /* SocialPlayer.cpp in Sources */,
 				5BD5264F150F822A004C9099 /* AbsoluteLayout.cpp in Sources */,
 				5BD5264F150F822A004C9099 /* AbsoluteLayout.cpp in Sources */,
 				5BD52651150F822A004C9099 /* Button.cpp in Sources */,
 				5BD52651150F822A004C9099 /* Button.cpp in Sources */,
 				5BD52653150F822A004C9099 /* CheckBox.cpp in Sources */,
 				5BD52653150F822A004C9099 /* CheckBox.cpp in Sources */,
@@ -3357,6 +3425,7 @@
 				42BCD4B015EFD0F300C0E076 /* lua_AudioSourceState.cpp in Sources */,
 				42BCD4B015EFD0F300C0E076 /* lua_AudioSourceState.cpp in Sources */,
 				42BCD4B415EFD0F300C0E076 /* lua_BoundingBox.cpp in Sources */,
 				42BCD4B415EFD0F300C0E076 /* lua_BoundingBox.cpp in Sources */,
 				42BCD4B815EFD0F300C0E076 /* lua_BoundingSphere.cpp in Sources */,
 				42BCD4B815EFD0F300C0E076 /* lua_BoundingSphere.cpp in Sources */,
+				425EDA6D17FB260500AABF95 /* SocialScore.cpp in Sources */,
 				42BCD4BC15EFD0F300C0E076 /* lua_Bundle.cpp in Sources */,
 				42BCD4BC15EFD0F300C0E076 /* lua_Bundle.cpp in Sources */,
 				42BCD4C015EFD0F300C0E076 /* lua_Button.cpp in Sources */,
 				42BCD4C015EFD0F300C0E076 /* lua_Button.cpp in Sources */,
 				42BCD4C415EFD0F300C0E076 /* lua_Camera.cpp in Sources */,
 				42BCD4C415EFD0F300C0E076 /* lua_Camera.cpp in Sources */,
@@ -3387,6 +3456,7 @@
 				42BCD52815EFD0F300C0E076 /* lua_GameClearFlags.cpp in Sources */,
 				42BCD52815EFD0F300C0E076 /* lua_GameClearFlags.cpp in Sources */,
 				42BCD52C15EFD0F300C0E076 /* lua_Gamepad.cpp in Sources */,
 				42BCD52C15EFD0F300C0E076 /* lua_Gamepad.cpp in Sources */,
 				42BCD53415EFD0F300C0E076 /* lua_GamepadGamepadEvent.cpp in Sources */,
 				42BCD53415EFD0F300C0E076 /* lua_GamepadGamepadEvent.cpp in Sources */,
+				425EDA6517FB260500AABF95 /* SocialController.cpp in Sources */,
 				42BCD53815EFD0F300C0E076 /* lua_GameState.cpp in Sources */,
 				42BCD53815EFD0F300C0E076 /* lua_GameState.cpp in Sources */,
 				42BCD53C15EFD0F300C0E076 /* lua_Global.cpp in Sources */,
 				42BCD53C15EFD0F300C0E076 /* lua_Global.cpp in Sources */,
 				42BCD54015EFD0F300C0E076 /* lua_Image.cpp in Sources */,
 				42BCD54015EFD0F300C0E076 /* lua_Image.cpp in Sources */,
@@ -3483,6 +3553,7 @@
 				42BCD6AC15EFD0F300C0E076 /* lua_Uniform.cpp in Sources */,
 				42BCD6AC15EFD0F300C0E076 /* lua_Uniform.cpp in Sources */,
 				42BCD6B015EFD0F300C0E076 /* lua_Vector2.cpp in Sources */,
 				42BCD6B015EFD0F300C0E076 /* lua_Vector2.cpp in Sources */,
 				42BCD6B415EFD0F300C0E076 /* lua_Vector3.cpp in Sources */,
 				42BCD6B415EFD0F300C0E076 /* lua_Vector3.cpp in Sources */,
+				425EDA6117FB260500AABF95 /* SocialChallenge.cpp in Sources */,
 				42BCD6B815EFD0F300C0E076 /* lua_Vector4.cpp in Sources */,
 				42BCD6B815EFD0F300C0E076 /* lua_Vector4.cpp in Sources */,
 				42BCD6BC15EFD0F300C0E076 /* lua_VertexAttributeBinding.cpp in Sources */,
 				42BCD6BC15EFD0F300C0E076 /* lua_VertexAttributeBinding.cpp in Sources */,
 				42BCD6C015EFD0F300C0E076 /* lua_VertexFormat.cpp in Sources */,
 				42BCD6C015EFD0F300C0E076 /* lua_VertexFormat.cpp in Sources */,
@@ -3506,6 +3577,7 @@
 				B661731716A619D30083A307 /* lua_TerrainFlags.cpp in Sources */,
 				B661731716A619D30083A307 /* lua_TerrainFlags.cpp in Sources */,
 				B661731F16A619FB0083A307 /* Terrain.cpp in Sources */,
 				B661731F16A619FB0083A307 /* Terrain.cpp in Sources */,
 				B661732316A619FB0083A307 /* TerrainPatch.cpp in Sources */,
 				B661732316A619FB0083A307 /* TerrainPatch.cpp in Sources */,
+				425EDA7317FB260500AABF95 /* SocialSessionListener.cpp in Sources */,
 				B661732916A61A140083A307 /* HeightField.cpp in Sources */,
 				B661732916A61A140083A307 /* HeightField.cpp in Sources */,
 				B661732F16A61A4B0083A307 /* lua_RenderStateDepthFunction.cpp in Sources */,
 				B661732F16A61A4B0083A307 /* lua_RenderStateDepthFunction.cpp in Sources */,
 				B661733516A61B430083A307 /* lua_GamepadButtonMapping.cpp in Sources */,
 				B661733516A61B430083A307 /* lua_GamepadButtonMapping.cpp in Sources */,
@@ -3560,6 +3632,7 @@
 				5B04C55214BFCFE100EB0071 /* PhysicsConstraint.cpp in Sources */,
 				5B04C55214BFCFE100EB0071 /* PhysicsConstraint.cpp in Sources */,
 				5B04C55314BFCFE100EB0071 /* PhysicsController.cpp in Sources */,
 				5B04C55314BFCFE100EB0071 /* PhysicsController.cpp in Sources */,
 				5B04C55414BFCFE100EB0071 /* PhysicsFixedConstraint.cpp in Sources */,
 				5B04C55414BFCFE100EB0071 /* PhysicsFixedConstraint.cpp in Sources */,
+				425EDA5E17FB260500AABF95 /* SocialAchievement.cpp in Sources */,
 				5B04C55514BFCFE100EB0071 /* PhysicsGenericConstraint.cpp in Sources */,
 				5B04C55514BFCFE100EB0071 /* PhysicsGenericConstraint.cpp in Sources */,
 				5B04C55614BFCFE100EB0071 /* PhysicsHingeConstraint.cpp in Sources */,
 				5B04C55614BFCFE100EB0071 /* PhysicsHingeConstraint.cpp in Sources */,
 				5B04C55814BFCFE100EB0071 /* PhysicsRigidBody.cpp in Sources */,
 				5B04C55814BFCFE100EB0071 /* PhysicsRigidBody.cpp in Sources */,
@@ -3587,6 +3660,7 @@
 				5B04C57214BFCFE100EB0071 /* Image.cpp in Sources */,
 				5B04C57214BFCFE100EB0071 /* Image.cpp in Sources */,
 				5B04C57314BFCFE100EB0071 /* MeshBatch.cpp in Sources */,
 				5B04C57314BFCFE100EB0071 /* MeshBatch.cpp in Sources */,
 				5B04C5CE14BFD48500EB0071 /* PlatformiOS.mm in Sources */,
 				5B04C5CE14BFD48500EB0071 /* PlatformiOS.mm in Sources */,
+				425EDA6A17FB260500AABF95 /* SocialPlayer.cpp in Sources */,
 				5BD52670150F8258004C9099 /* PhysicsCharacter.cpp in Sources */,
 				5BD52670150F8258004C9099 /* PhysicsCharacter.cpp in Sources */,
 				5BD52674150F8258004C9099 /* PhysicsCollisionObject.cpp in Sources */,
 				5BD52674150F8258004C9099 /* PhysicsCollisionObject.cpp in Sources */,
 				5BC4E73F150F843D00CBE1C0 /* AbsoluteLayout.cpp in Sources */,
 				5BC4E73F150F843D00CBE1C0 /* AbsoluteLayout.cpp in Sources */,
@@ -3641,6 +3715,7 @@
 				42BCD4B115EFD0F300C0E076 /* lua_AudioSourceState.cpp in Sources */,
 				42BCD4B115EFD0F300C0E076 /* lua_AudioSourceState.cpp in Sources */,
 				42BCD4B515EFD0F300C0E076 /* lua_BoundingBox.cpp in Sources */,
 				42BCD4B515EFD0F300C0E076 /* lua_BoundingBox.cpp in Sources */,
 				42BCD4B915EFD0F300C0E076 /* lua_BoundingSphere.cpp in Sources */,
 				42BCD4B915EFD0F300C0E076 /* lua_BoundingSphere.cpp in Sources */,
+				425EDA6E17FB260500AABF95 /* SocialScore.cpp in Sources */,
 				42BCD4BD15EFD0F300C0E076 /* lua_Bundle.cpp in Sources */,
 				42BCD4BD15EFD0F300C0E076 /* lua_Bundle.cpp in Sources */,
 				42BCD4C115EFD0F300C0E076 /* lua_Button.cpp in Sources */,
 				42BCD4C115EFD0F300C0E076 /* lua_Button.cpp in Sources */,
 				42BCD4C515EFD0F300C0E076 /* lua_Camera.cpp in Sources */,
 				42BCD4C515EFD0F300C0E076 /* lua_Camera.cpp in Sources */,
@@ -3671,6 +3746,7 @@
 				42BCD52915EFD0F300C0E076 /* lua_GameClearFlags.cpp in Sources */,
 				42BCD52915EFD0F300C0E076 /* lua_GameClearFlags.cpp in Sources */,
 				42BCD52D15EFD0F300C0E076 /* lua_Gamepad.cpp in Sources */,
 				42BCD52D15EFD0F300C0E076 /* lua_Gamepad.cpp in Sources */,
 				42BCD53515EFD0F300C0E076 /* lua_GamepadGamepadEvent.cpp in Sources */,
 				42BCD53515EFD0F300C0E076 /* lua_GamepadGamepadEvent.cpp in Sources */,
+				425EDA6617FB260500AABF95 /* SocialController.cpp in Sources */,
 				42BCD53915EFD0F300C0E076 /* lua_GameState.cpp in Sources */,
 				42BCD53915EFD0F300C0E076 /* lua_GameState.cpp in Sources */,
 				42BCD53D15EFD0F300C0E076 /* lua_Global.cpp in Sources */,
 				42BCD53D15EFD0F300C0E076 /* lua_Global.cpp in Sources */,
 				42BCD54115EFD0F300C0E076 /* lua_Image.cpp in Sources */,
 				42BCD54115EFD0F300C0E076 /* lua_Image.cpp in Sources */,
@@ -3767,6 +3843,7 @@
 				42BCD6AD15EFD0F300C0E076 /* lua_Uniform.cpp in Sources */,
 				42BCD6AD15EFD0F300C0E076 /* lua_Uniform.cpp in Sources */,
 				42BCD6B115EFD0F300C0E076 /* lua_Vector2.cpp in Sources */,
 				42BCD6B115EFD0F300C0E076 /* lua_Vector2.cpp in Sources */,
 				42BCD6B515EFD0F300C0E076 /* lua_Vector3.cpp in Sources */,
 				42BCD6B515EFD0F300C0E076 /* lua_Vector3.cpp in Sources */,
+				425EDA6217FB260500AABF95 /* SocialChallenge.cpp in Sources */,
 				42BCD6B915EFD0F300C0E076 /* lua_Vector4.cpp in Sources */,
 				42BCD6B915EFD0F300C0E076 /* lua_Vector4.cpp in Sources */,
 				42BCD6BD15EFD0F300C0E076 /* lua_VertexAttributeBinding.cpp in Sources */,
 				42BCD6BD15EFD0F300C0E076 /* lua_VertexAttributeBinding.cpp in Sources */,
 				42BCD6C115EFD0F300C0E076 /* lua_VertexFormat.cpp in Sources */,
 				42BCD6C115EFD0F300C0E076 /* lua_VertexFormat.cpp in Sources */,
@@ -3790,6 +3867,7 @@
 				B661731816A619D30083A307 /* lua_TerrainFlags.cpp in Sources */,
 				B661731816A619D30083A307 /* lua_TerrainFlags.cpp in Sources */,
 				B661732016A619FB0083A307 /* Terrain.cpp in Sources */,
 				B661732016A619FB0083A307 /* Terrain.cpp in Sources */,
 				B661732416A619FB0083A307 /* TerrainPatch.cpp in Sources */,
 				B661732416A619FB0083A307 /* TerrainPatch.cpp in Sources */,
+				425EDA7417FB260500AABF95 /* SocialSessionListener.cpp in Sources */,
 				B661732A16A61A140083A307 /* HeightField.cpp in Sources */,
 				B661732A16A61A140083A307 /* HeightField.cpp in Sources */,
 				B661733016A61A4B0083A307 /* lua_RenderStateDepthFunction.cpp in Sources */,
 				B661733016A61A4B0083A307 /* lua_RenderStateDepthFunction.cpp in Sources */,
 				B661733616A61B430083A307 /* lua_GamepadButtonMapping.cpp in Sources */,
 				B661733616A61B430083A307 /* lua_GamepadButtonMapping.cpp in Sources */,
@@ -3813,7 +3891,7 @@
 				ONLY_ACTIVE_ARCH = YES;
 				ONLY_ACTIVE_ARCH = YES;
 				SDKROOT = macosx;
 				SDKROOT = macosx;
 				SUPPORTED_PLATFORMS = "iphonesimulator macosx iphoneos";
 				SUPPORTED_PLATFORMS = "iphonesimulator macosx iphoneos";
-				VALID_ARCHS = "armv7 armv7s i386 x86_64";
+				VALID_ARCHS = "armv7 armv7s arm64 i386 x86_64";
 			};
 			};
 			name = Debug;
 			name = Debug;
 		};
 		};
@@ -3822,7 +3900,7 @@
 			buildSettings = {
 			buildSettings = {
 				SDKROOT = macosx;
 				SDKROOT = macosx;
 				SUPPORTED_PLATFORMS = "iphonesimulator macosx iphoneos";
 				SUPPORTED_PLATFORMS = "iphonesimulator macosx iphoneos";
-				VALID_ARCHS = "armv7 armv7s i386 x86_64";
+				VALID_ARCHS = "armv7 armv7s arm64 i386 x86_64";
 			};
 			};
 			name = Release;
 			name = Release;
 		};
 		};
@@ -3831,6 +3909,8 @@
 			buildSettings = {
 			buildSettings = {
 				ALWAYS_SEARCH_USER_PATHS = NO;
 				ALWAYS_SEARCH_USER_PATHS = NO;
 				ARCHS = "$(ARCHS_STANDARD_32_BIT)";
 				ARCHS = "$(ARCHS_STANDARD_32_BIT)";
+				CLANG_CXX_LANGUAGE_STANDARD = "gnu++98";
+				CLANG_CXX_LIBRARY = "libstdc++";
 				COMBINE_HIDPI_IMAGES = YES;
 				COMBINE_HIDPI_IMAGES = YES;
 				COPY_PHASE_STRIP = NO;
 				COPY_PHASE_STRIP = NO;
 				FRAMEWORK_SEARCH_PATHS = "$(inherited)";
 				FRAMEWORK_SEARCH_PATHS = "$(inherited)";
@@ -3848,6 +3928,7 @@
 				GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
 				GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
 				GCC_WARN_64_TO_32_BIT_CONVERSION = NO;
 				GCC_WARN_64_TO_32_BIT_CONVERSION = NO;
 				GCC_WARN_ABOUT_MISSING_PROTOTYPES = NO;
 				GCC_WARN_ABOUT_MISSING_PROTOTYPES = NO;
+				GCC_WARN_ABOUT_POINTER_SIGNEDNESS = NO;
 				GCC_WARN_ABOUT_RETURN_TYPE = YES;
 				GCC_WARN_ABOUT_RETURN_TYPE = YES;
 				GCC_WARN_CHECK_SWITCH_STATEMENTS = NO;
 				GCC_WARN_CHECK_SWITCH_STATEMENTS = NO;
 				GCC_WARN_MISSING_PARENTHESES = NO;
 				GCC_WARN_MISSING_PARENTHESES = NO;
@@ -3855,12 +3936,11 @@
 				HEADER_SEARCH_PATHS = (
 				HEADER_SEARCH_PATHS = (
 					"../external-deps/bullet/include",
 					"../external-deps/bullet/include",
 					"../external-deps/lua/include",
 					"../external-deps/lua/include",
-					"../external-deps/libpng/include",
+					"../external-deps/png/include",
 					"../external-deps/oggvorbis/include",
 					"../external-deps/oggvorbis/include",
-					./gameplay,
 				);
 				);
 				LIBRARY_SEARCH_PATHS = "$(inherited)";
 				LIBRARY_SEARCH_PATHS = "$(inherited)";
-				MACOSX_DEPLOYMENT_TARGET = 10.7;
+				MACOSX_DEPLOYMENT_TARGET = 10.8;
 				ONLY_ACTIVE_ARCH = YES;
 				ONLY_ACTIVE_ARCH = YES;
 				PRECOMPS_INCLUDE_HEADERS_FROM_BUILT_PRODUCTS_DIR = NO;
 				PRECOMPS_INCLUDE_HEADERS_FROM_BUILT_PRODUCTS_DIR = NO;
 				PRODUCT_NAME = gameplay;
 				PRODUCT_NAME = gameplay;
@@ -3877,6 +3957,8 @@
 			buildSettings = {
 			buildSettings = {
 				ALWAYS_SEARCH_USER_PATHS = NO;
 				ALWAYS_SEARCH_USER_PATHS = NO;
 				ARCHS = "$(ARCHS_STANDARD_32_BIT)";
 				ARCHS = "$(ARCHS_STANDARD_32_BIT)";
+				CLANG_CXX_LANGUAGE_STANDARD = "gnu++98";
+				CLANG_CXX_LIBRARY = "libstdc++";
 				COMBINE_HIDPI_IMAGES = YES;
 				COMBINE_HIDPI_IMAGES = YES;
 				COPY_PHASE_STRIP = YES;
 				COPY_PHASE_STRIP = YES;
 				DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
 				DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
@@ -3888,6 +3970,7 @@
 				GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
 				GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
 				GCC_WARN_64_TO_32_BIT_CONVERSION = NO;
 				GCC_WARN_64_TO_32_BIT_CONVERSION = NO;
 				GCC_WARN_ABOUT_MISSING_PROTOTYPES = NO;
 				GCC_WARN_ABOUT_MISSING_PROTOTYPES = NO;
+				GCC_WARN_ABOUT_POINTER_SIGNEDNESS = NO;
 				GCC_WARN_ABOUT_RETURN_TYPE = YES;
 				GCC_WARN_ABOUT_RETURN_TYPE = YES;
 				GCC_WARN_CHECK_SWITCH_STATEMENTS = NO;
 				GCC_WARN_CHECK_SWITCH_STATEMENTS = NO;
 				GCC_WARN_MISSING_PARENTHESES = NO;
 				GCC_WARN_MISSING_PARENTHESES = NO;
@@ -3895,12 +3978,11 @@
 				HEADER_SEARCH_PATHS = (
 				HEADER_SEARCH_PATHS = (
 					"../external-deps/bullet/include",
 					"../external-deps/bullet/include",
 					"../external-deps/lua/include",
 					"../external-deps/lua/include",
-					"../external-deps/libpng/include",
+					"../external-deps/png/include",
 					"../external-deps/oggvorbis/include",
 					"../external-deps/oggvorbis/include",
-					./gameplay,
 				);
 				);
 				LIBRARY_SEARCH_PATHS = "$(inherited)";
 				LIBRARY_SEARCH_PATHS = "$(inherited)";
-				MACOSX_DEPLOYMENT_TARGET = 10.7;
+				MACOSX_DEPLOYMENT_TARGET = 10.8;
 				PRECOMPS_INCLUDE_HEADERS_FROM_BUILT_PRODUCTS_DIR = NO;
 				PRECOMPS_INCLUDE_HEADERS_FROM_BUILT_PRODUCTS_DIR = NO;
 				PRODUCT_NAME = gameplay;
 				PRODUCT_NAME = gameplay;
 				PUBLIC_HEADERS_FOLDER_PATH = "$(PROJECT_NAME)_include";
 				PUBLIC_HEADERS_FOLDER_PATH = "$(PROJECT_NAME)_include";
@@ -3915,7 +3997,9 @@
 			isa = XCBuildConfiguration;
 			isa = XCBuildConfiguration;
 			buildSettings = {
 			buildSettings = {
 				ALWAYS_SEARCH_USER_PATHS = NO;
 				ALWAYS_SEARCH_USER_PATHS = NO;
-				ARCHS = "$(ARCHS_STANDARD_32_BIT)";
+				ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)";
+				CLANG_CXX_LANGUAGE_STANDARD = "gnu++98";
+				CLANG_CXX_LIBRARY = "libstdc++";
 				CODE_SIGN_IDENTITY = "iPhone Developer";
 				CODE_SIGN_IDENTITY = "iPhone Developer";
 				COPY_PHASE_STRIP = NO;
 				COPY_PHASE_STRIP = NO;
 				DEPLOYMENT_LOCATION = NO;
 				DEPLOYMENT_LOCATION = NO;
@@ -3931,6 +4015,7 @@
 				GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
 				GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
 				GCC_WARN_64_TO_32_BIT_CONVERSION = NO;
 				GCC_WARN_64_TO_32_BIT_CONVERSION = NO;
 				GCC_WARN_ABOUT_MISSING_PROTOTYPES = NO;
 				GCC_WARN_ABOUT_MISSING_PROTOTYPES = NO;
+				GCC_WARN_ABOUT_POINTER_SIGNEDNESS = NO;
 				GCC_WARN_ABOUT_RETURN_TYPE = YES;
 				GCC_WARN_ABOUT_RETURN_TYPE = YES;
 				GCC_WARN_CHECK_SWITCH_STATEMENTS = NO;
 				GCC_WARN_CHECK_SWITCH_STATEMENTS = NO;
 				GCC_WARN_MISSING_PARENTHESES = NO;
 				GCC_WARN_MISSING_PARENTHESES = NO;
@@ -3938,23 +4023,24 @@
 				HEADER_SEARCH_PATHS = (
 				HEADER_SEARCH_PATHS = (
 					"../external-deps/bullet/include",
 					"../external-deps/bullet/include",
 					"../external-deps/lua/include",
 					"../external-deps/lua/include",
-					"../external-deps/libpng/include",
+					"../external-deps/png/include",
 					"../external-deps/oggvorbis/include",
 					"../external-deps/oggvorbis/include",
 				);
 				);
 				LIBRARY_SEARCH_PATHS = "$(inherited)";
 				LIBRARY_SEARCH_PATHS = "$(inherited)";
-				MACOSX_DEPLOYMENT_TARGET = 10.7;
+				MACOSX_DEPLOYMENT_TARGET = 10.8;
 				ONLY_ACTIVE_ARCH = YES;
 				ONLY_ACTIVE_ARCH = YES;
 				OTHER_LDFLAGS = "-ObjC";
 				OTHER_LDFLAGS = "-ObjC";
 				PRECOMPS_INCLUDE_HEADERS_FROM_BUILT_PRODUCTS_DIR = NO;
 				PRECOMPS_INCLUDE_HEADERS_FROM_BUILT_PRODUCTS_DIR = NO;
 				PRODUCT_NAME = gameplay;
 				PRODUCT_NAME = gameplay;
 				PROVISIONING_PROFILE = "";
 				PROVISIONING_PROFILE = "";
-				PUBLIC_HEADERS_FOLDER_PATH = "$(PROJECT_NAME)_include";
+				PUBLIC_HEADERS_FOLDER_PATH = include;
 				SDKROOT = iphoneos;
 				SDKROOT = iphoneos;
 				SHARED_PRECOMPS_DIR = "";
 				SHARED_PRECOMPS_DIR = "";
 				SKIP_INSTALL = YES;
 				SKIP_INSTALL = YES;
 				SUPPORTED_PLATFORMS = "iphonesimulator iphoneos";
 				SUPPORTED_PLATFORMS = "iphonesimulator iphoneos";
+				TARGETED_DEVICE_FAMILY = "1,2";
 				USER_HEADER_SEARCH_PATHS = "";
 				USER_HEADER_SEARCH_PATHS = "";
-				VALID_ARCHS = "armv7 armv7s i386";
+				VALID_ARCHS = "armv7 armv7s arm64 i386 x86_64";
 			};
 			};
 			name = Debug;
 			name = Debug;
 		};
 		};
@@ -3962,7 +4048,9 @@
 			isa = XCBuildConfiguration;
 			isa = XCBuildConfiguration;
 			buildSettings = {
 			buildSettings = {
 				ALWAYS_SEARCH_USER_PATHS = NO;
 				ALWAYS_SEARCH_USER_PATHS = NO;
-				ARCHS = "$(ARCHS_STANDARD_32_BIT)";
+				ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)";
+				CLANG_CXX_LANGUAGE_STANDARD = "gnu++98";
+				CLANG_CXX_LIBRARY = "libstdc++";
 				CODE_SIGN_IDENTITY = "iPhone Developer";
 				CODE_SIGN_IDENTITY = "iPhone Developer";
 				COPY_PHASE_STRIP = YES;
 				COPY_PHASE_STRIP = YES;
 				DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
 				DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
@@ -3976,6 +4064,7 @@
 				GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
 				GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
 				GCC_WARN_64_TO_32_BIT_CONVERSION = NO;
 				GCC_WARN_64_TO_32_BIT_CONVERSION = NO;
 				GCC_WARN_ABOUT_MISSING_PROTOTYPES = NO;
 				GCC_WARN_ABOUT_MISSING_PROTOTYPES = NO;
+				GCC_WARN_ABOUT_POINTER_SIGNEDNESS = NO;
 				GCC_WARN_ABOUT_RETURN_TYPE = YES;
 				GCC_WARN_ABOUT_RETURN_TYPE = YES;
 				GCC_WARN_CHECK_SWITCH_STATEMENTS = NO;
 				GCC_WARN_CHECK_SWITCH_STATEMENTS = NO;
 				GCC_WARN_MISSING_PARENTHESES = NO;
 				GCC_WARN_MISSING_PARENTHESES = NO;
@@ -3983,22 +4072,23 @@
 				HEADER_SEARCH_PATHS = (
 				HEADER_SEARCH_PATHS = (
 					"../external-deps/bullet/include",
 					"../external-deps/bullet/include",
 					"../external-deps/lua/include",
 					"../external-deps/lua/include",
-					"../external-deps/libpng/include",
+					"../external-deps/png/include",
 					"../external-deps/oggvorbis/include",
 					"../external-deps/oggvorbis/include",
 				);
 				);
 				LIBRARY_SEARCH_PATHS = "$(inherited)";
 				LIBRARY_SEARCH_PATHS = "$(inherited)";
-				MACOSX_DEPLOYMENT_TARGET = 10.7;
+				MACOSX_DEPLOYMENT_TARGET = 10.8;
 				OTHER_LDFLAGS = "-ObjC";
 				OTHER_LDFLAGS = "-ObjC";
 				PRECOMPS_INCLUDE_HEADERS_FROM_BUILT_PRODUCTS_DIR = NO;
 				PRECOMPS_INCLUDE_HEADERS_FROM_BUILT_PRODUCTS_DIR = NO;
 				PRODUCT_NAME = gameplay;
 				PRODUCT_NAME = gameplay;
 				PROVISIONING_PROFILE = "";
 				PROVISIONING_PROFILE = "";
-				PUBLIC_HEADERS_FOLDER_PATH = "$(PROJECT_NAME)_include";
+				PUBLIC_HEADERS_FOLDER_PATH = include;
 				SDKROOT = iphoneos;
 				SDKROOT = iphoneos;
 				SHARED_PRECOMPS_DIR = "";
 				SHARED_PRECOMPS_DIR = "";
 				SKIP_INSTALL = YES;
 				SKIP_INSTALL = YES;
 				SUPPORTED_PLATFORMS = "iphonesimulator iphoneos";
 				SUPPORTED_PLATFORMS = "iphonesimulator iphoneos";
+				TARGETED_DEVICE_FAMILY = "1,2";
 				USER_HEADER_SEARCH_PATHS = "";
 				USER_HEADER_SEARCH_PATHS = "";
-				VALID_ARCHS = "armv7 armv7s i386";
+				VALID_ARCHS = "armv7 armv7s arm64 i386 x86_64";
 			};
 			};
 			name = Release;
 			name = Release;
 		};
 		};

+ 0 - 7
gameplay/gameplay.xcodeproj/project.xcworkspace/contents.xcworkspacedata

@@ -1,7 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<Workspace
-   version = "1.0">
-   <FileRef
-      location = "self:gameplay.xcodeproj">
-   </FileRef>
-</Workspace>

BIN
gameplay/gameplay.xcodeproj/project.xcworkspace/xcuserdata/mozeal.xcuserdatad/UserInterfaceState.xcuserstate


+ 1 - 1
gameplay/gameplay.xcodeproj/xcshareddata/xcschemes/gameplay-ios.xcscheme

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <?xml version="1.0" encoding="UTF-8"?>
 <Scheme
 <Scheme
-   LastUpgradeVersion = "0460"
+   LastUpgradeVersion = "0500"
    version = "1.3">
    version = "1.3">
    <BuildAction
    <BuildAction
       parallelizeBuildables = "YES"
       parallelizeBuildables = "YES"

+ 1 - 1
gameplay/gameplay.xcodeproj/xcshareddata/xcschemes/gameplay-macosx.xcscheme

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <?xml version="1.0" encoding="UTF-8"?>
 <Scheme
 <Scheme
-   LastUpgradeVersion = "0460"
+   LastUpgradeVersion = "0500"
    version = "1.3">
    version = "1.3">
    <BuildAction
    <BuildAction
       parallelizeBuildables = "YES"
       parallelizeBuildables = "YES"

+ 0 - 0
samples/lua/res/arial.ttf → gameplay/res/arial.ttf


+ 14 - 1
gameplay/res/shaders/font.frag

@@ -1,9 +1,13 @@
 #ifdef OPENGL_ES
 #ifdef OPENGL_ES
 precision highp float;
 precision highp float;
+#extension GL_OES_standard_derivatives : enable
 #endif
 #endif
 
 
 // Uniforms
 // Uniforms
 uniform sampler2D u_texture;
 uniform sampler2D u_texture;
+#ifdef DISTANCE_FIELD
+uniform vec2 u_cutoff;
+#endif
 
 
 // Varyings
 // Varyings
 varying vec2 v_texCoord;
 varying vec2 v_texCoord;
@@ -11,7 +15,16 @@ varying vec4 v_color;
 
 
 
 
 void main()
 void main()
-{
+{ 
+#ifdef DISTANCE_FIELD
+    gl_FragColor = v_color;
+    float distance = texture2D(u_texture, v_texCoord).a;
+    float smoothing = fwidth(distance);
+    float alpha = smoothstep(0.5 - smoothing * u_cutoff.x, 0.5 + smoothing * u_cutoff.y, distance);
+    gl_FragColor.a = alpha * v_color.a;
+
+#else
     gl_FragColor = v_color;
     gl_FragColor = v_color;
     gl_FragColor.a = texture2D(u_texture, v_texCoord).a * v_color.a;
     gl_FragColor.a = texture2D(u_texture, v_texCoord).a * v_color.a;
+#endif
 }
 }

+ 0 - 1
gameplay/res/shaders/font.vert

@@ -10,7 +10,6 @@ uniform mat4 u_projectionMatrix;
 varying vec2 v_texCoord;
 varying vec2 v_texCoord;
 varying vec4 v_color;
 varying vec4 v_color;
 
 
-
 void main()
 void main()
 {
 {
     gl_Position = u_projectionMatrix * vec4(a_position, 1);
     gl_Position = u_projectionMatrix * vec4(a_position, 1);

+ 1 - 1
gameplay/src/Animation.h

@@ -227,7 +227,7 @@ private:
 
 
     AnimationController* _controller;       // The AnimationController that this Animation will run on.
     AnimationController* _controller;       // The AnimationController that this Animation will run on.
     std::string _id;                        // The Animation's ID.
     std::string _id;                        // The Animation's ID.
-    unsigned long _duration;              // the length of the animation (in milliseconds).
+    unsigned long _duration;                // the length of the animation (in milliseconds).
     std::vector<Channel*> _channels;        // The channels within this Animation.
     std::vector<Channel*> _channels;        // The channels within this Animation.
     AnimationClip* _defaultClip;            // The Animation's default clip.
     AnimationClip* _defaultClip;            // The Animation's default clip.
     std::vector<AnimationClip*>* _clips;    // All the clips created from this Animation.
     std::vector<AnimationClip*>* _clips;    // All the clips created from this Animation.

+ 31 - 12
gameplay/src/Base.h

@@ -97,6 +97,17 @@ extern void print(const char* format, ...);
         gameplay::Logger::log(gameplay::Logger::LEVEL_WARN, "\n"); \
         gameplay::Logger::log(gameplay::Logger::LEVEL_WARN, "\n"); \
     } while (0)
     } while (0)
 
 
+#if defined(WIN32)
+    #pragma warning( disable : 4005 )
+    #pragma warning( disable : 4172 )
+    #pragma warning( disable : 4244 )
+    #pragma warning( disable : 4267 )
+    #pragma warning( disable : 4311 )
+    #pragma warning( disable : 4390 )
+    #pragma warning( disable : 4800 )
+    #pragma warning( disable : 4996 )
+#endif
+
 // Bullet Physics
 // Bullet Physics
 #include <btBulletDynamicsCommon.h>
 #include <btBulletDynamicsCommon.h>
 #include <BulletCollision/CollisionDispatch/btGhostObject.h>
 #include <BulletCollision/CollisionDispatch/btGhostObject.h>
@@ -281,13 +292,31 @@ typedef GLuint FrameBufferHandle;
 typedef GLuint RenderBufferHandle;
 typedef GLuint RenderBufferHandle;
 
 
 /** Gamepad handle definitions vary by platform. */
 /** Gamepad handle definitions vary by platform. */
-#if defined(__QNX__) && defined(USE_BLACKBERRY_GAMEPAD)
+#if defined(__QNX__) && defined(GP_USE_GAMEPAD)
     typedef screen_device_t GamepadHandle;
     typedef screen_device_t GamepadHandle;
-#elif defined(USE_XINPUT)
+#elif defined(WIN32)
     typedef unsigned long GamepadHandle;
     typedef unsigned long GamepadHandle;
 #else
 #else
     typedef unsigned int GamepadHandle;
     typedef unsigned int GamepadHandle;
 #endif
 #endif
+
+#if defined(__QNX__) && defined(GP_USE_SOCIAL)
+    typedef void* SocialPlayerHandle;
+    typedef void* SocialAchievementHandle;
+    typedef void* SocialScoreHandle;
+    typedef void* SocialChallengeHandle;
+#elif defined(WIN32)
+    typedef unsigned long SocialPlayerHandle;
+    typedef unsigned long SocialAchievementHandle;
+    typedef unsigned long SocialScoreHandle;
+    typedef unsigned long SocialChallengeHandle;
+#else
+    typedef unsigned int SocialPlayerHandle;
+    typedef unsigned int SocialAchievementHandle;
+    typedef unsigned int SocialScoreHandle;
+    typedef unsigned int SocialChallengeHandle;
+#endif
+
 }
 }
 
 
 /**
 /**
@@ -340,14 +369,4 @@ extern ALenum __al_error_code;
  */
  */
 #define AL_LAST_ERROR() __al_error_code
 #define AL_LAST_ERROR() __al_error_code
 
 
-
-#if defined(WIN32)
-    #pragma warning( disable : 4172 )
-    #pragma warning( disable : 4244 )
-    #pragma warning( disable : 4311 )
-    #pragma warning( disable : 4390 )
-    #pragma warning( disable : 4800 )
-    #pragma warning( disable : 4996 )
-#endif
-
 #endif
 #endif

+ 38 - 7
gameplay/src/Bundle.cpp

@@ -5,8 +5,9 @@
 #include "Scene.h"
 #include "Scene.h"
 #include "Joint.h"
 #include "Joint.h"
 
 
-#define BUNDLE_VERSION_MAJOR            1
-#define BUNDLE_VERSION_MINOR            2
+// Minimum version numbers supported
+#define BUNDLE_VERSION_MAJOR_REQUIRED   1 
+#define BUNDLE_VERSION_MINOR_REQUIRED   2
 
 
 #define BUNDLE_TYPE_SCENE               1
 #define BUNDLE_TYPE_SCENE               1
 #define BUNDLE_TYPE_NODE                2
 #define BUNDLE_TYPE_NODE                2
@@ -26,6 +27,9 @@
 // For sanity checking string reads
 // For sanity checking string reads
 #define BUNDLE_MAX_STRING_LENGTH        5000
 #define BUNDLE_MAX_STRING_LENGTH        5000
 
 
+#define BUNDLE_VERSION_MAJOR_FONT_FORMAT  1
+#define BUNDLE_VERSION_MINOR_FONT_FORMAT  3
+
 namespace gameplay
 namespace gameplay
 {
 {
 
 
@@ -55,6 +59,16 @@ Bundle::~Bundle()
     }
     }
 }
 }
 
 
+unsigned int Bundle::getVersionMajor() const
+{
+    return (unsigned int)_version[0];
+}
+
+unsigned int Bundle::getVersionMinor() const
+{
+    return (unsigned int)_version[1];
+}
+
 template <class T>
 template <class T>
 bool Bundle::readArray(unsigned int* length, T** ptr)
 bool Bundle::readArray(unsigned int* length, T** ptr)
 {
 {
@@ -189,17 +203,18 @@ Bundle* Bundle::create(const char* path)
     }
     }
 
 
     // Read version.
     // Read version.
-    unsigned char ver[2];
-    if (stream->read(ver, 1, 2) != 2)
+    unsigned char version[2];
+    if (stream->read(version, 1, 2) != 2)
     {
     {
         SAFE_DELETE(stream);
         SAFE_DELETE(stream);
         GP_ERROR("Failed to read GPB version for bundle '%s'.", path);
         GP_ERROR("Failed to read GPB version for bundle '%s'.", path);
         return NULL;
         return NULL;
     }
     }
-    if (ver[0] != BUNDLE_VERSION_MAJOR || ver[1] != BUNDLE_VERSION_MINOR)
+    // Check for the minimal 
+    if (version[0] != BUNDLE_VERSION_MAJOR_REQUIRED || version[1] < BUNDLE_VERSION_MINOR_REQUIRED)
     {
     {
         SAFE_DELETE(stream);
         SAFE_DELETE(stream);
-        GP_ERROR("Unsupported version (%d.%d) for bundle '%s' (expected %d.%d).", (int)ver[0], (int)ver[1], path, BUNDLE_VERSION_MAJOR, BUNDLE_VERSION_MINOR);
+        GP_ERROR("Unsupported version (%d.%d) for bundle '%s' (expected %d.%d).", (int)version[0], (int)version[1], path, BUNDLE_VERSION_MAJOR_REQUIRED, BUNDLE_VERSION_MINOR_REQUIRED);
         return NULL;
         return NULL;
     }
     }
 
 
@@ -229,6 +244,8 @@ Bundle* Bundle::create(const char* path)
 
 
     // Keep file open for faster reading later.
     // Keep file open for faster reading later.
     Bundle* bundle = new Bundle(path);
     Bundle* bundle = new Bundle(path);
+    bundle->_version[0] = version[0];
+    bundle->_version[1] = version[1];
     bundle->_referenceCount = refCount;
     bundle->_referenceCount = refCount;
     bundle->_references = refs;
     bundle->_references = refs;
     bundle->_stream = stream;
     bundle->_stream = stream;
@@ -1704,6 +1721,20 @@ Font* Bundle::loadFont(const char* id)
         return NULL;
         return NULL;
     }
     }
 
 
+    unsigned int format = Font::BITMAP;
+    // After bundle version we add enum FontFormat to bundle format
+    if (getVersionMajor() >= BUNDLE_VERSION_MAJOR_FONT_FORMAT &&
+        getVersionMinor() >= BUNDLE_VERSION_MINOR_FONT_FORMAT)
+    {
+        if (_stream->read(&format, 4, 1) != 1)
+        {
+            GP_ERROR("Failed to font format'%u'.", format);
+            SAFE_DELETE_ARRAY(glyphs);
+            SAFE_DELETE_ARRAY(textureData);
+            return NULL;
+        }
+    }
+
     // Create the texture for the font.
     // Create the texture for the font.
     Texture* texture = Texture::create(Texture::ALPHA, width, height, textureData, true);
     Texture* texture = Texture::create(Texture::ALPHA, width, height, textureData, true);
 
 
@@ -1718,7 +1749,7 @@ Font* Bundle::loadFont(const char* id)
     }
     }
 
 
     // Create the font.
     // Create the font.
-    Font* font = Font::create(family.c_str(), Font::PLAIN, size, glyphs, glyphCount, texture);
+    Font* font = Font::create(family.c_str(), Font::PLAIN, size, glyphs, glyphCount, texture, (Font::Format)format);
 
 
     // Free the glyph array.
     // Free the glyph array.
     SAFE_DELETE_ARRAY(glyphs);
     SAFE_DELETE_ARRAY(glyphs);

+ 16 - 1
gameplay/src/Bundle.h

@@ -89,7 +89,7 @@ public:
     unsigned int getObjectCount() const;
     unsigned int getObjectCount() const;
 
 
     /**
     /**
-     * Returns the unique identifier of the top-level object at the specified index in this bundle.
+     * Gets the unique identifier of the top-level object at the specified index in this bundle.
      *
      *
      * @param index The index of the object.
      * @param index The index of the object.
      * 
      * 
@@ -97,6 +97,20 @@ public:
      */
      */
     const char* getObjectId(unsigned int index) const;
     const char* getObjectId(unsigned int index) const;
 
 
+    /**
+     * Gets the major version of the loaded bundle.
+     *
+     * @return The major version of the loaded bundle.
+     */
+    unsigned int getVersionMajor() const;
+
+    /**
+     * Gets the minor version of the loaded bundle.
+     *
+     * @return The minor version of the loaded bundle.
+     */
+    unsigned int getVersionMinor() const;
+
 private:
 private:
 
 
     class Reference
     class Reference
@@ -433,6 +447,7 @@ private:
      */
      */
     bool skipNode();
     bool skipNode();
 
 
+    unsigned char _version[2];
     std::string _path;
     std::string _path;
     std::string _materialPath;
     std::string _materialPath;
     unsigned int _referenceCount;
     unsigned int _referenceCount;

+ 1 - 1
gameplay/src/Curve.cpp

@@ -110,7 +110,7 @@ Curve::~Curve()
 }
 }
 
 
 Curve::Point::Point()
 Curve::Point::Point()
-    : time(0.0f), value(NULL), inValue(NULL), outValue(NULL)
+    : time(0.0f), value(NULL), inValue(NULL), outValue(NULL), type(LINEAR)
 {
 {
 }
 }
 
 

+ 1 - 1
gameplay/src/DebugNew.cpp

@@ -1,4 +1,4 @@
-#ifdef GAMEPLAY_MEM_LEAK_DETECTION
+#ifdef GP_USE_MEM_LEAK_DETECTION
 
 
 #include <new>
 #include <new>
 #include <exception>
 #include <exception>

+ 14 - 14
gameplay/src/DebugNew.h

@@ -4,9 +4,9 @@
 /**
 /**
  * Global overrides of the new and delete operators for memory tracking.
  * Global overrides of the new and delete operators for memory tracking.
  * This file is only included when memory leak detection is explicitly
  * This file is only included when memory leak detection is explicitly
- * request via the pre-processor definition GAMEPLAY_MEM_LEAK_DETECTION.
+ * request via the pre-processor definition GP_USE_MEM_LEAK_DETECTION.
  */
  */
-#ifdef GAMEPLAY_MEM_LEAK_DETECTION
+#ifdef GP_USE_MEM_LEAK_DETECTION
 
 
 #include <new>
 #include <new>
 #include <exception>
 #include <exception>
@@ -42,7 +42,7 @@ void operator delete[] (void* p, const char* file, int line) throw();
 // 'new' before allocation and redefine it to our custom version afterwards (we support 0-2, 9 parameter constructors).
 // 'new' before allocation and redefine it to our custom version afterwards (we support 0-2, 9 parameter constructors).
 template<typename T> T* bullet_new()
 template<typename T> T* bullet_new()
 {
 {
-#ifdef GAMEPLAY_MEM_LEAK_DETECTION
+#ifdef GP_USE_MEM_LEAK_DETECTION
 #undef new
 #undef new
     T* t = new T();
     T* t = new T();
 #define new DEBUG_NEW
 #define new DEBUG_NEW
@@ -54,7 +54,7 @@ template<typename T> T* bullet_new()
 
 
 template<typename T, typename T1> T* bullet_new(const T1& t1)
 template<typename T, typename T1> T* bullet_new(const T1& t1)
 {
 {
-#ifdef GAMEPLAY_MEM_LEAK_DETECTION 
+#ifdef GP_USE_MEM_LEAK_DETECTION 
 #undef new 
 #undef new 
     T* t = new T(t1);
     T* t = new T(t1);
 #define new DEBUG_NEW
 #define new DEBUG_NEW
@@ -66,7 +66,7 @@ template<typename T, typename T1> T* bullet_new(const T1& t1)
 
 
 template<typename T, typename T1, typename T2> T* bullet_new(const T1& t1, const T2& t2)
 template<typename T, typename T1, typename T2> T* bullet_new(const T1& t1, const T2& t2)
 {
 {
-#ifdef GAMEPLAY_MEM_LEAK_DETECTION
+#ifdef GP_USE_MEM_LEAK_DETECTION
 #undef new
 #undef new
     T* t = new T(t1, t2);
     T* t = new T(t1, t2);
 #define new DEBUG_NEW
 #define new DEBUG_NEW
@@ -78,7 +78,7 @@ template<typename T, typename T1, typename T2> T* bullet_new(const T1& t1, const
 
 
 template<typename T, typename T1, typename T2> T* bullet_new(T1& t1, const T2& t2)
 template<typename T, typename T1, typename T2> T* bullet_new(T1& t1, const T2& t2)
 {
 {
-#ifdef GAMEPLAY_MEM_LEAK_DETECTION
+#ifdef GP_USE_MEM_LEAK_DETECTION
 #undef new
 #undef new
     T* t = new T(t1, t2);
     T* t = new T(t1, t2);
 #define new DEBUG_NEW
 #define new DEBUG_NEW
@@ -91,7 +91,7 @@ template<typename T, typename T1, typename T2> T* bullet_new(T1& t1, const T2& t
 template<typename T, typename T1, typename T2, typename T3> 
 template<typename T, typename T1, typename T2, typename T3> 
 T* bullet_new(const T1& t1, const T2& t2, const T3& t3)
 T* bullet_new(const T1& t1, const T2& t2, const T3& t3)
 {
 {
-#ifdef GAMEPLAY_MEM_LEAK_DETECTION
+#ifdef GP_USE_MEM_LEAK_DETECTION
 #undef new
 #undef new
     T* t = new T(t1, t2, t3);
     T* t = new T(t1, t2, t3);
 #define new DEBUG_NEW
 #define new DEBUG_NEW
@@ -104,7 +104,7 @@ T* bullet_new(const T1& t1, const T2& t2, const T3& t3)
 template<typename T, typename T1, typename T2, typename T3> 
 template<typename T, typename T1, typename T2, typename T3> 
 T* bullet_new(T1& t1, const T2& t2, const T3& t3)
 T* bullet_new(T1& t1, const T2& t2, const T3& t3)
 {
 {
-#ifdef GAMEPLAY_MEM_LEAK_DETECTION
+#ifdef GP_USE_MEM_LEAK_DETECTION
 #undef new
 #undef new
     T* t = new T(t1, t2, t3);
     T* t = new T(t1, t2, t3);
 #define new DEBUG_NEW
 #define new DEBUG_NEW
@@ -117,7 +117,7 @@ T* bullet_new(T1& t1, const T2& t2, const T3& t3)
 template<typename T, typename T1, typename T2, typename T3, typename T4> 
 template<typename T, typename T1, typename T2, typename T3, typename T4> 
 T* bullet_new(const T1& t1, const T2& t2, const T3& t3, const T4& t4)
 T* bullet_new(const T1& t1, const T2& t2, const T3& t3, const T4& t4)
 {
 {
-#ifdef GAMEPLAY_MEM_LEAK_DETECTION
+#ifdef GP_USE_MEM_LEAK_DETECTION
 #undef new
 #undef new
     T* t = new T(t1, t2, t3, t4);
     T* t = new T(t1, t2, t3, t4);
 #define new DEBUG_NEW
 #define new DEBUG_NEW
@@ -130,7 +130,7 @@ T* bullet_new(const T1& t1, const T2& t2, const T3& t3, const T4& t4)
 template<typename T, typename T1, typename T2, typename T3, typename T4> 
 template<typename T, typename T1, typename T2, typename T3, typename T4> 
 T* bullet_new(T1& t1, const T2& t2, const T3& t3, const T4& t4)
 T* bullet_new(T1& t1, const T2& t2, const T3& t3, const T4& t4)
 {
 {
-#ifdef GAMEPLAY_MEM_LEAK_DETECTION
+#ifdef GP_USE_MEM_LEAK_DETECTION
 #undef new
 #undef new
     T* t = new T(t1, t2, t3, t4);
     T* t = new T(t1, t2, t3, t4);
 #define new DEBUG_NEW
 #define new DEBUG_NEW
@@ -143,7 +143,7 @@ T* bullet_new(T1& t1, const T2& t2, const T3& t3, const T4& t4)
 template<typename T, typename T1, typename T2, typename T3, typename T4> 
 template<typename T, typename T1, typename T2, typename T3, typename T4> 
 T* bullet_new(T1& t1, T2& t2, const T3& t3, const T4& t4)
 T* bullet_new(T1& t1, T2& t2, const T3& t3, const T4& t4)
 {
 {
-#ifdef GAMEPLAY_MEM_LEAK_DETECTION
+#ifdef GP_USE_MEM_LEAK_DETECTION
 #undef new
 #undef new
     T* t = new T(t1, t2, t3, t4);
     T* t = new T(t1, t2, t3, t4);
 #define new DEBUG_NEW
 #define new DEBUG_NEW
@@ -156,7 +156,7 @@ T* bullet_new(T1& t1, T2& t2, const T3& t3, const T4& t4)
 template<typename T, typename T1, typename T2, typename T3, typename T4, typename T5> 
 template<typename T, typename T1, typename T2, typename T3, typename T4, typename T5> 
 T* bullet_new(const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5)
 T* bullet_new(const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5)
 {
 {
-#ifdef GAMEPLAY_MEM_LEAK_DETECTION
+#ifdef GP_USE_MEM_LEAK_DETECTION
 #undef new
 #undef new
     T* t = new T(t1, t2, t3, t4, t5);
     T* t = new T(t1, t2, t3, t4, t5);
 #define new DEBUG_NEW
 #define new DEBUG_NEW
@@ -169,7 +169,7 @@ T* bullet_new(const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5&
 template<typename T, typename T1, typename T2, typename T3, typename T4, typename T5> 
 template<typename T, typename T1, typename T2, typename T3, typename T4, typename T5> 
 T* bullet_new(T1& t1, T2& t2, const T3& t3, const T4& t4, const T5& t5)
 T* bullet_new(T1& t1, T2& t2, const T3& t3, const T4& t4, const T5& t5)
 {
 {
-#ifdef GAMEPLAY_MEM_LEAK_DETECTION
+#ifdef GP_USE_MEM_LEAK_DETECTION
 #undef new
 #undef new
     T* t = new T(t1, t2, t3, t4, t5);
     T* t = new T(t1, t2, t3, t4, t5);
 #define new DEBUG_NEW
 #define new DEBUG_NEW
@@ -182,7 +182,7 @@ T* bullet_new(T1& t1, T2& t2, const T3& t3, const T4& t4, const T5& t5)
 template<typename T, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9> 
 template<typename T, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9> 
 T* bullet_new(const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6, const T7& t7, const T8& t8, const T9& t9)
 T* bullet_new(const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6, const T7& t7, const T8& t8, const T9& t9)
 {
 {
-#ifdef GAMEPLAY_MEM_LEAK_DETECTION
+#ifdef GP_USE_MEM_LEAK_DETECTION
 #undef new
 #undef new
     T* t = new T(t1, t2, t3, t4, t5, t6, t7, t8, t9);
     T* t = new T(t1, t2, t3, t4, t5, t6, t7, t8, t9);
 #define new DEBUG_NEW
 #define new DEBUG_NEW

+ 22 - 4
gameplay/src/Font.cpp

@@ -16,7 +16,7 @@ static std::vector<Font*> __fontCache;
 static Effect* __fontEffect = NULL;
 static Effect* __fontEffect = NULL;
 
 
 Font::Font() :
 Font::Font() :
-    _style(PLAIN), _size(0), _spacing(0.125f), _glyphs(NULL), _glyphCount(0), _texture(NULL), _batch(NULL)
+    _format(BITMAP), _style(PLAIN), _size(0), _spacing(0.125f), _glyphs(NULL), _glyphCount(0), _texture(NULL), _batch(NULL), _cutoffParam(NULL)
 {
 {
 }
 }
 
 
@@ -90,7 +90,7 @@ Font* Font::create(const char* path, const char* id)
     return font;
     return font;
 }
 }
 
 
-Font* Font::create(const char* family, Style style, unsigned int size, Glyph* glyphs, int glyphCount, Texture* texture)
+Font* Font::create(const char* family, Style style, unsigned int size, Glyph* glyphs, int glyphCount, Texture* texture, Font::Format format)
 {
 {
     GP_ASSERT(family);
     GP_ASSERT(family);
     GP_ASSERT(glyphs);
     GP_ASSERT(glyphs);
@@ -99,7 +99,10 @@ Font* Font::create(const char* family, Style style, unsigned int size, Glyph* gl
     // Create the effect for the font's sprite batch.
     // Create the effect for the font's sprite batch.
     if (__fontEffect == NULL)
     if (__fontEffect == NULL)
     {
     {
-        __fontEffect = Effect::createFromFile(FONT_VSH, FONT_FSH);
+        char * defines = NULL;
+        if (format == DISTANCE_FIELD)
+            defines = "DISTANCE_FIELD";
+        __fontEffect = Effect::createFromFile(FONT_VSH, FONT_FSH, defines);
         if (__fontEffect == NULL)
         if (__fontEffect == NULL)
         {
         {
             GP_ERROR("Failed to create effect for font.");
             GP_ERROR("Failed to create effect for font.");
@@ -126,12 +129,14 @@ Font* Font::create(const char* family, Style style, unsigned int size, Glyph* gl
 
 
     // Add linear filtering for better font quality.
     // Add linear filtering for better font quality.
     Texture::Sampler* sampler = batch->getSampler();
     Texture::Sampler* sampler = batch->getSampler();
-    sampler->setFilterMode(Texture::LINEAR, Texture::LINEAR);
+    sampler->setFilterMode(Texture::LINEAR_MIPMAP_LINEAR, Texture::LINEAR);
+    sampler->setWrapMode(Texture::CLAMP, Texture::CLAMP);
 
 
     // Increase the ref count of the texture to retain it.
     // Increase the ref count of the texture to retain it.
     texture->addRef();
     texture->addRef();
 
 
     Font* font = new Font();
     Font* font = new Font();
+    font->_format = format;
     font->_family = family;
     font->_family = family;
     font->_style = style;
     font->_style = style;
     font->_size = size;
     font->_size = size;
@@ -151,6 +156,11 @@ unsigned int Font::getSize()
     return _size;
     return _size;
 }
 }
 
 
+Font::Format Font::getFormat()
+{
+    return _format;
+}
+
 void Font::start()
 void Font::start()
 {
 {
     GP_ASSERT(_batch);
     GP_ASSERT(_batch);
@@ -509,6 +519,14 @@ void Font::drawText(const char* text, int x, int y, const Vector4& color, unsign
                 if (index >= 0 && index < (int)_glyphCount)
                 if (index >= 0 && index < (int)_glyphCount)
                 {
                 {
                     Glyph& g = _glyphs[index];
                     Glyph& g = _glyphs[index];
+
+                    if (getFormat() == DISTANCE_FIELD )
+                    {
+                        if (_cutoffParam == NULL)
+                            _cutoffParam = getSpriteBatch()->getMaterial()->getParameter("u_cutoff");    
+                        // TODO: Fix me so that smaller font are much smoother
+                        _cutoffParam->setVector2(Vector2(1.0, 1.0));
+                    }
                     _batch->draw(xPos, yPos, g.width * scale, size, g.uvs[0], g.uvs[1], g.uvs[2], g.uvs[3], color);
                     _batch->draw(xPos, yPos, g.width * scale, size, g.uvs[0], g.uvs[1], g.uvs[2], g.uvs[3], color);
                     xPos += floor(g.width * scale + spacing);
                     xPos += floor(g.width * scale + spacing);
                     break;
                     break;

+ 19 - 2
gameplay/src/Font.h

@@ -49,6 +49,15 @@ public:
         ALIGN_BOTTOM_RIGHT = ALIGN_BOTTOM | ALIGN_RIGHT
         ALIGN_BOTTOM_RIGHT = ALIGN_BOTTOM | ALIGN_RIGHT
     };
     };
 
 
+    /**
+     * Defines the format of the font.
+     */
+    enum Format
+    {
+        BITMAP = 0,
+        DISTANCE_FIELD = 1
+    };
+
     /**
     /**
      * Vertex coordinates, UVs and indices can be computed and stored in a Text object.
      * Vertex coordinates, UVs and indices can be computed and stored in a Text object.
      * For static text labels that do not change frequently, this means these computations
      * For static text labels that do not change frequently, this means these computations
@@ -111,10 +120,15 @@ public:
     static Font* create(const char* path, const char* id = NULL);
     static Font* create(const char* path, const char* id = NULL);
 
 
     /**
     /**
-     * Returns the font size (max height of glyphs) in pixels.
+     * Gets the font size (max height of glyphs) in pixels.
      */
      */
     unsigned int getSize();
     unsigned int getSize();
 
 
+    /**
+     * Gets the font format. BITMAP or DISTANCEMAP.
+     */
+    Format getFormat();
+
     /**
     /**
      * Starts text drawing for this font.
      * Starts text drawing for this font.
      */
      */
@@ -327,10 +341,11 @@ private:
      * @param glyphs An array of font glyphs, defining each character in the font within the texture map.
      * @param glyphs An array of font glyphs, defining each character in the font within the texture map.
      * @param glyphCount The number of items in the glyph array.
      * @param glyphCount The number of items in the glyph array.
      * @param texture A texture map containing rendered glyphs.
      * @param texture A texture map containing rendered glyphs.
+     * @param format The format of the font (bitmap or distance fields)
      * 
      * 
      * @return The new Font.
      * @return The new Font.
      */
      */
-    static Font* create(const char* family, Style style, unsigned int size, Glyph* glyphs, int glyphCount, Texture* texture);
+    static Font* create(const char* family, Style style, unsigned int size, Glyph* glyphs, int glyphCount, Texture* texture, Font::Format format);
 
 
     void getMeasurementInfo(const char* text, const Rectangle& area, unsigned int size, Justify justify, bool wrap, bool rightToLeft,
     void getMeasurementInfo(const char* text, const Rectangle& area, unsigned int size, Justify justify, bool wrap, bool rightToLeft,
                             std::vector<int>* xPositions, int* yPosition, std::vector<unsigned int>* lineLengths);
                             std::vector<int>* xPositions, int* yPosition, std::vector<unsigned int>* lineLengths);
@@ -349,6 +364,7 @@ private:
     void addLineInfo(const Rectangle& area, int lineWidth, int lineLength, Justify hAlign,
     void addLineInfo(const Rectangle& area, int lineWidth, int lineLength, Justify hAlign,
                      std::vector<int>* xPositions, std::vector<unsigned int>* lineLengths, bool rightToLeft);
                      std::vector<int>* xPositions, std::vector<unsigned int>* lineLengths, bool rightToLeft);
 
 
+    Format _format;
     std::string _path;
     std::string _path;
     std::string _id;
     std::string _id;
     std::string _family;
     std::string _family;
@@ -360,6 +376,7 @@ private:
     Texture* _texture;
     Texture* _texture;
     SpriteBatch* _batch;
     SpriteBatch* _batch;
     Rectangle _viewport;
     Rectangle _viewport;
+    MaterialParameter* _cutoffParam;
 };
 };
 
 
 }
 }

+ 17 - 9
gameplay/src/Game.cpp

@@ -20,11 +20,11 @@ double Game::_pausedTimeTotal = 0.0;
 
 
 Game::Game()
 Game::Game()
     : _initialized(false), _state(UNINITIALIZED), _pausedCount(0),
     : _initialized(false), _state(UNINITIALIZED), _pausedCount(0),
-      _frameLastFPS(0), _frameCount(0), _frameRate(0),
+      _frameLastFPS(0), _frameCount(0), _frameRate(0), _width(0), _height(0),
       _clearDepth(1.0f), _clearStencil(0), _properties(NULL),
       _clearDepth(1.0f), _clearStencil(0), _properties(NULL),
       _animationController(NULL), _audioController(NULL),
       _animationController(NULL), _audioController(NULL),
       _physicsController(NULL), _aiController(NULL), _audioListener(NULL),
       _physicsController(NULL), _aiController(NULL), _audioListener(NULL),
-      _timeEvents(NULL), _scriptController(NULL), _scriptListeners(NULL)
+      _timeEvents(NULL), _scriptController(NULL), _socialController(NULL), _scriptListeners(NULL)
 {
 {
     GP_ASSERT(__gameInstance == NULL);
     GP_ASSERT(__gameInstance == NULL);
     __gameInstance = this;
     __gameInstance = this;
@@ -38,7 +38,7 @@ Game::~Game()
     // Do not call any virtual functions from the destructor.
     // Do not call any virtual functions from the destructor.
     // Finalization is done from outside this class.
     // Finalization is done from outside this class.
     SAFE_DELETE(_timeEvents);
     SAFE_DELETE(_timeEvents);
-#ifdef GAMEPLAY_MEM_LEAK_DETECTION
+#ifdef GP_USE_MEM_LEAK_DETECTION
     Ref::printLeaks();
     Ref::printLeaks();
     printMemoryLeaks();
     printMemoryLeaks();
 #endif
 #endif
@@ -114,6 +114,9 @@ bool Game::startup()
     _scriptController = new ScriptController();
     _scriptController = new ScriptController();
     _scriptController->initialize();
     _scriptController->initialize();
 
 
+    _socialController = new SocialController();
+    _socialController->initialize();
+
     // Load any gamepads, ui or physical.
     // Load any gamepads, ui or physical.
     loadGamepads();
     loadGamepads();
 
 
@@ -194,6 +197,9 @@ void Game::shutdown()
         _aiController->finalize();
         _aiController->finalize();
         SAFE_DELETE(_aiController);
         SAFE_DELETE(_aiController);
 
 
+        _socialController->initialize();
+        SAFE_DELETE(_socialController);
+
         // Note: we do not clean up the script controller here
         // Note: we do not clean up the script controller here
         // because users can call Game::exit() from a script.
         // because users can call Game::exit() from a script.
 
 
@@ -222,6 +228,7 @@ void Game::pause()
         _audioController->pause();
         _audioController->pause();
         _physicsController->pause();
         _physicsController->pause();
         _aiController->pause();
         _aiController->pause();
+        _socialController->pause();
     }
     }
 
 
     ++_pausedCount;
     ++_pausedCount;
@@ -245,6 +252,7 @@ void Game::resume()
             _audioController->resume();
             _audioController->resume();
             _physicsController->resume();
             _physicsController->resume();
             _aiController->resume();
             _aiController->resume();
+            _socialController->resume();
         }
         }
     }
     }
 }
 }
@@ -252,13 +260,13 @@ void Game::resume()
 void Game::exit()
 void Game::exit()
 {
 {
     // Only perform a full/clean shutdown if FORCE_CLEAN_SHUTDOWN or
     // Only perform a full/clean shutdown if FORCE_CLEAN_SHUTDOWN or
-    // GAMEPLAY_MEM_LEAK_DETECTION is defined. Every modern OS is able to
+    // GP_USE_MEM_LEAK_DETECTION is defined. Every modern OS is able to
     // handle reclaiming process memory hundreds of times faster than it
     // handle reclaiming process memory hundreds of times faster than it
     // would take us to go through every pointer in the engine and release
     // would take us to go through every pointer in the engine and release
     // them nicely. For large games, shutdown can end up taking long time,
     // them nicely. For large games, shutdown can end up taking long time,
     // so we'll just call ::exit(0) to force an instant shutdown.
     // so we'll just call ::exit(0) to force an instant shutdown.
 
 
-#if defined FORCE_CLEAN_SHUTDOWN || defined GAMEPLAY_MEM_LEAK_DETECTION
+#if defined FORCE_CLEAN_SHUTDOWN || defined GP_USE_MEM_LEAK_DETECTION
 
 
     // Schedule a call to shutdown rather than calling it right away.
     // Schedule a call to shutdown rather than calling it right away.
 	// This handles the case of shutting down the script system from
 	// This handles the case of shutting down the script system from
@@ -329,6 +337,9 @@ void Game::frame()
         // Audio Rendering.
         // Audio Rendering.
         _audioController->update(elapsedTime);
         _audioController->update(elapsedTime);
 
 
+        // Social Update.
+        _socialController->update(elapsedTime);
+
         // Graphics Rendering.
         // Graphics Rendering.
         render(elapsedTime);
         render(elapsedTime);
 
 
@@ -391,6 +402,7 @@ void Game::updateOnce()
     _aiController->update(elapsedTime);
     _aiController->update(elapsedTime);
     _audioController->update(elapsedTime);
     _audioController->update(elapsedTime);
     _scriptController->update(elapsedTime);
     _scriptController->update(elapsedTime);
+    _socialController->update(elapsedTime);
 }
 }
 
 
 void Game::setViewport(const Rectangle& viewport)
 void Game::setViewport(const Rectangle& viewport)
@@ -456,10 +468,6 @@ AudioListener* Game::getAudioListener()
     return _audioListener;
     return _audioListener;
 }
 }
 
 
-void Game::menuEvent()
-{
-}
-
 void Game::keyEvent(Keyboard::KeyEvent evt, int key)
 void Game::keyEvent(Keyboard::KeyEvent evt, int key)
 {
 {
 }
 }

+ 12 - 7
gameplay/src/Game.h

@@ -9,6 +9,7 @@
 #include "AudioController.h"
 #include "AudioController.h"
 #include "AnimationController.h"
 #include "AnimationController.h"
 #include "PhysicsController.h"
 #include "PhysicsController.h"
+#include "SocialController.h"
 #include "AIController.h"
 #include "AIController.h"
 #include "AudioListener.h"
 #include "AudioListener.h"
 #include "Rectangle.h"
 #include "Rectangle.h"
@@ -258,17 +259,20 @@ public:
      */
      */
     inline ScriptController* getScriptController() const;
     inline ScriptController* getScriptController() const;
 
 
+    /**
+     * Gets the social controller for managing control of social apis
+     * associated with the game.
+     *
+     * @return The script controller for this game.
+     */
+    inline SocialController* getSocialController() const;
+
     /**
     /**
      * Gets the audio listener for 3D audio.
      * Gets the audio listener for 3D audio.
      * 
      * 
      * @return The audio listener for this game.
      * @return The audio listener for this game.
      */
      */
     AudioListener* getAudioListener();
     AudioListener* getAudioListener();
-
-    /**
-     * Menu callback on menu events for platforms with special menu keys or special platform gestures.
-     */
-    virtual void menuEvent();
     
     
     /**
     /**
      * Shows or hides the virtual keyboard (if supported).
      * Shows or hides the virtual keyboard (if supported).
@@ -528,7 +532,7 @@ public:
     inline void getAccelerometerValues(float* pitch, float* roll);
     inline void getAccelerometerValues(float* pitch, float* roll);
 
 
     /**
     /**
-     * Gets raw sensor values, if equipped, allowing a distinction between device acceleration
+     * Gets sensor values (raw), if equipped, allowing a distinction between device acceleration
      * and rotation rate. Returns zeros on platforms with no corresponding support. See also
      * and rotation rate. Returns zeros on platforms with no corresponding support. See also
      * hasAccelerometer() and getAccelerometerValues().
      * hasAccelerometer() and getAccelerometerValues().
      *
      *
@@ -539,7 +543,7 @@ public:
      * @param gyroY The y-coordinate of the raw gyroscope data.
      * @param gyroY The y-coordinate of the raw gyroscope data.
      * @param gyroZ The z-coordinate of the raw gyroscope data.
      * @param gyroZ The z-coordinate of the raw gyroscope data.
      */
      */
-    inline void getRawSensorValues(float* accelX, float* accelY, float* accelZ, float* gyroX, float* gyroY, float* gyroZ);
+    inline void getSensorValues(float* accelX, float* accelY, float* accelZ, float* gyroX, float* gyroY, float* gyroZ);
 
 
     /**
     /**
      * Gets the command line arguments.
      * Gets the command line arguments.
@@ -740,6 +744,7 @@ private:
     AudioListener* _audioListener;              // The audio listener in 3D space.
     AudioListener* _audioListener;              // The audio listener in 3D space.
     std::priority_queue<TimeEvent, std::vector<TimeEvent>, std::less<TimeEvent> >* _timeEvents;     // Contains the scheduled time events.
     std::priority_queue<TimeEvent, std::vector<TimeEvent>, std::less<TimeEvent> >* _timeEvents;     // Contains the scheduled time events.
     ScriptController* _scriptController;            // Controls the scripting engine.
     ScriptController* _scriptController;            // Controls the scripting engine.
+    SocialController* _socialController;		// Controls social aspect of the game.
     std::vector<ScriptListener*>* _scriptListeners; // Lua script listeners.
     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.
     // Note: Do not add STL object member variables on the stack; this will cause false memory leaks to be reported.

+ 7 - 2
gameplay/src/Game.inl

@@ -63,6 +63,11 @@ inline AIController* Game::getAIController() const
     return _aiController;
     return _aiController;
 }
 }
 
 
+inline SocialController* Game::getSocialController() const
+{
+    return _socialController;
+}
+
 template <class T>
 template <class T>
 void Game::renderOnce(T* instance, void (T::*method)(void*), void* cookie)
 void Game::renderOnce(T* instance, void (T::*method)(void*), void* cookie)
 {
 {
@@ -131,9 +136,9 @@ inline void Game::getAccelerometerValues(float* pitch, float* roll)
     Platform::getAccelerometerValues(pitch, roll);
     Platform::getAccelerometerValues(pitch, roll);
 }
 }
 
 
-inline void Game::getRawSensorValues(float* accelX, float* accelY, float* accelZ, float* gyroX, float* gyroY, float* gyroZ)
+inline void Game::getSensorValues(float* accelX, float* accelY, float* accelZ, float* gyroX, float* gyroY, float* gyroZ)
 {
 {
-    return Platform::getRawSensorValues(accelX, accelY, accelZ, gyroX, gyroY, gyroZ);
+    return Platform::getSensorValues(accelX, accelY, accelZ, gyroX, gyroY, gyroZ);
 }
 }
 
 
 inline unsigned int Game::getGamepadCount() const
 inline unsigned int Game::getGamepadCount() const

+ 1 - 2
gameplay/src/Image.cpp

@@ -137,9 +137,8 @@ Image* Image::create(unsigned int width, unsigned int height, Image::Format form
 	return image;
 	return image;
 }
 }
 
 
-Image::Image()
+Image::Image() : _data(NULL), _format(RGB), _width(0), _height(0)
 {
 {
-    // Unused
 }
 }
 
 
 Image::~Image()
 Image::~Image()

+ 8 - 8
gameplay/src/Image.h

@@ -24,7 +24,7 @@ public:
 
 
     /**
     /**
      * Creates an image from the image file at the given path.
      * Creates an image from the image file at the given path.
-     * 
+     *
      * @param path The path to the image file.
      * @param path The path to the image file.
      * @return The newly created image.
      * @return The newly created image.
      * @script{create}
      * @script{create}
@@ -33,7 +33,7 @@ public:
 
 
 	/**
 	/**
      * Creates an image from the data provided
      * Creates an image from the data provided
-     * 
+     *
      * @param width The width of the image data.
      * @param width The width of the image data.
 	 * @param height The height of the image data.
 	 * @param height The height of the image data.
 	 * @param format The format of the image data.
 	 * @param format The format of the image data.
@@ -45,7 +45,7 @@ public:
 
 
     /**
     /**
      * Gets the image's raw pixel data.
      * Gets the image's raw pixel data.
-     * 
+     *
      * @return The image's pixel data.
      * @return The image's pixel data.
      * @script{ignore}
      * @script{ignore}
      */
      */
@@ -53,21 +53,21 @@ public:
 
 
     /**
     /**
      * Gets the image's format.
      * Gets the image's format.
-     * 
+     *
      * @return The image's format.
      * @return The image's format.
      */
      */
     inline Format getFormat() const;
     inline Format getFormat() const;
 
 
     /**
     /**
      * Gets the height of the image.
      * Gets the height of the image.
-     * 
+     *
      * @return The height of the image.
      * @return The height of the image.
      */
      */
     inline unsigned int getHeight() const;
     inline unsigned int getHeight() const;
-        
+
     /**
     /**
      * Gets the width of the image.
      * Gets the width of the image.
-     * 
+     *
      * @return The width of the image.
      * @return The width of the image.
      */
      */
     inline unsigned int getWidth() const;
     inline unsigned int getWidth() const;
@@ -91,8 +91,8 @@ private:
 
 
     unsigned char* _data;
     unsigned char* _data;
     Format _format;
     Format _format;
-    unsigned int _height;
     unsigned int _width;
     unsigned int _width;
+    unsigned int _height;
 };
 };
 
 
 }
 }

+ 2 - 2
gameplay/src/PhysicsController.cpp

@@ -7,12 +7,12 @@
 #include "Bundle.h"
 #include "Bundle.h"
 #include "Terrain.h"
 #include "Terrain.h"
 
 
-#ifdef GAMEPLAY_MEM_LEAK_DETECTION
+#ifdef GP_USE_MEM_LEAK_DETECTION
 #undef new
 #undef new
 #endif
 #endif
 #include "BulletCollision/CollisionShapes/btHeightfieldTerrainShape.h"
 #include "BulletCollision/CollisionShapes/btHeightfieldTerrainShape.h"
 #include "BulletCollision/CollisionShapes/btShapeHull.h"
 #include "BulletCollision/CollisionShapes/btShapeHull.h"
-#ifdef GAMEPLAY_MEM_LEAK_DETECTION
+#ifdef GP_USE_MEM_LEAK_DETECTION
 #define new DEBUG_NEW
 #define new DEBUG_NEW
 #endif
 #endif
 
 

+ 3 - 4
gameplay/src/Platform.h

@@ -36,12 +36,11 @@ public:
      * Creates a platform for the specified game which it will interact with.
      * Creates a platform for the specified game which it will interact with.
      *
      *
      * @param game The game to create a platform for.
      * @param game The game to create a platform for.
-     * @param attachToWindow The native window handle to optionally attach to.
      * 
      * 
      * @return The created platform interface.
      * @return The created platform interface.
      * @script{ignore}
      * @script{ignore}
      */
      */
-    static Platform* create(Game* game, void* attachToWindow = NULL);
+    static Platform* create(Game* game);
 
 
     /**
     /**
      * Begins processing the platform messages.
      * Begins processing the platform messages.
@@ -218,7 +217,7 @@ private:
     static void getAccelerometerValues(float* pitch, float* roll);
     static void getAccelerometerValues(float* pitch, float* roll);
 
 
     /**
     /**
-     * Gets raw sensor values, if equipped, allowing a distinction between device acceleration
+     * Gets sensor values (raw), if equipped, allowing a distinction between device acceleration
      * and rotation rate. Returns zeros on platforms with no corresponding support. See also
      * and rotation rate. Returns zeros on platforms with no corresponding support. See also
      * hasAccelerometer() and getAccelerometerValues().
      * hasAccelerometer() and getAccelerometerValues().
      *
      *
@@ -229,7 +228,7 @@ private:
      * @param gyroY The y-coordinate of the raw gyroscope data.
      * @param gyroY The y-coordinate of the raw gyroscope data.
      * @param gyroZ The z-coordinate of the raw gyroscope data.
      * @param gyroZ The z-coordinate of the raw gyroscope data.
      */
      */
-    static void getRawSensorValues(float* accelX, float* accelY, float* accelZ, float* gyroX, float* gyroY, float* gyroZ);
+    static void getSensorValues(float* accelX, float* accelY, float* accelZ, float* gyroX, float* gyroY, float* gyroZ);
 
 
     /**
     /**
      * Gets the command line arguments.
      * Gets the command line arguments.

+ 3 - 4
gameplay/src/PlatformAndroid.cpp

@@ -974,7 +974,7 @@ Platform::~Platform()
 {
 {
 }
 }
 
 
-Platform* Platform::create(Game* game, void* attachToWindow)
+Platform* Platform::create(Game* game)
 {
 {
     Platform* platform = new Platform(game);
     Platform* platform = new Platform(game);
     return platform;
     return platform;
@@ -1193,8 +1193,7 @@ void Platform::setMultiSampling(bool enabled)
         return;
         return;
     }
     }
 
 
-    //todo
-
+    // TODO
     __multiSampling = enabled;
     __multiSampling = enabled;
 }
 }
 
 
@@ -1258,7 +1257,7 @@ void Platform::getAccelerometerValues(float* pitch, float* roll)
     }
     }
 }
 }
 
 
-void Platform::getRawSensorValues(float* accelX, float* accelY, float* accelZ, float* gyroX, float* gyroY, float* gyroZ)
+void Platform::getSensorValues(float* accelX, float* accelY, float* accelZ, float* gyroX, float* gyroY, float* gyroZ)
 {
 {
     if (accelX)
     if (accelX)
     {
     {

+ 1643 - 1634
gameplay/src/PlatformBlackBerry.cpp

@@ -1,476 +1,477 @@
-#ifdef __QNX__
-
-#include "Base.h"
-#include "Platform.h"
-#include "FileSystem.h"
-#include "Game.h"
-#include "Form.h"
-#include "ScriptController.h"
-#include <unistd.h>
-#include <sys/keycodes.h>
-#include <screen/screen.h>
-#include <input/screen_helpers.h>
-#include <gestures/set.h>
-#include <gestures/swipe.h>
-#include <gestures/pinch.h>
-#include <gestures/tap.h>
-#include <bps/bps.h>
-#include <bps/event.h>
-#include <bps/screen.h>
-#include <bps/navigator.h>
-#include <bps/sensor.h>
-#include <bps/orientation.h>
-#include <bps/virtualkeyboard.h>
-
-#define TOUCH_COUNT_MAX     4
-
-using namespace std;
-
-int __argc = 0;
-char** __argv = 0;
-struct timespec __timespec;
-static double __timeStart;
-static double __timeAbsolute;
-static bool __vsync = WINDOW_VSYNC;
-static screen_context_t __screenContext;
-static screen_window_t __screenWindow;
-static screen_event_t __screenEvent;
-static int __screenWindowSize[2];
-static bool __screenFullscreen = false;
-static EGLDisplay __eglDisplay = EGL_NO_DISPLAY;
-static EGLContext __eglContext = EGL_NO_CONTEXT;
-static EGLSurface __eglSurface = EGL_NO_SURFACE;
-static EGLConfig __eglConfig = 0;
-static int __orientationAngle;
-static bool __multiTouch = false;
-static bool __multiSampling = false;
-static float __pitch;
-static float __roll;
-static float __accelRawX;
-static float __accelRawY;
-static float __accelRawZ;
-static float __gyroRawX;
-static float __gyroRawY;
-static float __gyroRawZ;
-static const char* __glExtensions;
-static struct gestures_set * __gestureSet;
-static bitset<3> __gestureEventsProcessed;
-static bool __gestureSwipeRecognized = false;
-PFNGLBINDVERTEXARRAYOESPROC glBindVertexArray = NULL;
-PFNGLDELETEVERTEXARRAYSOESPROC glDeleteVertexArrays = NULL;
-PFNGLGENVERTEXARRAYSOESPROC glGenVertexArrays = NULL;
-PFNGLISVERTEXARRAYOESPROC glIsVertexArray = NULL;
-
-namespace gameplay
-{
-
-// Gets the Keyboard::Key enumeration constant that corresponds to the given QNX key code.
-static Keyboard::Key getKey(int qnxKeycode)
-{
-    switch (qnxKeycode)
-    {
-    case KEYCODE_SYSREQ:
-        return Keyboard::KEY_SYSREQ;
-    case KEYCODE_BREAK:
-        return Keyboard::KEY_BREAK;
-    case KEYCODE_MENU:
-        return Keyboard::KEY_MENU;
-    case KEYCODE_KP_ENTER:
-        return Keyboard::KEY_KP_ENTER;
-    case KEYCODE_PAUSE:
-        return Keyboard::KEY_PAUSE;
-    case KEYCODE_SCROLL_LOCK:
-        return Keyboard::KEY_SCROLL_LOCK;
-    case KEYCODE_PRINT:
-        return Keyboard::KEY_PRINT;
-    case KEYCODE_ESCAPE:
-        return Keyboard::KEY_ESCAPE;
-    case KEYCODE_BACKSPACE:
-        return Keyboard::KEY_BACKSPACE;
-    case KEYCODE_BACK_TAB:
-        return Keyboard::KEY_BACK_TAB;
-    case KEYCODE_TAB:
-        return Keyboard::KEY_TAB;
-    case KEYCODE_RETURN:
-        return Keyboard::KEY_RETURN;
-    case KEYCODE_CAPS_LOCK:
-        return Keyboard::KEY_CAPS_LOCK;
-    case KEYCODE_LEFT_SHIFT:
-    case KEYCODE_RIGHT_SHIFT:
-        return Keyboard::KEY_SHIFT;
-    case KEYCODE_LEFT_CTRL:
-    case KEYCODE_RIGHT_CTRL:
-        return Keyboard::KEY_CTRL;
-    case KEYCODE_LEFT_ALT:
-    case KEYCODE_RIGHT_ALT:
-        return Keyboard::KEY_ALT;
-    case KEYCODE_LEFT_HYPER:
-    case KEYCODE_RIGHT_HYPER:
-        return Keyboard::KEY_HYPER;
-    case KEYCODE_INSERT:
-        return Keyboard::KEY_INSERT;
-    case KEYCODE_HOME:
-        return Keyboard::KEY_HOME;
-    case KEYCODE_PG_UP:
-        return Keyboard::KEY_PG_UP;
-    case KEYCODE_DELETE:
-        return Keyboard::KEY_DELETE;
-    case KEYCODE_END:
-        return Keyboard::KEY_END;
-    case KEYCODE_PG_DOWN:
-        return Keyboard::KEY_PG_DOWN;
-    case KEYCODE_LEFT:
-        return Keyboard::KEY_LEFT_ARROW;
-    case KEYCODE_RIGHT:
-        return Keyboard::KEY_RIGHT_ARROW;
-    case KEYCODE_UP:
-        return Keyboard::KEY_UP_ARROW;
-    case KEYCODE_DOWN:
-        return Keyboard::KEY_DOWN_ARROW;
-    case KEYCODE_NUM_LOCK:
-        return Keyboard::KEY_NUM_LOCK;
-    case KEYCODE_KP_PLUS:
-        return Keyboard::KEY_KP_PLUS;
-    case KEYCODE_KP_MINUS:
-        return Keyboard::KEY_KP_MINUS;
-    case KEYCODE_KP_MULTIPLY:
-        return Keyboard::KEY_KP_MULTIPLY;
-    case KEYCODE_KP_DIVIDE:
-        return Keyboard::KEY_KP_DIVIDE;
-    case KEYCODE_KP_HOME:
-        return Keyboard::KEY_KP_HOME;
-    case KEYCODE_KP_UP:
-        return Keyboard::KEY_KP_UP;
-    case KEYCODE_KP_PG_UP:
-        return Keyboard::KEY_KP_PG_UP;
-    case KEYCODE_KP_LEFT:
-        return Keyboard::KEY_KP_LEFT;
-    case KEYCODE_KP_FIVE:
-        return Keyboard::KEY_KP_FIVE;
-    case KEYCODE_KP_RIGHT:
-        return Keyboard::KEY_KP_RIGHT;
-    case KEYCODE_KP_END:
-        return Keyboard::KEY_KP_END;
-    case KEYCODE_KP_DOWN:
-        return Keyboard::KEY_KP_DOWN;
-    case KEYCODE_KP_PG_DOWN:
-        return Keyboard::KEY_KP_PG_DOWN;
-    case KEYCODE_KP_INSERT:
-        return Keyboard::KEY_KP_INSERT;
-    case KEYCODE_KP_DELETE:
-        return Keyboard::KEY_KP_DELETE;
-    case KEYCODE_F1:
-        return Keyboard::KEY_F1;
-    case KEYCODE_F2:
-        return Keyboard::KEY_F2;
-    case KEYCODE_F3:
-        return Keyboard::KEY_F3;
-    case KEYCODE_F4:
-        return Keyboard::KEY_F4;
-    case KEYCODE_F5:
-        return Keyboard::KEY_F5;
-    case KEYCODE_F6:
-        return Keyboard::KEY_F6;
-    case KEYCODE_F7:
-        return Keyboard::KEY_F7;
-    case KEYCODE_F8:
-        return Keyboard::KEY_F8;
-    case KEYCODE_F9:
-        return Keyboard::KEY_F9;
-    case KEYCODE_F10:
-        return Keyboard::KEY_F10;
-    case KEYCODE_F11:
-        return Keyboard::KEY_F11;
-    case KEYCODE_F12:
-        return Keyboard::KEY_F12;
-    case KEYCODE_SPACE:
-        return Keyboard::KEY_SPACE;
-    case KEYCODE_RIGHT_PAREN:
-        return Keyboard::KEY_RIGHT_PARENTHESIS;
-    case KEYCODE_ZERO:
-        return Keyboard::KEY_ZERO;
-    case KEYCODE_EXCLAM:
-        return Keyboard::KEY_EXCLAM;
-    case KEYCODE_ONE:
-        return Keyboard::KEY_ONE;
-    case KEYCODE_AT:
-        return Keyboard::KEY_AT;
-    case KEYCODE_TWO:
-        return Keyboard::KEY_TWO;
-    case KEYCODE_NUMBER:
-        return Keyboard::KEY_NUMBER;
-    case KEYCODE_THREE:
-        return Keyboard::KEY_THREE;
-    case KEYCODE_DOLLAR:
-        return Keyboard::KEY_DOLLAR;
-    case KEYCODE_FOUR:
-        return Keyboard::KEY_FOUR;
-    case KEYCODE_PERCENT:
-        return Keyboard::KEY_PERCENT;
-    case KEYCODE_FIVE:
-        return Keyboard::KEY_FIVE;
-    case KEYCODE_CIRCUMFLEX:
-        return Keyboard::KEY_CIRCUMFLEX;
-    case KEYCODE_SIX:
-        return Keyboard::KEY_SIX;
-    case KEYCODE_AMPERSAND:
-        return Keyboard::KEY_AMPERSAND;
-    case KEYCODE_SEVEN:
-        return Keyboard::KEY_SEVEN;
-    case KEYCODE_ASTERISK:
-        return Keyboard::KEY_ASTERISK;
-    case KEYCODE_EIGHT:
-        return Keyboard::KEY_EIGHT;
-    case KEYCODE_LEFT_PAREN:
-        return Keyboard::KEY_LEFT_PARENTHESIS;
-    case KEYCODE_NINE:
-        return Keyboard::KEY_NINE;
-    case KEYCODE_EQUAL:
-        return Keyboard::KEY_EQUAL;
-    case KEYCODE_PLUS:
-        return Keyboard::KEY_PLUS;
-    case KEYCODE_LESS_THAN:
-        return Keyboard::KEY_LESS_THAN;
-    case KEYCODE_COMMA:
-        return Keyboard::KEY_COMMA;
-    case KEYCODE_UNDERSCORE:
-        return Keyboard::KEY_UNDERSCORE;
-    case KEYCODE_MINUS:
-        return Keyboard::KEY_MINUS;
-    case KEYCODE_GREATER_THAN:
-        return Keyboard::KEY_GREATER_THAN;
-    case KEYCODE_PERIOD:
-        return Keyboard::KEY_PERIOD;
-    case KEYCODE_COLON:
-        return Keyboard::KEY_COLON;
-    case KEYCODE_SEMICOLON:
-        return Keyboard::KEY_SEMICOLON;
-    case KEYCODE_QUESTION:
-        return Keyboard::KEY_QUESTION;
-    case KEYCODE_SLASH:
-        return Keyboard::KEY_SLASH;
-    case KEYCODE_GRAVE:
-        return Keyboard::KEY_GRAVE;
-    case KEYCODE_TILDE:
-        return Keyboard::KEY_TILDE;
-    case KEYCODE_LEFT_BRACE:
-        return Keyboard::KEY_LEFT_BRACE;
-    case KEYCODE_LEFT_BRACKET:
-        return Keyboard::KEY_LEFT_BRACKET;
-    case KEYCODE_BAR:
-        return Keyboard::KEY_BAR;
-    case KEYCODE_BACK_SLASH:
-        return Keyboard::KEY_BACK_SLASH;
-    case KEYCODE_RIGHT_BRACE:
-        return Keyboard::KEY_RIGHT_BRACE;
-    case KEYCODE_RIGHT_BRACKET:
-        return Keyboard::KEY_RIGHT_BRACKET;
-    case KEYCODE_QUOTE:
-        return Keyboard::KEY_QUOTE;
-    case KEYCODE_APOSTROPHE:
-        return Keyboard::KEY_APOSTROPHE;
-    case 0x20AC:
-        return Keyboard::KEY_EURO;
-    case KEYCODE_POUND_SIGN:
-        return Keyboard::KEY_POUND;
-    case KEYCODE_YEN_SIGN:
-        return Keyboard::KEY_YEN;
-    case KEYCODE_MIDDLE_DOT:
-        return Keyboard::KEY_MIDDLE_DOT;
-    case KEYCODE_CAPITAL_A:
-        return Keyboard::KEY_CAPITAL_A;
-    case KEYCODE_A:
-        return Keyboard::KEY_A;
-    case KEYCODE_CAPITAL_B:
-        return Keyboard::KEY_CAPITAL_B;
-    case KEYCODE_B:
-        return Keyboard::KEY_B;
-    case KEYCODE_CAPITAL_C:
-        return Keyboard::KEY_CAPITAL_C;
-    case KEYCODE_C:
-        return Keyboard::KEY_C;
-    case KEYCODE_CAPITAL_D:
-        return Keyboard::KEY_CAPITAL_D;
-    case KEYCODE_D:
-        return Keyboard::KEY_D;
-    case KEYCODE_CAPITAL_E:
-        return Keyboard::KEY_CAPITAL_E;
-    case KEYCODE_E:
-        return Keyboard::KEY_E;
-    case KEYCODE_CAPITAL_F:
-        return Keyboard::KEY_CAPITAL_F;
-    case KEYCODE_F:
-        return Keyboard::KEY_F;
-    case KEYCODE_CAPITAL_G:
-        return Keyboard::KEY_CAPITAL_G;
-    case KEYCODE_G:
-        return Keyboard::KEY_G;
-    case KEYCODE_CAPITAL_H:
-        return Keyboard::KEY_CAPITAL_H;
-    case KEYCODE_H:
-        return Keyboard::KEY_H;
-    case KEYCODE_CAPITAL_I:
-        return Keyboard::KEY_CAPITAL_I;
-    case KEYCODE_I:
-        return Keyboard::KEY_I;
-    case KEYCODE_CAPITAL_J:
-        return Keyboard::KEY_CAPITAL_J;
-    case KEYCODE_J:
-        return Keyboard::KEY_J;
-    case KEYCODE_CAPITAL_K:
-        return Keyboard::KEY_CAPITAL_K;
-    case KEYCODE_K:
-        return Keyboard::KEY_K;
-    case KEYCODE_CAPITAL_L:
-        return Keyboard::KEY_CAPITAL_L;
-    case KEYCODE_L:
-        return Keyboard::KEY_L;
-    case KEYCODE_CAPITAL_M:
-        return Keyboard::KEY_CAPITAL_M;
-    case KEYCODE_M:
-        return Keyboard::KEY_M;
-    case KEYCODE_CAPITAL_N:
-        return Keyboard::KEY_CAPITAL_N;
-    case KEYCODE_N:
-        return Keyboard::KEY_N;
-    case KEYCODE_CAPITAL_O:
-        return Keyboard::KEY_CAPITAL_O;
-    case KEYCODE_O:
-        return Keyboard::KEY_O;
-    case KEYCODE_CAPITAL_P:
-        return Keyboard::KEY_CAPITAL_P;
-    case KEYCODE_P:
-        return Keyboard::KEY_P;
-    case KEYCODE_CAPITAL_Q:
-        return Keyboard::KEY_CAPITAL_Q;
-    case KEYCODE_Q:
-        return Keyboard::KEY_Q;
-    case KEYCODE_CAPITAL_R:
-        return Keyboard::KEY_CAPITAL_R;
-    case KEYCODE_R:
-        return Keyboard::KEY_R;
-    case KEYCODE_CAPITAL_S:
-        return Keyboard::KEY_CAPITAL_S;
-    case KEYCODE_S:
-        return Keyboard::KEY_S;
-    case KEYCODE_CAPITAL_T:
-        return Keyboard::KEY_CAPITAL_T;
-    case KEYCODE_T:
-        return Keyboard::KEY_T;
-    case KEYCODE_CAPITAL_U:
-        return Keyboard::KEY_CAPITAL_U;
-    case KEYCODE_U:
-        return Keyboard::KEY_U;
-    case KEYCODE_CAPITAL_V:
-        return Keyboard::KEY_CAPITAL_V;
-    case KEYCODE_V:
-        return Keyboard::KEY_V;
-    case KEYCODE_CAPITAL_W:
-        return Keyboard::KEY_CAPITAL_W;
-    case KEYCODE_W:
-        return Keyboard::KEY_W;
-    case KEYCODE_CAPITAL_X:
-        return Keyboard::KEY_CAPITAL_X;
-    case KEYCODE_X:
-        return Keyboard::KEY_X;
-    case KEYCODE_CAPITAL_Y:
-        return Keyboard::KEY_CAPITAL_Y;
-    case KEYCODE_Y:
-        return Keyboard::KEY_Y;
-    case KEYCODE_CAPITAL_Z:
-        return Keyboard::KEY_CAPITAL_Z;
-    case KEYCODE_Z:
-        return Keyboard::KEY_Z;
-    default:
-        return Keyboard::KEY_NONE;
-    }
-}
-
-/**
- * Returns the unicode value from the given QNX key code value.
- * Some non-printable characters also have corresponding unicode values, such as backspace.
- *
- * @param qnxKeyCode The keyboard key code.
- *
- * @return The unicode value or 0 if the keycode did not represent a unicode key.
- */
-static int getUnicode(int qnxKeyCode)
-{
-    if (qnxKeyCode >= KEYCODE_PC_KEYS && qnxKeyCode <= UNICODE_PRIVATE_USE_AREA_LAST)
-    {
-        switch (qnxKeyCode)
-        {
-        case KEYCODE_BACKSPACE:
-            return 0x0008;
-        case KEYCODE_TAB:
-            return 0x0009;
-        case KEYCODE_KP_ENTER:
-        case KEYCODE_RETURN:
-            return 0x000A;
-        case KEYCODE_ESCAPE:
-            return 0x001B;
-        // Win32 doesn't consider delete to be a key char.
-        default:
-            return 0;
-        }
-    }
-    return qnxKeyCode;
-}
-
-extern void print(const char* format, ...)
-{
-    GP_ASSERT(format);
-    va_list argptr;
-    va_start(argptr, format);
-    vfprintf(stderr, format, argptr);
-    va_end(argptr);
-}
-
-EGLenum checkErrorEGL(const char* msg)
-{
-    GP_ASSERT(msg);
-    static const char* errmsg[] =
-    {
-        "EGL function failed",
-        "EGL is not initialized, or could not be initialized, for the specified display",
-        "EGL cannot access a requested resource",
-        "EGL failed to allocate resources for the requested operation",
-        "EGL fail to access an unrecognized attribute or attribute value was passed in an attribute list",
-        "EGLConfig argument does not name a valid EGLConfig",
-        "EGLContext argument does not name a valid EGLContext",
-        "EGL current surface of the calling thread is no longer valid",
-        "EGLDisplay argument does not name a valid EGLDisplay",
-        "EGL arguments are inconsistent",
-        "EGLNativePixmapType argument does not refer to a valid native pixmap",
-        "EGLNativeWindowType argument does not refer to a valid native window",
-        "EGL one or more argument values are invalid",
-        "EGLSurface argument does not name a valid surface configured for rendering",
-        "EGL power management event has occurred",
-    };
-    EGLenum error = eglGetError();
-    fprintf(stderr, "%s: %s\n", msg, errmsg[error - EGL_SUCCESS]);
-    return error;
-}
-
-void gesture_callback(gesture_base_t* gesture, mtouch_event_t* event, void* param, int async)
-{
-    switch (gesture->type)
-    {
-    case GESTURE_SWIPE:
-        {
-            if ( __gestureEventsProcessed.test(Gesture::GESTURE_SWIPE) )
-            {
-                gesture_swipe_t* swipe = (gesture_swipe_t*)gesture;
-                if (!__gestureSwipeRecognized)
-                {
-                    Platform::gestureSwipeEventInternal(swipe->coords.x, swipe->coords.y, swipe->direction);
-                    __gestureSwipeRecognized = true;
-                }
-
-            }
-            break;
-        }
-
+#ifdef __QNX__
+
+#include "Base.h"
+#include "Platform.h"
+#include "FileSystem.h"
+#include "SocialController.h"
+#include "Game.h"
+#include "Form.h"
+#include "ScriptController.h"
+#include <unistd.h>
+#include <sys/keycodes.h>
+#include <screen/screen.h>
+#include <input/screen_helpers.h>
+#include <gestures/set.h>
+#include <gestures/swipe.h>
+#include <gestures/pinch.h>
+#include <gestures/tap.h>
+#include <bps/bps.h>
+#include <bps/event.h>
+#include <bps/screen.h>
+#include <bps/navigator.h>
+#include <bps/sensor.h>
+#include <bps/orientation.h>
+#include <bps/virtualkeyboard.h>
+
+#define TOUCH_COUNT_MAX     4
+
+using namespace std;
+
+int __argc = 0;
+char** __argv = 0;
+struct timespec __timespec;
+static double __timeStart;
+static double __timeAbsolute;
+static bool __vsync = WINDOW_VSYNC;
+static screen_context_t __screenContext;
+static screen_window_t __screenWindow;
+static screen_event_t __screenEvent;
+static int __screenWindowSize[2];
+static bool __screenFullscreen = false;
+static EGLDisplay __eglDisplay = EGL_NO_DISPLAY;
+static EGLContext __eglContext = EGL_NO_CONTEXT;
+static EGLSurface __eglSurface = EGL_NO_SURFACE;
+static EGLConfig __eglConfig = 0;
+static int __orientationAngle;
+static bool __multiTouch = false;
+static bool __multiSampling = false;
+static float __pitch;
+static float __roll;
+static float __accelRawX;
+static float __accelRawY;
+static float __accelRawZ;
+static float __gyroRawX;
+static float __gyroRawY;
+static float __gyroRawZ;
+static const char* __glExtensions;
+static struct gestures_set * __gestureSet;
+static bitset<3> __gestureEventsProcessed;
+static bool __gestureSwipeRecognized = false;
+PFNGLBINDVERTEXARRAYOESPROC glBindVertexArray = NULL;
+PFNGLDELETEVERTEXARRAYSOESPROC glDeleteVertexArrays = NULL;
+PFNGLGENVERTEXARRAYSOESPROC glGenVertexArrays = NULL;
+PFNGLISVERTEXARRAYOESPROC glIsVertexArray = NULL;
+
+namespace gameplay
+{
+
+// Gets the Keyboard::Key enumeration constant that corresponds to the given QNX key code.
+static Keyboard::Key getKey(int qnxKeycode)
+{
+    switch (qnxKeycode)
+    {
+    case KEYCODE_SYSREQ:
+        return Keyboard::KEY_SYSREQ;
+    case KEYCODE_BREAK:
+        return Keyboard::KEY_BREAK;
+    case KEYCODE_MENU:
+        return Keyboard::KEY_MENU;
+    case KEYCODE_KP_ENTER:
+        return Keyboard::KEY_KP_ENTER;
+    case KEYCODE_PAUSE:
+        return Keyboard::KEY_PAUSE;
+    case KEYCODE_SCROLL_LOCK:
+        return Keyboard::KEY_SCROLL_LOCK;
+    case KEYCODE_PRINT:
+        return Keyboard::KEY_PRINT;
+    case KEYCODE_ESCAPE:
+        return Keyboard::KEY_ESCAPE;
+    case KEYCODE_BACKSPACE:
+        return Keyboard::KEY_BACKSPACE;
+    case KEYCODE_BACK_TAB:
+        return Keyboard::KEY_BACK_TAB;
+    case KEYCODE_TAB:
+        return Keyboard::KEY_TAB;
+    case KEYCODE_RETURN:
+        return Keyboard::KEY_RETURN;
+    case KEYCODE_CAPS_LOCK:
+        return Keyboard::KEY_CAPS_LOCK;
+    case KEYCODE_LEFT_SHIFT:
+    case KEYCODE_RIGHT_SHIFT:
+        return Keyboard::KEY_SHIFT;
+    case KEYCODE_LEFT_CTRL:
+    case KEYCODE_RIGHT_CTRL:
+        return Keyboard::KEY_CTRL;
+    case KEYCODE_LEFT_ALT:
+    case KEYCODE_RIGHT_ALT:
+        return Keyboard::KEY_ALT;
+    case KEYCODE_LEFT_HYPER:
+    case KEYCODE_RIGHT_HYPER:
+        return Keyboard::KEY_HYPER;
+    case KEYCODE_INSERT:
+        return Keyboard::KEY_INSERT;
+    case KEYCODE_HOME:
+        return Keyboard::KEY_HOME;
+    case KEYCODE_PG_UP:
+        return Keyboard::KEY_PG_UP;
+    case KEYCODE_DELETE:
+        return Keyboard::KEY_DELETE;
+    case KEYCODE_END:
+        return Keyboard::KEY_END;
+    case KEYCODE_PG_DOWN:
+        return Keyboard::KEY_PG_DOWN;
+    case KEYCODE_LEFT:
+        return Keyboard::KEY_LEFT_ARROW;
+    case KEYCODE_RIGHT:
+        return Keyboard::KEY_RIGHT_ARROW;
+    case KEYCODE_UP:
+        return Keyboard::KEY_UP_ARROW;
+    case KEYCODE_DOWN:
+        return Keyboard::KEY_DOWN_ARROW;
+    case KEYCODE_NUM_LOCK:
+        return Keyboard::KEY_NUM_LOCK;
+    case KEYCODE_KP_PLUS:
+        return Keyboard::KEY_KP_PLUS;
+    case KEYCODE_KP_MINUS:
+        return Keyboard::KEY_KP_MINUS;
+    case KEYCODE_KP_MULTIPLY:
+        return Keyboard::KEY_KP_MULTIPLY;
+    case KEYCODE_KP_DIVIDE:
+        return Keyboard::KEY_KP_DIVIDE;
+    case KEYCODE_KP_HOME:
+        return Keyboard::KEY_KP_HOME;
+    case KEYCODE_KP_UP:
+        return Keyboard::KEY_KP_UP;
+    case KEYCODE_KP_PG_UP:
+        return Keyboard::KEY_KP_PG_UP;
+    case KEYCODE_KP_LEFT:
+        return Keyboard::KEY_KP_LEFT;
+    case KEYCODE_KP_FIVE:
+        return Keyboard::KEY_KP_FIVE;
+    case KEYCODE_KP_RIGHT:
+        return Keyboard::KEY_KP_RIGHT;
+    case KEYCODE_KP_END:
+        return Keyboard::KEY_KP_END;
+    case KEYCODE_KP_DOWN:
+        return Keyboard::KEY_KP_DOWN;
+    case KEYCODE_KP_PG_DOWN:
+        return Keyboard::KEY_KP_PG_DOWN;
+    case KEYCODE_KP_INSERT:
+        return Keyboard::KEY_KP_INSERT;
+    case KEYCODE_KP_DELETE:
+        return Keyboard::KEY_KP_DELETE;
+    case KEYCODE_F1:
+        return Keyboard::KEY_F1;
+    case KEYCODE_F2:
+        return Keyboard::KEY_F2;
+    case KEYCODE_F3:
+        return Keyboard::KEY_F3;
+    case KEYCODE_F4:
+        return Keyboard::KEY_F4;
+    case KEYCODE_F5:
+        return Keyboard::KEY_F5;
+    case KEYCODE_F6:
+        return Keyboard::KEY_F6;
+    case KEYCODE_F7:
+        return Keyboard::KEY_F7;
+    case KEYCODE_F8:
+        return Keyboard::KEY_F8;
+    case KEYCODE_F9:
+        return Keyboard::KEY_F9;
+    case KEYCODE_F10:
+        return Keyboard::KEY_F10;
+    case KEYCODE_F11:
+        return Keyboard::KEY_F11;
+    case KEYCODE_F12:
+        return Keyboard::KEY_F12;
+    case KEYCODE_SPACE:
+        return Keyboard::KEY_SPACE;
+    case KEYCODE_RIGHT_PAREN:
+        return Keyboard::KEY_RIGHT_PARENTHESIS;
+    case KEYCODE_ZERO:
+        return Keyboard::KEY_ZERO;
+    case KEYCODE_EXCLAM:
+        return Keyboard::KEY_EXCLAM;
+    case KEYCODE_ONE:
+        return Keyboard::KEY_ONE;
+    case KEYCODE_AT:
+        return Keyboard::KEY_AT;
+    case KEYCODE_TWO:
+        return Keyboard::KEY_TWO;
+    case KEYCODE_NUMBER:
+        return Keyboard::KEY_NUMBER;
+    case KEYCODE_THREE:
+        return Keyboard::KEY_THREE;
+    case KEYCODE_DOLLAR:
+        return Keyboard::KEY_DOLLAR;
+    case KEYCODE_FOUR:
+        return Keyboard::KEY_FOUR;
+    case KEYCODE_PERCENT:
+        return Keyboard::KEY_PERCENT;
+    case KEYCODE_FIVE:
+        return Keyboard::KEY_FIVE;
+    case KEYCODE_CIRCUMFLEX:
+        return Keyboard::KEY_CIRCUMFLEX;
+    case KEYCODE_SIX:
+        return Keyboard::KEY_SIX;
+    case KEYCODE_AMPERSAND:
+        return Keyboard::KEY_AMPERSAND;
+    case KEYCODE_SEVEN:
+        return Keyboard::KEY_SEVEN;
+    case KEYCODE_ASTERISK:
+        return Keyboard::KEY_ASTERISK;
+    case KEYCODE_EIGHT:
+        return Keyboard::KEY_EIGHT;
+    case KEYCODE_LEFT_PAREN:
+        return Keyboard::KEY_LEFT_PARENTHESIS;
+    case KEYCODE_NINE:
+        return Keyboard::KEY_NINE;
+    case KEYCODE_EQUAL:
+        return Keyboard::KEY_EQUAL;
+    case KEYCODE_PLUS:
+        return Keyboard::KEY_PLUS;
+    case KEYCODE_LESS_THAN:
+        return Keyboard::KEY_LESS_THAN;
+    case KEYCODE_COMMA:
+        return Keyboard::KEY_COMMA;
+    case KEYCODE_UNDERSCORE:
+        return Keyboard::KEY_UNDERSCORE;
+    case KEYCODE_MINUS:
+        return Keyboard::KEY_MINUS;
+    case KEYCODE_GREATER_THAN:
+        return Keyboard::KEY_GREATER_THAN;
+    case KEYCODE_PERIOD:
+        return Keyboard::KEY_PERIOD;
+    case KEYCODE_COLON:
+        return Keyboard::KEY_COLON;
+    case KEYCODE_SEMICOLON:
+        return Keyboard::KEY_SEMICOLON;
+    case KEYCODE_QUESTION:
+        return Keyboard::KEY_QUESTION;
+    case KEYCODE_SLASH:
+        return Keyboard::KEY_SLASH;
+    case KEYCODE_GRAVE:
+        return Keyboard::KEY_GRAVE;
+    case KEYCODE_TILDE:
+        return Keyboard::KEY_TILDE;
+    case KEYCODE_LEFT_BRACE:
+        return Keyboard::KEY_LEFT_BRACE;
+    case KEYCODE_LEFT_BRACKET:
+        return Keyboard::KEY_LEFT_BRACKET;
+    case KEYCODE_BAR:
+        return Keyboard::KEY_BAR;
+    case KEYCODE_BACK_SLASH:
+        return Keyboard::KEY_BACK_SLASH;
+    case KEYCODE_RIGHT_BRACE:
+        return Keyboard::KEY_RIGHT_BRACE;
+    case KEYCODE_RIGHT_BRACKET:
+        return Keyboard::KEY_RIGHT_BRACKET;
+    case KEYCODE_QUOTE:
+        return Keyboard::KEY_QUOTE;
+    case KEYCODE_APOSTROPHE:
+        return Keyboard::KEY_APOSTROPHE;
+    case 0x20AC:
+        return Keyboard::KEY_EURO;
+    case KEYCODE_POUND_SIGN:
+        return Keyboard::KEY_POUND;
+    case KEYCODE_YEN_SIGN:
+        return Keyboard::KEY_YEN;
+    case KEYCODE_MIDDLE_DOT:
+        return Keyboard::KEY_MIDDLE_DOT;
+    case KEYCODE_CAPITAL_A:
+        return Keyboard::KEY_CAPITAL_A;
+    case KEYCODE_A:
+        return Keyboard::KEY_A;
+    case KEYCODE_CAPITAL_B:
+        return Keyboard::KEY_CAPITAL_B;
+    case KEYCODE_B:
+        return Keyboard::KEY_B;
+    case KEYCODE_CAPITAL_C:
+        return Keyboard::KEY_CAPITAL_C;
+    case KEYCODE_C:
+        return Keyboard::KEY_C;
+    case KEYCODE_CAPITAL_D:
+        return Keyboard::KEY_CAPITAL_D;
+    case KEYCODE_D:
+        return Keyboard::KEY_D;
+    case KEYCODE_CAPITAL_E:
+        return Keyboard::KEY_CAPITAL_E;
+    case KEYCODE_E:
+        return Keyboard::KEY_E;
+    case KEYCODE_CAPITAL_F:
+        return Keyboard::KEY_CAPITAL_F;
+    case KEYCODE_F:
+        return Keyboard::KEY_F;
+    case KEYCODE_CAPITAL_G:
+        return Keyboard::KEY_CAPITAL_G;
+    case KEYCODE_G:
+        return Keyboard::KEY_G;
+    case KEYCODE_CAPITAL_H:
+        return Keyboard::KEY_CAPITAL_H;
+    case KEYCODE_H:
+        return Keyboard::KEY_H;
+    case KEYCODE_CAPITAL_I:
+        return Keyboard::KEY_CAPITAL_I;
+    case KEYCODE_I:
+        return Keyboard::KEY_I;
+    case KEYCODE_CAPITAL_J:
+        return Keyboard::KEY_CAPITAL_J;
+    case KEYCODE_J:
+        return Keyboard::KEY_J;
+    case KEYCODE_CAPITAL_K:
+        return Keyboard::KEY_CAPITAL_K;
+    case KEYCODE_K:
+        return Keyboard::KEY_K;
+    case KEYCODE_CAPITAL_L:
+        return Keyboard::KEY_CAPITAL_L;
+    case KEYCODE_L:
+        return Keyboard::KEY_L;
+    case KEYCODE_CAPITAL_M:
+        return Keyboard::KEY_CAPITAL_M;
+    case KEYCODE_M:
+        return Keyboard::KEY_M;
+    case KEYCODE_CAPITAL_N:
+        return Keyboard::KEY_CAPITAL_N;
+    case KEYCODE_N:
+        return Keyboard::KEY_N;
+    case KEYCODE_CAPITAL_O:
+        return Keyboard::KEY_CAPITAL_O;
+    case KEYCODE_O:
+        return Keyboard::KEY_O;
+    case KEYCODE_CAPITAL_P:
+        return Keyboard::KEY_CAPITAL_P;
+    case KEYCODE_P:
+        return Keyboard::KEY_P;
+    case KEYCODE_CAPITAL_Q:
+        return Keyboard::KEY_CAPITAL_Q;
+    case KEYCODE_Q:
+        return Keyboard::KEY_Q;
+    case KEYCODE_CAPITAL_R:
+        return Keyboard::KEY_CAPITAL_R;
+    case KEYCODE_R:
+        return Keyboard::KEY_R;
+    case KEYCODE_CAPITAL_S:
+        return Keyboard::KEY_CAPITAL_S;
+    case KEYCODE_S:
+        return Keyboard::KEY_S;
+    case KEYCODE_CAPITAL_T:
+        return Keyboard::KEY_CAPITAL_T;
+    case KEYCODE_T:
+        return Keyboard::KEY_T;
+    case KEYCODE_CAPITAL_U:
+        return Keyboard::KEY_CAPITAL_U;
+    case KEYCODE_U:
+        return Keyboard::KEY_U;
+    case KEYCODE_CAPITAL_V:
+        return Keyboard::KEY_CAPITAL_V;
+    case KEYCODE_V:
+        return Keyboard::KEY_V;
+    case KEYCODE_CAPITAL_W:
+        return Keyboard::KEY_CAPITAL_W;
+    case KEYCODE_W:
+        return Keyboard::KEY_W;
+    case KEYCODE_CAPITAL_X:
+        return Keyboard::KEY_CAPITAL_X;
+    case KEYCODE_X:
+        return Keyboard::KEY_X;
+    case KEYCODE_CAPITAL_Y:
+        return Keyboard::KEY_CAPITAL_Y;
+    case KEYCODE_Y:
+        return Keyboard::KEY_Y;
+    case KEYCODE_CAPITAL_Z:
+        return Keyboard::KEY_CAPITAL_Z;
+    case KEYCODE_Z:
+        return Keyboard::KEY_Z;
+    default:
+        return Keyboard::KEY_NONE;
+    }
+}
+
+/**
+ * Returns the unicode value from the given QNX key code value.
+ * Some non-printable characters also have corresponding unicode values, such as backspace.
+ *
+ * @param qnxKeyCode The keyboard key code.
+ *
+ * @return The unicode value or 0 if the keycode did not represent a unicode key.
+ */
+static int getUnicode(int qnxKeyCode)
+{
+    if (qnxKeyCode >= KEYCODE_PC_KEYS && qnxKeyCode <= UNICODE_PRIVATE_USE_AREA_LAST)
+    {
+        switch (qnxKeyCode)
+        {
+        case KEYCODE_BACKSPACE:
+            return 0x0008;
+        case KEYCODE_TAB:
+            return 0x0009;
+        case KEYCODE_KP_ENTER:
+        case KEYCODE_RETURN:
+            return 0x000A;
+        case KEYCODE_ESCAPE:
+            return 0x001B;
+        // Win32 doesn't consider delete to be a key char.
+        default:
+            return 0;
+        }
+    }
+    return qnxKeyCode;
+}
+
+extern void print(const char* format, ...)
+{
+    GP_ASSERT(format);
+    va_list argptr;
+    va_start(argptr, format);
+    vfprintf(stderr, format, argptr);
+    va_end(argptr);
+}
+
+EGLenum checkErrorEGL(const char* msg)
+{
+    GP_ASSERT(msg);
+    static const char* errmsg[] =
+    {
+        "EGL function failed",
+        "EGL is not initialized, or could not be initialized, for the specified display",
+        "EGL cannot access a requested resource",
+        "EGL failed to allocate resources for the requested operation",
+        "EGL fail to access an unrecognized attribute or attribute value was passed in an attribute list",
+        "EGLConfig argument does not name a valid EGLConfig",
+        "EGLContext argument does not name a valid EGLContext",
+        "EGL current surface of the calling thread is no longer valid",
+        "EGLDisplay argument does not name a valid EGLDisplay",
+        "EGL arguments are inconsistent",
+        "EGLNativePixmapType argument does not refer to a valid native pixmap",
+        "EGLNativeWindowType argument does not refer to a valid native window",
+        "EGL one or more argument values are invalid",
+        "EGLSurface argument does not name a valid surface configured for rendering",
+        "EGL power management event has occurred",
+    };
+    EGLenum error = eglGetError();
+    fprintf(stderr, "%s: %s\n", msg, errmsg[error - EGL_SUCCESS]);
+    return error;
+}
+
+void gesture_callback(gesture_base_t* gesture, mtouch_event_t* event, void* param, int async)
+{
+    switch (gesture->type)
+    {
+    case GESTURE_SWIPE:
+        {
+            if ( __gestureEventsProcessed.test(Gesture::GESTURE_SWIPE) )
+            {
+                gesture_swipe_t* swipe = (gesture_swipe_t*)gesture;
+                if (!__gestureSwipeRecognized)
+                {
+                    Platform::gestureSwipeEventInternal(swipe->coords.x, swipe->coords.y, swipe->direction);
+                    __gestureSwipeRecognized = true;
+                }
+
+            }
+            break;
+        }
+
     case GESTURE_PINCH:
     case GESTURE_PINCH:
         {
         {
             if ( __gestureEventsProcessed.test(Gesture::GESTURE_PINCH) )
             if ( __gestureEventsProcessed.test(Gesture::GESTURE_PINCH) )
@@ -482,1164 +483,1172 @@ void gesture_callback(gesture_base_t* gesture, mtouch_event_t* event, void* para
                 Game::getInstance()->gesturePinchEvent(pinch->centroid.x, pinch->centroid.y, scale);
                 Game::getInstance()->gesturePinchEvent(pinch->centroid.x, pinch->centroid.y, scale);
             }
             }
             break;
             break;
-        }
-
-    case GESTURE_TAP:
-        {
-            if ( __gestureEventsProcessed.test(Gesture::GESTURE_TAP) )
-            {
-                gesture_tap_t* tap = (gesture_tap_t*)gesture;
-                Platform::gestureTapEventInternal(tap->touch_coords.x, tap->touch_coords.y);
-            }
-            break;
-        }
-
-    default:
-        break;
-
-    }
-}
-
-#ifdef USE_BLACKBERRY_GAMEPAD
-
-static const char* __vendorStrings[] =
-{
-    "SteelSeries",
-    "Nintendo",
-};
-
-static const char* __productStrings[] =
-{
-    "FREE",
-    "Wii Remote",
-};
-
-static const int __VIDs[] = {
-    0x1038,
-    0x057e,
-};
-
-static const int __PIDs[] = {
-    0x1412,
-    0x0306,
-};
-
-static const unsigned int __knownGamepads = 2;
-
-void queryGamepad(GamepadHandle handle, int* buttonCount, int* joystickCount, int* productId, int* vendorId, char* productString, char* vendorString)
-{
-    char id[128];
-    screen_get_device_property_iv(handle, SCREEN_PROPERTY_BUTTON_COUNT, buttonCount);
-    screen_get_device_property_cv(handle, SCREEN_PROPERTY_ID_STRING, 128, id);
-    screen_get_device_property_cv(handle, SCREEN_PROPERTY_PRODUCT, 64, productString);
-    screen_get_device_property_cv(handle, SCREEN_PROPERTY_VENDOR, 64, vendorString);
-
-    // Check for the existence of analog sticks.
-    int analogs[3];
-    if (!screen_get_device_property_iv(handle, SCREEN_PROPERTY_ANALOG0, analogs))
-    {
-    	++(*joystickCount);
-    }
-
-    if (!screen_get_device_property_iv(handle, SCREEN_PROPERTY_ANALOG1, analogs))
-    {
-    	++(*joystickCount);
-    }
-
-    // ID string format: A-BBBB-CCCC-D.D
-    // A is the device's index
-    // BBBB is the device's Vendor ID (in hexadecimal)
-    // CCCC is the device's Product ID (also in hexadecimal)
-    // D.D is the device's version number
-    char* token = strtok(id, "-");
-    token = strtok(NULL, "-");
-    if (token)
-    {
-	    *vendorId = strtol(token, NULL, 16);
-    }
-
-    token = strtok(NULL, "-");
-    if (token)
-    {
-        *productId = strtol(token, NULL, 16);
-    }
-
-    // For gamepads unknown to BB10,
-    // check VID and PID against gamepads known to gameplay.
-    if (strlen(productString) == 0 || strlen(vendorString) == 0)
-    {
-        for (unsigned int i = 0; i < __knownGamepads; ++i)
-        {
-            if (__VIDs[i] == *vendorId && __PIDs[i] == *productId)
-            {
-            	strcpy(vendorString, __vendorStrings[i]);
-                strcpy(productString, __productStrings[i]);
-            }
-        }
-    }
-}
-
-void Platform::pollGamepadState(Gamepad* gamepad)
-{
-	unsigned int buttons;
-    screen_get_device_property_iv(gamepad->_handle, SCREEN_PROPERTY_BUTTONS, (int*)&buttons);
-	gamepad->setButtons(buttons);
-
-    unsigned int i;
-    for (i = 0; i < gamepad->_joystickCount; ++i)
-    {
-        GP_ASSERT(i < 2);
-
-        int analog[3];
-        switch (i)
-        {
-        case 0:
-            screen_get_device_property_iv(gamepad->_handle, SCREEN_PROPERTY_ANALOG0, analog);
-            break;
-        case 1:
-            screen_get_device_property_iv(gamepad->_handle, SCREEN_PROPERTY_ANALOG1, analog);
-            break;
-        }
-        
-        // So far we've tested two gamepads with analog sticks on BlackBerry:
-        // the SteelSeries FREE, and the iControlPad.
-        // Both return values between -128 and +127, with the y axis starting from
-        // the top at -128.
-        // 1 / 128 == 0.0078125f
-        // 1 / 127 == 0.0078740157480315f
-        float x = (float)analog[0];
-        float y = -(float)analog[1];
-        x *= (x < 0) ? 0.0078125f : 0.0078740157480315f;
-        y *= (y > 0) ? 0.0078125f : 0.0078740157480315f;
-
-		gamepad->setJoystickValue(i, x, y);
-    }
-
-    for (i = 0; i < gamepad->_triggerCount; ++i)
-    {
-        GP_ASSERT(i < 2);
-
-        int analog[3];
-        switch (i)
-        {
-        case 0:
-            screen_get_device_property_iv(gamepad->_handle, SCREEN_PROPERTY_ANALOG0, analog);
-            break;
-        case 1:
-            screen_get_device_property_iv(gamepad->_handle, SCREEN_PROPERTY_ANALOG1, analog);
-            break;
-        }
-
-        float value = (float)analog[2] * 0.0078125f;
-		gamepad->setTriggerValue(i, value);
-    }
-}
-#else
-void Platform::pollGamepadState(Gamepad* gamepad)
-{
-}
-#endif
-
-Platform::Platform(Game* game)
-    : _game(game)
-{
-}
-
-Platform::~Platform()
-{
-    if (__eglDisplay != EGL_NO_DISPLAY)
-    {
-        eglMakeCurrent(__eglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
-    }
-
-    if (__eglSurface != EGL_NO_SURFACE)
-    {
-        eglDestroySurface(__eglDisplay, __eglSurface);
-        __eglSurface = EGL_NO_SURFACE;
-    }
-
-    if (__eglContext != EGL_NO_CONTEXT)
-    {
-        eglDestroyContext(__eglDisplay, __eglContext);
-        __eglContext = EGL_NO_CONTEXT;
-    }
-
-    if (__eglDisplay != EGL_NO_DISPLAY)
-    {
-        eglTerminate(__eglDisplay);
-        __eglDisplay = EGL_NO_DISPLAY;
-    }
-
-    if (__screenWindow)
-    {
-        screen_destroy_window(__screenWindow);
-        __screenWindow = NULL;
-    }
-
-    if (__screenEvent)
-    {
-        screen_destroy_event(__screenEvent);
-        __screenEvent = NULL;
-    }
-
-    if (__screenContext)
-    {
-        screen_destroy_context(__screenContext);
-        __screenContext = NULL;
-    }
-}
-
-Platform* Platform::create(Game* game, void* attachToWindow)
-{
-    FileSystem::setResourcePath("./app/native/");
-    Platform* platform = new Platform(game);
-
-    // Query game config
-    int samples = 0;
-    Properties* config = Game::getInstance()->getConfig()->getNamespace("window", true);
-    if (config)
-    {
-        samples = std::max(config->getInt("samples"), 0);
-    }
-
-    __gestureSet = gestures_set_alloc();
-    swipe_gesture_alloc(NULL, gesture_callback, __gestureSet);
-    pinch_gesture_alloc(NULL, gesture_callback, __gestureSet);
-    tap_gesture_alloc(NULL, gesture_callback, __gestureSet);
-
-    bps_initialize();
-
-    // Initialize navigator and orientation
-    static const int SENSOR_RATE = 25000; // (25000 microseconds = 40 Hz)
-    sensor_set_rate(SENSOR_TYPE_AZIMUTH_PITCH_ROLL, SENSOR_RATE);
-    sensor_set_rate(SENSOR_TYPE_ACCELEROMETER, SENSOR_RATE);
-    sensor_set_rate(SENSOR_TYPE_GYROSCOPE, SENSOR_RATE);
-    sensor_set_skip_duplicates(SENSOR_TYPE_AZIMUTH_PITCH_ROLL, true);
-    sensor_set_skip_duplicates(SENSOR_TYPE_ACCELEROMETER, true);
-    sensor_set_skip_duplicates(SENSOR_TYPE_GYROSCOPE, true);
-    sensor_request_events(SENSOR_TYPE_AZIMUTH_PITCH_ROLL);
-    sensor_request_events(SENSOR_TYPE_ACCELEROMETER);
-    sensor_request_events(SENSOR_TYPE_GYROSCOPE);
-    navigator_request_events(0);
-    navigator_rotation_lock(true);
-    __orientationAngle = atoi(getenv("ORIENTATION"));
-
-    int rc = 0;
-    int screenFormat = SCREEN_FORMAT_RGBA8888;
-#ifdef __X86__
-    int screenUsage = SCREEN_USAGE_OPENGL_ES2;
-#else
-    int screenUsage = SCREEN_USAGE_DISPLAY|SCREEN_USAGE_OPENGL_ES2; // Physical device copy directly into physical display
-#endif
-    int screenSwapInterval = WINDOW_VSYNC ? 1 : 0;
-    int screenTransparency = SCREEN_TRANSPARENCY_NONE;
-
-    char *width_str = getenv("WIDTH");
-    char *height_str = getenv("HEIGHT");
-
-    // Hard-coded to (0,0).
-    int windowPosition[] =
-    {
-        0, 0
-    };
-
-    EGLint eglConfigCount;
-
-    // Hard-coded to 32-bit/OpenGL ES 2.0.
-    // NOTE: EGL_SAMPLE_BUFFERS and EGL_SAMPLES MUST remain at the beginning of the attribute list
-    // since they are expected to be at indices 0-3 in config fallback code later.
-    EGLint eglConfigAttrs[] =
-    {
-        EGL_SAMPLE_BUFFERS,     samples > 0 ? 1 : 0,
-        EGL_SAMPLES,            samples,
-        EGL_RED_SIZE,           8,
-        EGL_GREEN_SIZE,         8,
-        EGL_BLUE_SIZE,          8,
-        EGL_ALPHA_SIZE,         8,
-        EGL_DEPTH_SIZE,         24,
-        EGL_STENCIL_SIZE,       8,
-        EGL_SURFACE_TYPE,       EGL_WINDOW_BIT,
-        EGL_RENDERABLE_TYPE,    EGL_OPENGL_ES2_BIT,
-        EGL_NONE
-    };
-    __multiSampling = samples > 0;
-
-    const EGLint eglContextAttrs[] =
-    {
-        EGL_CONTEXT_CLIENT_VERSION,    2,
-        EGL_NONE
-    };
-
-    const EGLint eglSurfaceAttrs[] =
-    {
-        EGL_RENDER_BUFFER,    EGL_BACK_BUFFER,
-        EGL_NONE
-    };
-
-    // Create the screen context.
-    rc = screen_create_context(&__screenContext, 0);
-    if (rc)
-    {
-        perror("screen_create_context");
-        goto error;
-    }
-
-    // Create the screen window.
-    rc = screen_create_window(&__screenWindow, __screenContext);
-    if (rc)
-    {
-        perror("screen_create_window");
-        goto error;
-    }
-
-    // Set/get any window properties.
-    rc = screen_set_window_property_iv(__screenWindow, SCREEN_PROPERTY_FORMAT, &screenFormat);
-    if (rc)
-    {
-        perror("screen_set_window_property_iv(SCREEN_PROPERTY_FORMAT)");
-        goto error;
-    }
-
-    rc = screen_set_window_property_iv(__screenWindow, SCREEN_PROPERTY_USAGE, &screenUsage);
-    if (rc)
-    {
-        perror("screen_set_window_property_iv(SCREEN_PROPERTY_USAGE)");
-        goto error;
-    }
-
-    if (width_str && height_str)
-    {
-        __screenWindowSize[0] = atoi(width_str);
-        __screenWindowSize[1] = atoi(height_str);
-    }
-    else
-    {
-        screen_display_t screen_display;
-        rc = screen_get_window_property_pv(__screenWindow, SCREEN_PROPERTY_DISPLAY, (void **)&screen_display);
-        if (rc)
-        {
-            perror("screen_get_window_property_pv(SCREEN_PROPERTY_DISPLAY)");
-            goto error;
-        }
-
-        screen_display_mode_t screen_mode;
-        rc = screen_get_display_property_pv(screen_display, SCREEN_PROPERTY_MODE, (void**)&screen_mode);
-        if (rc)
-        {
-            perror("screen_get_display_property_pv(SCREEN_PROPERTY_MODE)");
-            goto error;
-        }
-
-        int size[2];
-        rc = screen_get_window_property_iv(__screenWindow, SCREEN_PROPERTY_BUFFER_SIZE, size);
-        if (rc)
-        {
-            perror("screen_get_window_property_iv(SCREEN_PROPERTY_BUFFER_SIZE)");
-            goto error;
-        }
-
-        __screenWindowSize[0] = size[0];
-        __screenWindowSize[1] = size[1];
-
-        if ((__orientationAngle == 0) || (__orientationAngle == 180))
-        {
-            if (((screen_mode.width > screen_mode.height) && (size[0] < size[1])) ||
-                ((screen_mode.width < screen_mode.height) && (size[0] > size[1])))
-            {
-                __screenWindowSize[1] = size[0];
-                __screenWindowSize[0] = size[1];
-            }
-        }
-        else if ((__orientationAngle == 90) || (__orientationAngle == 270))
-        {
-            if (((screen_mode.width > screen_mode.height) && (size[0] > size[1])) ||
-                ((screen_mode.width < screen_mode.height) && (size[0] < size[1])))
-            {
-                __screenWindowSize[1] = size[0];
-                __screenWindowSize[0] = size[1];
-            }
-        }
-        else
-        {
-            perror("Navigator returned an unexpected orientation angle.");
-            goto error;
-        }
-
-
-        rc = screen_set_window_property_iv(__screenWindow, SCREEN_PROPERTY_ROTATION, &__orientationAngle);
-        if (rc)
-        {
-            perror("screen_set_window_property_iv(SCREEN_PROPERTY_ROTATION)");
-            goto error;
-        }
-    }
-
-    rc = screen_set_window_property_iv(__screenWindow, SCREEN_PROPERTY_BUFFER_SIZE, __screenWindowSize);
-    if (rc)
-    {
-        perror("screen_set_window_property_iv(SCREEN_PROPERTY_BUFFER_SIZE)");
-        goto error;
-    }
-
-    if (windowPosition[0] != 0 || windowPosition[1] != 0)
-    {
-        rc = screen_set_window_property_iv(__screenWindow, SCREEN_PROPERTY_POSITION, windowPosition);
-        if (rc)
-        {
-            perror("screen_set_window_property_iv(SCREEN_PROPERTY_POSITION)");
-            goto error;
-        }
-    }
-
-    rc = screen_set_window_property_iv(__screenWindow, SCREEN_PROPERTY_TRANSPARENCY, &screenTransparency);
-    if (rc)
-    {
-        perror("screen_set_window_property_iv(SCREEN_PROPERTY_TRANSPARENCY)");
-        goto error;
-    }
-
-    // Double buffered.
-    rc = screen_create_window_buffers(__screenWindow, 2);
-    if (rc)
-    {
-        perror("screen_create_window_buffers");
-        goto error;
-    }
-
-    // Create screen event object.
-    rc = screen_create_event(&__screenEvent);
-    if (rc)
-    {
-        perror("screen_create_event");
-        goto error;
-    }
-
-    // Request screen events.
-    screen_request_events(__screenContext);
-
-    // Get the EGL display and initialize.
-    __eglDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY);
-    if (__eglDisplay == EGL_NO_DISPLAY)
-    {
-        perror("eglGetDisplay");
-        goto error;
-    }
-    if (eglInitialize(__eglDisplay, NULL, NULL) != EGL_TRUE)
-    {
-        perror("eglInitialize");
-        goto error;
-    }
-
-    if (eglChooseConfig(__eglDisplay, eglConfigAttrs, &__eglConfig, 1, &eglConfigCount) != EGL_TRUE || eglConfigCount == 0)
-    {
-        bool success = false;
-        while (samples)
-        {
-            // Try lowering the MSAA sample count until we find a supported config
-            GP_WARN("Failed to find a valid EGL configuration with EGL samples=%d. Trying samples=%d instead.", samples, samples/2);
-            samples /= 2;
-            eglConfigAttrs[1] = samples > 0 ? 1 : 0;
-            eglConfigAttrs[3] = samples;
-            if (eglChooseConfig(__eglDisplay, eglConfigAttrs, &__eglConfig, 1, &eglConfigCount) == EGL_TRUE && eglConfigCount > 0)
-            {
-                success = true;
-                break;
-            }
-        }
-
-        __multiSampling = samples > 0;
-
-        if (!success)
-        {
-            checkErrorEGL("eglChooseConfig");
-            goto error;
-        }
-    }
-
-    __eglContext = eglCreateContext(__eglDisplay, __eglConfig, EGL_NO_CONTEXT, eglContextAttrs);
-    if (__eglContext == EGL_NO_CONTEXT)
-    {
-        checkErrorEGL("eglCreateContext");
-        goto error;
-    }
-
-    __eglSurface = eglCreateWindowSurface(__eglDisplay, __eglConfig, __screenWindow, eglSurfaceAttrs);
-    if (__eglSurface == EGL_NO_SURFACE)
-    {
-        checkErrorEGL("eglCreateWindowSurface");
-        goto error;
-    }
-
-    if (eglMakeCurrent(__eglDisplay, __eglSurface, __eglSurface, __eglContext) != EGL_TRUE)
-    {
-        checkErrorEGL("eglMakeCurrent");
-        goto error;
-    }
-
-    // Set vsync.
-    eglSwapInterval(__eglDisplay, screenSwapInterval);
-
-    // Initialize OpenGL ES extensions.
-    __glExtensions = (const char*)glGetString(GL_EXTENSIONS);
-
-    if (strstr(__glExtensions, "GL_OES_vertex_array_object") || strstr(__glExtensions, "GL_ARB_vertex_array_object"))
-    {
-        glBindVertexArray = (PFNGLBINDVERTEXARRAYOESPROC)eglGetProcAddress("glBindVertexArrayOES");
-        glDeleteVertexArrays = (PFNGLDELETEVERTEXARRAYSOESPROC)eglGetProcAddress("glDeleteVertexArraysOES");
-        glGenVertexArrays = (PFNGLGENVERTEXARRAYSOESPROC)eglGetProcAddress("glGenVertexArraysOES");
-        glIsVertexArray = (PFNGLISVERTEXARRAYOESPROC)eglGetProcAddress("glIsVertexArrayOES");
-    }
-
- #ifdef USE_BLACKBERRY_GAMEPAD
-
-    screen_device_t* screenDevs;
-
-    // Discover initial gamepad devices.
-    int count;
-    screen_get_context_property_iv(__screenContext, SCREEN_PROPERTY_DEVICE_COUNT, &count);
-    screenDevs = (screen_device_t*)calloc(count, sizeof(screen_device_t));
-    screen_get_context_property_pv(__screenContext, SCREEN_PROPERTY_DEVICES, (void**)screenDevs);
-
-	for (int i = 0; i < count; i++) 
-    {
-	    int type;
-        screen_get_device_property_iv(screenDevs[i], SCREEN_PROPERTY_TYPE, &type);
-
-        if (type == SCREEN_EVENT_GAMEPAD || type == SCREEN_EVENT_JOYSTICK)
-        {
-            int buttonCount = 0;
-            int joystickCount = 0;
-            int productId;
-            int vendorId;
-            char productString[64];
-            char vendorString[64];
-            queryGamepad(screenDevs[i], &buttonCount, &joystickCount, &productId, &vendorId, productString, vendorString);
-            Platform::gamepadEventConnectedInternal(screenDevs[i], buttonCount, joystickCount, 0, vendorId, productId, vendorString, productString);
-        }
-	}
-	free(screenDevs);
-#endif
-
-    return platform;
-
-error:
-
-    return NULL;
-}
-
-/**
- * Convert the timespec into milliseconds.
- */
-double timespec2millis(struct timespec *a)
-{
-    GP_ASSERT(a);
-    return (1000.0 * a->tv_sec) + (0.000001 * a->tv_nsec);
-}
-
-/**
- * Fires a mouse event or a touch event on the game.
- * If the mouse event is not consumed, a touch event is fired instead.
- *
- * @param mouseEvent The mouse event to fire.
- * @param touchEvent The touch event to fire.
- * @param x The x position of the touch in pixels.
- * @param y The y position of the touch in pixels.
- */
-void mouseOrTouchEvent(Mouse::MouseEvent mouseEvent, Touch::TouchEvent touchEvent, int x, int y)
-{
-    if (!gameplay::Platform::mouseEventInternal(mouseEvent, x, y, 0))
-    {
-        Platform::touchEventInternal(touchEvent, x, y, 0, true);
-    }
-}
-
-int Platform::enterMessagePump()
-{
-    GP_ASSERT(_game);
-
-    int rc;
-    int eventType;
-    int flags;
-    int value;
-    int position[2];
-    int domain;
-    mtouch_event_t touchEvent;
-    bool suspended = false;
-
-    // Get the initial time.
-    clock_gettime(CLOCK_REALTIME, &__timespec);
-    __timeStart = timespec2millis(&__timespec);
-    __timeAbsolute = 0L;
-
-    _game->run();
-
-    // Message loop.
-    while (true)
-    {
-        bps_event_t* event = NULL;
-        
-        while (true)
-        {
-            rc = bps_get_event(&event, 1);
-            GP_ASSERT(rc == BPS_SUCCESS);
-
-            if (event == NULL)
-                break;
-
-            domain = bps_event_get_domain(event);
-
-            if (domain == screen_get_domain())
-            {
-                __screenEvent = screen_event_get_event(event);
-                screen_get_event_property_iv(__screenEvent, SCREEN_PROPERTY_TYPE, &eventType);
-                switch (eventType)
-                {
-                    case SCREEN_EVENT_MTOUCH_TOUCH:
-                    {
-                        screen_get_mtouch_event(__screenEvent, &touchEvent, 0);
-                        if (__gestureEventsProcessed.any())
-                            rc = gestures_set_process_event(__gestureSet, &touchEvent, NULL);
-
-                        if ( !rc && (__multiTouch || touchEvent.contact_id == 0) )
-                        {
-                            gameplay::Platform::touchEventInternal(Touch::TOUCH_PRESS, touchEvent.x, touchEvent.y, touchEvent.contact_id);
-                        }
-                        break;
-                    }
-
-                    case SCREEN_EVENT_MTOUCH_RELEASE:
-                    {
-                        screen_get_mtouch_event(__screenEvent, &touchEvent, 0);
-                        if (__gestureEventsProcessed.any())
-                            rc = gestures_set_process_event(__gestureSet, &touchEvent, NULL);
-
-                        if ( !rc && (__multiTouch || touchEvent.contact_id == 0) )
-                        {
-                            gameplay::Platform::touchEventInternal(Touch::TOUCH_RELEASE, touchEvent.x, touchEvent.y, touchEvent.contact_id);
-                        }
-                        if (__gestureSwipeRecognized)
-                        {
-                            __gestureSwipeRecognized = false;
-                        }
-                        break;
-                    }
-
-                    case SCREEN_EVENT_MTOUCH_MOVE:
-                    {
-                        screen_get_mtouch_event(__screenEvent, &touchEvent, 0);
-                        if (__gestureEventsProcessed.any())
-                            rc = gestures_set_process_event(__gestureSet, &touchEvent, NULL);
-
-                        if ( !rc && (__multiTouch || touchEvent.contact_id == 0) )
-                        {
-                            gameplay::Platform::touchEventInternal(Touch::TOUCH_MOVE, touchEvent.x, touchEvent.y, touchEvent.contact_id);
-                        }
-                        break;
-                    }
-
-                    case SCREEN_EVENT_POINTER:
-                    {
-                        static int mouse_pressed = 0;
-                        int buttons;
-                        int wheel;
-                        // A move event will be fired unless a button state changed.
-                        bool move = true;
-                        bool left_move = false;
-                        // This is a mouse move event, it is applicable to a device with a usb mouse or simulator.
-                        screen_get_event_property_iv(__screenEvent, SCREEN_PROPERTY_BUTTONS, &buttons);
-                        screen_get_event_property_iv(__screenEvent, SCREEN_PROPERTY_SOURCE_POSITION, position);
-                        screen_get_event_property_iv(__screenEvent, SCREEN_PROPERTY_MOUSE_WHEEL, &wheel);
-
-                        // Handle left mouse. Interpret as touch if the left mouse event is not consumed.
-                        if (buttons & SCREEN_LEFT_MOUSE_BUTTON)
-                        {
-                            if (mouse_pressed & SCREEN_LEFT_MOUSE_BUTTON)
-                            {
-                                left_move = true;
-                            }
-                            else
-                            {
-                                move = false;
-                                mouse_pressed |= SCREEN_LEFT_MOUSE_BUTTON;
-                                mouseOrTouchEvent(Mouse::MOUSE_PRESS_LEFT_BUTTON, Touch::TOUCH_PRESS, position[0], position[1]);
-                            }
-                        }
-                        else if (mouse_pressed & SCREEN_LEFT_MOUSE_BUTTON)
-                        {
-                            move = false;
-                            mouse_pressed &= ~SCREEN_LEFT_MOUSE_BUTTON;
-                            mouseOrTouchEvent(Mouse::MOUSE_RELEASE_LEFT_BUTTON, Touch::TOUCH_RELEASE, position[0], position[1]);
-                        }
-
-                        // Handle right mouse.
-                        if (buttons & SCREEN_RIGHT_MOUSE_BUTTON)
-                        {
-                            if ((mouse_pressed & SCREEN_RIGHT_MOUSE_BUTTON) == 0)
-                            {
-                                move = false;
-                                mouse_pressed |= SCREEN_RIGHT_MOUSE_BUTTON;
-                                gameplay::Platform::mouseEventInternal(Mouse::MOUSE_PRESS_RIGHT_BUTTON, position[0], position[1], 0);
-                            }
-                        }
-                        else if (mouse_pressed & SCREEN_RIGHT_MOUSE_BUTTON)
-                        {
-                            move = false;
-                            mouse_pressed &= ~SCREEN_RIGHT_MOUSE_BUTTON;
-                            gameplay::Platform::mouseEventInternal(Mouse::MOUSE_RELEASE_RIGHT_BUTTON, position[0], position[1], 0);
-                        }
-
-                        // Handle middle mouse.
-                        if (buttons & SCREEN_MIDDLE_MOUSE_BUTTON)
-                        {
-                            if ((mouse_pressed & SCREEN_MIDDLE_MOUSE_BUTTON) == 0)
-                            {
-                                move = false;
-                                mouse_pressed |= SCREEN_MIDDLE_MOUSE_BUTTON;
-                                gameplay::Platform::mouseEventInternal(Mouse::MOUSE_PRESS_MIDDLE_BUTTON, position[0], position[1], 0);
-                            }
-                        }
-                        else if (mouse_pressed & SCREEN_MIDDLE_MOUSE_BUTTON)
-                        {
-                            move = false;
-                            mouse_pressed &= ~SCREEN_MIDDLE_MOUSE_BUTTON;
-                            gameplay::Platform::mouseEventInternal(Mouse::MOUSE_RELEASE_MIDDLE_BUTTON, position[0], position[1], 0);
-                        }
-
-                        // Fire a move event if none of the buttons changed.
-                        if (left_move)
-                        {
-                            mouseOrTouchEvent(Mouse::MOUSE_MOVE, Touch::TOUCH_MOVE, position[0], position[1]);
-                        }
-                        else if (move)
-                        {
-                            gameplay::Platform::mouseEventInternal(Mouse::MOUSE_MOVE, position[0], position[1], 0);
-                        }
-
-                        // Handle mouse wheel events.
-                        if (wheel)
-                        {
-                            gameplay::Platform::mouseEventInternal(Mouse::MOUSE_WHEEL, position[0], position[1], -wheel);
-                        }
-                        break;
-                    }
-
-                    case SCREEN_EVENT_KEYBOARD:
-                    {
-                        screen_get_event_property_iv(__screenEvent, SCREEN_PROPERTY_KEY_FLAGS, &flags);
-                        screen_get_event_property_iv(__screenEvent, SCREEN_PROPERTY_KEY_SYM, &value);
-                        gameplay::Keyboard::KeyEvent evt = (flags & KEY_DOWN) ? gameplay::Keyboard::KEY_PRESS :  gameplay::Keyboard::KEY_RELEASE;
-                        // Suppress key repeats.
-                        if ((flags & KEY_REPEAT) == 0)
-                        {
-                            keyEventInternal(evt, getKey(value));
-                            if (evt == gameplay::Keyboard::KEY_PRESS && (flags & KEY_SYM_VALID))
-                            {
-                                int unicode = getUnicode(value);
-                                if (unicode)
-                                    keyEventInternal(gameplay::Keyboard::KEY_CHAR, unicode);
-                            }
-                        }
-                        break;
-                    }
-#ifdef USE_BLACKBERRY_GAMEPAD
-                    case SCREEN_EVENT_DEVICE:
-                    {
-                        // A device was attached or removed.
-                        screen_device_t device;
-                        int attached;
-
-                        screen_get_event_property_pv(__screenEvent, SCREEN_PROPERTY_DEVICE, (void**)&device);
-                        screen_get_event_property_iv(__screenEvent, SCREEN_PROPERTY_ATTACHED, &attached);
-
-                        if (attached)
-                        {
-                            int type;
-                            screen_get_device_property_iv(device, SCREEN_PROPERTY_TYPE, &type);
-                            if (type == SCREEN_EVENT_GAMEPAD || type == SCREEN_EVENT_JOYSTICK)
-                            {
-                                int buttonCount = 0;
-                                int joystickCount = 0;
-                                int productId;
-                                int vendorId;
-                                char productString[64];
-                                char vendorString[64];
-                                queryGamepad(device, &buttonCount, &joystickCount, &productId, &vendorId, productString, vendorString);
-                                Platform::gamepadEventConnectedInternal(device, buttonCount, joystickCount, 0, vendorId, productId, vendorString, productString);
-                            }
-                        }
-                        else
-                        {
-                            Platform::gamepadEventDisconnectedInternal(device);
-                        }
-
-                        break;
-                    }
-#endif
-                    default:
-                        break;
-                }
-            }
-            else if (domain == navigator_get_domain())
-            {
-                switch (bps_event_get_code(event))
-                {
-                case NAVIGATOR_SWIPE_DOWN:
-                    _game->menuEvent();
-                    break;
-                case NAVIGATOR_WINDOW_STATE:
-                {
-                    navigator_window_state_t state = navigator_event_get_window_state(event);
-                    switch (state)
-                    {
-                    case NAVIGATOR_WINDOW_FULLSCREEN:
-                        if (!__screenFullscreen)
-                            __screenFullscreen = true;
-                        _game->resume();
-                        suspended = false;
-                        break;
-                    case NAVIGATOR_WINDOW_THUMBNAIL:
-                    case NAVIGATOR_WINDOW_INVISIBLE:
-                        if (__screenFullscreen && !suspended)
-                        {
-                            _game->pause();
-                            suspended = true;
-                        }
-                        break;
-                    }
-                    break;
-                }
-                case NAVIGATOR_EXIT:
-                	// Call Game::shutdown directly, instead of Game::exit.
-                	// We need to do this since exit() queues a request to shutdown for the
-                	// next frame, which will never get executed because we are suspended.
-                    _game->shutdown();
-                    break;
-                }
-            }
-            else if (domain == sensor_get_domain())
-            {
-                if (bps_event_get_code(event) == SENSOR_AZIMUTH_PITCH_ROLL_READING)
-                {
-                    float azimuth;
-                    sensor_event_get_apr(event, &azimuth, &__pitch, &__roll);
-                }
-                else if (bps_event_get_code(event) == SENSOR_ACCELEROMETER_READING)
-                {
-                    sensor_event_get_xyz(event, &__accelRawX, &__accelRawY, &__accelRawZ);
-                }
-                else if (bps_event_get_code(event) == SENSOR_GYROSCOPE_READING)
-                {
-                    sensor_event_get_xyz(event, &__gyroRawX, &__gyroRawY, &__gyroRawZ);
-                }
-            }
-        }
-
-        // If we are done, then exit.
-        if (_game->getState() == Game::UNINITIALIZED)
-            break;
-
-        if (!suspended)
-        {
-            _game->frame();
-
-            // Post the new frame to the display.
-            // Note that there are a couple cases where eglSwapBuffers could fail
-            // with an error code that requires a certain level of re-initialization:
-            //
-            // 1) EGL_BAD_NATIVE_WINDOW - Called when the surface we're currently using
-            //    is invalidated. This would require us to destroy our EGL surface,
-            //    close our OpenKODE window, and start again.
-            //
-            // 2) EGL_CONTEXT_LOST - Power management event that led to our EGL context
-            //    being lost. Requires us to re-create and re-initalize our EGL context
-            //    and all OpenGL ES state.
-            //
-            // For now, if we get these, we'll simply exit.
-            rc = eglSwapBuffers(__eglDisplay, __eglSurface);
-            if (rc != EGL_TRUE)
-            {
-                _game->shutdown();
-                perror("eglSwapBuffers");
-                break;
-            }
-        }
-    }
-
-    screen_stop_events(__screenContext);
-    bps_shutdown();
-    screen_destroy_context(__screenContext);
-
-    return 0;
-}
-    
-void Platform::signalShutdown() 
-{
-    // nothing to do  
-}
-
-bool Platform::canExit()
-{
-    return true;
-}
-
-unsigned int Platform::getDisplayWidth()
-{
-    return __screenWindowSize[0];
-}
-
-unsigned int Platform::getDisplayHeight()
-{
-    return __screenWindowSize[1];
-}
-
-double Platform::getAbsoluteTime()
-{
-    clock_gettime(CLOCK_REALTIME, &__timespec);
-    double now = timespec2millis(&__timespec);
-    __timeAbsolute = now - __timeStart;
-
-    return __timeAbsolute;
-}
-
-void Platform::setAbsoluteTime(double time)
-{
-    __timeAbsolute = time;
-}
-
-bool Platform::isVsync()
-{
-    return __vsync;
-}
-
-void Platform::setVsync(bool enable)
-{
-    eglSwapInterval(__eglDisplay, enable ? 1 : 0);
-    __vsync = enable;
-}
-
-void Platform::swapBuffers()
-{
-    if (__eglDisplay && __eglSurface)
-        eglSwapBuffers(__eglDisplay, __eglSurface);
-}
-
-void Platform::sleep(long ms)
-{
-    usleep(ms * 1000);
-}
-
-void Platform::setMultiSampling(bool enabled)
-{
-    if (enabled == __multiSampling)
-    {
-        return;
-    }
-
-    //todo
-
-    __multiSampling = enabled;
-}
-
-bool Platform::isMultiSampling()
-{
-    return __multiSampling;
-}
-
-void Platform::setMultiTouch(bool enabled)
-{
-    __multiTouch = enabled;
-}
-
-bool Platform::isMultiTouch()
-{
-    return __multiTouch;
-}
-
-bool Platform::hasAccelerometer()
-{
-    return true;
-}
-
-void Platform::getAccelerometerValues(float* pitch, float* roll)
-{
-    GP_ASSERT(pitch);
-    GP_ASSERT(roll);
-
-    switch(__orientationAngle)
-    {
-    // Landscape based device adjusting for landscape game mode
-    case 0:
-        if (pitch)
-            *pitch = __pitch;
-        if (roll)
-            *roll = -__roll;
-        break;
-    case 180:
-        if (pitch)
-            *pitch = -__pitch;
-        if (roll)
-            *roll = __roll;
-        break;
-
-    // Portrait based device adjusting for landscape game mode
-    case 90:
-        if (pitch)
-            *pitch = -__roll;
-        if (roll)
-            *roll = -__pitch;
-        break;
-
-    case  270:
-        if (pitch)
-            *pitch = __roll;
-        if (roll)
-            *roll = __pitch;
-        break;
-
-    default:
-        break;
-    }
-}
-
-void Platform::getRawSensorValues(float* accelX, float* accelY, float* accelZ, float* gyroX, float* gyroY, float* gyroZ)
-{
-	if (accelX)
-	{
-		*accelX = __accelRawX;
-	}
-
-	if (accelY)
-	{
-		*accelY = __accelRawY;
-	}
-
-	if (accelZ)
-	{
-		*accelZ = __accelRawZ;
-	}
-
-	if (gyroX)
-	{
-		*gyroX = __gyroRawX;
-	}
-
-	if (gyroY)
-	{
-		*gyroY = __gyroRawY;
-	}
-
-	if (gyroZ)
-	{
-		*gyroZ = __gyroRawZ;
-	}
-}
-
-void Platform::getArguments(int* argc, char*** argv)
-{
-    if (argc)
-        *argc = __argc;
-    if (argv)
-        *argv = __argv;
-}
-
-bool Platform::hasMouse()
-{
-    // not supported
-    return false;
-}
-
-void Platform::setMouseCaptured(bool captured)
-{
-    // not supported
-}
-
-bool Platform::isMouseCaptured()
-{
-    // not supported
-    return false;
-}
-
-void Platform::setCursorVisible(bool visible)
-{
-    // not supported
-}
-
-bool Platform::isCursorVisible()
-{
-    // not supported
-    return false;
-}
-
-void Platform::displayKeyboard(bool display)
-{
-    if (display)
-        virtualkeyboard_show();
-    else
-        virtualkeyboard_hide();
-}
-
-void Platform::shutdownInternal()
-{
-    Game::getInstance()->shutdown();
-}
-
-bool Platform::isGestureSupported(Gesture::GestureEvent evt)
-{
-    // All are supported no need to test the bitset
-    return true;
-}
-
-void Platform::registerGesture(Gesture::GestureEvent evt)
-{
-    switch(evt)
-    {
-    case Gesture::GESTURE_ANY_SUPPORTED:
-        __gestureEventsProcessed.set();
-        break;
-
-    case Gesture::GESTURE_SWIPE:
-    case Gesture::GESTURE_PINCH:
-    case Gesture::GESTURE_TAP:
-        __gestureEventsProcessed.set(evt);
-        break;
-
-    default:
-        break;
-    }
-}
-
-void Platform::unregisterGesture(Gesture::GestureEvent evt)
-{
-    switch(evt)
-    {
-    case Gesture::GESTURE_ANY_SUPPORTED:
-        __gestureEventsProcessed.reset();
-        break;
-
-    case Gesture::GESTURE_SWIPE:
-    case Gesture::GESTURE_PINCH:
-    case Gesture::GESTURE_TAP:
-        __gestureEventsProcessed.set(evt, 0);
-        break;
-
-    default:
-        break;
-    }
-}
-    
-bool Platform::isGestureRegistered(Gesture::GestureEvent evt)
-{
-    return __gestureEventsProcessed.test(evt);
-}
-
-bool Platform::launchURL(const char* url)
-{
-    if (url == NULL || *url == '\0')
-        return false;
-
-    return navigator_invoke(url, NULL) == BPS_SUCCESS;
-}
-
-}
-
-#endif
+        }
+
+    case GESTURE_TAP:
+        {
+            if ( __gestureEventsProcessed.test(Gesture::GESTURE_TAP) )
+            {
+                gesture_tap_t* tap = (gesture_tap_t*)gesture;
+                Platform::gestureTapEventInternal(tap->touch_coords.x, tap->touch_coords.y);
+            }
+            break;
+        }
+
+    default:
+        break;
+
+    }
+}
+
+#ifdef GP_USE_GAMEPAD
+
+static const char* __vendorStrings[] =
+{
+    "SteelSeries",
+    "Nintendo",
+};
+
+static const char* __productStrings[] =
+{
+    "FREE",
+    "Wii Remote",
+};
+
+static const int __VIDs[] = {
+    0x1038,
+    0x057e,
+};
+
+static const int __PIDs[] = {
+    0x1412,
+    0x0306,
+};
+
+static const unsigned int __knownGamepads = 2;
+
+void queryGamepad(GamepadHandle handle, int* buttonCount, int* joystickCount, int* productId, int* vendorId, char* productString, char* vendorString)
+{
+    char id[128];
+    screen_get_device_property_iv(handle, SCREEN_PROPERTY_BUTTON_COUNT, buttonCount);
+    screen_get_device_property_cv(handle, SCREEN_PROPERTY_ID_STRING, 128, id);
+    screen_get_device_property_cv(handle, SCREEN_PROPERTY_PRODUCT, 64, productString);
+    screen_get_device_property_cv(handle, SCREEN_PROPERTY_VENDOR, 64, vendorString);
+
+    // Check for the existence of analog sticks.
+    int analogs[3];
+    if (!screen_get_device_property_iv(handle, SCREEN_PROPERTY_ANALOG0, analogs))
+    {
+    	++(*joystickCount);
+    }
+
+    if (!screen_get_device_property_iv(handle, SCREEN_PROPERTY_ANALOG1, analogs))
+    {
+    	++(*joystickCount);
+    }
+
+    // ID string format: A-BBBB-CCCC-D.D
+    // A is the device's index
+    // BBBB is the device's Vendor ID (in hexadecimal)
+    // CCCC is the device's Product ID (also in hexadecimal)
+    // D.D is the device's version number
+    char* token = strtok(id, "-");
+    token = strtok(NULL, "-");
+    if (token)
+    {
+	    *vendorId = strtol(token, NULL, 16);
+    }
+
+    token = strtok(NULL, "-");
+    if (token)
+    {
+        *productId = strtol(token, NULL, 16);
+    }
+
+    // For gamepads unknown to BB10,
+    // check VID and PID against gamepads known to gameplay.
+    if (strlen(productString) == 0 || strlen(vendorString) == 0)
+    {
+        for (unsigned int i = 0; i < __knownGamepads; ++i)
+        {
+            if (__VIDs[i] == *vendorId && __PIDs[i] == *productId)
+            {
+            	strcpy(vendorString, __vendorStrings[i]);
+                strcpy(productString, __productStrings[i]);
+            }
+        }
+    }
+}
+
+void Platform::pollGamepadState(Gamepad* gamepad)
+{
+	unsigned int buttons;
+    screen_get_device_property_iv(gamepad->_handle, SCREEN_PROPERTY_BUTTONS, (int*)&buttons);
+	gamepad->setButtons(buttons);
+
+    unsigned int i;
+    for (i = 0; i < gamepad->_joystickCount; ++i)
+    {
+        GP_ASSERT(i < 2);
+
+        int analog[3];
+        switch (i)
+        {
+        case 0:
+            screen_get_device_property_iv(gamepad->_handle, SCREEN_PROPERTY_ANALOG0, analog);
+            break;
+        case 1:
+            screen_get_device_property_iv(gamepad->_handle, SCREEN_PROPERTY_ANALOG1, analog);
+            break;
+        }
+        
+        // So far we've tested two gamepads with analog sticks on BlackBerry:
+        // the SteelSeries FREE, and the iControlPad.
+        // Both return values between -128 and +127, with the y axis starting from
+        // the top at -128.
+        // 1 / 128 == 0.0078125f
+        // 1 / 127 == 0.0078740157480315f
+        float x = (float)analog[0];
+        float y = -(float)analog[1];
+        x *= (x < 0) ? 0.0078125f : 0.0078740157480315f;
+        y *= (y > 0) ? 0.0078125f : 0.0078740157480315f;
+
+		gamepad->setJoystickValue(i, x, y);
+    }
+
+    for (i = 0; i < gamepad->_triggerCount; ++i)
+    {
+        GP_ASSERT(i < 2);
+
+        int analog[3];
+        switch (i)
+        {
+        case 0:
+            screen_get_device_property_iv(gamepad->_handle, SCREEN_PROPERTY_ANALOG0, analog);
+            break;
+        case 1:
+            screen_get_device_property_iv(gamepad->_handle, SCREEN_PROPERTY_ANALOG1, analog);
+            break;
+        }
+
+        float value = (float)analog[2] * 0.0078125f;
+		gamepad->setTriggerValue(i, value);
+    }
+}
+#else
+void Platform::pollGamepadState(Gamepad* gamepad)
+{
+}
+#endif
+
+Platform::Platform(Game* game)
+    : _game(game)
+{
+}
+
+Platform::~Platform()
+{
+    if (__eglDisplay != EGL_NO_DISPLAY)
+    {
+        eglMakeCurrent(__eglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
+    }
+
+    if (__eglSurface != EGL_NO_SURFACE)
+    {
+        eglDestroySurface(__eglDisplay, __eglSurface);
+        __eglSurface = EGL_NO_SURFACE;
+    }
+
+    if (__eglContext != EGL_NO_CONTEXT)
+    {
+        eglDestroyContext(__eglDisplay, __eglContext);
+        __eglContext = EGL_NO_CONTEXT;
+    }
+
+    if (__eglDisplay != EGL_NO_DISPLAY)
+    {
+        eglTerminate(__eglDisplay);
+        __eglDisplay = EGL_NO_DISPLAY;
+    }
+
+    if (__screenWindow)
+    {
+        screen_destroy_window(__screenWindow);
+        __screenWindow = NULL;
+    }
+
+    if (__screenEvent)
+    {
+        screen_destroy_event(__screenEvent);
+        __screenEvent = NULL;
+    }
+
+    if (__screenContext)
+    {
+        screen_destroy_context(__screenContext);
+        __screenContext = NULL;
+    }
+}
+
+Platform* Platform::create(Game* game)
+{
+    FileSystem::setResourcePath("./app/native/");
+    Platform* platform = new Platform(game);
+
+    // Query game config
+    int samples = 0;
+    Properties* config = Game::getInstance()->getConfig()->getNamespace("window", true);
+    if (config)
+    {
+        samples = std::max(config->getInt("samples"), 0);
+    }
+
+    __gestureSet = gestures_set_alloc();
+    swipe_gesture_alloc(NULL, gesture_callback, __gestureSet);
+    pinch_gesture_alloc(NULL, gesture_callback, __gestureSet);
+    tap_gesture_alloc(NULL, gesture_callback, __gestureSet);
+
+    bps_initialize();
+
+    // Initialize navigator and orientation
+    static const int SENSOR_RATE = 25000; // (25000 microseconds = 40 Hz)
+    sensor_set_rate(SENSOR_TYPE_AZIMUTH_PITCH_ROLL, SENSOR_RATE);
+    sensor_set_rate(SENSOR_TYPE_ACCELEROMETER, SENSOR_RATE);
+    sensor_set_rate(SENSOR_TYPE_GYROSCOPE, SENSOR_RATE);
+    sensor_set_skip_duplicates(SENSOR_TYPE_AZIMUTH_PITCH_ROLL, true);
+    sensor_set_skip_duplicates(SENSOR_TYPE_ACCELEROMETER, true);
+    sensor_set_skip_duplicates(SENSOR_TYPE_GYROSCOPE, true);
+    sensor_request_events(SENSOR_TYPE_AZIMUTH_PITCH_ROLL);
+    sensor_request_events(SENSOR_TYPE_ACCELEROMETER);
+    sensor_request_events(SENSOR_TYPE_GYROSCOPE);
+    navigator_request_events(0);
+    navigator_rotation_lock(true);
+    __orientationAngle = atoi(getenv("ORIENTATION"));
+
+    int rc = 0;
+    int screenFormat = SCREEN_FORMAT_RGBA8888;
+#ifdef __X86__
+    int screenUsage = SCREEN_USAGE_OPENGL_ES2;
+#else
+    int screenUsage = SCREEN_USAGE_DISPLAY|SCREEN_USAGE_OPENGL_ES2; // Physical device copy directly into physical display
+#endif
+    int screenSwapInterval = WINDOW_VSYNC ? 1 : 0;
+    int screenTransparency = SCREEN_TRANSPARENCY_NONE;
+
+    char *width_str = getenv("WIDTH");
+    char *height_str = getenv("HEIGHT");
+
+    // Hard-coded to (0,0).
+    int windowPosition[] =
+    {
+        0, 0
+    };
+
+    EGLint eglConfigCount;
+
+    // Hard-coded to 32-bit/OpenGL ES 2.0.
+    // NOTE: EGL_SAMPLE_BUFFERS and EGL_SAMPLES MUST remain at the beginning of the attribute list
+    // since they are expected to be at indices 0-3 in config fallback code later.
+    EGLint eglConfigAttrs[] =
+    {
+        EGL_SAMPLE_BUFFERS,     samples > 0 ? 1 : 0,
+        EGL_SAMPLES,            samples,
+        EGL_RED_SIZE,           8,
+        EGL_GREEN_SIZE,         8,
+        EGL_BLUE_SIZE,          8,
+        EGL_ALPHA_SIZE,         8,
+        EGL_DEPTH_SIZE,         24,
+        EGL_STENCIL_SIZE,       8,
+        EGL_SURFACE_TYPE,       EGL_WINDOW_BIT,
+        EGL_RENDERABLE_TYPE,    EGL_OPENGL_ES2_BIT,
+        EGL_NONE
+    };
+    __multiSampling = samples > 0;
+
+    const EGLint eglContextAttrs[] =
+    {
+        EGL_CONTEXT_CLIENT_VERSION,    2,
+        EGL_NONE
+    };
+
+    const EGLint eglSurfaceAttrs[] =
+    {
+        EGL_RENDER_BUFFER,    EGL_BACK_BUFFER,
+        EGL_NONE
+    };
+
+    // Create the screen context.
+    rc = screen_create_context(&__screenContext, 0);
+    if (rc)
+    {
+        perror("screen_create_context");
+        goto error;
+    }
+
+    // Create the screen window.
+    rc = screen_create_window(&__screenWindow, __screenContext);
+    if (rc)
+    {
+        perror("screen_create_window");
+        goto error;
+    }
+
+    // Window group
+	rc = screen_create_window_group(__screenWindow, "windowgroup");
+	if (rc)
+	{
+		perror("screen_create_window_group failed");
+		goto error;
+	}
+
+    // Set/get any window properties.
+    rc = screen_set_window_property_iv(__screenWindow, SCREEN_PROPERTY_FORMAT, &screenFormat);
+    if (rc)
+    {
+        perror("screen_set_window_property_iv(SCREEN_PROPERTY_FORMAT)");
+        goto error;
+    }
+
+    rc = screen_set_window_property_iv(__screenWindow, SCREEN_PROPERTY_USAGE, &screenUsage);
+    if (rc)
+    {
+        perror("screen_set_window_property_iv(SCREEN_PROPERTY_USAGE)");
+        goto error;
+    }
+
+    if (width_str && height_str)
+    {
+        __screenWindowSize[0] = atoi(width_str);
+        __screenWindowSize[1] = atoi(height_str);
+    }
+    else
+    {
+        screen_display_t screen_display;
+        rc = screen_get_window_property_pv(__screenWindow, SCREEN_PROPERTY_DISPLAY, (void **)&screen_display);
+        if (rc)
+        {
+            perror("screen_get_window_property_pv(SCREEN_PROPERTY_DISPLAY)");
+            goto error;
+        }
+
+        screen_display_mode_t screen_mode;
+        rc = screen_get_display_property_pv(screen_display, SCREEN_PROPERTY_MODE, (void**)&screen_mode);
+        if (rc)
+        {
+            perror("screen_get_display_property_pv(SCREEN_PROPERTY_MODE)");
+            goto error;
+        }
+
+        int size[2];
+        rc = screen_get_window_property_iv(__screenWindow, SCREEN_PROPERTY_BUFFER_SIZE, size);
+        if (rc)
+        {
+            perror("screen_get_window_property_iv(SCREEN_PROPERTY_BUFFER_SIZE)");
+            goto error;
+        }
+
+        __screenWindowSize[0] = size[0];
+        __screenWindowSize[1] = size[1];
+
+        if ((__orientationAngle == 0) || (__orientationAngle == 180))
+        {
+            if (((screen_mode.width > screen_mode.height) && (size[0] < size[1])) ||
+                ((screen_mode.width < screen_mode.height) && (size[0] > size[1])))
+            {
+                __screenWindowSize[1] = size[0];
+                __screenWindowSize[0] = size[1];
+            }
+        }
+        else if ((__orientationAngle == 90) || (__orientationAngle == 270))
+        {
+            if (((screen_mode.width > screen_mode.height) && (size[0] > size[1])) ||
+                ((screen_mode.width < screen_mode.height) && (size[0] < size[1])))
+            {
+                __screenWindowSize[1] = size[0];
+                __screenWindowSize[0] = size[1];
+            }
+        }
+        else
+        {
+            perror("Navigator returned an unexpected orientation angle.");
+            goto error;
+        }
+
+
+        rc = screen_set_window_property_iv(__screenWindow, SCREEN_PROPERTY_ROTATION, &__orientationAngle);
+        if (rc)
+        {
+            perror("screen_set_window_property_iv(SCREEN_PROPERTY_ROTATION)");
+            goto error;
+        }
+    }
+
+    rc = screen_set_window_property_iv(__screenWindow, SCREEN_PROPERTY_BUFFER_SIZE, __screenWindowSize);
+    if (rc)
+    {
+        perror("screen_set_window_property_iv(SCREEN_PROPERTY_BUFFER_SIZE)");
+        goto error;
+    }
+
+    if (windowPosition[0] != 0 || windowPosition[1] != 0)
+    {
+        rc = screen_set_window_property_iv(__screenWindow, SCREEN_PROPERTY_POSITION, windowPosition);
+        if (rc)
+        {
+            perror("screen_set_window_property_iv(SCREEN_PROPERTY_POSITION)");
+            goto error;
+        }
+    }
+
+    rc = screen_set_window_property_iv(__screenWindow, SCREEN_PROPERTY_TRANSPARENCY, &screenTransparency);
+    if (rc)
+    {
+        perror("screen_set_window_property_iv(SCREEN_PROPERTY_TRANSPARENCY)");
+        goto error;
+    }
+
+    // Double buffered.
+    rc = screen_create_window_buffers(__screenWindow, 2);
+    if (rc)
+    {
+        perror("screen_create_window_buffers");
+        goto error;
+    }
+
+    // Create screen event object.
+    rc = screen_create_event(&__screenEvent);
+    if (rc)
+    {
+        perror("screen_create_event");
+        goto error;
+    }
+
+    // Request screen events.
+    screen_request_events(__screenContext);
+
+    // Get the EGL display and initialize.
+    __eglDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY);
+    if (__eglDisplay == EGL_NO_DISPLAY)
+    {
+        perror("eglGetDisplay");
+        goto error;
+    }
+    if (eglInitialize(__eglDisplay, NULL, NULL) != EGL_TRUE)
+    {
+        perror("eglInitialize");
+        goto error;
+    }
+
+    if (eglChooseConfig(__eglDisplay, eglConfigAttrs, &__eglConfig, 1, &eglConfigCount) != EGL_TRUE || eglConfigCount == 0)
+    {
+        bool success = false;
+        while (samples)
+        {
+            // Try lowering the MSAA sample count until we find a supported config
+            GP_WARN("Failed to find a valid EGL configuration with EGL samples=%d. Trying samples=%d instead.", samples, samples/2);
+            samples /= 2;
+            eglConfigAttrs[1] = samples > 0 ? 1 : 0;
+            eglConfigAttrs[3] = samples;
+            if (eglChooseConfig(__eglDisplay, eglConfigAttrs, &__eglConfig, 1, &eglConfigCount) == EGL_TRUE && eglConfigCount > 0)
+            {
+                success = true;
+                break;
+            }
+        }
+
+        __multiSampling = samples > 0;
+
+        if (!success)
+        {
+            checkErrorEGL("eglChooseConfig");
+            goto error;
+        }
+    }
+
+    __eglContext = eglCreateContext(__eglDisplay, __eglConfig, EGL_NO_CONTEXT, eglContextAttrs);
+    if (__eglContext == EGL_NO_CONTEXT)
+    {
+        checkErrorEGL("eglCreateContext");
+        goto error;
+    }
+
+    __eglSurface = eglCreateWindowSurface(__eglDisplay, __eglConfig, __screenWindow, eglSurfaceAttrs);
+    if (__eglSurface == EGL_NO_SURFACE)
+    {
+        checkErrorEGL("eglCreateWindowSurface");
+        goto error;
+    }
+
+    if (eglMakeCurrent(__eglDisplay, __eglSurface, __eglSurface, __eglContext) != EGL_TRUE)
+    {
+        checkErrorEGL("eglMakeCurrent");
+        goto error;
+    }
+
+    // Set vsync.
+    eglSwapInterval(__eglDisplay, screenSwapInterval);
+
+    // Initialize OpenGL ES extensions.
+    __glExtensions = (const char*)glGetString(GL_EXTENSIONS);
+
+    if (strstr(__glExtensions, "GL_OES_vertex_array_object") || strstr(__glExtensions, "GL_ARB_vertex_array_object"))
+    {
+        glBindVertexArray = (PFNGLBINDVERTEXARRAYOESPROC)eglGetProcAddress("glBindVertexArrayOES");
+        glDeleteVertexArrays = (PFNGLDELETEVERTEXARRAYSOESPROC)eglGetProcAddress("glDeleteVertexArraysOES");
+        glGenVertexArrays = (PFNGLGENVERTEXARRAYSOESPROC)eglGetProcAddress("glGenVertexArraysOES");
+        glIsVertexArray = (PFNGLISVERTEXARRAYOESPROC)eglGetProcAddress("glIsVertexArrayOES");
+    }
+
+ #ifdef GP_USE_GAMEPAD
+
+    screen_device_t* screenDevs;
+
+    // Discover initial gamepad devices.
+    int count;
+    screen_get_context_property_iv(__screenContext, SCREEN_PROPERTY_DEVICE_COUNT, &count);
+    screenDevs = (screen_device_t*)calloc(count, sizeof(screen_device_t));
+    screen_get_context_property_pv(__screenContext, SCREEN_PROPERTY_DEVICES, (void**)screenDevs);
+
+	for (int i = 0; i < count; i++) 
+    {
+	    int type;
+        screen_get_device_property_iv(screenDevs[i], SCREEN_PROPERTY_TYPE, &type);
+
+        if (type == SCREEN_EVENT_GAMEPAD || type == SCREEN_EVENT_JOYSTICK)
+        {
+            int buttonCount = 0;
+            int joystickCount = 0;
+            int productId;
+            int vendorId;
+            char productString[64];
+            char vendorString[64];
+            queryGamepad(screenDevs[i], &buttonCount, &joystickCount, &productId, &vendorId, productString, vendorString);
+            Platform::gamepadEventConnectedInternal(screenDevs[i], buttonCount, joystickCount, 0, vendorId, productId, vendorString, productString);
+        }
+	}
+	free(screenDevs);
+#endif
+
+    return platform;
+
+error:
+
+    return NULL;
+}
+
+/**
+ * Convert the timespec into milliseconds.
+ */
+double timespec2millis(struct timespec *a)
+{
+    GP_ASSERT(a);
+    return (1000.0 * a->tv_sec) + (0.000001 * a->tv_nsec);
+}
+
+/**
+ * Fires a mouse event or a touch event on the game.
+ * If the mouse event is not consumed, a touch event is fired instead.
+ *
+ * @param mouseEvent The mouse event to fire.
+ * @param touchEvent The touch event to fire.
+ * @param x The x position of the touch in pixels.
+ * @param y The y position of the touch in pixels.
+ */
+void mouseOrTouchEvent(Mouse::MouseEvent mouseEvent, Touch::TouchEvent touchEvent, int x, int y)
+{
+    if (!gameplay::Platform::mouseEventInternal(mouseEvent, x, y, 0))
+    {
+        Platform::touchEventInternal(touchEvent, x, y, 0, true);
+    }
+}
+
+int Platform::enterMessagePump()
+{
+    GP_ASSERT(_game);
+
+    int rc;
+    int eventType;
+    int flags;
+    int value;
+    int position[2];
+    int domain;
+    mtouch_event_t touchEvent;
+    bool suspended = false;
+
+    // Get the initial time.
+    clock_gettime(CLOCK_REALTIME, &__timespec);
+    __timeStart = timespec2millis(&__timespec);
+    __timeAbsolute = 0L;
+
+    _game->run();
+
+    // Message loop.
+    while (true)
+    {
+        bps_event_t* event = NULL;
+        
+        while (true)
+        {
+            rc = bps_get_event(&event, 1);
+            GP_ASSERT(rc == BPS_SUCCESS);
+
+            if (event == NULL)
+                break;
+
+            // if the social controller needs to deal with the event do that here
+            if (Game::getInstance()->getSocialController()->handleEvent(event))
+            	break;
+
+            domain = bps_event_get_domain(event);
+
+            if (domain == screen_get_domain())
+            {
+                __screenEvent = screen_event_get_event(event);
+                screen_get_event_property_iv(__screenEvent, SCREEN_PROPERTY_TYPE, &eventType);
+                switch (eventType)
+                {
+                    case SCREEN_EVENT_MTOUCH_TOUCH:
+                    {
+                        screen_get_mtouch_event(__screenEvent, &touchEvent, 0);
+                        if (__gestureEventsProcessed.any())
+                            rc = gestures_set_process_event(__gestureSet, &touchEvent, NULL);
+
+                        if ( !rc && (__multiTouch || touchEvent.contact_id == 0) )
+                        {
+                            gameplay::Platform::touchEventInternal(Touch::TOUCH_PRESS, touchEvent.x, touchEvent.y, touchEvent.contact_id);
+                        }
+                        break;
+                    }
+
+                    case SCREEN_EVENT_MTOUCH_RELEASE:
+                    {
+                        screen_get_mtouch_event(__screenEvent, &touchEvent, 0);
+                        if (__gestureEventsProcessed.any())
+                            rc = gestures_set_process_event(__gestureSet, &touchEvent, NULL);
+
+                        if ( !rc && (__multiTouch || touchEvent.contact_id == 0) )
+                        {
+                            gameplay::Platform::touchEventInternal(Touch::TOUCH_RELEASE, touchEvent.x, touchEvent.y, touchEvent.contact_id);
+                        }
+                        if (__gestureSwipeRecognized)
+                        {
+                            __gestureSwipeRecognized = false;
+                        }
+                        break;
+                    }
+
+                    case SCREEN_EVENT_MTOUCH_MOVE:
+                    {
+                        screen_get_mtouch_event(__screenEvent, &touchEvent, 0);
+                        if (__gestureEventsProcessed.any())
+                            rc = gestures_set_process_event(__gestureSet, &touchEvent, NULL);
+
+                        if ( !rc && (__multiTouch || touchEvent.contact_id == 0) )
+                        {
+                            gameplay::Platform::touchEventInternal(Touch::TOUCH_MOVE, touchEvent.x, touchEvent.y, touchEvent.contact_id);
+                        }
+                        break;
+                    }
+
+                    case SCREEN_EVENT_POINTER:
+                    {
+                        static int mouse_pressed = 0;
+                        int buttons;
+                        int wheel;
+                        // A move event will be fired unless a button state changed.
+                        bool move = true;
+                        bool left_move = false;
+                        // This is a mouse move event, it is applicable to a device with a usb mouse or simulator.
+                        screen_get_event_property_iv(__screenEvent, SCREEN_PROPERTY_BUTTONS, &buttons);
+                        screen_get_event_property_iv(__screenEvent, SCREEN_PROPERTY_SOURCE_POSITION, position);
+                        screen_get_event_property_iv(__screenEvent, SCREEN_PROPERTY_MOUSE_WHEEL, &wheel);
+
+                        // Handle left mouse. Interpret as touch if the left mouse event is not consumed.
+                        if (buttons & SCREEN_LEFT_MOUSE_BUTTON)
+                        {
+                            if (mouse_pressed & SCREEN_LEFT_MOUSE_BUTTON)
+                            {
+                                left_move = true;
+                            }
+                            else
+                            {
+                                move = false;
+                                mouse_pressed |= SCREEN_LEFT_MOUSE_BUTTON;
+                                mouseOrTouchEvent(Mouse::MOUSE_PRESS_LEFT_BUTTON, Touch::TOUCH_PRESS, position[0], position[1]);
+                            }
+                        }
+                        else if (mouse_pressed & SCREEN_LEFT_MOUSE_BUTTON)
+                        {
+                            move = false;
+                            mouse_pressed &= ~SCREEN_LEFT_MOUSE_BUTTON;
+                            mouseOrTouchEvent(Mouse::MOUSE_RELEASE_LEFT_BUTTON, Touch::TOUCH_RELEASE, position[0], position[1]);
+                        }
+
+                        // Handle right mouse.
+                        if (buttons & SCREEN_RIGHT_MOUSE_BUTTON)
+                        {
+                            if ((mouse_pressed & SCREEN_RIGHT_MOUSE_BUTTON) == 0)
+                            {
+                                move = false;
+                                mouse_pressed |= SCREEN_RIGHT_MOUSE_BUTTON;
+                                gameplay::Platform::mouseEventInternal(Mouse::MOUSE_PRESS_RIGHT_BUTTON, position[0], position[1], 0);
+                            }
+                        }
+                        else if (mouse_pressed & SCREEN_RIGHT_MOUSE_BUTTON)
+                        {
+                            move = false;
+                            mouse_pressed &= ~SCREEN_RIGHT_MOUSE_BUTTON;
+                            gameplay::Platform::mouseEventInternal(Mouse::MOUSE_RELEASE_RIGHT_BUTTON, position[0], position[1], 0);
+                        }
+
+                        // Handle middle mouse.
+                        if (buttons & SCREEN_MIDDLE_MOUSE_BUTTON)
+                        {
+                            if ((mouse_pressed & SCREEN_MIDDLE_MOUSE_BUTTON) == 0)
+                            {
+                                move = false;
+                                mouse_pressed |= SCREEN_MIDDLE_MOUSE_BUTTON;
+                                gameplay::Platform::mouseEventInternal(Mouse::MOUSE_PRESS_MIDDLE_BUTTON, position[0], position[1], 0);
+                            }
+                        }
+                        else if (mouse_pressed & SCREEN_MIDDLE_MOUSE_BUTTON)
+                        {
+                            move = false;
+                            mouse_pressed &= ~SCREEN_MIDDLE_MOUSE_BUTTON;
+                            gameplay::Platform::mouseEventInternal(Mouse::MOUSE_RELEASE_MIDDLE_BUTTON, position[0], position[1], 0);
+                        }
+
+                        // Fire a move event if none of the buttons changed.
+                        if (left_move)
+                        {
+                            mouseOrTouchEvent(Mouse::MOUSE_MOVE, Touch::TOUCH_MOVE, position[0], position[1]);
+                        }
+                        else if (move)
+                        {
+                            gameplay::Platform::mouseEventInternal(Mouse::MOUSE_MOVE, position[0], position[1], 0);
+                        }
+
+                        // Handle mouse wheel events.
+                        if (wheel)
+                        {
+                            gameplay::Platform::mouseEventInternal(Mouse::MOUSE_WHEEL, position[0], position[1], -wheel);
+                        }
+                        break;
+                    }
+
+                    case SCREEN_EVENT_KEYBOARD:
+                    {
+                        screen_get_event_property_iv(__screenEvent, SCREEN_PROPERTY_KEY_FLAGS, &flags);
+                        screen_get_event_property_iv(__screenEvent, SCREEN_PROPERTY_KEY_SYM, &value);
+                        gameplay::Keyboard::KeyEvent evt = (flags & KEY_DOWN) ? gameplay::Keyboard::KEY_PRESS :  gameplay::Keyboard::KEY_RELEASE;
+                        // Suppress key repeats.
+                        if ((flags & KEY_REPEAT) == 0)
+                        {
+                            keyEventInternal(evt, getKey(value));
+                            if (evt == gameplay::Keyboard::KEY_PRESS && (flags & KEY_SYM_VALID))
+                            {
+                                int unicode = getUnicode(value);
+                                if (unicode)
+                                    keyEventInternal(gameplay::Keyboard::KEY_CHAR, unicode);
+                            }
+                        }
+                        break;
+                    }
+#ifdef GP_USE_GAMEPAD
+                    case SCREEN_EVENT_DEVICE:
+                    {
+                        // A device was attached or removed.
+                        screen_device_t device;
+                        int attached;
+
+                        screen_get_event_property_pv(__screenEvent, SCREEN_PROPERTY_DEVICE, (void**)&device);
+                        screen_get_event_property_iv(__screenEvent, SCREEN_PROPERTY_ATTACHED, &attached);
+
+                        if (attached)
+                        {
+                            int type;
+                            screen_get_device_property_iv(device, SCREEN_PROPERTY_TYPE, &type);
+                            if (type == SCREEN_EVENT_GAMEPAD || type == SCREEN_EVENT_JOYSTICK)
+                            {
+                                int buttonCount = 0;
+                                int joystickCount = 0;
+                                int productId;
+                                int vendorId;
+                                char productString[64];
+                                char vendorString[64];
+                                queryGamepad(device, &buttonCount, &joystickCount, &productId, &vendorId, productString, vendorString);
+                                Platform::gamepadEventConnectedInternal(device, buttonCount, joystickCount, 0, vendorId, productId, vendorString, productString);
+                            }
+                        }
+                        else
+                        {
+                            Platform::gamepadEventDisconnectedInternal(device);
+                        }
+
+                        break;
+                    }
+#endif
+                    default:
+                        break;
+                }
+            }
+            else if (domain == navigator_get_domain())
+            {
+                switch (bps_event_get_code(event))
+                {
+                case NAVIGATOR_WINDOW_STATE:
+                {
+                    navigator_window_state_t state = navigator_event_get_window_state(event);
+                    switch (state)
+                    {
+                    case NAVIGATOR_WINDOW_FULLSCREEN:
+                        if (!__screenFullscreen)
+                            __screenFullscreen = true;
+                        _game->resume();
+                        suspended = false;
+                        break;
+                    case NAVIGATOR_WINDOW_THUMBNAIL:
+                    case NAVIGATOR_WINDOW_INVISIBLE:
+                        if (__screenFullscreen && !suspended)
+                        {
+                            _game->pause();
+                            suspended = true;
+                        }
+                        break;
+                    }
+                    break;
+                }
+                case NAVIGATOR_EXIT:
+                	// Call Game::shutdown directly, instead of Game::exit.
+                	// We need to do this since exit() queues a request to shutdown for the
+                	// next frame, which will never get executed because we are suspended.
+                    _game->shutdown();
+                    break;
+                }
+            }
+            else if (domain == sensor_get_domain())
+            {
+                if (bps_event_get_code(event) == SENSOR_AZIMUTH_PITCH_ROLL_READING)
+                {
+                    float azimuth;
+                    sensor_event_get_apr(event, &azimuth, &__pitch, &__roll);
+                }
+                else if (bps_event_get_code(event) == SENSOR_ACCELEROMETER_READING)
+                {
+                    sensor_event_get_xyz(event, &__accelRawX, &__accelRawY, &__accelRawZ);
+                }
+                else if (bps_event_get_code(event) == SENSOR_GYROSCOPE_READING)
+                {
+                    sensor_event_get_xyz(event, &__gyroRawX, &__gyroRawY, &__gyroRawZ);
+                }
+            }
+        }
+
+        // If we are done, then exit.
+        if (_game->getState() == Game::UNINITIALIZED)
+            break;
+
+        if (!suspended)
+        {
+            _game->frame();
+
+            // Post the new frame to the display.
+            // Note that there are a couple cases where eglSwapBuffers could fail
+            // with an error code that requires a certain level of re-initialization:
+            //
+            // 1) EGL_BAD_NATIVE_WINDOW - Called when the surface we're currently using
+            //    is invalidated. This would require us to destroy our EGL surface,
+            //    close our OpenKODE window, and start again.
+            //
+            // 2) EGL_CONTEXT_LOST - Power management event that led to our EGL context
+            //    being lost. Requires us to re-create and re-initalize our EGL context
+            //    and all OpenGL ES state.
+            //
+            // For now, if we get these, we'll simply exit.
+            rc = eglSwapBuffers(__eglDisplay, __eglSurface);
+            if (rc != EGL_TRUE)
+            {
+                _game->shutdown();
+                perror("eglSwapBuffers");
+                break;
+            }
+        }
+    }
+
+    screen_stop_events(__screenContext);
+    bps_shutdown();
+    screen_destroy_context(__screenContext);
+
+    return 0;
+}
+    
+void Platform::signalShutdown() 
+{
+    // nothing to do  
+}
+
+bool Platform::canExit()
+{
+    return true;
+}
+
+unsigned int Platform::getDisplayWidth()
+{
+    return __screenWindowSize[0];
+}
+
+unsigned int Platform::getDisplayHeight()
+{
+    return __screenWindowSize[1];
+}
+
+double Platform::getAbsoluteTime()
+{
+    clock_gettime(CLOCK_REALTIME, &__timespec);
+    double now = timespec2millis(&__timespec);
+    __timeAbsolute = now - __timeStart;
+
+    return __timeAbsolute;
+}
+
+void Platform::setAbsoluteTime(double time)
+{
+    __timeAbsolute = time;
+}
+
+bool Platform::isVsync()
+{
+    return __vsync;
+}
+
+void Platform::setVsync(bool enable)
+{
+    eglSwapInterval(__eglDisplay, enable ? 1 : 0);
+    __vsync = enable;
+}
+
+void Platform::swapBuffers()
+{
+    if (__eglDisplay && __eglSurface)
+        eglSwapBuffers(__eglDisplay, __eglSurface);
+}
+
+void Platform::sleep(long ms)
+{
+    usleep(ms * 1000);
+}
+
+void Platform::setMultiSampling(bool enabled)
+{
+    if (enabled == __multiSampling)
+    {
+        return;
+    }
+
+    // TODO:
+    __multiSampling = enabled;
+}
+
+bool Platform::isMultiSampling()
+{
+    return __multiSampling;
+}
+
+void Platform::setMultiTouch(bool enabled)
+{
+    __multiTouch = enabled;
+}
+
+bool Platform::isMultiTouch()
+{
+    return __multiTouch;
+}
+
+bool Platform::hasAccelerometer()
+{
+    return true;
+}
+
+void Platform::getAccelerometerValues(float* pitch, float* roll)
+{
+    GP_ASSERT(pitch);
+    GP_ASSERT(roll);
+
+    switch(__orientationAngle)
+    {
+    // Landscape based device adjusting for landscape game mode
+    case 0:
+        if (pitch)
+            *pitch = __pitch;
+        if (roll)
+            *roll = -__roll;
+        break;
+    case 180:
+        if (pitch)
+            *pitch = -__pitch;
+        if (roll)
+            *roll = __roll;
+        break;
+
+    // Portrait based device adjusting for landscape game mode
+    case 90:
+        if (pitch)
+            *pitch = -__roll;
+        if (roll)
+            *roll = -__pitch;
+        break;
+
+    case  270:
+        if (pitch)
+            *pitch = __roll;
+        if (roll)
+            *roll = __pitch;
+        break;
+
+    default:
+        break;
+    }
+}
+
+void Platform::getSensorValues(float* accelX, float* accelY, float* accelZ, float* gyroX, float* gyroY, float* gyroZ)
+{
+	if (accelX)
+	{
+		*accelX = __accelRawX;
+	}
+
+	if (accelY)
+	{
+		*accelY = __accelRawY;
+	}
+
+	if (accelZ)
+	{
+		*accelZ = __accelRawZ;
+	}
+
+	if (gyroX)
+	{
+		*gyroX = __gyroRawX;
+	}
+
+	if (gyroY)
+	{
+		*gyroY = __gyroRawY;
+	}
+
+	if (gyroZ)
+	{
+		*gyroZ = __gyroRawZ;
+	}
+}
+
+void Platform::getArguments(int* argc, char*** argv)
+{
+    if (argc)
+        *argc = __argc;
+    if (argv)
+        *argv = __argv;
+}
+
+bool Platform::hasMouse()
+{
+    // not supported
+    return false;
+}
+
+void Platform::setMouseCaptured(bool captured)
+{
+    // not supported
+}
+
+bool Platform::isMouseCaptured()
+{
+    // not supported
+    return false;
+}
+
+void Platform::setCursorVisible(bool visible)
+{
+    // not supported
+}
+
+bool Platform::isCursorVisible()
+{
+    // not supported
+    return false;
+}
+
+void Platform::displayKeyboard(bool display)
+{
+    if (display)
+        virtualkeyboard_show();
+    else
+        virtualkeyboard_hide();
+}
+
+void Platform::shutdownInternal()
+{
+    Game::getInstance()->shutdown();
+}
+
+bool Platform::isGestureSupported(Gesture::GestureEvent evt)
+{
+    // All are supported no need to test the bitset
+    return true;
+}
+
+void Platform::registerGesture(Gesture::GestureEvent evt)
+{
+    switch(evt)
+    {
+    case Gesture::GESTURE_ANY_SUPPORTED:
+        __gestureEventsProcessed.set();
+        break;
+
+    case Gesture::GESTURE_SWIPE:
+    case Gesture::GESTURE_PINCH:
+    case Gesture::GESTURE_TAP:
+        __gestureEventsProcessed.set(evt);
+        break;
+
+    default:
+        break;
+    }
+}
+
+void Platform::unregisterGesture(Gesture::GestureEvent evt)
+{
+    switch(evt)
+    {
+    case Gesture::GESTURE_ANY_SUPPORTED:
+        __gestureEventsProcessed.reset();
+        break;
+
+    case Gesture::GESTURE_SWIPE:
+    case Gesture::GESTURE_PINCH:
+    case Gesture::GESTURE_TAP:
+        __gestureEventsProcessed.set(evt, 0);
+        break;
+
+    default:
+        break;
+    }
+}
+    
+bool Platform::isGestureRegistered(Gesture::GestureEvent evt)
+{
+    return __gestureEventsProcessed.test(evt);
+}
+
+bool Platform::launchURL(const char* url)
+{
+    if (url == NULL || *url == '\0')
+        return false;
+
+    return navigator_invoke(url, NULL) == BPS_SUCCESS;
+}
+
+}
+
+#endif

+ 2 - 4
gameplay/src/PlatformLinux.cpp

@@ -89,7 +89,6 @@ static Display* __display;
 static Window   __window;
 static Window   __window;
 static int __windowSize[2];
 static int __windowSize[2];
 static GLXContext __context;
 static GLXContext __context;
-static Window __attachToWindow;
 static Atom __atomWmDeleteWindow;
 static Atom __atomWmDeleteWindow;
 static list<ConnectedGamepadDevInfo> __connectedGamepads;
 static list<ConnectedGamepadDevInfo> __connectedGamepads;
 
 
@@ -551,12 +550,11 @@ namespace gameplay
     {
     {
     }
     }
 
 
-    Platform* Platform::create(Game* game, void* attachToWindow)
+    Platform* Platform::create(Game* game)
     {
     {
 
 
         GP_ASSERT(game);
         GP_ASSERT(game);
 
 
-        __attachToWindow = (Window)attachToWindow;
         FileSystem::setResourcePath("./");
         FileSystem::setResourcePath("./");
         Platform* platform = new Platform(game);
         Platform* platform = new Platform(game);
 
 
@@ -1422,7 +1420,7 @@ namespace gameplay
         *roll = 0;
         *roll = 0;
     }
     }
 
 
-    void Platform::getRawSensorValues(float* accelX, float* accelY, float* accelZ, float* gyroX, float* gyroY, float* gyroZ)
+    void Platform::getSensorValues(float* accelX, float* accelY, float* accelZ, float* gyroX, float* gyroY, float* gyroZ)
     {
     {
         if (accelX)
         if (accelX)
         {
         {

+ 2 - 4
gameplay/src/PlatformMacOSX.mm

@@ -48,7 +48,6 @@ static bool __shiftDown = false;
 static char* __title = NULL;
 static char* __title = NULL;
 static bool __fullscreen = false;
 static bool __fullscreen = false;
 static bool __resizable = false;
 static bool __resizable = false;
-static void* __attachToWindow = NULL;
 static bool __mouseCaptured = false;
 static bool __mouseCaptured = false;
 static bool __mouseCapturedFirstPass = false;
 static bool __mouseCapturedFirstPass = false;
 static CGPoint __mouseCapturePoint;
 static CGPoint __mouseCapturePoint;
@@ -1623,9 +1622,8 @@ Platform::~Platform()
 }
 }
 
 
     
     
-Platform* Platform::create(Game* game, void* attachToWindow)
+Platform* Platform::create(Game* game)
 {
 {
-    __attachToWindow = attachToWindow;
     Platform* platform = new Platform(game);
     Platform* platform = new Platform(game);
     
     
     return platform;
     return platform;
@@ -1813,7 +1811,7 @@ void Platform::getAccelerometerValues(float* pitch, float* roll)
     *roll = 0;
     *roll = 0;
 }
 }
 
 
-void Platform::getRawSensorValues(float* accelX, float* accelY, float* accelZ, float* gyroX, float* gyroY, float* gyroZ)
+void Platform::getSensorValues(float* accelX, float* accelY, float* accelZ, float* gyroX, float* gyroY, float* gyroZ)
 {
 {
     if (accelX)
     if (accelX)
     {
     {

+ 46 - 65
gameplay/src/PlatformWindows.cpp

@@ -10,7 +10,7 @@
 #include <GL/wglew.h>
 #include <GL/wglew.h>
 #include <windowsx.h>
 #include <windowsx.h>
 #include <shellapi.h>
 #include <shellapi.h>
-#ifdef USE_XINPUT
+#ifdef GP_USE_GAMEPAD
 #include <XInput.h>
 #include <XInput.h>
 #endif
 #endif
 
 
@@ -28,7 +28,6 @@ static double __timeStart;
 static double __timeAbsolute;
 static double __timeAbsolute;
 static bool __vsync = WINDOW_VSYNC;
 static bool __vsync = WINDOW_VSYNC;
 static HINSTANCE __hinstance = 0;
 static HINSTANCE __hinstance = 0;
-static HWND __attachToWindow = 0;
 static HWND __hwnd = 0;
 static HWND __hwnd = 0;
 static HDC __hdc = 0;
 static HDC __hdc = 0;
 static HGLRC __hrc = 0;
 static HGLRC __hrc = 0;
@@ -38,7 +37,7 @@ static bool __multiSampling = false;
 static bool __cursorVisible = true;
 static bool __cursorVisible = true;
 static unsigned int __gamepadsConnected = 0;
 static unsigned int __gamepadsConnected = 0;
 
 
-#ifdef USE_XINPUT
+#ifdef GP_USE_GAMEPAD
 static const unsigned int XINPUT_BUTTON_COUNT = 14;
 static const unsigned int XINPUT_BUTTON_COUNT = 14;
 static const unsigned int XINPUT_JOYSTICK_COUNT = 2;
 static const unsigned int XINPUT_JOYSTICK_COUNT = 2;
 static const unsigned int XINPUT_TRIGGER_COUNT = 2;
 static const unsigned int XINPUT_TRIGGER_COUNT = 2;
@@ -787,7 +786,7 @@ bool initializeGL(WindowCreationParams* params)
     return true;
     return true;
 }
 }
 
 
-Platform* Platform::create(Game* game, void* attachToWindow)
+Platform* Platform::create(Game* game)
 {
 {
     GP_ASSERT(game);
     GP_ASSERT(game);
 
 
@@ -797,8 +796,6 @@ Platform* Platform::create(Game* game, void* attachToWindow)
     // Get the application module handle.
     // Get the application module handle.
     __hinstance = ::GetModuleHandle(NULL);
     __hinstance = ::GetModuleHandle(NULL);
 
 
-    __attachToWindow = (HWND)attachToWindow;
-
     // Read window settings from config.
     // Read window settings from config.
     WindowCreationParams params;
     WindowCreationParams params;
     params.fullscreen = false;
     params.fullscreen = false;
@@ -890,67 +887,54 @@ Platform* Platform::create(Game* game, void* attachToWindow)
         }
         }
     }
     }
 
 
-    if (!__attachToWindow)
+
+    // Register our window class.
+    WNDCLASSEX wc;
+    wc.cbSize = sizeof(WNDCLASSEX);
+    wc.style          = CS_HREDRAW | CS_VREDRAW | CS_OWNDC;
+    wc.lpfnWndProc    = (WNDPROC)__WndProc;
+    wc.cbClsExtra     = 0;
+    wc.cbWndExtra     = 0;
+    wc.hInstance      = __hinstance;
+    wc.hIcon          = LoadIcon(NULL, IDI_APPLICATION);
+    wc.hIconSm        = NULL;
+    wc.hCursor        = LoadCursor(NULL, IDC_ARROW);
+    wc.hbrBackground  = NULL;  // No brush - we are going to paint our own background
+    wc.lpszMenuName   = NULL;  // No default menu
+    wc.lpszClassName  = L"gameplay";
+
+    if (!::RegisterClassEx(&wc))
     {
     {
-        // Register our window class.
-        WNDCLASSEX wc;
-        wc.cbSize = sizeof(WNDCLASSEX);
-        wc.style          = CS_HREDRAW | CS_VREDRAW | CS_OWNDC;
-        wc.lpfnWndProc    = (WNDPROC)__WndProc;
-        wc.cbClsExtra     = 0;
-        wc.cbWndExtra     = 0;
-        wc.hInstance      = __hinstance;
-        wc.hIcon          = LoadIcon(NULL, IDI_APPLICATION);
-        wc.hIconSm        = NULL;
-        wc.hCursor        = LoadCursor(NULL, IDC_ARROW);
-        wc.hbrBackground  = NULL;  // No brush - we are going to paint our own background
-        wc.lpszMenuName   = NULL;  // No default menu
-        wc.lpszClassName  = L"gameplay";
-
-        if (!::RegisterClassEx(&wc))
-        {
-            GP_ERROR("Failed to register window class.");
-            goto error;
-        }
+        GP_ERROR("Failed to register window class.");
+        goto error;
+    }
 
 
-        if (params.fullscreen)
+    if (params.fullscreen)
+    {
+        DEVMODE dm;
+        memset(&dm, 0, sizeof(dm));
+        dm.dmSize= sizeof(dm);
+        dm.dmPelsWidth  = width;
+        dm.dmPelsHeight = height;
+        dm.dmBitsPerPel = DEFAULT_COLOR_BUFFER_SIZE;
+        dm.dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT;
+
+        // Try to set selected mode and get results. NOTE: CDS_FULLSCREEN gets rid of start bar.
+        if (ChangeDisplaySettings(&dm, CDS_FULLSCREEN) != DISP_CHANGE_SUCCESSFUL)
         {
         {
-            DEVMODE dm;
-            memset(&dm, 0, sizeof(dm));
-            dm.dmSize= sizeof(dm);
-            dm.dmPelsWidth  = width;
-            dm.dmPelsHeight = height;
-            dm.dmBitsPerPel = DEFAULT_COLOR_BUFFER_SIZE;
-            dm.dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT;
-
-            // Try to set selected mode and get results. NOTE: CDS_FULLSCREEN gets rid of start bar.
-            if (ChangeDisplaySettings(&dm, CDS_FULLSCREEN) != DISP_CHANGE_SUCCESSFUL)
-            {
-                params.fullscreen = false;
-                GP_ERROR("Failed to start game in full-screen mode with resolution %dx%d.", width, height);
-                goto error;
-            }
-        }
-
-        if (!initializeGL(&params))
+            params.fullscreen = false;
+            GP_ERROR("Failed to start game in full-screen mode with resolution %dx%d.", width, height);
             goto error;
             goto error;
-
-        // Show the window.
-        ShowWindow(__hwnd, SW_SHOW);
+        }
     }
     }
-    else
-    {
-        // Attach to a previous windows
-        __hwnd = (HWND)__attachToWindow;
-        __hdc = GetDC(__hwnd);
 
 
-        SetWindowLongPtr(__hwnd, GWLP_WNDPROC, (LONG)(WNDPROC)__WndProc);
+    if (!initializeGL(&params))
+        goto error;
 
 
-        if (!initializeGL(NULL))
-            goto error;
-    }
+    // Show the window.
+    ShowWindow(__hwnd, SW_SHOW);
 
 
-#ifdef USE_XINPUT
+#ifdef GP_USE_GAMEPAD
     // Initialize XInputGamepads.
     // Initialize XInputGamepads.
     for (DWORD i = 0; i < XUSER_MAX_COUNT; i++)
     for (DWORD i = 0; i < XUSER_MAX_COUNT; i++)
     {
     {
@@ -992,9 +976,6 @@ int Platform::enterMessagePump()
     if (_game->getState() != Game::RUNNING)
     if (_game->getState() != Game::RUNNING)
         _game->run();
         _game->run();
 
 
-    if (__attachToWindow)
-        return 0;
-
     // Enter event dispatch loop.
     // Enter event dispatch loop.
     MSG msg;
     MSG msg;
     while (true)
     while (true)
@@ -1012,7 +993,7 @@ int Platform::enterMessagePump()
         }
         }
         else
         else
         {
         {
-#ifdef USE_XINPUT
+#ifdef GP_USE_GAMEPAD
             // Check for connected XInput gamepads.
             // Check for connected XInput gamepads.
             for (DWORD i = 0; i < XUSER_MAX_COUNT; i++)
             for (DWORD i = 0; i < XUSER_MAX_COUNT; i++)
             {
             {
@@ -1150,7 +1131,7 @@ void Platform::getAccelerometerValues(float* pitch, float* roll)
     *roll = 0;
     *roll = 0;
 }
 }
 
 
-void Platform::getRawSensorValues(float* accelX, float* accelY, float* accelZ, float* gyroX, float* gyroY, float* gyroZ)
+void Platform::getSensorValues(float* accelX, float* accelY, float* accelZ, float* gyroX, float* gyroY, float* gyroZ)
 {
 {
     if (accelX)
     if (accelX)
     {
     {
@@ -1262,7 +1243,7 @@ bool Platform::isGestureRegistered(Gesture::GestureEvent evt)
     return false;
     return false;
 }
 }
 
 
-#ifdef USE_XINPUT
+#ifdef GP_USE_GAMEPAD
 void Platform::pollGamepadState(Gamepad* gamepad)
 void Platform::pollGamepadState(Gamepad* gamepad)
 {
 {
     GP_ASSERT(gamepad->_handle < XUSER_MAX_COUNT);
     GP_ASSERT(gamepad->_handle < XUSER_MAX_COUNT);

+ 7 - 2
gameplay/src/PlatformiOS.mm

@@ -863,6 +863,11 @@ int getUnicode(int key);
     return YES;
     return YES;
 }
 }
 
 
+- (BOOL)prefersStatusBarHidden
+{
+    return YES;
+}
+
 - (void)getAccelerometerPitch:(float*)pitch roll:(float*)roll 
 - (void)getAccelerometerPitch:(float*)pitch roll:(float*)roll 
 {
 {
     float p = 0.0f;
     float p = 0.0f;
@@ -1336,7 +1341,7 @@ Platform::~Platform()
 {
 {
 }
 }
 
 
-Platform* Platform::create(Game* game, void* attachToWindow)
+Platform* Platform::create(Game* game)
 {
 {
     Platform* platform = new Platform(game);
     Platform* platform = new Platform(game);
     return platform;
     return platform;
@@ -1417,7 +1422,7 @@ void Platform::getAccelerometerValues(float* pitch, float* roll)
     [__appDelegate getAccelerometerPitch:pitch roll:roll];
     [__appDelegate getAccelerometerPitch:pitch roll:roll];
 }
 }
 
 
-void Platform::getRawSensorValues(float* accelX, float* accelY, float* accelZ, float* gyroX, float* gyroY, float* gyroZ)
+void Platform::getSensorValues(float* accelX, float* accelY, float* accelZ, float* gyroX, float* gyroY, float* gyroZ)
 {
 {
     float x, y, z;
     float x, y, z;
     [__appDelegate getRawAccelX:&x Y:&y Z:&z];
     [__appDelegate getRawAccelX:&x Y:&y Z:&z];

+ 1 - 1
gameplay/src/Properties.cpp

@@ -184,7 +184,7 @@ void Properties::readProperties(Stream* stream)
                 name = trimWhiteSpace(name);
                 name = trimWhiteSpace(name);
 
 
                 // Scan for next token, the property's value.
                 // Scan for next token, the property's value.
-                value = strtok(NULL, "=");
+                value = strtok(NULL, "");
                 if (value == NULL)
                 if (value == NULL)
                 {
                 {
                     GP_ERROR("Error parsing properties file: attribute with name ('%s') but no value.", name);
                     GP_ERROR("Error parsing properties file: attribute with name ('%s') but no value.", name);

+ 5 - 5
gameplay/src/Ref.cpp

@@ -5,7 +5,7 @@
 namespace gameplay
 namespace gameplay
 {
 {
 
 
-#ifdef GAMEPLAY_MEM_LEAK_DETECTION
+#ifdef GP_USE_MEM_LEAK_DETECTION
 void* trackRef(Ref* ref);
 void* trackRef(Ref* ref);
 void untrackRef(Ref* ref, void* record);
 void untrackRef(Ref* ref, void* record);
 #endif
 #endif
@@ -13,7 +13,7 @@ void untrackRef(Ref* ref, void* record);
 Ref::Ref() :
 Ref::Ref() :
     _refCount(1)
     _refCount(1)
 {
 {
-#ifdef GAMEPLAY_MEM_LEAK_DETECTION
+#ifdef GP_USE_MEM_LEAK_DETECTION
     __record = trackRef(this);
     __record = trackRef(this);
 #endif
 #endif
 }
 }
@@ -21,7 +21,7 @@ Ref::Ref() :
 Ref::Ref(const Ref& copy) :
 Ref::Ref(const Ref& copy) :
     _refCount(1)
     _refCount(1)
 {
 {
-#ifdef GAMEPLAY_MEM_LEAK_DETECTION
+#ifdef GP_USE_MEM_LEAK_DETECTION
     __record = trackRef(this);
     __record = trackRef(this);
 #endif
 #endif
 }
 }
@@ -39,7 +39,7 @@ void Ref::release()
 {
 {
     if ((--_refCount) <= 0)
     if ((--_refCount) <= 0)
     {
     {
-#ifdef GAMEPLAY_MEM_LEAK_DETECTION
+#ifdef GP_USE_MEM_LEAK_DETECTION
         untrackRef(this, __record);
         untrackRef(this, __record);
 #endif
 #endif
         delete this;
         delete this;
@@ -51,7 +51,7 @@ unsigned int Ref::getRefCount() const
     return _refCount;
     return _refCount;
 }
 }
 
 
-#ifdef GAMEPLAY_MEM_LEAK_DETECTION
+#ifdef GP_USE_MEM_LEAK_DETECTION
 
 
 struct RefAllocationRecord
 struct RefAllocationRecord
 {
 {

+ 2 - 2
gameplay/src/Ref.h

@@ -66,8 +66,8 @@ private:
 
 
     unsigned int _refCount;
     unsigned int _refCount;
 
 
-    // Memory leak diagnostic data (only included when GAMEPLAY_MEM_LEAK_DETECTION is defined)
-#ifdef GAMEPLAY_MEM_LEAK_DETECTION
+    // Memory leak diagnostic data (only included when GP_USE_MEM_LEAK_DETECTION is defined)
+#ifdef GP_USE_MEM_LEAK_DETECTION
     friend class Game;
     friend class Game;
     static void printLeaks();
     static void printLeaks();
     void* __record;
     void* __record;

+ 10 - 10
gameplay/src/RenderState.cpp

@@ -315,7 +315,7 @@ void RenderState::applyAutoBinding(const char* uniformName, const char* autoBind
         else
         else
         {
         {
             bound = false;
             bound = false;
-            GP_WARN("Unsupported auto binding type (%d).", autoBinding);
+            GP_WARN("Unsupported auto binding type (%s).", autoBinding);
         }
         }
     }
     }
 
 
@@ -471,7 +471,7 @@ RenderState* RenderState::getTopmost(RenderState* below)
         }
         }
         rs = rs->_parent;
         rs = rs->_parent;
     }
     }
-    
+
     return NULL;
     return NULL;
 }
 }
 
 
@@ -514,8 +514,8 @@ void RenderState::cloneInto(RenderState* renderState, NodeCloneContext& context)
 RenderState::StateBlock::StateBlock()
 RenderState::StateBlock::StateBlock()
     : _cullFaceEnabled(false), _depthTestEnabled(false), _depthWriteEnabled(true), _depthFunction(RenderState::DEPTH_LESS),
     : _cullFaceEnabled(false), _depthTestEnabled(false), _depthWriteEnabled(true), _depthFunction(RenderState::DEPTH_LESS),
       _blendEnabled(false), _blendSrc(RenderState::BLEND_ONE), _blendDst(RenderState::BLEND_ZERO),
       _blendEnabled(false), _blendSrc(RenderState::BLEND_ONE), _blendDst(RenderState::BLEND_ZERO),
-      _cullFaceSide(CULL_FACE_SIDE_BACK), _frontFace(FRONT_FACE_CCW), _stencilTestEnabled(false), _stencilWrite(RS_ALL_ONES), 
-	  _stencilFunction(RenderState::STENCIL_ALWAYS), _stencilFunctionRef(0), _stencilFunctionMask(RS_ALL_ONES), 
+      _cullFaceSide(CULL_FACE_SIDE_BACK), _frontFace(FRONT_FACE_CCW), _stencilTestEnabled(false), _stencilWrite(RS_ALL_ONES),
+	  _stencilFunction(RenderState::STENCIL_ALWAYS), _stencilFunctionRef(0), _stencilFunctionMask(RS_ALL_ONES),
 	  _stencilOpSfail(RenderState::STENCIL_OP_KEEP), _stencilOpDpfail(RenderState::STENCIL_OP_KEEP), _stencilOpDppass(RenderState::STENCIL_OP_KEEP),
 	  _stencilOpSfail(RenderState::STENCIL_OP_KEEP), _stencilOpDpfail(RenderState::STENCIL_OP_KEEP), _stencilOpDppass(RenderState::STENCIL_OP_KEEP),
       _bits(0L)
       _bits(0L)
 {
 {
@@ -586,9 +586,9 @@ void RenderState::StateBlock::bindNoRestore()
     }
     }
     if ((_bits & RS_DEPTH_TEST) && (_depthTestEnabled != _defaultState->_depthTestEnabled))
     if ((_bits & RS_DEPTH_TEST) && (_depthTestEnabled != _defaultState->_depthTestEnabled))
     {
     {
-        if (_depthTestEnabled) 
+        if (_depthTestEnabled)
             GL_ASSERT( glEnable(GL_DEPTH_TEST) );
             GL_ASSERT( glEnable(GL_DEPTH_TEST) );
-        else 
+        else
             GL_ASSERT( glDisable(GL_DEPTH_TEST) );
             GL_ASSERT( glDisable(GL_DEPTH_TEST) );
         _defaultState->_depthTestEnabled = _depthTestEnabled;
         _defaultState->_depthTestEnabled = _depthTestEnabled;
     }
     }
@@ -604,9 +604,9 @@ void RenderState::StateBlock::bindNoRestore()
     }
     }
 	if ((_bits & RS_STENCIL_TEST) && (_stencilTestEnabled != _defaultState->_stencilTestEnabled))
 	if ((_bits & RS_STENCIL_TEST) && (_stencilTestEnabled != _defaultState->_stencilTestEnabled))
     {
     {
-        if (_stencilTestEnabled) 
+        if (_stencilTestEnabled)
 			GL_ASSERT( glEnable(GL_STENCIL_TEST) );
 			GL_ASSERT( glEnable(GL_STENCIL_TEST) );
-        else 
+        else
             GL_ASSERT( glDisable(GL_STENCIL_TEST) );
             GL_ASSERT( glDisable(GL_STENCIL_TEST) );
         _defaultState->_stencilTestEnabled = _stencilTestEnabled;
         _defaultState->_stencilTestEnabled = _stencilTestEnabled;
     }
     }
@@ -615,7 +615,7 @@ void RenderState::StateBlock::bindNoRestore()
 		GL_ASSERT( glStencilMask(_stencilWrite) );
 		GL_ASSERT( glStencilMask(_stencilWrite) );
         _defaultState->_stencilWrite = _stencilWrite;
         _defaultState->_stencilWrite = _stencilWrite;
     }
     }
-	if ((_bits & RS_STENCIL_FUNC) && (_stencilFunction != _defaultState->_stencilFunction || 
+	if ((_bits & RS_STENCIL_FUNC) && (_stencilFunction != _defaultState->_stencilFunction ||
 										_stencilFunctionRef != _defaultState->_stencilFunctionRef ||
 										_stencilFunctionRef != _defaultState->_stencilFunctionRef ||
 										_stencilFunctionMask != _defaultState->_stencilFunctionMask))
 										_stencilFunctionMask != _defaultState->_stencilFunctionMask))
     {
     {
@@ -624,7 +624,7 @@ void RenderState::StateBlock::bindNoRestore()
 		_defaultState->_stencilFunctionRef = _stencilFunctionRef;
 		_defaultState->_stencilFunctionRef = _stencilFunctionRef;
 		_defaultState->_stencilFunctionMask = _stencilFunctionMask;
 		_defaultState->_stencilFunctionMask = _stencilFunctionMask;
     }
     }
-	if ((_bits & RS_STENCIL_OP) && (_stencilOpSfail != _defaultState->_stencilOpSfail || 
+	if ((_bits & RS_STENCIL_OP) && (_stencilOpSfail != _defaultState->_stencilOpSfail ||
 									_stencilOpDpfail != _defaultState->_stencilOpDpfail ||
 									_stencilOpDpfail != _defaultState->_stencilOpDpfail ||
 									_stencilOpDppass != _defaultState->_stencilOpDppass))
 									_stencilOpDppass != _defaultState->_stencilOpDppass))
     {
     {

+ 1 - 1
gameplay/src/Slider.cpp

@@ -126,7 +126,7 @@ bool Slider::isValueTextVisible() const
 
 
 void Slider::setValueTextAlignment(Font::Justify alignment)
 void Slider::setValueTextAlignment(Font::Justify alignment)
 {
 {
-    if (alignment != _alignment)
+    if (alignment != _valueTextAlignment)
     {
     {
         _dirty = true;
         _dirty = true;
     }
     }

+ 18 - 0
gameplay/src/SocialAchievement.cpp

@@ -0,0 +1,18 @@
+#include "Base.h"
+#include "SocialAchievement.h"
+
+namespace gameplay
+{
+
+SocialAchievement::SocialAchievement()
+    : value(0), total(0), percentCompleted(0.0f)
+{
+}
+
+SocialAchievement::~SocialAchievement()
+{
+}
+
+}
+
+

+ 63 - 0
gameplay/src/SocialAchievement.h

@@ -0,0 +1,63 @@
+#ifndef SOCIALACHIEVEMENT_H_
+#define SOCIALACHIEVEMENT_H_
+
+namespace gameplay
+{
+
+/**
+ * Defines a social achievement in a game.
+ */
+class SocialAchievement
+{
+
+public:
+
+    /**
+     * The name of the achievement.
+     */
+    std::string name;
+
+    /**
+     * The title of the achievement.
+     */
+    std::string title;
+
+    /**
+     * The value of progress (0 to getTotal) representing the current unit value of completion.
+     */
+    unsigned int value;
+
+    /**
+     * The total value of progress needed to complete the achievement.
+     */
+    unsigned int total;
+
+    /**
+     * The percent that the achievement is complete. Equivalent to getValue() / getTotal() * 100.0f
+     */
+    float percentCompleted;
+
+    /**
+     * The date/time the achievement was achieved. (UTC string format "2013-06-27T07:40::05")
+     */
+    std::string dateTimeAchieved;
+
+    /**
+     * The provider handle for an achievement.
+     */
+    SocialAchievementHandle handle;
+
+    /**
+     * Constructor.
+     */
+    SocialAchievement();
+
+    /**
+     * Destructor.
+     */
+    ~SocialAchievement();
+};
+
+}
+
+#endif

+ 16 - 0
gameplay/src/SocialChallenge.cpp

@@ -0,0 +1,16 @@
+#include "Base.h"
+#include "SocialChallenge.h"
+
+namespace gameplay
+{
+
+SocialChallenge::SocialChallenge()
+    : state(INVALID), score(0.0f)
+{
+}
+
+SocialChallenge::~SocialChallenge()
+{
+}
+
+}

+ 84 - 0
gameplay/src/SocialChallenge.h

@@ -0,0 +1,84 @@
+#ifndef SOCIALCHALLENGE_H_
+#define SOCIALCHALLENGE_H_
+
+namespace gameplay
+{
+
+/**
+ * Defines a social challenge between social players.
+ */
+class SocialChallenge
+{
+
+public:
+
+	/**
+	 * The challenge state.
+	 */
+    enum State
+    {
+        PENDING,
+        COMPLETE,
+        DECLINED,
+        INVALID
+    };
+
+    /**
+     * The name of the challenge.
+     */
+    std::string name;
+
+    /**
+     * The title of the challenge.
+     */
+    std::string title;
+
+    /**
+     * The name of the player issuing the challenge.
+     */
+    std::string issuedPlayerName;
+
+    /**
+     * The name of the player being challenged.
+     */
+    std::string challengedPlayerName;
+
+    /**
+     * The state of the challenge.
+     */
+    State state;
+
+    /**
+     * The score for the challenge.
+     */
+    float score;
+
+    /**
+     * The date/time the challenge was issued. (UTC string format "2013-06-27T07:40::05")
+     */
+    std::string dateTimeIssued;
+
+    /**
+     * The date/time the challenge was completed. (UTC string format "2013-06-27T07:40::05")
+     */
+    std::string dateTimeCompleted;
+
+    /**
+     * The provider handle for an challenge.
+     */
+    SocialChallengeHandle handle;
+
+    /**
+     * Constructor.
+     */
+    SocialChallenge();
+
+    /**
+     * Destructor.
+     */
+    ~SocialChallenge();
+};
+
+}
+
+#endif

+ 92 - 0
gameplay/src/SocialController.cpp

@@ -0,0 +1,92 @@
+#include "Base.h"
+#include "SocialController.h"
+#include "Game.h"
+#include "social/ScoreloopSocialSession.h"
+#include "social/GoogleGamesSocialSession.h"
+
+namespace gameplay
+{
+
+SocialController::SocialController()
+    : _session(NULL)
+{
+}
+
+SocialController::~SocialController()
+{
+}
+
+void SocialController::initialize()
+{
+}
+
+void SocialController::finalize()
+{
+	if (_session)
+		_session->synchronizeAchievements();
+}
+
+void SocialController::pause()
+{
+	if (_session)
+		_session->synchronizeAchievements();
+}
+
+void SocialController::resume()
+{
+}
+
+void SocialController::update(float elapsedTime)
+{
+}
+
+bool SocialController::handleEvent(void *event)
+{
+	if (_session)
+		return _session->handleEvent(event);
+
+	return false;
+}
+
+void SocialController::authenticate(SocialSessionListener* listener)
+{
+#ifdef GP_USE_SOCIAL
+#if defined(__QNX__)
+    Properties* socialProperties = Game::getInstance()->getConfig()->getNamespace("social", true);
+    const char* providerStr = "";
+
+    if (socialProperties)
+    {
+    	providerStr = socialProperties->getString("provider");
+    }
+
+    if (strcmp(providerStr, "Scoreloop") == 0)
+    {
+        _session = ScoreloopSocialSession::authenticate(listener, socialProperties);
+    }
+    else
+    {
+        listener->authenticateEvent(SocialSessionListener::ERROR_INITIALIZATION, NULL);
+    }
+#elif defined(__ANDROID__)
+    Properties* socialProperties = Game::getInstance()->getConfig()->getNamespace("social", true);
+    const char* providerStr = "";
+
+    if (socialProperties)
+    {
+    	providerStr = socialProperties->getString("provider");
+    }
+
+    if (strcmp(providerStr, "GoogleGames") == 0)
+    {
+        _session = GoogleGamesSocialSession::authenticate(listener, socialProperties);
+    }
+    else
+    {
+        listener->authenticateEvent(SocialSessionListener::ERROR_INITIALIZATION, NULL);
+    }
+#endif
+#endif
+}
+
+}

+ 101 - 0
gameplay/src/SocialController.h

@@ -0,0 +1,101 @@
+#ifndef SOCIALCONTROLLER_H_
+#define SOCIALCONTROLLER_H_
+
+#include "Properties.h"
+#include "SocialSession.h"
+#include "SocialSessionListener.h"
+
+namespace gameplay
+{
+
+/**
+ * Defines a class for controlling various back-end support for social capabilities.
+ *
+ * Back-end social providers include Friends, Leaderboards, Achievements and Multiplayer.
+ * Social back-ends supported are Scoreloop, GameCenter and Google Play Game Services and Facebook.
+ * Configuration for these are specified in game.config:
+
+  @verbatim
+    social
+    {
+         provider = Scoreloop
+         id  = d346c484-12aa-49a2-a0a0-de2f87492d72
+         secret = aAa+DehBfyGO/CYaE3nWomgu7SIbWFczUih+Qwf3/n7u0y3nyq5Hag==
+         version = 1.0
+         language = en
+         currency = ASC
+         leaderboard_mappings
+         {
+             // Format: leaderboardId = provider value
+             easy = 0
+             medium = 1
+             hard = 2
+         }
+    }
+
+ */
+class SocialController
+{
+    friend class Game;
+
+public:
+
+    /**
+     * Asyncrhonously authenticates a new user session.
+     *
+     * @param listener The listener
+     */
+    void authenticate(SocialSessionListener* listener);
+
+    /**
+     * Handle the event from the event loop if needed.
+     */
+    bool handleEvent(void *event);
+
+private:
+
+    /**
+     * Constructor.
+     */
+    SocialController();
+
+    /**
+     * Destructor.
+     */
+    ~SocialController();
+
+    /**
+     * Callback for when the controller is initialized.
+     */
+    void initialize();
+
+    /*
+     * Callback for when the controller is finalized.
+     */
+    void finalize();
+
+    /**
+     * Pauses the controller.
+     */
+    void pause();
+
+    /**
+     * Resumes the controller.
+     */
+    void resume();
+
+    /**
+     * Callback for when the controller receives a frame update event.
+     */
+    void update(float elapsedTime);
+
+private:
+
+    SocialSession* _session;
+
+};
+
+}
+
+#endif
+

+ 17 - 0
gameplay/src/SocialPlayer.cpp

@@ -0,0 +1,17 @@
+#include "Base.h"
+#include "SocialPlayer.h"
+
+namespace gameplay
+{
+
+SocialPlayer::SocialPlayer()
+{
+}
+
+SocialPlayer::~SocialPlayer()
+{
+}
+
+}
+
+

+ 40 - 0
gameplay/src/SocialPlayer.h

@@ -0,0 +1,40 @@
+#ifndef SOCIALPLAYER_H_
+#define SOCIALPLAYER_H_
+
+namespace gameplay
+{
+
+/**
+ * Defines a social player.
+ *
+ * This can either be the authenticated user, friend or community user (not friend yet...).
+ */
+class SocialPlayer
+{
+
+public:
+
+    /**
+     * The players friendly name.
+     */
+    std::string name;
+
+    /**
+     * The provider handle for a player.
+     */
+    SocialPlayerHandle handle;
+
+    /**
+     * Constructor
+     */
+    SocialPlayer();
+
+    /**
+     * Destructor
+     */
+    ~SocialPlayer();
+};
+
+}
+
+#endif

+ 18 - 0
gameplay/src/SocialScore.cpp

@@ -0,0 +1,18 @@
+#include "Base.h"
+#include "SocialScore.h"
+
+namespace gameplay
+{
+
+SocialScore::SocialScore()
+    : value(0.0f), rank(0)
+{
+}
+
+SocialScore::~SocialScore()
+{
+}
+
+}
+
+

+ 52 - 0
gameplay/src/SocialScore.h

@@ -0,0 +1,52 @@
+#ifndef SOCIALSCORE_H_
+#define SOCIALSCORE_H_
+
+namespace gameplay
+{
+
+/**
+ * Defines an abstract class for a score that resides in a leaderboard
+ */
+class SocialScore
+{
+public:
+
+    /**
+     * The value for the score.
+     */
+    float value;
+
+    /**
+     * The formatted value for the score.
+     */
+    std::string valueFormatted;
+
+    /**
+     * The rank index of the score within the leaderboard.
+     */
+    unsigned int rank;
+
+    /**
+     * The handle of the player that achieved the score
+     */
+    std::string playerName;
+
+    /**
+     * The score
+     */
+    SocialScoreHandle handle;
+
+    /**
+     * Constructor
+     */
+    SocialScore();
+
+    /**
+     * Destructor
+     */
+    ~SocialScore();
+};
+
+}
+
+#endif

+ 111 - 0
gameplay/src/SocialSession.h

@@ -0,0 +1,111 @@
+#ifndef SOCIALSESSION_H_
+#define SOCIALSESSION_H_
+
+#include "SocialSessionListener.h"
+#include "SocialPlayer.h"
+#include "SocialAchievement.h"
+#include "SocialScore.h"
+#include "SocialChallenge.h"
+#include "Properties.h"
+
+namespace gameplay
+{
+
+/**
+ * Defines an abstract class for typical social game activities running with an authenticated session.
+ */
+class SocialSession
+{
+    friend class SocialController;
+
+public:
+
+    enum CommunityScope
+    {
+        COMMUNITY_SCOPE_FRIENDS,
+        COMMUNITY_SCOPE_ALL
+    };
+
+    enum TimeScope
+    {
+        TIME_SCOPE_TODAY,
+        TIME_SCOPE_WEEK,
+        TIME_SCOPE_ALL,
+    };
+
+    /**
+     * Gets the asynchronous response listener that registered for this session.
+     *
+     * @return The asynchronous response listener that registered for this session.
+     */
+    virtual SocialSessionListener* getListener() = 0;
+
+    virtual const SocialPlayer& getUser() const = 0;
+
+    virtual void loadFriends() = 0;
+
+    virtual void loadAchievements() = 0;
+
+    virtual void submitAchievement(const char* achievementId, unsigned int value, bool achieved=false) = 0;
+
+    virtual void incrementAchievement(const char* achievementId, unsigned int increment=1) = 0;
+
+    virtual void synchronizeAchievements() = 0;
+
+    /**
+     * Asynchronously request the scores for the count where the player is in the middle.
+     *
+     * @param leaderboardId The leaderboard to get populated with the scores.
+     * @param community The community scope to filter the search list.
+     * @param time The time scope to filter teh search list.
+     * @param player The player to narrow the search around.
+     * @param count The number to scores return in the result.
+     */
+    virtual void loadScores(const char* leaderboardId, CommunityScope community, TimeScope time, const SocialPlayer& player, unsigned int count) = 0;
+
+    /**
+     * Asynchronously request the scores for a specified leaderboard for this game.
+     *
+     * @param leaderboardId The leaderboard to get populated with the scores.
+     */
+    virtual void loadScores(const char* leaderboardId, CommunityScope community, TimeScope time, unsigned int start, unsigned int count) = 0;
+
+    virtual void submitScore(const char* leaderboardId, float value) = 0;
+
+    virtual void submitChallenge(const SocialPlayer *player, unsigned int wager, float score, const char* leaderboardId=0) = 0;
+
+    virtual void loadChallenges(bool showOpenChallengesOnly=true) = 0;
+
+    virtual void replyToChallenge(const SocialChallenge *challenge, bool accept) = 0;
+
+    virtual void loadSavedData(const char* key) = 0;
+
+    virtual void submitSavedData(const char* key, std::string data) = 0;
+
+    virtual void displayLeaderboard(const char* leaderboardId) = 0;
+
+    virtual void displayAchievements() = 0;
+
+    virtual void displayChallenges() = 0;
+
+    virtual void displayChallengeSubmit(const SocialChallenge *challenge, float score) = 0;
+
+    virtual bool handleEvent(void *event) { return true; }
+
+protected:
+
+    /**
+     * Contructor
+     */
+    SocialSession() { }
+
+    /**
+     * Destructor
+     */
+    virtual ~SocialSession() { }
+
+};
+
+}
+
+#endif

+ 92 - 0
gameplay/src/SocialSessionListener.cpp

@@ -0,0 +1,92 @@
+#include "Base.h"
+#include "SocialSessionListener.h"
+
+namespace gameplay
+{
+SocialSessionListener::SocialSessionListener()
+{
+}
+
+SocialSessionListener::SocialSessionListener(const SocialSessionListener& copy)
+{
+}
+
+SocialSessionListener::~SocialSessionListener()
+{
+}
+
+void SocialSessionListener::authenticateEvent(ResponseCode code, SocialSession* session)
+{
+}
+
+void SocialSessionListener::loadFriendsEvent(ResponseCode code, std::vector<SocialPlayer> friends)
+{
+}
+
+void SocialSessionListener::loadAchievementsEvent(ResponseCode code, std::vector<SocialAchievement> achievements)
+{
+}
+
+void SocialSessionListener::synchronizeAchievementEvent(ResponseCode code)
+{
+}
+
+void SocialSessionListener::submitAchievementEvent(ResponseCode code)
+{
+}
+
+void SocialSessionListener::awardAchievedEvent(ResponseCode code, const SocialAchievement &achievement)
+{
+}
+
+void SocialSessionListener::loadScoresEvent(ResponseCode code, std::vector<SocialScore> scores)
+{
+}
+
+void SocialSessionListener::submitScoreEvent(ResponseCode code)
+{
+}
+
+void SocialSessionListener::submitChallengeEvent(ResponseCode code, const SocialChallenge &challenge)
+{
+}
+
+void SocialSessionListener::startChallengeEvent(ResponseCode code, const SocialChallenge &challenge)
+{
+}
+
+void SocialSessionListener::replyToChallengeEvent(ResponseCode code)
+{
+}
+
+void SocialSessionListener::loadChallengesEvent(ResponseCode code, std::vector<SocialChallenge> challenges)
+{
+}
+
+void SocialSessionListener::loadSavedDataEvent(ResponseCode code, std::string data)
+{
+}
+
+void SocialSessionListener::submitSavedDataEvent(ResponseCode code)
+{
+}
+
+void SocialSessionListener::uiEvent(ResponseCode code, std::string errorMessage)
+{
+}
+
+void SocialSessionListener::displayedLeaderboardEvent(ResponseCode code, std::string errorMessage)
+{
+}
+
+void SocialSessionListener::displayedAchievementsEvent(ResponseCode code, std::string errorMessage)
+{
+}
+
+void SocialSessionListener::displayedChallengesEvent(ResponseCode code, std::string errorMessage)
+{
+}
+
+}
+
+

+ 93 - 0
gameplay/src/SocialSessionListener.h

@@ -0,0 +1,93 @@
+#ifndef SOCIALSESSIONLISTENER_H_
+#define SOCIALSESSIONLISTENER_H_
+
+#include "SocialPlayer.h"
+#include "SocialAchievement.h"
+#include "SocialScore.h"
+#include "SocialChallenge.h"
+
+namespace gameplay
+{
+
+class SocialSession;
+
+/**
+ * Defines a class for handling session responses to various session request.
+ */
+class SocialSessionListener
+{
+public:
+
+    /**
+     * Constructor
+     */
+    SocialSessionListener();
+
+    /**
+     * Constructor
+     */
+    SocialSessionListener(const SocialSessionListener& copy);
+
+    /**
+     * Destructor
+     */
+    virtual ~SocialSessionListener();
+
+    /**
+     * Response codes returned on listener events.
+     */
+    enum ResponseCode
+    {
+        SUCCESS = 0,
+        ERROR_INITIALIZATION,
+        ERROR_PENDING_RESPONSE,
+        ERROR_INVALID_USER,
+        ERROR_INVALID_ARG,
+        ERROR_SERVER,
+        ERROR_CANCELLED,
+        ERROR_NOT_SUPPORTED,
+        ERROR_UNKNOWN
+    };
+
+    virtual void authenticateEvent(ResponseCode code, SocialSession* session);
+
+    virtual void loadFriendsEvent(ResponseCode code, std::vector<SocialPlayer> friends);
+
+    virtual void loadAchievementsEvent(ResponseCode code, std::vector<SocialAchievement> achievements);
+
+    virtual void synchronizeAchievementEvent(ResponseCode code);
+
+    virtual void submitAchievementEvent(ResponseCode code);
+
+    virtual void awardAchievedEvent(ResponseCode code, const SocialAchievement &achievement);
+
+    virtual void loadScoresEvent(ResponseCode code, std::vector<SocialScore> scores);
+
+    virtual void submitScoreEvent(ResponseCode code);
+
+    virtual void submitChallengeEvent(ResponseCode code, const SocialChallenge &challenge);
+
+    virtual void startChallengeEvent(ResponseCode code, const SocialChallenge &challenge);
+
+    virtual void replyToChallengeEvent(ResponseCode code);
+
+    virtual void loadChallengesEvent(ResponseCode code, std::vector<SocialChallenge> challenges);
+
+    virtual void loadSavedDataEvent(ResponseCode code, std::string data);
+
+    virtual void submitSavedDataEvent(ResponseCode code);
+
+    virtual void uiEvent(ResponseCode code, std::string errorMessage="");
+
+    virtual void displayedLeaderboardEvent(ResponseCode code, std::string errorMessage="");
+
+    virtual void displayedAchievementsEvent(ResponseCode code, std::string errorMessage="");
+
+    virtual void displayedChallengesEvent(ResponseCode code, std::string errorMessage="");
+
+};
+
+}
+
+
+#endif

+ 1 - 0
gameplay/src/Theme.cpp

@@ -95,6 +95,7 @@ Theme* Theme::create(const char* url)
     theme->_spriteBatch = SpriteBatch::create(theme->_texture);
     theme->_spriteBatch = SpriteBatch::create(theme->_texture);
     GP_ASSERT(theme->_spriteBatch);
     GP_ASSERT(theme->_spriteBatch);
     theme->_spriteBatch->getSampler()->setFilterMode(Texture::LINEAR, Texture::LINEAR);
     theme->_spriteBatch->getSampler()->setFilterMode(Texture::LINEAR, Texture::LINEAR);
+    theme->_spriteBatch->getSampler()->setWrapMode(Texture::CLAMP, Texture::CLAMP);
 
 
     float tw = 1.0f / theme->_texture->getWidth();
     float tw = 1.0f / theme->_texture->getWidth();
     float th = 1.0f / theme->_texture->getHeight();
     float th = 1.0f / theme->_texture->getHeight();

+ 9 - 1
gameplay/src/gameplay.h

@@ -88,7 +88,7 @@
 #include "AIState.h"
 #include "AIState.h"
 #include "AIStateMachine.h"
 #include "AIStateMachine.h"
 
 
-// UI
+// Forms UI
 #include "Theme.h"
 #include "Theme.h"
 #include "Control.h"
 #include "Control.h"
 #include "Container.h"
 #include "Container.h"
@@ -105,3 +105,11 @@
 #include "AbsoluteLayout.h"
 #include "AbsoluteLayout.h"
 #include "VerticalLayout.h"
 #include "VerticalLayout.h"
 #include "FlowLayout.h"
 #include "FlowLayout.h"
+
+// Social
+#include "SocialController.h"
+#include "SocialSession.h"
+#include "SocialSessionListener.h"
+#include "SocialPlayer.h"
+#include "SocialAchievement.h"
+#include "SocialScore.h"

+ 4 - 37
gameplay/src/lua/lua_Game.cpp

@@ -44,8 +44,8 @@ void luaRegister_Game()
         {"getGamepadCount", lua_Game_getGamepadCount},
         {"getGamepadCount", lua_Game_getGamepadCount},
         {"getHeight", lua_Game_getHeight},
         {"getHeight", lua_Game_getHeight},
         {"getPhysicsController", lua_Game_getPhysicsController},
         {"getPhysicsController", lua_Game_getPhysicsController},
-        {"getRawSensorValues", lua_Game_getRawSensorValues},
         {"getScriptController", lua_Game_getScriptController},
         {"getScriptController", lua_Game_getScriptController},
+        {"getSensorValues", lua_Game_getSensorValues},
         {"getState", lua_Game_getState},
         {"getState", lua_Game_getState},
         {"getViewport", lua_Game_getViewport},
         {"getViewport", lua_Game_getViewport},
         {"getWidth", lua_Game_getWidth},
         {"getWidth", lua_Game_getWidth},
@@ -60,7 +60,6 @@ void luaRegister_Game()
         {"isMultiTouch", lua_Game_isMultiTouch},
         {"isMultiTouch", lua_Game_isMultiTouch},
         {"keyEvent", lua_Game_keyEvent},
         {"keyEvent", lua_Game_keyEvent},
         {"launchURL", lua_Game_launchURL},
         {"launchURL", lua_Game_launchURL},
-        {"menuEvent", lua_Game_menuEvent},
         {"mouseEvent", lua_Game_mouseEvent},
         {"mouseEvent", lua_Game_mouseEvent},
         {"pause", lua_Game_pause},
         {"pause", lua_Game_pause},
         {"registerGesture", lua_Game_registerGesture},
         {"registerGesture", lua_Game_registerGesture},
@@ -1070,7 +1069,7 @@ int lua_Game_getPhysicsController(lua_State* state)
     return 0;
     return 0;
 }
 }
 
 
-int lua_Game_getRawSensorValues(lua_State* state)
+int lua_Game_getSensorValues(lua_State* state)
 {
 {
     // Get the number of parameters.
     // Get the number of parameters.
     int paramCount = lua_gettop(state);
     int paramCount = lua_gettop(state);
@@ -1107,12 +1106,12 @@ int lua_Game_getRawSensorValues(lua_State* state)
                 gameplay::ScriptUtil::LuaArray<float> param6 = gameplay::ScriptUtil::getFloatPointer(7);
                 gameplay::ScriptUtil::LuaArray<float> param6 = gameplay::ScriptUtil::getFloatPointer(7);
 
 
                 Game* instance = getInstance(state);
                 Game* instance = getInstance(state);
-                instance->getRawSensorValues(param1, param2, param3, param4, param5, param6);
+                instance->getSensorValues(param1, param2, param3, param4, param5, param6);
                 
                 
                 return 0;
                 return 0;
             }
             }
 
 
-            lua_pushstring(state, "lua_Game_getRawSensorValues - Failed to match the given parameters to a valid function signature.");
+            lua_pushstring(state, "lua_Game_getSensorValues - Failed to match the given parameters to a valid function signature.");
             lua_error(state);
             lua_error(state);
             break;
             break;
         }
         }
@@ -1686,38 +1685,6 @@ int lua_Game_launchURL(lua_State* state)
     return 0;
     return 0;
 }
 }
 
 
-int lua_Game_menuEvent(lua_State* state)
-{
-    // Get the number of parameters.
-    int paramCount = lua_gettop(state);
-
-    // Attempt to match the parameters to a valid binding.
-    switch (paramCount)
-    {
-        case 1:
-        {
-            if ((lua_type(state, 1) == LUA_TUSERDATA))
-            {
-                Game* instance = getInstance(state);
-                instance->menuEvent();
-                
-                return 0;
-            }
-
-            lua_pushstring(state, "lua_Game_menuEvent - Failed to match the given parameters to a valid function signature.");
-            lua_error(state);
-            break;
-        }
-        default:
-        {
-            lua_pushstring(state, "Invalid number of parameters (expected 1).");
-            lua_error(state);
-            break;
-        }
-    }
-    return 0;
-}
-
 int lua_Game_mouseEvent(lua_State* state)
 int lua_Game_mouseEvent(lua_State* state)
 {
 {
     // Get the number of parameters.
     // Get the number of parameters.

+ 1 - 2
gameplay/src/lua/lua_Game.h

@@ -27,8 +27,8 @@ int lua_Game_getGamepad(lua_State* state);
 int lua_Game_getGamepadCount(lua_State* state);
 int lua_Game_getGamepadCount(lua_State* state);
 int lua_Game_getHeight(lua_State* state);
 int lua_Game_getHeight(lua_State* state);
 int lua_Game_getPhysicsController(lua_State* state);
 int lua_Game_getPhysicsController(lua_State* state);
-int lua_Game_getRawSensorValues(lua_State* state);
 int lua_Game_getScriptController(lua_State* state);
 int lua_Game_getScriptController(lua_State* state);
+int lua_Game_getSensorValues(lua_State* state);
 int lua_Game_getState(lua_State* state);
 int lua_Game_getState(lua_State* state);
 int lua_Game_getViewport(lua_State* state);
 int lua_Game_getViewport(lua_State* state);
 int lua_Game_getWidth(lua_State* state);
 int lua_Game_getWidth(lua_State* state);
@@ -43,7 +43,6 @@ int lua_Game_isMultiSampling(lua_State* state);
 int lua_Game_isMultiTouch(lua_State* state);
 int lua_Game_isMultiTouch(lua_State* state);
 int lua_Game_keyEvent(lua_State* state);
 int lua_Game_keyEvent(lua_State* state);
 int lua_Game_launchURL(lua_State* state);
 int lua_Game_launchURL(lua_State* state);
-int lua_Game_menuEvent(lua_State* state);
 int lua_Game_mouseEvent(lua_State* state);
 int lua_Game_mouseEvent(lua_State* state);
 int lua_Game_pause(lua_State* state);
 int lua_Game_pause(lua_State* state);
 int lua_Game_registerGesture(lua_State* state);
 int lua_Game_registerGesture(lua_State* state);

+ 192 - 0
gameplay/src/social/GoogleGamesSocialSession.cpp

@@ -0,0 +1,192 @@
+#if defined(__ANDROID__) && defined(GP_USE_SOCIAL)
+
+#include "Base.h"
+#include "GoogleGamesSocialSession.h"
+#include <android_native_app_glue.h>
+#include <android/log.h>
+
+namespace gameplay
+{
+
+extern struct android_app* __state;
+
+GoogleGamesSocialSession* GoogleGamesSocialSession::_session = NULL;
+
+GoogleGamesSocialSession::GoogleGamesSocialSession()
+    : SocialSession(),
+      _listener(NULL), _properties(NULL), _pendingUserResponse(false), _pendingFriendsResponse(false),
+      _pendingScoresResponse(false), _pendingSubmitScoreResponse(false), _pendingAchievementResponse(false),
+      _pendingDataResponse(false),
+      _key(NULL)
+{
+    _userOp = USEROP_GET_LOCALUSER;
+}
+
+GoogleGamesSocialSession::~GoogleGamesSocialSession()
+{
+}
+
+SocialSessionListener* GoogleGamesSocialSession::getListener()
+{
+    return _listener;
+}
+
+SocialSession *GoogleGamesSocialSession::authenticate(SocialSessionListener* listener, Properties* properties)
+{
+    if (!_session)
+    {
+		_session = new GoogleGamesSocialSession();
+		_session->_listener = listener;
+		_session->_properties = properties;
+
+		const char* gameId = properties->getString("id");
+		const char* gameSecret = properties->getString("secret");
+		const char* gameVersion = properties->getString("version");
+		const char* gameCurrency = properties->getString("currency");
+		const char* gameLanguage = properties->getString("language");
+#ifdef __ANDROID__
+	    android_app* state = __state;
+	    GP_ASSERT(state && state->activity && state->activity->vm);
+	    JavaVM* jvm = state->activity->vm;
+	    JNIEnv* env = NULL;
+	    jvm->GetEnv((void **)&env, JNI_VERSION_1_6);
+	    jint r = jvm->AttachCurrentThread(&env, NULL);
+	    if (r == JNI_ERR)
+	    {
+	        GP_ERROR("Failed to retrieve JVM environment to authenticate.");
+	        return 0;
+	    }
+	    GP_ASSERT(env);
+
+		jclass testClassHandle = env->FindClass("org/gameplay3d/lib/TestClass");
+		jmethodID computeMultHandle = env->GetMethodID(testClassHandle, "ComputeMult", "(FF)I");
+		jmethodID testClassCtor = env->GetMethodID(testClassHandle, "<init>", "()V");
+		jobject testClassInstance = env->NewObject(testClassHandle, testClassCtor);
+
+		jfloat a = 4.0f;
+		jfloat b = 0.5f;
+		jint result = env->CallIntMethod(testClassInstance, computeMultHandle, a, b);
+		fprintf(stderr, "the results is %d\n", result);
+
+		jvm->DetachCurrentThread();
+#endif
+    }
+
+    return _session;
+}
+
+const SocialPlayer& GoogleGamesSocialSession::getUser() const
+{
+	return _user;
+}
+
+/**
+ * @see SocialSession::loadFriends
+ */
+void GoogleGamesSocialSession::loadFriends()
+{
+
+}
+
+/**
+ * @see SocialSession::loadAchievements
+ */
+void GoogleGamesSocialSession::loadAchievements()
+{
+
+}
+
+/**
+ * @see SocialSession::submitAchievement
+ */
+void GoogleGamesSocialSession::submitAchievement(const char* achievementId, unsigned int value, bool achieved=false)
+{
+
+}
+
+/**
+ * @see SocialSession::incrementAchievement
+ */
+void GoogleGamesSocialSession::incrementAchievement(const char* achievementId, unsigned int increment=1)
+{
+
+}
+
+/**
+  * @see SocialSession::syncAchievements
+  */
+void GoogleGamesSocialSession::synchronizeAchievements()
+{
+
+}
+
+/**
+ * @see SocialSession::loadScores
+ */
+void GoogleGamesSocialSession::loadScores(const char* leaderboardId, SocialSession::CommunityScope community, SocialSession::TimeScope time, const SocialPlayer& player, unsigned int count)
+{
+
+}
+
+/**
+ * @see SocialSession::loadScores
+ */
+void GoogleGamesSocialSession::loadScores(const char* leaderboardId, SocialSession::CommunityScope community, SocialSession::TimeScope time, unsigned int start, unsigned int count)
+{
+
+}
+
+/**
+ * @see SocialSession::submitScore
+ */
+void GoogleGamesSocialSession::submitScore(const char* leaderboardId, float score)
+{
+
+}
+
+/**
+  * @see SocialSession::submitChallenge
+  */
+void GoogleGamesSocialSession::submitChallenge(const SocialPlayer *player, unsigned int wager, float score, const char* leaderboardId=0)
+{
+
+}
+
+/**
+  * @see SocialSession::loadChallenges
+  */
+void GoogleGamesSocialSession::loadChallenges(bool showOpenChallengesOnly=true)
+{
+
+}
+
+/**
+  * @see SocialSession::acceptChallenge
+  */
+void GoogleGamesSocialSession::replyToChallenge(const SocialChallenge *challenge, bool accept)
+{
+
+}
+
+/**
+ * @see SocialSession::requestSavedData
+ */
+void GoogleGamesSocialSession::loadSavedData(const char* key) {}
+
+/**
+ * @see SocialSession::submitSavedData
+ */
+void GoogleGamesSocialSession::submitSavedData(const char* key, std::string data) {}
+
+void GoogleGamesSocialSession::displayLeaderboard(const char* leaderboardId) {}
+
+void GoogleGamesSocialSession::displayAchievements() {}
+
+void GoogleGamesSocialSession::displayChallenges() {}
+
+void GoogleGamesSocialSession::displayChallengeSubmit(const SocialChallenge *challenge, float score) {}
+
+
+}
+
+#endif

+ 201 - 0
gameplay/src/social/GoogleGamesSocialSession.h

@@ -0,0 +1,201 @@
+#if defined(__ANDROID__) && defined(GP_USE_SOCIAL)
+
+#ifndef GOOGLEGAMESSOCIALSESSION_H_
+#define GOOGLEGAMESSOCIALSESSION_H_
+
+#include "SocialSession.h"
+
+namespace gameplay
+{
+
+/**
+ * Google Games implementation of SocialSession
+ *
+ * Note: ensure game.config has the following properties
+ *
+  @verbatim
+    social
+    {
+         provider = GoogleGames
+         id = d346c484-12aa-49a2-a0a0-de2f87492d72
+         secret = aAa+DehBfyGO/CYaE3nWomgu7SIbWFczUih+Qwf3/n7u0y3nyq5Hag==
+         version = 1.0
+         language = en
+         currency = ASC
+         leaderboard_mappings
+         {
+             // Format: leaderboardId =  mode <unsigned int>
+             easy = 0
+             medium = 1
+             hard = 2
+         }
+    }
+ *
+ * Note: Ensure your bar-descriptor.xml has:
+ *
+ * <action>read_device_identifying_information</action>
+ *
+ * @script{ignore}
+ */
+class GoogleGamesSocialSession : public SocialSession
+{
+    friend class SocialController;
+
+public:
+
+    /**
+     * @see SocialSession::getListener
+     */
+    SocialSessionListener* getListener();
+
+    /**
+     * Initializes the session with the local client definition for this game.
+     *
+     * @param listener The listener for responses for this session
+     * @param properties The properties to initialize this session with for this game.
+     */
+    static SocialSession *authenticate(SocialSessionListener* listener, Properties* properties);
+
+    /**
+     * @see SocialSession::getUser
+     */
+    const SocialPlayer& getUser() const;
+
+    /**
+     * @see SocialSession::loadFriends
+     */
+    void loadFriends();
+
+    /**
+     * @see SocialSession::loadAchievements
+     */
+    void loadAchievements();
+
+    /**
+     * @see SocialSession::submitAchievement
+     */
+    void submitAchievement(const char* achievementId, unsigned int value, bool achieved=false);
+
+    /**
+     * @see SocialSession::incrementAchievement
+     */
+    void incrementAchievement(const char* achievementId, unsigned int increment=1);
+
+    /**
+      * @see SocialSession::syncAchievements
+      */
+    void synchronizeAchievements();
+
+    /**
+     * @see SocialSession::loadScores
+     */
+    void loadScores(const char* leaderboardId, CommunityScope community, TimeScope time, const SocialPlayer& player, unsigned int count);
+
+    /**
+     * @see SocialSession::loadScores
+     */
+    void loadScores(const char* leaderboardId, CommunityScope community, TimeScope time, unsigned int start, unsigned int count);
+
+    /**
+     * @see SocialSession::submitScore
+     */
+    void submitScore(const char* leaderboardId, float score);
+
+    /**
+      * @see SocialSession::submitChallenge
+      */
+    void submitChallenge(const SocialPlayer *player, unsigned int wager, float score, const char* leaderboardId=0);
+
+    /**
+      * @see SocialSession::loadChallenges
+      */
+    void loadChallenges(bool showOpenChallengesOnly=true);
+
+    /**
+      * @see SocialSession::acceptChallenge
+      */
+    void replyToChallenge(const SocialChallenge *challenge, bool accept);
+
+    /**
+     * @see SocialSession::requestSavedData
+     */
+    void loadSavedData(const char* key);
+
+    /**
+     * @see SocialSession::submitSavedData
+     */
+    void submitSavedData(const char* key, std::string data);
+
+    void displayLeaderboard(const char* leaderboardId);
+
+    void displayAchievements();
+
+    void displayChallenges();
+
+    void displayChallengeSubmit(const SocialChallenge *challenge, float score);
+
+
+protected:
+
+private:
+
+    /**
+     * Contructor
+     */
+    GoogleGamesSocialSession();
+
+    /**
+     * Destructor
+     */
+    virtual ~GoogleGamesSocialSession();
+#if 0
+
+    static void userCallback(void* cookie, unsigned int result);
+
+    static void uiCallback(void *cookie, SCUI_Result_t result, const void *data);
+
+    static void loadFriendsCallback(void* cookie, SC_Error_t result);
+
+    static void loadAchievementsCallback(void* cookie, SC_Error_t result);
+
+    static void submitAchievementCallback(void* cookie, SC_Error_t result);
+
+    static void loadScoresCallback(void* cookie, SC_Error_t result);
+
+    static void submitScoreCallback(void* cookie, SC_Error_t result);
+
+    const SocialAchievement* getAchievement(const char* achievementId) const;
+
+    SocialChallenge &addChallenge(SC_Challenge_h challenge);
+#endif
+    static GoogleGamesSocialSession* _session;
+
+    enum UserOp
+    {
+        USEROP_GET_LOCALUSER,
+        USEROP_WRITE_CONTEXT,
+        USEROP_READ_CONTEXT
+    };
+
+    SocialSessionListener* _listener;
+    Properties* _properties;
+    bool _pendingUserResponse;
+    bool _pendingFriendsResponse;
+    bool _pendingScoresResponse;
+    bool _pendingSubmitScoreResponse;
+    bool _pendingAchievementResponse;
+    bool _pendingDataResponse;
+    const char* _key;
+    std::string _data;
+    SocialPlayer _user;
+    UserOp _userOp;
+    std::vector<SocialPlayer> _friends;
+    std::vector<SocialAchievement> _achievements;
+    std::vector<SocialScore> _scores;
+};
+
+}
+
+#endif
+
+#endif

+ 1394 - 0
gameplay/src/social/ScoreloopSocialSession.cpp

@@ -0,0 +1,1394 @@
+#if defined(__QNX__) && defined(GP_USE_SOCIAL)
+
+#include "Base.h"
+#include "ScoreloopSocialSession.h"
+
+namespace gameplay
+{
+
+ScoreloopSocialSession* ScoreloopSocialSession::_session = NULL;
+
+ScoreloopSocialSession::ScoreloopSocialSession()
+    : SocialSession(),
+      _listener(NULL), _properties(NULL), _pendingUserResponse(false), _pendingFriendsResponse(false),
+      _pendingScoresResponse(false), _pendingSubmitScoreResponse(false), _pendingAchievementResponse(false),
+      _pendingChallengeResponse(false), _pendingChallengesResponse(false), _pendingDataResponse(false),
+      _client(NULL), _uiClient(NULL), _userController(NULL), _usersController(NULL),
+      _localAchievementsController(NULL), _scoresController(NULL), _scoreController(NULL),
+      _challengeController(NULL), _challengesController(NULL), _key(NULL), _acceptedChallenge(NULL)
+{
+    pthread_cond_init(&_channelCond, NULL);
+    pthread_mutex_init(&_channelMutex, NULL);
+    _userOp = USEROP_GET_LOCALUSER;
+}
+
+ScoreloopSocialSession::~ScoreloopSocialSession()
+{
+#if 0
+	SC_Client_Release(_client);
+	SCUI_Client_Release(_uiClient);
+	SC_ScoresController_Release(_scoresController);
+	SC_ScoreController_Release(_scoreController);
+	SC_UserController_Release(_userController);
+	SC_UsersController_Release(_usersController);
+	SC_LocalAchievementsController_Release(_localAchievementsController);
+	SC_ChallengeController_Release(_challengeController);
+	SC_ChallengesController_Release(_challengesController);
+#endif
+}
+
+SocialSessionListener* ScoreloopSocialSession::getListener()
+{
+    return _listener;
+}
+
+void* ScoreloopSocialSession::platformEventCallback(void* data)
+{
+	fprintf(stderr, "platformEventCallback!\n");
+    _session = (ScoreloopSocialSession*)data;
+
+    int rc = bps_initialize();
+
+    if (rc == BPS_FAILURE)
+        GP_ERROR("ScoreloopSocialSession::platformEventHandler - bps_initialize failed.");
+
+//    pthread_mutex_lock(&_session->_channelMutex);
+//    pthread_mutex_unlock(&_session->_channelMutex);
+//   pthread_cond_signal(&_session->_channelCond);
+fprintf(stderr, "hello here\n");
+    bps_event_t* event = NULL;
+    while (true)
+    {
+    	fprintf(stderr, "weird stuff start loop\n");
+        rc = bps_get_event(&event, 0);
+        fprintf(stderr, "bps_get_event %d\n", rc);
+        if (rc == BPS_FAILURE)
+            GP_ERROR("ScoreloopSocialSession::platformEventHandler - bps_get_event failed.");
+fprintf(stderr, "we are in a bps loop here\n");
+     //   if (bps_event_get_domain(event) == SC_GetBPSEventDomain(&_session->_initData) || bps_event_get_domain(event) == SCUI_GetBPSEventDomain())
+        {
+        	fprintf(stderr, "found a bps event!\n");
+        	// can either be a scoreloop event or a ui event - need to handle both
+            if ((SC_HandleBPSEvent(&_session->_initData, event) == BPS_SUCCESS) || SCUI_Client_HandleEvent(_session->_uiClient, event))
+            	continue;
+        }
+    }
+    bps_shutdown();
+    return 0;
+}
+
+SocialSession *ScoreloopSocialSession::authenticate(SocialSessionListener* listener, Properties* properties)
+{
+    if (!_session)
+    {
+		_session = new ScoreloopSocialSession();
+		_session->_listener = listener;
+		_session->_properties = properties;
+
+		const char* gameId = properties->getString("id");
+		const char* gameSecret = properties->getString("secret");
+		const char* gameVersion = properties->getString("version");
+		const char* gameCurrency = properties->getString("currency");
+		const char* gameLanguage = properties->getString("language");
+
+		// Create thread for platform event handler needed by Scoreloop
+//		pthread_mutex_lock(&_session->_channelMutex);
+//		pthread_create(NULL, NULL, platformEventCallback, _session);
+//		pthread_cond_wait(&_session->_channelCond, &_session->_channelMutex);
+//		pthread_mutex_unlock(&_session->_channelMutex);
+
+		SC_InitData_Init(&_session->_initData);
+
+		SC_Error_t rc = SC_Client_New(&_session->_client, &_session->_initData, gameId, gameSecret, gameVersion, gameCurrency, gameLanguage);
+		if (rc != SC_OK)
+		{
+			listener->authenticateEvent(SocialSessionListener::ERROR_INITIALIZATION, NULL);
+			return 0;
+		}
+
+		rc = SCUI_Client_NewWithCallback(&_session->_uiClient, _session->_client, ScoreloopSocialSession::uiCallback, _session);
+	    if (rc != SC_OK)
+	    {
+	    	listener->authenticateEvent(SocialSessionListener::ERROR_INITIALIZATION, NULL);
+	    }
+
+		rc = SC_Client_CreateUserController(_session->_client, &_session->_userController, ScoreloopSocialSession::userCallback, _session);
+		if (rc != SC_OK)
+		{
+			listener->authenticateEvent(SocialSessionListener::ERROR_INITIALIZATION, NULL);
+			return 0;
+		}
+
+		rc = SC_UserController_LoadUser(_session->_userController);
+		if (rc != SC_OK)
+		{
+			SC_UserController_Release(_session->_userController);
+			_session->_userController = NULL;
+			listener->authenticateEvent(SocialSessionListener::ERROR_INITIALIZATION, NULL);
+		}
+    }
+
+    return _session;
+}
+
+bool ScoreloopSocialSession::handleEvent(void *event)
+{
+#if 1
+	bps_event_t* bps_event = (bps_event_t *)event;
+
+	if (SC_HandleBPSEvent(&_session->_initData, bps_event) == BPS_SUCCESS)
+		return true;
+
+	if (SCUI_Client_HandleEvent(_session->_uiClient, bps_event))
+		return true;
+
+#endif
+    return false;
+}
+
+const SocialPlayer& ScoreloopSocialSession::getUser() const
+{
+	return _user;
+}
+
+void ScoreloopSocialSession::userCallback(void* cookie, SC_Error_t result)
+{
+    ScoreloopSocialSession* session = (ScoreloopSocialSession*)cookie;
+
+    switch (result)
+    {
+    	case SC_OK:
+        {
+            switch(session->_userOp)
+            {
+            	case USEROP_GET_LOCALUSER:
+                {
+                    session->_user.handle =  SC_UserController_GetUser(session->_userController);
+                    SC_String_h name = SC_User_GetLogin((SC_User_h)session->_user.handle);
+                    session->_user.name = SC_String_GetData(name);
+                    session->getListener()->authenticateEvent(SocialSessionListener::SUCCESS, session);
+                }
+                break;
+
+            	case USEROP_WRITE_CONTEXT:
+                {
+                    session->getListener()->submitSavedDataEvent(SocialSessionListener::SUCCESS);
+                }
+                break;
+
+            	case USEROP_READ_CONTEXT:
+                {
+                    SC_Context_h context = SC_User_GetContext((SC_User_h)session->_user.handle);
+                    SC_String_h str;
+                    SC_Error_t rc = SC_Context_Get(context, session->_key, &str);
+                    if (rc != SC_OK)
+                    {
+                        session->getListener()->loadSavedDataEvent(SocialSessionListener::ERROR_INVALID_ARG, "");
+                    }
+                    else
+                    {
+                        session->getListener()->loadSavedDataEvent(SocialSessionListener::SUCCESS, std::string(SC_String_GetData(str)));
+                    }
+                }
+                break;
+            }
+        }
+        break;
+
+    case SC_INVALID_USER_DATA:
+        {
+            switch(session->_userOp)
+            {
+                case USEROP_GET_LOCALUSER:
+                    session->getListener()->authenticateEvent(SocialSessionListener::ERROR_INVALID_USER, NULL);
+                    break;
+                case USEROP_WRITE_CONTEXT:
+                    session->getListener()->submitSavedDataEvent(SocialSessionListener::ERROR_INVALID_USER);
+                    break;
+                case USEROP_READ_CONTEXT:
+                    session->getListener()->loadSavedDataEvent(SocialSessionListener::ERROR_INVALID_USER, "");
+                    break;
+            }
+        }
+        break;
+
+    case SC_HTTP_SERVER_ERROR:
+        {
+            switch(session->_userOp)
+            {
+                case USEROP_GET_LOCALUSER:
+                    session->getListener()->authenticateEvent(SocialSessionListener::ERROR_SERVER, NULL);
+                    break;
+                case USEROP_WRITE_CONTEXT:
+                    session->getListener()->submitSavedDataEvent(SocialSessionListener::ERROR_SERVER);
+                    break;
+                case USEROP_READ_CONTEXT:
+                    session->getListener()->loadSavedDataEvent(SocialSessionListener::ERROR_SERVER, "");
+                    break;
+            }
+        }
+        break;
+
+    default:
+        {
+            switch(session->_userOp)
+            {
+                case USEROP_GET_LOCALUSER:
+                    session->getListener()->authenticateEvent(SocialSessionListener::ERROR_UNKNOWN, NULL);
+                    break;
+                case USEROP_WRITE_CONTEXT:
+                    session->getListener()->submitSavedDataEvent(SocialSessionListener::ERROR_UNKNOWN);
+                    break;
+                case USEROP_READ_CONTEXT:
+                    session->getListener()->loadSavedDataEvent(SocialSessionListener::ERROR_UNKNOWN, "");
+                    break;
+            }
+        }
+        break;
+    }
+
+    session->_pendingUserResponse = false;
+}
+
+
+static SC_Challenge_h challenge1 = 0;
+
+void ScoreloopSocialSession::uiCallback(void *cookie, SCUI_Result_t result, const void *data)
+{
+	ScoreloopSocialSession* session = (ScoreloopSocialSession*)cookie;
+    SC_Error_t rc = SC_INVALID_ARGUMENT;
+
+    switch (result)
+    {
+		case SCUI_RESULT_OK:
+			session->getListener()->uiEvent(SocialSessionListener::SUCCESS);
+			break;
+
+		case SCUI_RESULT_ERROR:
+			if (data != NULL)
+				rc = *((SC_Error_t *)data);
+
+			session->getListener()->uiEvent(SocialSessionListener::SUCCESS, SC_MapErrorToStr(rc));
+			break;
+
+		case SCUI_RESULT_START_CHALLENGE:
+			{
+				fprintf(stderr, "START challenge\n");
+
+				// Get details of the Challenge from 'data' argument by casting it.
+				SocialChallenge &challenge = session->addChallenge((SC_Challenge_h)data);
+
+				session->getListener()->startChallengeEvent(SocialSessionListener::SUCCESS, challenge);
+			}
+			break;
+
+		default:
+			if (result == SCUI_RESULT_CANCEL)
+				session->getListener()->uiEvent(SocialSessionListener::ERROR_CANCELLED);
+			break;
+    }
+
+    fprintf(stderr, "UI result: %s\n", SCUI_MapResultCodeToStr(result));
+}
+
+void ScoreloopSocialSession::loadFriends()
+{
+    if (_pendingFriendsResponse)
+    {
+        _listener->loadFriendsEvent(SocialSessionListener::ERROR_PENDING_RESPONSE, _friends);
+        return;
+    }
+    _pendingFriendsResponse = true;
+
+    // Create a scoreloop users controller (for finding friends)
+    SC_Error_t rc;
+    if (_usersController == NULL)
+    {
+        rc = SC_Client_CreateUsersController(_client, &_usersController, ScoreloopSocialSession::loadFriendsCallback, this);
+        if (rc != SC_OK)
+        {
+            _listener->loadFriendsEvent(SocialSessionListener::ERROR_INITIALIZATION, _friends);
+            return;
+        }
+    }
+    rc = SC_UsersController_LoadBuddies(_usersController, (SC_User_h)_user.handle);
+    if (rc != SC_OK)
+    {
+    	SC_UsersController_Release(_usersController);
+    	_usersController = NULL;
+    	_listener->loadFriendsEvent(SocialSessionListener::ERROR_INITIALIZATION, _friends);
+    }
+}
+
+void ScoreloopSocialSession::loadFriendsCallback(void* cookie, SC_Error_t result)
+{
+    ScoreloopSocialSession* session = (ScoreloopSocialSession*)cookie;
+    switch (result)
+    {
+		case SC_OK:
+			{
+				SC_UserList_h usersList = SC_UsersController_GetUsers(session->_usersController);
+				unsigned int usersCount = SC_UserList_GetCount(usersList);
+				session->_friends.clear();
+				for (unsigned int i = 0; i < usersCount; i++)
+				{
+					SocialPlayer player;
+					player.handle = SC_UserList_GetAt(usersList, i);
+					SC_UserController_GetUser(session->_userController);
+					SC_String_h name = SC_User_GetLogin((SC_User_h)player.handle);
+					player.name = SC_String_GetData(name);
+					session->_friends.push_back(player);
+				}
+				session->getListener()->loadFriendsEvent(SocialSessionListener::SUCCESS, session->_friends);
+			}
+			break;
+		case SC_INVALID_USER_DATA:
+			session->getListener()->loadFriendsEvent(SocialSessionListener::ERROR_INVALID_USER, session->_friends);
+			break;
+		case SC_HTTP_SERVER_ERROR:
+			session->getListener()->loadFriendsEvent(SocialSessionListener::ERROR_SERVER, session->_friends);
+			break;
+		default:
+			session->getListener()->loadFriendsEvent(SocialSessionListener::ERROR_UNKNOWN, session->_friends);
+			break;
+    }
+
+    session->_pendingFriendsResponse = false;
+}
+
+void ScoreloopSocialSession::loadAchievements()
+{
+    if (_pendingAchievementResponse)
+    {
+        _listener->loadAchievementsEvent(SocialSessionListener::ERROR_PENDING_RESPONSE, _achievements);
+        return;
+    }
+    _pendingAchievementResponse = true;
+
+    SC_Error_t rc;
+
+    if (_localAchievementsController == NULL)
+    {
+		rc = SC_Client_CreateLocalAchievementsController(_client, &_localAchievementsController, ScoreloopSocialSession::loadAchievementsCallback, this);
+		if (rc != SC_OK)
+		{
+			_listener->loadAchievementsEvent(SocialSessionListener::ERROR_INITIALIZATION, _achievements);
+			_pendingAchievementResponse = false;
+			return;
+		}
+    }
+
+    if (SC_LocalAchievementsController_ShouldSynchronize(_localAchievementsController))
+    {
+        rc = SC_LocalAchievementsController_Synchronize(_localAchievementsController);
+        if (rc != SC_OK)
+        {
+            _listener->loadAchievementsEvent(SocialSessionListener::ERROR_INITIALIZATION, _achievements);
+            _pendingAchievementResponse = false;
+            return;
+        }
+    }
+    else
+    	ScoreloopSocialSession::loadAchievementsCallback(this, SC_OK);
+}
+
+void ScoreloopSocialSession::loadAchievementsCallback(void* cookie, SC_Error_t result)
+{
+    ScoreloopSocialSession* session = (ScoreloopSocialSession*)cookie;
+    switch (result)
+    {
+    	case SC_OK:
+			{
+				SC_AchievementList_h achievementsList = SC_LocalAchievementsController_GetAchievements(session->_localAchievementsController);
+				unsigned int achievementsCount = SC_AchievementList_GetCount(achievementsList);
+				session->_achievements.clear();
+				for (unsigned int i = 0; i < achievementsCount; i++)
+				{
+					SocialAchievement achievement;
+					achievement.handle = SC_AchievementList_GetAt(achievementsList, i);
+					SC_Award_h award = SC_Achievement_GetAward((SC_Achievement_h)achievement.handle);
+
+					SC_String_h id = SC_Award_GetIdentifier(award);
+					achievement.name = (id) ? SC_String_GetData(id) : "";
+					SC_String_h title = SC_Award_GetLocalizedTitle(award);
+					achievement.title = (title) ? SC_String_GetData(title) : "";
+					achievement.value = (unsigned int)SC_Achievement_GetValue((SC_Achievement_h)achievement.handle);
+					SC_String_h dateTime = SC_Achievement_GetDate((SC_Achievement_h)achievement.handle);
+					achievement.dateTimeAchieved = (dateTime) ? SC_String_GetData(dateTime) : "";
+					achievement.total = SC_Award_GetAchievingValue(award);
+					achievement.percentCompleted = achievement.value == 0 ? 0.0f : ((float)achievement.value / (float)achievement.total) * 100.f;
+
+					session->_achievements.push_back(achievement);
+				}
+				session->getListener()->loadAchievementsEvent(SocialSessionListener::SUCCESS, _session->_achievements);
+			}
+
+			break;
+		case SC_INVALID_USER_DATA:
+			session->getListener()->loadAchievementsEvent(SocialSessionListener::ERROR_INVALID_USER, _session->_achievements);
+			break;
+		case SC_HTTP_SERVER_ERROR:
+			session->getListener()->loadAchievementsEvent(SocialSessionListener::ERROR_SERVER, _session->_achievements);
+			break;
+		default:
+			session->getListener()->loadAchievementsEvent(SocialSessionListener::ERROR_UNKNOWN, _session->_achievements);
+			break;
+    }
+
+    session->_pendingAchievementResponse = false;
+}
+
+const SocialAchievement* ScoreloopSocialSession::getAchievement(const char* achievementId) const
+{
+	uint size = _achievements.size();
+
+	for (uint i = 0; i < size; i++)
+	{
+		if (strcmp(_achievements[i].name.data(), achievementId) == 0)
+			return &_achievements[i];
+	}
+	return 0;
+}
+
+void ScoreloopSocialSession::submitAchievement(const char* achievementId, unsigned int value, bool isAchieved)
+{
+    SC_Error_t rc;
+    if (_localAchievementsController == NULL)
+    {
+		rc = SC_Client_CreateLocalAchievementsController(_client, &_localAchievementsController, ScoreloopSocialSession::submitAchievementCallback, this);
+		if (rc != SC_OK)
+		{
+			_listener->submitAchievementEvent(SocialSessionListener::ERROR_INITIALIZATION);
+			return;
+		}
+    }
+
+    SC_Bool_t achieved = SC_FALSE;
+    if (isAchieved)
+    {
+    	rc = SC_LocalAchievementsController_SetAchievedValueForAwardIdentifier(_localAchievementsController, achievementId, &achieved);
+    }
+    else
+    {
+		rc = SC_LocalAchievementsController_SetValueForAwardIdentifier(_localAchievementsController, achievementId, value, &achieved);
+    }
+
+    if (rc != SC_OK)
+    {
+        _listener->submitAchievementEvent(SocialSessionListener::ERROR_INITIALIZATION);
+        return;
+    }
+
+    if (achieved == SC_TRUE)
+    {
+    	const SocialAchievement *achievement = getAchievement(achievementId);
+    	if (achievement)
+    		_listener->awardAchievedEvent(SocialSessionListener::SUCCESS, *achievement);
+
+    	fprintf(stderr, "AWARD ACHIEVED %s!!!\n", achievementId);
+    }
+}
+
+void ScoreloopSocialSession::incrementAchievement(const char* achievementId, unsigned int increment)
+{
+    SC_Error_t rc;
+    if (_localAchievementsController == NULL)
+    {
+		rc = SC_Client_CreateLocalAchievementsController(_client, &_localAchievementsController, ScoreloopSocialSession::submitAchievementCallback, this);
+		if (rc != SC_OK)
+		{
+			_listener->submitAchievementEvent(SocialSessionListener::ERROR_INITIALIZATION);
+			return;
+		}
+    }
+    SC_Bool_t achieved;
+	rc = SC_LocalAchievementsController_IncrementValueForAwardIdentifier(_localAchievementsController, achievementId, &achieved);
+
+    if (achieved == SC_TRUE)
+    {
+    	const SocialAchievement *achievement = getAchievement(achievementId);
+    	if (achievement)
+    		_listener->awardAchievedEvent(SocialSessionListener::SUCCESS, *achievement);
+    }
+
+    if (rc != SC_OK)
+    {
+        _listener->submitAchievementEvent(SocialSessionListener::ERROR_INITIALIZATION);
+        return;
+    }
+}
+
+void ScoreloopSocialSession::synchronizeAchievements()
+{
+    SC_Error_t rc;
+    if (_localAchievementsController == NULL)
+    {
+		rc = SC_Client_CreateLocalAchievementsController(_client, &_localAchievementsController, ScoreloopSocialSession::submitAchievementCallback, this);
+		if (rc != SC_OK)
+		{
+			_listener->submitAchievementEvent(SocialSessionListener::ERROR_INITIALIZATION);
+			_pendingAchievementResponse = false;
+			return;
+		}
+    }
+
+	if (SC_LocalAchievementsController_ShouldSynchronize(_localAchievementsController) == SC_TRUE)
+	{
+		_pendingAchievementResponse = true;
+
+fprintf(stderr, "we are attempting to synchronize our achievements\n");
+		rc = SC_LocalAchievementsController_Synchronize(_localAchievementsController);
+		if (rc != SC_OK)
+		{
+			_listener->submitAchievementEvent(SocialSessionListener::ERROR_INITIALIZATION);
+			_pendingAchievementResponse = false;
+			return;
+		}
+	}
+}
+
+void ScoreloopSocialSession::submitAchievementCallback(void* cookie, SC_Error_t result)
+{
+    ScoreloopSocialSession* session = (ScoreloopSocialSession*)cookie;
+
+    switch (result)
+    {
+		case SC_OK:
+			session->getListener()->submitAchievementEvent(SocialSessionListener::SUCCESS);
+			break;
+		case SC_INVALID_USER_DATA:
+			session->getListener()->submitAchievementEvent(SocialSessionListener::ERROR_INVALID_USER);
+			break;
+		case SC_HTTP_SERVER_ERROR:
+			session->getListener()->submitAchievementEvent(SocialSessionListener::ERROR_SERVER);
+			break;
+		default:
+			session->getListener()->submitAchievementEvent(SocialSessionListener::ERROR_UNKNOWN);
+			break;
+    }
+
+    session->_pendingAchievementResponse = false;
+}
+
+void ScoreloopSocialSession::loadScores(const char* leaderboardId, CommunityScope community, TimeScope time, const SocialPlayer& player, unsigned int count)
+{
+    if (_pendingScoresResponse)
+     {
+         _listener->loadScoresEvent(SocialSessionListener::ERROR_PENDING_RESPONSE, _scores);
+         return;
+     }
+    _pendingScoresResponse = true;
+
+    SC_Error_t rc;
+    if (_scoresController == NULL)
+    {
+        rc = SC_Client_CreateScoresController(_client, &_scoresController, ScoreloopSocialSession::loadScoresCallback, this);
+        if (rc != SC_OK)
+        {
+            _listener->loadScoresEvent(SocialSessionListener::ERROR_INITIALIZATION, _scores);
+            _pendingScoresResponse = false;
+            return;
+        }
+    }
+
+    // Lookup the mode to be mapped for the specified leader board id
+    if (leaderboardId != NULL)
+    {
+        Properties* leaderboardMappings = _properties->getNamespace("leaderboard_mappings", false);
+        if (leaderboardMappings)
+        {
+            int mode = leaderboardMappings->getInt(leaderboardId);
+            if (mode >=  0)
+            {
+                SC_ScoresController_SetMode(_scoresController, (unsigned int)mode);
+            }
+        }
+    }
+
+    // Set the search list filter
+    SC_ScoresSearchList_t searchList;
+    searchList.countrySelector = SC_COUNTRY_SELECTOR_ALL;
+    searchList.buddyhoodUser = (SC_User_h)_user.handle;
+
+    switch (community)
+    {
+		case COMMUNITY_SCOPE_FRIENDS:
+			searchList.usersSelector = SC_USERS_SELECTOR_BUDDYHOOD;
+			break;
+		case COMMUNITY_SCOPE_ALL:
+		default:
+			searchList.usersSelector = SC_USERS_SELECTOR_ALL;
+			break;
+    }
+    switch(time)
+    {
+		case TIME_SCOPE_TODAY:
+			searchList.timeInterval = SC_TIME_INTERVAL_24H;
+			break;
+		case TIME_SCOPE_WEEK:
+            searchList.timeInterval = SC_TIME_INTERVAL_7DAYS;
+            break;
+		case TIME_SCOPE_ALL:
+		default:
+            searchList.timeInterval = SC_TIME_INTERVAL_ALL;
+            break;
+    }
+    SC_ScoresController_SetSearchList(_scoresController, searchList);
+
+    // Specify the player and range count to get the scores around
+    SC_User_h user = (SC_User_h)player.handle;
+    rc = SC_ScoresController_LoadScoresAroundUser(_scoresController, (SC_User_h)_user.handle, count);
+    if (rc != SC_OK)
+    {
+        SC_ScoresController_Release(_scoresController);
+        _scoresController = NULL;
+        _listener->loadScoresEvent(SocialSessionListener::ERROR_INITIALIZATION, _scores);
+    }
+}
+
+void ScoreloopSocialSession::loadScores(const char* leaderboardId, CommunityScope community, TimeScope time, unsigned int start, unsigned int count)
+{
+    if (_pendingScoresResponse)
+    {
+        _listener->loadScoresEvent(SocialSessionListener::ERROR_PENDING_RESPONSE, _scores);
+        return;
+    }
+    _pendingScoresResponse = true;
+
+    SC_Error_t rc;
+    if (_scoresController == NULL)
+    {
+        rc = SC_Client_CreateScoresController(_client, &_scoresController, ScoreloopSocialSession::loadScoresCallback, this);
+        if (rc != SC_OK)
+        {
+            _listener->loadScoresEvent(SocialSessionListener::ERROR_INITIALIZATION, _scores);
+            _pendingScoresResponse = false;
+            return;
+        }
+    }
+
+    // Lookup the mode to be mapped for the specified leaderboard id
+    if (leaderboardId != NULL)
+    {
+        Properties* leaderboardMappings = _properties->getNamespace("leaderboard_mappings", false);
+        if (leaderboardMappings)
+        {
+
+            int mode = leaderboardMappings->getInt(leaderboardId);
+            if (mode >=  0)
+            {
+                SC_ScoresController_SetMode(_scoresController, (unsigned int)mode);
+            }
+        }
+    }
+
+    // Set the search list filter
+    SC_ScoresSearchList_t searchList;
+    searchList.countrySelector = SC_COUNTRY_SELECTOR_ALL;
+    searchList.buddyhoodUser = (SC_User_h)_user.handle;
+
+    switch (community)
+    {
+		case COMMUNITY_SCOPE_FRIENDS:
+			searchList.usersSelector = SC_USERS_SELECTOR_BUDDYHOOD;
+			break;
+		case COMMUNITY_SCOPE_ALL:
+		default:
+			searchList.usersSelector = SC_USERS_SELECTOR_ALL;
+			break;
+    }
+
+    switch (time)
+    {
+		case TIME_SCOPE_TODAY:
+			searchList.timeInterval = SC_TIME_INTERVAL_24H;
+			break;
+		case TIME_SCOPE_WEEK:
+			searchList.timeInterval = SC_TIME_INTERVAL_7DAYS;
+			break;
+		case TIME_SCOPE_ALL:
+		default:
+			searchList.timeInterval = SC_TIME_INTERVAL_ALL;
+			break;
+    }
+    SC_ScoresController_SetSearchList(_scoresController, searchList);
+
+    // Set the search range
+   SC_Range_t range;
+   range.offset = start;
+   range.length = count;
+   rc = SC_ScoresController_LoadScores(_scoresController, range);
+   if (rc != SC_OK)
+   {
+       SC_ScoresController_Release(_scoresController);
+       _scoresController = NULL;
+       _pendingScoresResponse = false;
+       _listener->loadScoresEvent(SocialSessionListener::ERROR_INITIALIZATION, _scores);
+   }
+}
+
+void ScoreloopSocialSession::loadScoresCallback(void* cookie, SC_Error_t result)
+{
+    ScoreloopSocialSession* session = (ScoreloopSocialSession*)cookie;
+    switch (result)
+    {
+    	case SC_OK:
+        {
+            SC_ScoreFormatter_h scoreFormatter = SC_Client_GetScoreFormatter(session->_client);
+
+            SC_ScoreList_h scoresList = SC_ScoresController_GetScores(session->_scoresController);
+            unsigned int scoresCount = SC_ScoreList_GetCount(scoresList);
+            session->_scores.clear();
+            for (unsigned int i = 0; i < scoresCount; i++)
+            {
+                SocialScore score;
+                score.handle = SC_ScoreList_GetAt(scoresList, i);
+                score.rank = SC_Score_GetRank((SC_Score_h)score.handle);
+                score.value = (float)SC_Score_GetResult((SC_Score_h)score.handle);
+                SC_String_h formatted;
+                SC_ScoreFormatter_FormatScore(scoreFormatter, (SC_Score_h)score.handle, SC_SCORE_FORMAT_DEFAULT, &formatted);
+                score.valueFormatted = SC_String_GetData(formatted);
+                SC_User_h player = SC_Score_GetUser((SC_Score_h)score.handle);
+                SC_String_h playerStr = SC_User_GetLogin(player);
+                score.playerName = SC_String_GetData(playerStr);
+                session->_scores.push_back(score);
+            }
+            session->getListener()->loadScoresEvent(SocialSessionListener::SUCCESS, session->_scores);
+        }
+        break;
+
+		case SC_INVALID_USER_DATA:
+			session->getListener()->loadScoresEvent(SocialSessionListener::ERROR_INVALID_USER, session->_scores);
+			break;
+		case SC_HTTP_SERVER_ERROR:
+			session->getListener()->loadScoresEvent(SocialSessionListener::ERROR_SERVER, session->_scores);
+			break;
+		default:
+			session->getListener()->loadScoresEvent(SocialSessionListener::ERROR_UNKNOWN, session->_scores);
+			break;
+    }
+
+    session->_pendingScoresResponse = false;
+}
+
+void ScoreloopSocialSession::submitScore(const char* leaderboardId, float value)
+{
+    if (_pendingSubmitScoreResponse)
+    {
+        _listener->submitScoreEvent(SocialSessionListener::ERROR_PENDING_RESPONSE);
+        return;
+    }
+    _pendingSubmitScoreResponse = true;
+
+    SC_Error_t rc;
+    rc = SC_Client_CreateScoreController(_client, &_scoreController, ScoreloopSocialSession::submitScoreCallback, this);
+    if (rc != SC_OK)
+    {
+        _listener->submitScoreEvent(SocialSessionListener::ERROR_INITIALIZATION);
+        _pendingSubmitScoreResponse = false;
+        return;
+    }
+
+    // Create a score to submit
+    SC_Score_h score;
+    rc = SC_Client_CreateScore(_client, &score);
+    if (rc != SC_OK)
+    {
+        _listener->submitScoreEvent(SocialSessionListener::ERROR_INITIALIZATION);
+        _pendingSubmitScoreResponse = false;
+        return;
+    }
+
+    // Set the leaderboard to associate this score with
+    if (leaderboardId != NULL)
+    {
+        Properties* leaderboardMappings = _properties->getNamespace("leaderboard_mappings", true);
+        if (leaderboardMappings)
+        {
+            int mode = leaderboardMappings->getInt(leaderboardId);
+            if (mode >=  0)
+            {
+                SC_Score_SetMode(score, (unsigned int)mode);
+            }
+        }
+    }
+
+    // Set the score value and submit the score
+    SC_Score_SetResult(score, value);
+    rc = SC_ScoreController_SubmitScore(_scoreController, score);
+    if (rc != SC_OK)
+    {
+         SC_ScoreController_Release(_scoreController);
+         _scoreController = NULL;
+         _pendingSubmitScoreResponse = false;
+         _listener->submitScoreEvent(SocialSessionListener::ERROR_INITIALIZATION);
+    }
+
+    if (_acceptedChallenge)
+    {
+        if (_pendingChallengeResponse)
+        {
+            _listener->submitChallengeEvent(SocialSessionListener::ERROR_PENDING_RESPONSE, *_acceptedChallenge);
+            return;
+        }
+        _pendingChallengeResponse = true;
+
+    	rc = SC_ChallengeController_SubmitChallengeScore(_challengeController, score);
+    	if (rc != SC_OK)
+    	{
+    		_listener->submitChallengeEvent(SocialSessionListener::ERROR_INITIALIZATION, *_acceptedChallenge);
+    		return;
+    	}
+    	_acceptedChallenge = 0;
+    }
+
+    SC_Score_Release(score);
+}
+
+void ScoreloopSocialSession::submitScoreCallback(void* cookie, SC_Error_t result)
+{
+    ScoreloopSocialSession* session = (ScoreloopSocialSession*)cookie;
+    switch (result)
+    {
+		case SC_OK:
+			session->getListener()->submitScoreEvent(SocialSessionListener::SUCCESS);
+			break;
+		case SC_INVALID_USER_DATA:
+			session->getListener()->submitScoreEvent(SocialSessionListener::ERROR_INVALID_USER);
+			break;
+		case SC_HTTP_SERVER_ERROR:
+			session->getListener()->submitScoreEvent(SocialSessionListener::ERROR_SERVER);
+			break;
+		default:
+			session->getListener()->submitScoreEvent(SocialSessionListener::ERROR_UNKNOWN);
+			break;
+    }
+
+    session->_pendingSubmitScoreResponse = false;
+}
+
+void ScoreloopSocialSession::submitChallenge(const SocialPlayer *player, unsigned int wager, float score, const char* leaderboardId)
+{
+	SocialChallenge challenge;
+
+    if (_pendingChallengeResponse)
+    {
+        _listener->submitChallengeEvent(SocialSessionListener::ERROR_PENDING_RESPONSE, challenge);
+        return;
+    }
+    _pendingChallengeResponse = true;
+
+	SC_Error_t rc;
+	SC_Challenge_h sc_challenge;
+	SC_Money_h stake = NULL;
+
+	if (!_challengeController)
+	{
+		rc = SC_Client_CreateChallengeController(_client, &_challengeController, ScoreloopSocialSession::submitChallengeCallback, this);
+	    if (rc != SC_OK)
+	    {
+	    	_listener->submitChallengeEvent(SocialSessionListener::ERROR_INITIALIZATION, challenge);
+	        return;
+	    }
+	}
+
+	rc = SC_Client_CreateMoney(_client, &stake, wager);
+    if (rc != SC_OK)
+	{
+		_listener->submitChallengeEvent(SocialSessionListener::ERROR_INITIALIZATION, challenge);
+		return;
+	}
+
+    if (stake == NULL)
+    {
+        SC_MoneyList_h moneyList = SC_Session_GetChallengeStakes(SC_Client_GetSession(_client));
+        /* Just pick the first stake here - if available */
+        if (SC_MoneyList_GetCount(moneyList) > 0)
+        {
+            stake = SC_MoneyList_GetAt(moneyList, 0);
+        }
+    }
+
+    if (stake == NULL)
+	{
+		_listener->submitChallengeEvent(SocialSessionListener::ERROR_INITIALIZATION, challenge);
+	}
+
+    // Lookup the mode to be mapped for the specified leaderboard id
+	int mode = 0;
+    if (leaderboardId != NULL)
+    {
+        Properties* leaderboardMappings = _properties->getNamespace("leaderboard_mappings", false);
+        if (leaderboardMappings)
+        {
+            mode = leaderboardMappings->getInt(leaderboardId);
+            if (mode >=  0)
+            {
+                SC_ScoresController_SetMode(_scoresController, (unsigned int)mode);
+            }
+        }
+    }
+
+	//Passing null as the contestant argument creates an open challenge.
+	//The contender is automatically equal to the current session user.
+    SC_User_h challenger = (player) ? (SC_User_h)player->handle : NULL;
+	rc = SC_Client_CreateChallenge(_client, stake, challenger, mode, 0, &sc_challenge);
+	if (rc != SC_OK)
+	{
+		_listener->submitChallengeEvent(SocialSessionListener::ERROR_INITIALIZATION, challenge);
+		return;
+	}
+
+	rc = SC_ChallengeController_SetChallenge(_challengeController, sc_challenge);
+	if (rc != SC_OK)
+	{
+		_listener->submitChallengeEvent(SocialSessionListener::ERROR_INITIALIZATION, challenge);
+		return;
+	}
+
+	SC_Score_h sc_score;
+	rc = SC_Client_CreateScore(_client, &sc_score);
+	if (rc != SC_OK)
+	{
+		//_listener->submitChallengeScoreEvent(SocialSessionListener::ERROR_INITIALIZATION);
+		return;
+	}
+
+	SC_Score_SetMode(sc_score, (unsigned int)mode);
+	SC_Score_SetResult(sc_score, score);
+
+	rc = SC_ChallengeController_SubmitChallengeScore(_challengeController, sc_score);
+	if (rc != SC_OK)
+	{
+		_listener->submitChallengeEvent(SocialSessionListener::ERROR_INITIALIZATION, challenge);
+		return;
+	}
+	SC_Score_Release(sc_score);
+
+//	_listener->submitChallengeEvent(SocialSessionListener::SUCESS, challenge);
+}
+
+void ScoreloopSocialSession::submitChallengeCallback(void* cookie, SC_Error_t result)
+{
+    ScoreloopSocialSession* session = (ScoreloopSocialSession*)cookie;
+
+    SocialChallenge challenge;
+
+fprintf(stderr, "issueChallengeCallback is called!\n");
+    switch (result)
+    {
+    	case SC_OK:
+			{
+				challenge.handle = SC_ChallengeController_GetChallenge(session->_challengeController);
+
+				SC_User_h user = SC_Challenge_GetContestant((SC_Challenge_h)challenge.handle);
+				SC_String_h playerStr = (user) ? SC_User_GetLogin(user) : NULL;
+				challenge.challengedPlayerName = (playerStr) ? SC_String_GetData(playerStr) : "";
+
+				user = SC_Challenge_GetContender((SC_Challenge_h)challenge.handle);
+				playerStr = (user) ? SC_User_GetLogin(user) : NULL;
+				challenge.issuedPlayerName = (playerStr) ? SC_String_GetData(playerStr) : "";
+
+				SC_Score_h score = SC_Challenge_GetContenderScore((SC_Challenge_h)challenge.handle);
+				challenge.score = (float)SC_Score_GetResult(score);
+				SC_String_h dateStr = SC_Challenge_GetCreatedAt((SC_Challenge_h)challenge.handle);
+				challenge.dateTimeIssued = (dateStr) ? SC_String_GetData(dateStr) : "";
+
+				if (SC_Challenge_IsComplete((SC_Challenge_h)challenge.handle))
+					challenge.state = SocialChallenge::COMPLETE;
+				else if (SC_Challenge_IsRejected((SC_Challenge_h)challenge.handle))
+					challenge.state = SocialChallenge::DECLINED;
+				else if (SC_Challenge_IsAssigned((SC_Challenge_h)challenge.handle))
+					challenge.state = SocialChallenge::PENDING;
+				else
+					challenge.state = SocialChallenge::INVALID;
+
+				fprintf(stderr, "%s challenged player %s on %s\n", challenge.issuedPlayerName.data(), challenge.challengedPlayerName.data(), challenge.dateTimeIssued.data());
+				fprintf(stderr, "score to beat is %lf current state is %d\n", challenge.score, challenge.state);
+
+				session->getListener()->submitChallengeEvent(SocialSessionListener::SUCCESS, challenge);
+			}
+        	break;
+		case SC_INVALID_USER_DATA:
+			fprintf(stderr, "Hey, who the heck got us in here?\n");
+			session->getListener()->submitChallengeEvent(SocialSessionListener::ERROR_INVALID_USER, challenge);
+			break;
+		case SC_HTTP_SERVER_ERROR:
+			session->getListener()->submitChallengeEvent(SocialSessionListener::ERROR_SERVER, challenge);
+			break;
+		default:
+			session->getListener()->submitChallengeEvent(SocialSessionListener::ERROR_UNKNOWN, challenge);
+			break;
+    }
+
+    session->_pendingChallengeResponse = false;
+}
+
+
+void ScoreloopSocialSession::replyToChallenge(const SocialChallenge *challenge, bool accept)
+{
+	if (!challenge)
+		return;
+
+    if (_pendingChallengeResponse)
+    {
+        _listener->replyToChallengeEvent(SocialSessionListener::ERROR_PENDING_RESPONSE);
+        return;
+    }
+    _pendingChallengeResponse = true;
+
+	SC_Error_t rc;
+
+	if (_challengeController)
+	{
+		SC_ChallengeController_Release(_challengeController);
+fprintf(stderr, "creating new challenge controller\n");
+		rc = SC_Client_CreateChallengeController(_client, &_challengeController, ScoreloopSocialSession::replyToChallengeCallback, this);
+	    if (rc != SC_OK)
+	    {
+	    	_listener->replyToChallengeEvent(SocialSessionListener::ERROR_INITIALIZATION);
+	        return;
+	    }
+	}
+
+	rc = SC_ChallengeController_SetChallenge(_challengeController, challenge1); //(SC_Challenge_h)challenge->handle);
+	if (rc != SC_OK)
+	{
+		SC_ChallengeController_Release(_challengeController);
+		_challengeController = 0;
+		fprintf(stderr, "have error SetChallenge %d %s\n", rc, SC_MapErrorToStr(rc));
+		_listener->replyToChallengeEvent(SocialSessionListener::ERROR_INITIALIZATION);
+		return;
+	}
+
+fprintf(stderr, "replyTochallenge %d\n", accept);
+	if (accept)
+	{
+		rc = SC_ChallengeController_AcceptChallenge(_challengeController);
+		_acceptedChallenge = challenge;
+	}
+	else
+	{
+		rc = SC_ChallengeController_RejectChallenge(_challengeController);
+	}
+
+	if (rc != SC_OK)
+	{
+		fprintf(stderr, "have error in accept/reject challenge %d %s\n", rc, SC_MapErrorToStr(rc));
+		SC_ChallengeController_Release(_challengeController);
+		_challengeController = 0;
+	//	_listener->issueChallengeEvent(SocialSessionListener::ERROR_INITIALIZATION, challenge);
+		return;
+	}
+}
+
+void ScoreloopSocialSession::replyToChallengeCallback(void* cookie, SC_Error_t result)
+{
+    ScoreloopSocialSession* session = (ScoreloopSocialSession*)cookie;
+
+fprintf(stderr, "replyToChallengeCallback is called!\n");
+    switch (result)
+    {
+    	case SC_OK:
+			session->getListener()->replyToChallengeEvent(SocialSessionListener::SUCCESS);
+        	break;
+		case SC_INVALID_USER_DATA:
+			session->_acceptedChallenge = 0;
+			session->getListener()->replyToChallengeEvent(SocialSessionListener::ERROR_INVALID_USER);
+			break;
+		case SC_HTTP_SERVER_ERROR:
+			session->_acceptedChallenge = 0;
+			session->getListener()->replyToChallengeEvent(SocialSessionListener::ERROR_SERVER);
+			break;
+		default:
+			session->_acceptedChallenge = 0;
+			session->getListener()->replyToChallengeEvent(SocialSessionListener::ERROR_UNKNOWN);
+			break;
+    }
+
+    session->_pendingChallengeResponse = false;
+
+    SC_ChallengeController_Release(session->_challengeController);
+    session->_challengeController = 0;
+}
+
+void ScoreloopSocialSession::loadChallenges(bool showOpenChallengesOnly)
+{
+    if (_pendingChallengesResponse)
+    {
+    	_listener->loadChallengesEvent(SocialSessionListener::ERROR_PENDING_RESPONSE, _challenges);
+        return;
+    }
+    _pendingChallengesResponse = true;
+
+	int mode;
+	SC_Error_t rc;
+
+	if (!_challengesController)
+	{
+		rc = SC_Client_CreateChallengesController(_client, &_challengesController, ScoreloopSocialSession::loadChallengesCallback, this);
+	    if (rc != SC_OK)
+	    {
+	    	_listener->loadChallengesEvent(SocialSessionListener::ERROR_INITIALIZATION, _challenges);
+	    	_pendingChallengesResponse = false;
+	        return;
+	    }
+	}
+
+	if (showOpenChallengesOnly)
+		rc = SC_ChallengesController_LoadOpenChallenges(_challengesController);
+	else
+		rc = SC_ChallengesController_LoadChallengeHistory(_challengesController);
+
+    if (rc != SC_OK)
+    {
+    	_listener->loadChallengesEvent(SocialSessionListener::ERROR_INITIALIZATION, _challenges);
+       	_pendingChallengesResponse = false;
+        return;
+    }
+}
+
+SocialChallenge &ScoreloopSocialSession::addChallenge(SC_Challenge_h scoreloopChallenge)
+{
+	SocialChallenge challenge;
+
+	challenge.handle = scoreloopChallenge;
+
+	SC_User_h user = SC_Challenge_GetContestant((SC_Challenge_h)challenge.handle);
+	SC_String_h playerStr = (user) ? SC_User_GetLogin(user) : NULL;
+	challenge.challengedPlayerName = (playerStr) ? SC_String_GetData(playerStr) : "";
+
+	user = SC_Challenge_GetContender((SC_Challenge_h)challenge.handle);
+	playerStr = (user) ? SC_User_GetLogin(user) : NULL;
+	challenge.issuedPlayerName = (playerStr) ? SC_String_GetData(playerStr) : "";
+
+	SC_Score_h score = SC_Challenge_GetContenderScore((SC_Challenge_h)challenge.handle);
+	challenge.score = (score) ? (float)SC_Score_GetResult(score) : 0;
+	SC_String_h dateStr = SC_Challenge_GetCreatedAt((SC_Challenge_h)challenge.handle);
+	challenge.dateTimeIssued = (dateStr) ? SC_String_GetData(dateStr) : "";
+	dateStr = SC_Challenge_GetCompletedAt((SC_Challenge_h)challenge.handle);
+	challenge.dateTimeCompleted = (dateStr) ? SC_String_GetData(dateStr) : "";
+
+	if (SC_Challenge_IsComplete((SC_Challenge_h)challenge.handle))
+		challenge.state = SocialChallenge::COMPLETE;
+	else if (SC_Challenge_IsRejected((SC_Challenge_h)challenge.handle))
+		challenge.state = SocialChallenge::DECLINED;
+	else if (SC_Challenge_IsAssigned((SC_Challenge_h)challenge.handle))
+		challenge.state = SocialChallenge::PENDING;
+	else
+		challenge.state = SocialChallenge::INVALID;
+
+    _challenges.push_back(challenge);
+
+    return _challenges.back();
+}
+
+void ScoreloopSocialSession::loadChallengesCallback(void* cookie, SC_Error_t result)
+{
+    ScoreloopSocialSession* session = (ScoreloopSocialSession*)cookie;
+
+
+fprintf(stderr, "loadChallengesCallback is called!\n");
+    switch (result)
+    {
+    	case SC_OK:
+        {
+        	SC_ChallengeList_h challengeList = SC_ChallengesController_GetChallenges(session->_challengesController);
+
+            unsigned int count = SC_ChallengeList_GetCount(challengeList);
+            session->_challenges.clear();
+
+            for (unsigned int i = 0; i < count; i++)
+            {
+            	SC_Challenge_h sc_challenge = SC_ChallengeList_GetAt(challengeList, i);
+            	session->addChallenge(sc_challenge);
+            }
+
+            session->getListener()->loadChallengesEvent(SocialSessionListener::SUCCESS, session->_challenges);
+        }
+        break;
+
+		case SC_INVALID_USER_DATA:
+			session->getListener()->loadChallengesEvent(SocialSessionListener::ERROR_INVALID_USER, session->_challenges);
+			break;
+		case SC_HTTP_SERVER_ERROR:
+			session->getListener()->loadChallengesEvent(SocialSessionListener::ERROR_SERVER, session->_challenges);
+			break;
+		default:
+			session->getListener()->loadChallengesEvent(SocialSessionListener::ERROR_UNKNOWN, session->_challenges);
+			break;
+    }
+
+    session->_pendingChallengesResponse = false;
+}
+
+void ScoreloopSocialSession::loadSavedData(const char* key)
+{
+    if (_pendingDataResponse)
+    {
+        _listener->loadSavedDataEvent(SocialSessionListener::ERROR_PENDING_RESPONSE, "");
+        return;
+    }
+
+    SC_Error_t rc = SC_UserController_LoadUserContext(_userController);
+    if (rc != SC_OK)
+    {
+        _listener->loadSavedDataEvent(SocialSessionListener::ERROR_INITIALIZATION, "");
+        return;
+    }
+    _pendingDataResponse = true;
+    _key = key;
+}
+
+void ScoreloopSocialSession::submitSavedData(const char* key, std::string data)
+{
+    if (_pendingDataResponse)
+    {
+        _listener->submitSavedDataEvent(SocialSessionListener::ERROR_PENDING_RESPONSE);
+        return;
+    }
+    _pendingDataResponse = true;
+
+    SC_Context_h context;
+    SC_Error_t rc = SC_Context_New(&context);
+    if (rc != SC_OK)
+    {
+        _listener->submitSavedDataEvent(SocialSessionListener::ERROR_INITIALIZATION);
+        return;
+    }
+    SC_String_h str;
+    rc = SC_String_New(&str, data.c_str());
+    if (rc != SC_OK)
+    {
+        _listener->submitSavedDataEvent(SocialSessionListener::ERROR_INITIALIZATION);
+        return;
+    }
+    SC_Context_Put(context, key, str);
+    SC_User_SetContext((SC_User_h)_user.handle, context);
+    SC_UserController_SetUser(_userController, (SC_User_h)_user.handle);
+    rc = SC_UserController_UpdateUserContext(_userController);
+    if (rc != SC_OK)
+    {
+        _listener->submitSavedDataEvent(SocialSessionListener::ERROR_INITIALIZATION);
+        return;
+    }
+}
+
+void ScoreloopSocialSession::displayLeaderboard(const char* leaderboardId)
+{
+	SC_Error_t rc;
+	int mode = 0;
+
+    // Set the leaderboard to associate this leaderboard with
+    if (leaderboardId != NULL)
+    {
+        Properties* leaderboardMappings = _properties->getNamespace("leaderboard_mappings", true);
+        if (leaderboardMappings)
+        {
+            mode = leaderboardMappings->getInt(leaderboardId);
+        }
+    }
+
+	rc = SCUI_Client_SetLeadearboardFlags(_uiClient, SCUI_LEADERBOARD_FLAGS_SHOW_LIST_AROUND_USER);
+	if (rc != SC_OK)
+	{
+		_listener->uiEvent(SocialSessionListener::ERROR_INITIALIZATION, SC_MapErrorToStr(rc));
+		return;
+	}
+
+	rc = SCUI_Client_ShowLeaderboardView(_uiClient, mode, SCUI_LEADERBOARD_TYPE_GLOBAL, NULL);
+	if (rc != SC_OK)
+	{
+		_listener->uiEvent(SocialSessionListener::ERROR_INITIALIZATION, SC_MapErrorToStr(rc));
+	}
+}
+
+void ScoreloopSocialSession::displayAchievements()
+{
+	SC_Error_t rc;
+
+	rc = SCUI_Client_SetAchievementFlags(_uiClient, SCUI_ACHIEVEMENT_FLAGS_DEFAULT);
+	if (rc != SC_OK)
+	{
+		_listener->uiEvent(SocialSessionListener::ERROR_INITIALIZATION, SC_MapErrorToStr(rc));
+		return;
+	}
+
+	rc = SCUI_Client_ShowAchievementsView(_uiClient);
+	if (rc != SC_OK)
+	{
+		_listener->uiEvent(SocialSessionListener::ERROR_INITIALIZATION, SC_MapErrorToStr(rc));
+	}
+}
+
+void ScoreloopSocialSession::displayChallenges()
+{
+	fprintf(stderr, "displayChallenges has been called\n");
+    SC_Error_t rc = SC_NOT_IMPLEMENTED_YET;
+
+    rc = SCUI_Client_SetChallengeFlags(_uiClient, SCUI_CHALLENGE_FLAGS_DEFAULT);
+    if (rc != SC_OK)
+    {
+        fprintf(stderr, "Can't set challenge flags\n");
+        return;
+    }
+
+    char format[] = "%.2f";
+    rc = SCUI_Client_SetSimpleMoneyFormat(_uiClient, format);
+    if (rc != SC_OK)
+    {
+        fprintf(stderr, "Can't set money format\n");
+        return;
+    }
+
+    rc = SCUI_Client_ShowChallengesView(_uiClient);
+   // rc = SCUI_Client_ShowChallengeCreateView(_uiClient);
+    if (rc != SC_OK)
+    {
+        fprintf(stderr, "Failed to start a Challenges card! %s\n", SC_MapErrorToStr(rc));
+    }
+}
+
+void ScoreloopSocialSession::displayChallengeSubmit(const SocialChallenge *challenge, float score)
+{
+	SC_Error_t rc = SC_NOT_IMPLEMENTED_YET;
+
+	if (!challenge)
+		return;
+
+	rc = SCUI_Client_SetChallengeFlags(_uiClient, SCUI_CHALLENGE_FLAGS_DEFAULT);
+    if (rc != SC_OK)
+    {
+    	fprintf(stderr, "Can't set challenge flags\n");
+        return;
+    }
+
+    char format[] = "%.2f";
+    rc = SCUI_Client_SetSimpleMoneyFormat(_uiClient, format);
+    if (rc != SC_OK)
+    {
+    	fprintf(stderr, "Can't set money format\n");
+        return;
+    }
+    fprintf(stderr, "just before setting the score\n");
+	SC_Score_h sc_score;
+	rc = SC_Client_CreateScore(_client, &sc_score);
+	if (rc != SC_OK)
+	{
+		//_listener->submitChallengeScoreEvent(SocialSessionListener::ERROR_INITIALIZATION);
+		return;
+	}
+
+	int mode = 0;
+	SC_Score_SetMode(sc_score, (unsigned int)mode);
+	SC_Score_SetResult(sc_score, score);
+    rc = SCUI_Client_ShowChallengeSubmitView(_uiClient, (SC_Challenge_h)challenge->handle, sc_score);
+    if (rc != SC_OK)
+    {
+    	fprintf(stderr, "Failed to start a Challenges card! %s\n", SC_MapErrorToStr(rc));
+    }
+}
+
+}
+
+#endif

+ 231 - 0
gameplay/src/social/ScoreloopSocialSession.h

@@ -0,0 +1,231 @@
+#if defined(__QNX__) && defined(GP_USE_SOCIAL)
+
+#ifndef SCORELOOPSOCIALSESSION_H_
+#define SCORELOOPSOCIALSESSION_H_
+
+#include "SocialSession.h"
+#include <scoreloop/sc_client.h>
+#include <scoreloop/scui_client.h>
+#include <scoreloop/sc_init.h>
+#include <pthread.h>
+
+namespace gameplay
+{
+
+/**
+ * Scoreloop implementation of SocialSession
+ *
+ * Note: ensure game.config has the following properties
+ *
+  @verbatim
+    social
+    {
+         provider = Scoreloop
+         id  = d346c484-12aa-49a2-a0a0-de2f87492d72
+         secret = aAa+DehBfyGO/CYaE3nWomgu7SIbWFczUih+Qwf3/n7u0y3nyq5Hag==
+         version = 1.0
+         language = en
+         currency = ASC
+         leaderboard_mappings
+         {
+             // Format: leaderboardId =  mode <unsigned int>
+             easy = 0
+             medium = 1
+             hard = 2
+         }
+    }
+ *
+ * Note: Ensure your bar-descriptor.xml has:
+ *
+ * <action>read_device_identifying_information</action>
+ *
+ * @script{ignore}
+ */
+class ScoreloopSocialSession : public SocialSession
+{
+    friend class SocialController;
+
+public:
+
+    /**
+     * @see SocialSession::getListener
+     */
+    SocialSessionListener* getListener();
+
+    /**
+     * Initializes the session with the local client definition for this game.
+     *
+     * @param listener The listener for responses for this session
+     * @param properties The properties to initialize this session with for this game.
+     */
+    static SocialSession *authenticate(SocialSessionListener* listener, Properties* properties);
+
+    /**
+     * @see SocialSession::getUser
+     */
+    const SocialPlayer& getUser() const;
+
+    /**
+     * @see SocialSession::loadFriends
+     */
+    void loadFriends();
+
+    /**
+     * @see SocialSession::loadAchievements
+     */
+    void loadAchievements();
+
+    /**
+     * @see SocialSession::submitAchievement
+     */
+    void submitAchievement(const char* achievementId, unsigned int value, bool achieved=false);
+
+    /**
+     * @see SocialSession::incrementAchievement
+     */
+    void incrementAchievement(const char* achievementId, unsigned int increment=1);
+
+    /**
+      * @see SocialSession::syncAchievements
+      */
+    void synchronizeAchievements();
+
+    /**
+     * @see SocialSession::loadScores
+     */
+    void loadScores(const char* leaderboardId, CommunityScope community, TimeScope time, const SocialPlayer& player, unsigned int count);
+
+    /**
+     * @see SocialSession::loadScores
+     */
+    void loadScores(const char* leaderboardId, CommunityScope community, TimeScope time, unsigned int start, unsigned int count);
+
+    /**
+     * @see SocialSession::submitScore
+     */
+    void submitScore(const char* leaderboardId, float score);
+
+    /**
+      * @see SocialSession::submitChallenge
+      */
+    void submitChallenge(const SocialPlayer *player, unsigned int wager, float score, const char* leaderboardId=0);
+
+    /**
+      * @see SocialSession::loadChallenges
+      */
+    void loadChallenges(bool showOpenChallengesOnly=true);
+
+    /**
+      * @see SocialSession::acceptChallenge
+      */
+    void replyToChallenge(const SocialChallenge *challenge, bool accept);
+
+    /**
+     * @see SocialSession::requestSavedData
+     */
+    void loadSavedData(const char* key);
+
+    /**
+     * @see SocialSession::submitSavedData
+     */
+    void submitSavedData(const char* key, std::string data);
+
+    void displayLeaderboard(const char* leaderboardId);
+
+    void displayAchievements();
+
+    void displayChallenges();
+
+    void displayChallengeSubmit(const SocialChallenge *challenge, float score);
+
+protected:
+
+    bool handleEvent(void *event);
+
+private:
+
+    /**
+     * Contructor
+     */
+    ScoreloopSocialSession();
+
+    /**
+     * Destructor
+     */
+    virtual ~ScoreloopSocialSession();
+
+    static void* platformEventCallback(void* data);
+
+    static void userCallback(void* cookie, unsigned int result);
+
+    static void uiCallback(void *cookie, SCUI_Result_t result, const void *data);
+
+    static void loadFriendsCallback(void* cookie, SC_Error_t result);
+
+    static void loadAchievementsCallback(void* cookie, SC_Error_t result);
+
+    static void submitAchievementCallback(void* cookie, SC_Error_t result);
+
+    static void submitChallengeCallback(void *cookie, SC_Error_t result);
+
+    static void replyToChallengeCallback(void *cookie, SC_Error_t result);
+
+    static void submittedChallengeScoreCallback(void *cookie, SC_Error_t result);
+
+    static void loadChallengesCallback(void *cookie, SC_Error_t result);
+
+    static void loadScoresCallback(void* cookie, SC_Error_t result);
+
+    static void submitScoreCallback(void* cookie, SC_Error_t result);
+
+    const SocialAchievement* getAchievement(const char* achievementId) const;
+
+    SocialChallenge &addChallenge(SC_Challenge_h challenge);
+
+    static ScoreloopSocialSession* _session;
+
+    enum UserOp
+    {
+        USEROP_GET_LOCALUSER,
+        USEROP_WRITE_CONTEXT,
+        USEROP_READ_CONTEXT
+    };
+
+    SocialSessionListener* _listener;
+    Properties* _properties;
+    bool _pendingUserResponse;
+    bool _pendingFriendsResponse;
+    bool _pendingScoresResponse;
+    bool _pendingSubmitScoreResponse;
+    bool _pendingAchievementResponse;
+    bool _pendingChallengeResponse;
+    bool _pendingChallengesResponse;
+    bool _pendingDataResponse;
+    SC_InitData_t _initData;
+    SC_Client_h _client;
+    SCUI_Client_h _uiClient;
+    SC_UserController_h _userController;
+    SC_UsersController_h _usersController;
+    SC_LocalAchievementsController_h _localAchievementsController;
+    SC_ScoresController_h _scoresController;
+    SC_ScoreController_h _scoreController;
+    SC_ChallengeController_h _challengeController;
+    SC_ChallengesController_h _challengesController;
+    pthread_cond_t _channelCond;
+    pthread_mutex_t _channelMutex;
+    const char* _key;
+    std::string _data;
+    SocialPlayer _user;
+    const SocialChallenge* _acceptedChallenge;
+    UserOp _userOp;
+    std::vector<SocialPlayer> _friends;
+    std::vector<SocialAchievement> _achievements;
+    std::vector<SocialScore> _scores;
+    std::vector<SocialChallenge> _challenges;
+};
+
+}
+
+#endif
+
+#endif

+ 2 - 1
install.bat

@@ -34,11 +34,12 @@ cd %~dp0
 >> temp.cs ECHO         try
 >> temp.cs ECHO         try
 >> temp.cs ECHO         {
 >> temp.cs ECHO         {
 >> temp.cs ECHO             WebClient client = new WebClient();
 >> temp.cs ECHO             WebClient client = new WebClient();
+>> temp.cs ECHO             client.Proxy = null;
 >> temp.cs ECHO             client.DownloadProgressChanged += new DownloadProgressChangedEventHandler(DownloadProgressChanged);
 >> temp.cs ECHO             client.DownloadProgressChanged += new DownloadProgressChangedEventHandler(DownloadProgressChanged);
 >> temp.cs ECHO             client.DownloadFileCompleted += new AsyncCompletedEventHandler(DownloadFileCompleted);
 >> temp.cs ECHO             client.DownloadFileCompleted += new AsyncCompletedEventHandler(DownloadFileCompleted);
 >> temp.cs ECHO             Console.Write("Downloading " + url + ": 0%%    ");
 >> temp.cs ECHO             Console.Write("Downloading " + url + ": 0%%    ");
 >> temp.cs ECHO             client.DownloadFileAsync(new Uri(url), file);
 >> temp.cs ECHO             client.DownloadFileAsync(new Uri(url), file);
->> temp.cs ECHO             while (!done) System.Threading.Thread.Sleep(1000);
+>> temp.cs ECHO             while (!done) System.Threading.Thread.Sleep(500);
 >> temp.cs ECHO         }
 >> temp.cs ECHO         }
 >> temp.cs ECHO         catch (Exception x)
 >> temp.cs ECHO         catch (Exception x)
 >> temp.cs ECHO         {
 >> temp.cs ECHO         {

+ 2 - 3
samples/CMakeLists.txt

@@ -4,7 +4,7 @@ include_directories(
     ${CMAKE_SOURCE_DIR}/gameplay/src
     ${CMAKE_SOURCE_DIR}/gameplay/src
     ${CMAKE_SOURCE_DIR}/external-deps/lua/include
     ${CMAKE_SOURCE_DIR}/external-deps/lua/include
     ${CMAKE_SOURCE_DIR}/external-deps/bullet/include
     ${CMAKE_SOURCE_DIR}/external-deps/bullet/include
-    ${CMAKE_SOURCE_DIR}/external-deps/libpng/include
+    ${CMAKE_SOURCE_DIR}/external-deps/png/include
     ${CMAKE_SOURCE_DIR}/external-deps/oggvorbis/include
     ${CMAKE_SOURCE_DIR}/external-deps/oggvorbis/include
     ${CMAKE_SOURCE_DIR}/external-deps/zlib/include
     ${CMAKE_SOURCE_DIR}/external-deps/zlib/include
     ${CMAKE_SOURCE_DIR}/external-deps/openal/include
     ${CMAKE_SOURCE_DIR}/external-deps/openal/include
@@ -16,7 +16,7 @@ add_definitions(-D__linux__)
 link_directories(
 link_directories(
     ${CMAKE_SOURCE_DIR}/external-deps/lua/lib/linux/${ARCH_DIR}
     ${CMAKE_SOURCE_DIR}/external-deps/lua/lib/linux/${ARCH_DIR}
     ${CMAKE_SOURCE_DIR}/external-deps/zlib/lib/linux/${ARCH_DIR}
     ${CMAKE_SOURCE_DIR}/external-deps/zlib/lib/linux/${ARCH_DIR}
-    ${CMAKE_SOURCE_DIR}/external-deps/libpng/lib/linux/${ARCH_DIR}
+    ${CMAKE_SOURCE_DIR}/external-deps/png/lib/linux/${ARCH_DIR}
     ${CMAKE_SOURCE_DIR}/external-deps/bullet/lib/linux/${ARCH_DIR}
     ${CMAKE_SOURCE_DIR}/external-deps/bullet/lib/linux/${ARCH_DIR}
     ${CMAKE_SOURCE_DIR}/external-deps/oggvorbis/lib/linux/${ARCH_DIR}
     ${CMAKE_SOURCE_DIR}/external-deps/oggvorbis/lib/linux/${ARCH_DIR}
     ${CMAKE_SOURCE_DIR}/external-deps/openal/lib/linux/${ARCH_DIR}
     ${CMAKE_SOURCE_DIR}/external-deps/openal/lib/linux/${ARCH_DIR}
@@ -48,7 +48,6 @@ add_definitions(-lstdc++ -lgameplay -lm -llua -lz -lpng -lvorbis -logg -lBulletC
 
 
 add_subdirectory(browser)
 add_subdirectory(browser)
 add_subdirectory(character)
 add_subdirectory(character)
-add_subdirectory(longboard)
 add_subdirectory(lua)
 add_subdirectory(lua)
 add_subdirectory(mesh)
 add_subdirectory(mesh)
 add_subdirectory(particles)
 add_subdirectory(particles)

+ 13 - 3
samples/browser/.cproject

@@ -25,6 +25,8 @@
 								<option id="com.qnx.qcc.option.compiler.security.1844270687" name="Enhanced Security (-fstack-protector-strong)" superClass="com.qnx.qcc.option.compiler.security" value="false" valueType="boolean"/>
 								<option id="com.qnx.qcc.option.compiler.security.1844270687" name="Enhanced Security (-fstack-protector-strong)" superClass="com.qnx.qcc.option.compiler.security" value="false" valueType="boolean"/>
 								<option id="com.qnx.qcc.option.compiler.defines.2033387229" name="Defines (-D)" superClass="com.qnx.qcc.option.compiler.defines" valueType="definedSymbols">
 								<option id="com.qnx.qcc.option.compiler.defines.2033387229" name="Defines (-D)" superClass="com.qnx.qcc.option.compiler.defines" valueType="definedSymbols">
 									<listOptionValue builtIn="false" value="_FORTIFY_SOURCE=2"/>
 									<listOptionValue builtIn="false" value="_FORTIFY_SOURCE=2"/>
+									<listOptionValue builtIn="false" value="GP_USE_SOCIAL"/>
+									<listOptionValue builtIn="false" value="GP_USE_GAMEPAD"/>
 								</option>
 								</option>
 								<option id="com.qnx.qcc.option.compiler.includePath.1368017357" name="Include Directories (-I)" superClass="com.qnx.qcc.option.compiler.includePath" valueType="includePath">
 								<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="${QNX_TARGET}/../target-override/usr/include"/>
@@ -62,7 +64,7 @@
 									<listOptionValue builtIn="false" value="EGL"/>
 									<listOptionValue builtIn="false" value="EGL"/>
 									<listOptionValue builtIn="false" value="screen"/>
 									<listOptionValue builtIn="false" value="screen"/>
 									<listOptionValue builtIn="false" value="m"/>
 									<listOptionValue builtIn="false" value="m"/>
-									<listOptionValue builtIn="false" value="png14"/>
+									<listOptionValue builtIn="false" value="png"/>
 									<listOptionValue builtIn="false" value="pps"/>
 									<listOptionValue builtIn="false" value="pps"/>
 									<listOptionValue builtIn="false" value="bps"/>
 									<listOptionValue builtIn="false" value="bps"/>
 									<listOptionValue builtIn="false" value="OpenAL"/>
 									<listOptionValue builtIn="false" value="OpenAL"/>
@@ -72,6 +74,7 @@
 									<listOptionValue builtIn="false" value="lua"/>
 									<listOptionValue builtIn="false" value="lua"/>
 									<listOptionValue builtIn="false" value="bullet"/>
 									<listOptionValue builtIn="false" value="bullet"/>
 									<listOptionValue builtIn="false" value="vorbis"/>
 									<listOptionValue builtIn="false" value="vorbis"/>
+									<listOptionValue builtIn="false" value="scoreloopcore"/>
 								</option>
 								</option>
 								<option id="com.qnx.qcc.option.linker.objectFiles.782983295" name="Additional Object Files" superClass="com.qnx.qcc.option.linker.objectFiles"/>
 								<option id="com.qnx.qcc.option.linker.objectFiles.782983295" name="Additional Object Files" superClass="com.qnx.qcc.option.linker.objectFiles"/>
 								<inputType id="com.qnx.qcc.inputType.linker.149610709" superClass="com.qnx.qcc.inputType.linker">
 								<inputType id="com.qnx.qcc.inputType.linker.149610709" superClass="com.qnx.qcc.inputType.linker">
@@ -112,6 +115,8 @@
 								<option id="com.qnx.qcc.option.compiler.security.1558473615" name="Enhanced Security (-fstack-protector-strong)" superClass="com.qnx.qcc.option.compiler.security" value="false" valueType="boolean"/>
 								<option id="com.qnx.qcc.option.compiler.security.1558473615" name="Enhanced Security (-fstack-protector-strong)" superClass="com.qnx.qcc.option.compiler.security" value="false" valueType="boolean"/>
 								<option id="com.qnx.qcc.option.compiler.defines.679430995" name="Defines (-D)" superClass="com.qnx.qcc.option.compiler.defines" valueType="definedSymbols">
 								<option id="com.qnx.qcc.option.compiler.defines.679430995" name="Defines (-D)" superClass="com.qnx.qcc.option.compiler.defines" valueType="definedSymbols">
 									<listOptionValue builtIn="false" value="_FORTIFY_SOURCE=2"/>
 									<listOptionValue builtIn="false" value="_FORTIFY_SOURCE=2"/>
+									<listOptionValue builtIn="false" value="GP_USE_SOCIAL"/>
+									<listOptionValue builtIn="false" value="GP_USE_GAMEPAD"/>
 								</option>
 								</option>
 								<option id="com.qnx.qcc.option.compiler.includePath.1438345058" name="Include Directories (-I)" superClass="com.qnx.qcc.option.compiler.includePath" valueType="includePath">
 								<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="${QNX_TARGET}/../target-override/usr/include"/>
@@ -147,7 +152,7 @@
 									<listOptionValue builtIn="false" value="EGL"/>
 									<listOptionValue builtIn="false" value="EGL"/>
 									<listOptionValue builtIn="false" value="screen"/>
 									<listOptionValue builtIn="false" value="screen"/>
 									<listOptionValue builtIn="false" value="m"/>
 									<listOptionValue builtIn="false" value="m"/>
-									<listOptionValue builtIn="false" value="png14"/>
+									<listOptionValue builtIn="false" value="png"/>
 									<listOptionValue builtIn="false" value="pps"/>
 									<listOptionValue builtIn="false" value="pps"/>
 									<listOptionValue builtIn="false" value="bps"/>
 									<listOptionValue builtIn="false" value="bps"/>
 									<listOptionValue builtIn="false" value="OpenAL"/>
 									<listOptionValue builtIn="false" value="OpenAL"/>
@@ -157,6 +162,7 @@
 									<listOptionValue builtIn="false" value="lua"/>
 									<listOptionValue builtIn="false" value="lua"/>
 									<listOptionValue builtIn="false" value="bullet"/>
 									<listOptionValue builtIn="false" value="bullet"/>
 									<listOptionValue builtIn="false" value="vorbis"/>
 									<listOptionValue builtIn="false" value="vorbis"/>
+									<listOptionValue builtIn="false" value="scoreloopcore"/>
 								</option>
 								</option>
 								<option id="com.qnx.qcc.option.linker.objectFiles.661413139" name="Additional Object Files" superClass="com.qnx.qcc.option.linker.objectFiles"/>
 								<option id="com.qnx.qcc.option.linker.objectFiles.661413139" name="Additional Object Files" superClass="com.qnx.qcc.option.linker.objectFiles"/>
 								<inputType id="com.qnx.qcc.inputType.linker.1335515313" superClass="com.qnx.qcc.inputType.linker">
 								<inputType id="com.qnx.qcc.inputType.linker.1335515313" superClass="com.qnx.qcc.inputType.linker">
@@ -196,6 +202,8 @@
 								<option id="com.qnx.qcc.option.compiler.security.2051337094" name="Enhanced Security (-fstack-protector-strong)" superClass="com.qnx.qcc.option.compiler.security" value="false" valueType="boolean"/>
 								<option id="com.qnx.qcc.option.compiler.security.2051337094" name="Enhanced Security (-fstack-protector-strong)" superClass="com.qnx.qcc.option.compiler.security" value="false" valueType="boolean"/>
 								<option id="com.qnx.qcc.option.compiler.defines.1669819974" name="Defines (-D)" superClass="com.qnx.qcc.option.compiler.defines" valueType="definedSymbols">
 								<option id="com.qnx.qcc.option.compiler.defines.1669819974" name="Defines (-D)" superClass="com.qnx.qcc.option.compiler.defines" valueType="definedSymbols">
 									<listOptionValue builtIn="false" value="_FORTIFY_SOURCE=2"/>
 									<listOptionValue builtIn="false" value="_FORTIFY_SOURCE=2"/>
+									<listOptionValue builtIn="false" value="GP_USE_SOCIAL"/>
+									<listOptionValue builtIn="false" value="GP_USE_GAMEPAD"/>
 								</option>
 								</option>
 								<option id="com.qnx.qcc.option.compiler.includePath.456477750" name="Include Directories (-I)" superClass="com.qnx.qcc.option.compiler.includePath" valueType="includePath">
 								<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="${QNX_TARGET}/../target-override/usr/include"/>
@@ -233,7 +241,7 @@
 									<listOptionValue builtIn="false" value="EGL"/>
 									<listOptionValue builtIn="false" value="EGL"/>
 									<listOptionValue builtIn="false" value="screen"/>
 									<listOptionValue builtIn="false" value="screen"/>
 									<listOptionValue builtIn="false" value="m"/>
 									<listOptionValue builtIn="false" value="m"/>
-									<listOptionValue builtIn="false" value="png14"/>
+									<listOptionValue builtIn="false" value="png"/>
 									<listOptionValue builtIn="false" value="pps"/>
 									<listOptionValue builtIn="false" value="pps"/>
 									<listOptionValue builtIn="false" value="bps"/>
 									<listOptionValue builtIn="false" value="bps"/>
 									<listOptionValue builtIn="false" value="OpenAL"/>
 									<listOptionValue builtIn="false" value="OpenAL"/>
@@ -243,6 +251,7 @@
 									<listOptionValue builtIn="false" value="lua"/>
 									<listOptionValue builtIn="false" value="lua"/>
 									<listOptionValue builtIn="false" value="bullet"/>
 									<listOptionValue builtIn="false" value="bullet"/>
 									<listOptionValue builtIn="false" value="vorbis"/>
 									<listOptionValue builtIn="false" value="vorbis"/>
+									<listOptionValue builtIn="false" value="scoreloopcore"/>
 								</option>
 								</option>
 								<option id="com.qnx.qcc.option.linker.objectFiles.901324184" name="Additional Object Files" superClass="com.qnx.qcc.option.linker.objectFiles"/>
 								<option id="com.qnx.qcc.option.linker.objectFiles.901324184" name="Additional Object Files" superClass="com.qnx.qcc.option.linker.objectFiles"/>
 								<inputType id="com.qnx.qcc.inputType.linker.1669353763" superClass="com.qnx.qcc.inputType.linker">
 								<inputType id="com.qnx.qcc.inputType.linker.1669353763" superClass="com.qnx.qcc.inputType.linker">
@@ -293,4 +302,5 @@
 		<resource resourceType="PROJECT" workspacePath="/sample-browser"/>
 		<resource resourceType="PROJECT" workspacePath="/sample-browser"/>
 	</storageModule>
 	</storageModule>
 	<storageModule moduleId="com.qnx.tools.ide.qde.core.QNXProjectProperties"/>
 	<storageModule moduleId="com.qnx.tools.ide.qde.core.QNXProjectProperties"/>
+	<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
 </cproject>
 </cproject>

+ 2 - 2
samples/browser/CMakeLists.txt

@@ -3,7 +3,7 @@ include_directories(
     ${CMAKE_SOURCE_DIR}/gameplay/src
     ${CMAKE_SOURCE_DIR}/gameplay/src
     ${CMAKE_SOURCE_DIR}/external-deps/lua/include
     ${CMAKE_SOURCE_DIR}/external-deps/lua/include
     ${CMAKE_SOURCE_DIR}/external-deps/bullet/include
     ${CMAKE_SOURCE_DIR}/external-deps/bullet/include
-    ${CMAKE_SOURCE_DIR}/external-deps/libpng/include
+    ${CMAKE_SOURCE_DIR}/external-deps/png/include
     ${CMAKE_SOURCE_DIR}/external-deps/oggvorbis/include
     ${CMAKE_SOURCE_DIR}/external-deps/oggvorbis/include
     ${CMAKE_SOURCE_DIR}/external-deps/zlib/include
     ${CMAKE_SOURCE_DIR}/external-deps/zlib/include
     ${CMAKE_SOURCE_DIR}/external-deps/openal/include
     ${CMAKE_SOURCE_DIR}/external-deps/openal/include
@@ -15,7 +15,7 @@ add_definitions(-D__linux__)
 link_directories(
 link_directories(
     ${CMAKE_SOURCE_DIR}/external-deps/lua/lib/linux/${ARCH_DIR}
     ${CMAKE_SOURCE_DIR}/external-deps/lua/lib/linux/${ARCH_DIR}
     ${CMAKE_SOURCE_DIR}/external-deps/zlib/lib/linux/${ARCH_DIR}
     ${CMAKE_SOURCE_DIR}/external-deps/zlib/lib/linux/${ARCH_DIR}
-    ${CMAKE_SOURCE_DIR}/external-deps/libpng/lib/linux/${ARCH_DIR}
+    ${CMAKE_SOURCE_DIR}/external-deps/png/lib/linux/${ARCH_DIR}
     ${CMAKE_SOURCE_DIR}/external-deps/bullet/lib/linux/${ARCH_DIR}
     ${CMAKE_SOURCE_DIR}/external-deps/bullet/lib/linux/${ARCH_DIR}
     ${CMAKE_SOURCE_DIR}/external-deps/oggvorbis/lib/linux/${ARCH_DIR}
     ${CMAKE_SOURCE_DIR}/external-deps/oggvorbis/lib/linux/${ARCH_DIR}
     ${CMAKE_SOURCE_DIR}/external-deps/openal/lib/linux/${ARCH_DIR}
     ${CMAKE_SOURCE_DIR}/external-deps/openal/lib/linux/${ARCH_DIR}

+ 3 - 3
samples/browser/android/jni/Android.mk

@@ -1,7 +1,7 @@
 SAMPLE_PATH := $(call my-dir)/../../src
 SAMPLE_PATH := $(call my-dir)/../../src
 
 
 # external-deps
 # external-deps
-LIBPNG_PATH := $(call my-dir)/../../../../external-deps/libpng/lib/android/arm
+PNG_PATH := $(call my-dir)/../../../../external-deps/png/lib/android/arm
 ZLIB_PATH := $(call my-dir)/../../../../external-deps/zlib/lib/android/arm
 ZLIB_PATH := $(call my-dir)/../../../../external-deps/zlib/lib/android/arm
 LUA_PATH := $(call my-dir)/../../../../external-deps/lua/lib/android/arm
 LUA_PATH := $(call my-dir)/../../../../external-deps/lua/lib/android/arm
 BULLET_PATH := $(call my-dir)/../../../../external-deps/bullet/lib/android/arm
 BULLET_PATH := $(call my-dir)/../../../../external-deps/bullet/lib/android/arm
@@ -16,7 +16,7 @@ LOCAL_SRC_FILES := libgameplay.a
 include $(PREBUILT_STATIC_LIBRARY)
 include $(PREBUILT_STATIC_LIBRARY)
 
 
 # libpng
 # libpng
-LOCAL_PATH := $(LIBPNG_PATH)
+LOCAL_PATH := $(PNG_PATH)
 include $(CLEAR_VARS)
 include $(CLEAR_VARS)
 LOCAL_MODULE    := libpng 
 LOCAL_MODULE    := libpng 
 LOCAL_SRC_FILES := libpng.a
 LOCAL_SRC_FILES := libpng.a
@@ -87,7 +87,7 @@ LOCAL_SRC_FILES := ../../../gameplay/src/gameplay-main-android.cpp \
 	TriangleSample.cpp
 	TriangleSample.cpp
 
 
 LOCAL_LDLIBS    := -llog -landroid -lEGL -lGLESv2 -lOpenSLES
 LOCAL_LDLIBS    := -llog -landroid -lEGL -lGLESv2 -lOpenSLES
-LOCAL_CFLAGS    := -D__ANDROID__ -Wno-psabi -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" -I"../../../gameplay/src"
+LOCAL_CFLAGS    := -D__ANDROID__ -Wno-psabi -I"../../../external-deps/lua/include" -I"../../../external-deps/bullet/include" -I"../../../external-deps/png/include" -I"../../../external-deps/oggvorbis/include" -I"../../../external-deps/openal/include" -I"../../../gameplay/src"
 LOCAL_STATIC_LIBRARIES := android_native_app_glue libgameplay libpng libzlib liblua libbullet libvorbis libOpenAL
 LOCAL_STATIC_LIBRARIES := android_native_app_glue libgameplay libpng libzlib liblua libbullet libvorbis libOpenAL
 
 
 include $(BUILD_SHARED_LIBRARY)
 include $(BUILD_SHARED_LIBRARY)

BIN
samples/browser/android/res/drawable/icon.png


+ 5 - 21
samples/browser/bar-descriptor.xml

@@ -2,9 +2,7 @@
 <qnx xmlns="http://www.qnx.com/schemas/application/1.0">
 <qnx xmlns="http://www.qnx.com/schemas/application/1.0">
 
 
 <!-- BlackBerry OS application descriptor file.
 <!-- BlackBerry OS application descriptor file.
-
     Specifies parameters for identifying, installing, and launching native applications on BlackBerry OS.
     Specifies parameters for identifying, installing, and launching native applications on BlackBerry OS.
-
 -->
 -->
 
 
     <!-- A universally unique application identifier. Must be unique across all BlackBerry OS applications.
     <!-- A universally unique application identifier. Must be unique across all BlackBerry OS applications.
@@ -18,7 +16,7 @@
     <!-- A string value of the format <0-999>.<0-999>.<0-999> that represents application version which can be used to check for application upgrade. 
     <!-- A string value of the format <0-999>.<0-999>.<0-999> that represents application version which can be used to check for application upgrade. 
          Values can also be 1-part or 2-part. It is not necessary to have a 3-part value.
          Values can also be 1-part or 2-part. It is not necessary to have a 3-part value.
          An updated version of application must have a versionNumber value higher than the previous version. Required. -->
          An updated version of application must have a versionNumber value higher than the previous version. Required. -->
-    <versionNumber>1.7.0</versionNumber>
+    <versionNumber>2.0.0</versionNumber>
 
 
     <!-- Fourth digit segment of the package version. First three segments are taken from the 
     <!-- Fourth digit segment of the package version. First three segments are taken from the 
          <versionNumber> element.  Must be an integer from 0 to 2^16-1 -->
          <versionNumber> element.  Must be an integer from 0 to 2^16-1 -->
@@ -49,15 +47,15 @@
 	<asset path="res/common">res/common</asset>
 	<asset path="res/common">res/common</asset>
 	<asset path="res/png">res/png</asset>
 	<asset path="res/png">res/png</asset>
 
 
-    <configuration id="com.qnx.qcc.configuration.exe.debug.242437683" name="Device-Debug">
+    <configuration name="Device-Debug">
        <platformArchitecture>armle-v7</platformArchitecture>
        <platformArchitecture>armle-v7</platformArchitecture>
        <asset path="Device-Debug/sample-browser" entry="true" type="Qnx/Elf">sample-browser</asset>
        <asset path="Device-Debug/sample-browser" entry="true" type="Qnx/Elf">sample-browser</asset>
     </configuration>
     </configuration>
-    <configuration id="com.qnx.qcc.configuration.exe.release.693953760" name="Device-Release">
+    <configuration name="Device-Release">
        <platformArchitecture>armle-v7</platformArchitecture>
        <platformArchitecture>armle-v7</platformArchitecture>
        <asset path="Device-Release/sample-browser" entry="true" type="Qnx/Elf">sample-browser</asset>
        <asset path="Device-Release/sample-browser" entry="true" type="Qnx/Elf">sample-browser</asset>
     </configuration>
     </configuration>
-    <configuration id="com.qnx.qcc.configuration.exe.debug.882133523" name="Simulator">
+    <configuration name="Simulator">
         <platformArchitecture>x86</platformArchitecture>
         <platformArchitecture>x86</platformArchitecture>
        <asset path="Simulator/sample-browser" entry="true" type="Qnx/Elf">sample-browser</asset>
        <asset path="Simulator/sample-browser" entry="true" type="Qnx/Elf">sample-browser</asset>
     </configuration>
     </configuration>
@@ -67,23 +65,9 @@
         <image>icon.png</image>
         <image>icon.png</image>
     </icon>
     </icon>
 
 
-    <!-- The splash screen that will appear when your application is launching, which should be 1280x768 -->
+    <!-- The splash screen that will appear when your application is launching, which should be 1280x720. -->
     <!-- <splashscreen></splashscreen> -->
     <!-- <splashscreen></splashscreen> -->
 
 
-    <!-- Request permission to execute native code.  Required for native applications. -->
-    <action system="true">run_native</action>
-
-    <!-- The permissions requested by your application. -->
-    <!--  <action>access_shared</action> -->
-    <!--  <action>record_audio</action> -->
-    <!--  <action>read_geolocation</action> -->
-    <!--  <action>use_camera</action> -->
-    <!--  <action>access_internet</action> -->
-    <!--  <action>play_audio</action> -->
-    <!--  <action>post_notification</action> -->
-    <!--  <action>set_audio_volume</action> -->
-    <!--  <action>read_device_identifying_information</action> -->
-
     <!-- Ensure that shared libraries in the package are found at run-time. -->
     <!-- Ensure that shared libraries in the package are found at run-time. -->
     <env var="LD_LIBRARY_PATH" value="app/native/lib"/>
     <env var="LD_LIBRARY_PATH" value="app/native/lib"/>
 
 

+ 1 - 0
samples/browser/game.config

@@ -4,6 +4,7 @@ window
     width = 1280
     width = 1280
     height = 720
     height = 720
     fullscreen = false
     fullscreen = false
+    //samples = 4
 }
 }
 
 
 aliases
 aliases

BIN
samples/browser/icon.png


BIN
samples/browser/res/common/arial-distance.gpb


BIN
samples/browser/res/common/arial.gpb


BIN
samples/browser/res/common/arial18.gpb


BIN
samples/browser/res/common/badaboom.gpb


BIN
samples/browser/res/common/baroque.gpb


BIN
samples/browser/res/common/custom.gpb


+ 8 - 8
samples/browser/res/common/default.theme

@@ -213,8 +213,8 @@ theme mainMenu
         {
         {
             skin = underliner
             skin = underliner
             textColor = #ffffffff
             textColor = #ffffffff
-            font = res/common/arial18.gpb
-            fontSize = 25
+            font = res/common/arial.gpb
+            fontSize = 24
             textAlignment = ALIGN_BOTTOM_HCENTER
             textAlignment = ALIGN_BOTTOM_HCENTER
         }
         }
     }
     }
@@ -234,7 +234,7 @@ theme mainMenu
             skin = mainNormal
             skin = mainNormal
             imageList = normalImages
             imageList = normalImages
 
 
-            font = res/common/arial18.gpb
+            font = res/common/arial.gpb
             textColor = #ffffffff
             textColor = #ffffffff
             fontSize = 18
             fontSize = 18
             textAlignment = ALIGN_VCENTER_HCENTER
             textAlignment = ALIGN_VCENTER_HCENTER
@@ -289,7 +289,7 @@ theme mainMenu
 
 
         stateNormal
         stateNormal
         {
         {
-            font = res/common/arial18.gpb
+            font = res/common/arial.gpb
             fontSize = 20
             fontSize = 20
         }
         }
 
 
@@ -312,7 +312,7 @@ theme mainMenu
         stateNormal
         stateNormal
         {
         {
             imageList = normalImages
             imageList = normalImages
-            font = res/common/arial18.gpb
+            font = res/common/arial.gpb
             textColor = #ffffffff
             textColor = #ffffffff
             fontSize = 14
             fontSize = 14
             textAlignment = ALIGN_VCENTER_HCENTER
             textAlignment = ALIGN_VCENTER_HCENTER
@@ -334,14 +334,14 @@ theme mainMenu
     {
     {
         stateNormal
         stateNormal
         {
         {
-            font = res/common/arial18.gpb
+            font = res/common/arial.gpb
             fontSize = 20
             fontSize = 20
             textAlignment = ALIGN_VCENTER_LEFT
             textAlignment = ALIGN_VCENTER_LEFT
         }
         }
 
 
         stateActive
         stateActive
         {
         {
-            font = res/common/arial18.gpb
+            font = res/common/arial.gpb
             fontSize = 20
             fontSize = 20
             textAlignment = ALIGN_VCENTER_LEFT
             textAlignment = ALIGN_VCENTER_LEFT
         }
         }
@@ -365,7 +365,7 @@ theme mainMenu
         stateNormal
         stateNormal
         {
         {
             textColor = #ffffffff
             textColor = #ffffffff
-            font = res/common/arial18.gpb
+            font = res/common/arial.gpb
             fontSize = 26
             fontSize = 26
             textAlignment = ALIGN_BOTTOM_HCENTER
             textAlignment = ALIGN_BOTTOM_HCENTER
         }
         }

BIN
samples/browser/res/common/dynamic.gpb


BIN
samples/browser/res/common/arial14.gpb → samples/browser/res/common/fishfingers.gpb


BIN
samples/browser/res/common/pirulen.gpb → samples/browser/res/common/neuropol.gpb


BIN
samples/browser/res/common/squarehead.gpb


+ 4 - 4
samples/browser/res/common/text.form

@@ -26,7 +26,7 @@ form textTest
         autoWidth = true
         autoWidth = true
         height = 50
         height = 50
         consumeInputEvents = false
         consumeInputEvents = false
-        text = Font (arial18)
+        text = Font (arial)
     }
     }
 
 
     button wrapButton : fontButton
     button wrapButton : fontButton
@@ -54,12 +54,12 @@ form textTest
         text = Font API (Advanced)
         text = Font API (Advanced)
     }
     }
 
 
-    label scaleLabel : topLabel
+    label sizeLabel : topLabel
     {
     {
-        text = Scale (1.0)
+        text = Size (18)
     }
     }
 
 
-    container scaling
+    container size
     {
     {
         style = noBorder
         style = noBorder
         autoWidth = true
         autoWidth = true

+ 5 - 1
samples/browser/sample-browser-ios.plist

@@ -19,16 +19,20 @@
 	<key>CFBundlePackageType</key>
 	<key>CFBundlePackageType</key>
 	<string>APPL</string>
 	<string>APPL</string>
 	<key>CFBundleShortVersionString</key>
 	<key>CFBundleShortVersionString</key>
-	<string>1.0</string>
+	<string>2.0</string>
 	<key>CFBundleSignature</key>
 	<key>CFBundleSignature</key>
 	<string>????</string>
 	<string>????</string>
 	<key>CFBundleVersion</key>
 	<key>CFBundleVersion</key>
 	<string>1</string>
 	<string>1</string>
 	<key>LSApplicationCategoryType</key>
 	<key>LSApplicationCategoryType</key>
 	<string>public.app-category.games</string>
 	<string>public.app-category.games</string>
+	<key>UIStatusBarHidden</key>
+	<true/>
 	<key>UISupportedInterfaceOrientations</key>
 	<key>UISupportedInterfaceOrientations</key>
 	<array>
 	<array>
 		<string>UIInterfaceOrientationLandscapeRight</string>
 		<string>UIInterfaceOrientationLandscapeRight</string>
 	</array>
 	</array>
+	<key>UIViewControllerBasedStatusBarAppearance</key>
+	<false/>
 </dict>
 </dict>
 </plist>
 </plist>

+ 1 - 1
samples/browser/sample-browser-macosx.plist

@@ -19,7 +19,7 @@
 	<key>CFBundlePackageType</key>
 	<key>CFBundlePackageType</key>
 	<string>APPL</string>
 	<string>APPL</string>
 	<key>CFBundleShortVersionString</key>
 	<key>CFBundleShortVersionString</key>
-	<string>1.0</string>
+	<string>2.0</string>
 	<key>CFBundleSignature</key>
 	<key>CFBundleSignature</key>
 	<string>????</string>
 	<string>????</string>
 	<key>CFBundleVersion</key>
 	<key>CFBundleVersion</key>

+ 41 - 37
samples/browser/sample-browser.vcxproj

@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8"?>
 <Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
 <Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
   <ItemGroup Label="ProjectConfigurations">
   <ItemGroup Label="ProjectConfigurations">
     <ProjectConfiguration Include="DebugMem|BlackBerry">
     <ProjectConfiguration Include="DebugMem|BlackBerry">
@@ -255,15 +255,17 @@
       <WarningLevel>Level3</WarningLevel>
       <WarningLevel>Level3</WarningLevel>
       <Optimization>Disabled</Optimization>
       <Optimization>Disabled</Optimization>
       <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_ITERATOR_DEBUG_LEVEL=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_ITERATOR_DEBUG_LEVEL=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories>../../gameplay/src;../../external-deps/lua/include;../../external-deps/bullet/include;../../external-deps/openal/include/AL;../../external-deps/oggvorbis/include;../../external-deps/libpng/include;../../external-deps/zlib/include;../../external-deps/glew/include</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>../../gameplay/src;../../external-deps/lua/include;../../external-deps/bullet/include;../../external-deps/openal/include/AL;../../external-deps/oggvorbis/include;../../external-deps/png/include;../../external-deps/zlib/include;../../external-deps/glew/include</AdditionalIncludeDirectories>
       <RuntimeTypeInfo>true</RuntimeTypeInfo>
       <RuntimeTypeInfo>true</RuntimeTypeInfo>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
+      <DisableSpecificWarnings>
+      </DisableSpecificWarnings>
     </ClCompile>
     </ClCompile>
     <Link>
     <Link>
       <SubSystem>Windows</SubSystem>
       <SubSystem>Windows</SubSystem>
-      <GenerateDebugInformation>true</GenerateDebugInformation>
-      <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>../../external-deps/lua/lib/windows/x86;../../external-deps/bullet/lib/windows/x86;../../external-deps/openal/lib/windows/x86;../../external-deps/oggvorbis/lib/windows/x86;../../external-deps/glew/lib/windows/x86;../../external-deps/libpng/lib/windows/x86;../../external-deps/zlib/lib/windows/x86;../../gameplay/windows/x86/$(Configuration)</AdditionalLibraryDirectories>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <AdditionalDependencies>lua.lib;OpenAL32.lib;OpenGL32.lib;GLU32.lib;glew32.lib;libpng.lib;zlib.lib;gameplay.lib;libogg.lib;libvorbis.lib;libvorbisfile.lib;BulletDynamics.lib;BulletCollision.lib;LinearMath.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalLibraryDirectories>../../external-deps/lua/lib/windows/x86;../../external-deps/bullet/lib/windows/x86;../../external-deps/openal/lib/windows/x86;../../external-deps/oggvorbis/lib/windows/x86;../../external-deps/glew/lib/windows/x86;../../external-deps/png/lib/windows/x86;../../external-deps/zlib/lib/windows/x86;../../gameplay/windows/x86/$(Configuration)</AdditionalLibraryDirectories>
     </Link>
     </Link>
     <PostBuildEvent>
     <PostBuildEvent>
       <Command>
       <Command>
@@ -285,15 +287,15 @@
       <WarningLevel>Level3</WarningLevel>
       <WarningLevel>Level3</WarningLevel>
       <Optimization>Disabled</Optimization>
       <Optimization>Disabled</Optimization>
       <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_ITERATOR_DEBUG_LEVEL=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_ITERATOR_DEBUG_LEVEL=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories>../../gameplay/src;../../external-deps/lua/include;../../external-deps/bullet/include;../../external-deps/openal/include/AL;../../external-deps/oggvorbis/include;../../external-deps/libpng/include;../../external-deps/zlib/include;../../external-deps/glew/include</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>../../gameplay/src;../../external-deps/lua/include;../../external-deps/bullet/include;../../external-deps/openal/include/AL;../../external-deps/oggvorbis/include;../../external-deps/png/include;../../external-deps/zlib/include;../../external-deps/glew/include</AdditionalIncludeDirectories>
       <RuntimeTypeInfo>true</RuntimeTypeInfo>
       <RuntimeTypeInfo>true</RuntimeTypeInfo>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
     </ClCompile>
     </ClCompile>
     <Link>
     <Link>
       <SubSystem>Windows</SubSystem>
       <SubSystem>Windows</SubSystem>
-      <GenerateDebugInformation>true</GenerateDebugInformation>
-      <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>../../external-deps/lua/lib/windows/x64;../../external-deps/bullet/lib/windows/x64;../../external-deps/openal/lib/windows/x64;../../external-deps/oggvorbis/lib/windows/x64;../../external-deps/glew/lib/windows/x64;../../external-deps/libpng/lib/windows/x64;../../external-deps/zlib/lib/windows/x64;../../gameplay/windows/x64/$(Configuration)</AdditionalLibraryDirectories>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <AdditionalDependencies>lua.lib;OpenAL32.lib;OpenGL32.lib;GLU32.lib;glew32.lib;libpng.lib;zlib.lib;gameplay.lib;libogg.lib;libvorbis.lib;libvorbisfile.lib;BulletDynamics.lib;BulletCollision.lib;LinearMath.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalLibraryDirectories>../../external-deps/lua/lib/windows/x64;../../external-deps/bullet/lib/windows/x64;../../external-deps/openal/lib/windows/x64;../../external-deps/oggvorbis/lib/windows/x64;../../external-deps/glew/lib/windows/x64;../../external-deps/png/lib/windows/x64;../../external-deps/zlib/lib/windows/x64;../../gameplay/windows/x64/$(Configuration)</AdditionalLibraryDirectories>
     </Link>
     </Link>
     <PostBuildEvent>
     <PostBuildEvent>
       <Command>
       <Command>
@@ -315,7 +317,7 @@
       <WarningLevel>Level3</WarningLevel>
       <WarningLevel>Level3</WarningLevel>
       <Optimization>Disabled</Optimization>
       <Optimization>Disabled</Optimization>
       <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_ITERATOR_DEBUG_LEVEL=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_ITERATOR_DEBUG_LEVEL=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories>../../external-deps/lua/include;../../external-deps/bullet/include;../../gameplay/src;../../external-deps/openal/include/AL;../../external-deps/oggvorbis/include;../../external-deps/libpng/include;../../external-deps/zlib/include;../../external-deps/glew/include</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>../../external-deps/lua/include;../../external-deps/bullet/include;../../gameplay/src;../../external-deps/openal/include/AL;../../external-deps/oggvorbis/include;../../external-deps/png/include;../../external-deps/zlib/include;../../external-deps/glew/include</AdditionalIncludeDirectories>
       <RuntimeTypeInfo>true</RuntimeTypeInfo>
       <RuntimeTypeInfo>true</RuntimeTypeInfo>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
       <AdditionalOptions>-mfpu=neon %(AdditionalOptions)</AdditionalOptions>
       <AdditionalOptions>-mfpu=neon %(AdditionalOptions)</AdditionalOptions>
@@ -323,7 +325,7 @@
     <Link>
     <Link>
       <SubSystem>Windows</SubSystem>
       <SubSystem>Windows</SubSystem>
       <GenerateDebugInformation>true</GenerateDebugInformation>
       <GenerateDebugInformation>true</GenerateDebugInformation>
-      <AdditionalDependencies>GLESv2;EGL;screen;m;png14;pps;bps;gestures;OpenAL;asound;gameplay;bullet;vorbis;lua</AdditionalDependencies>
+      <AdditionalDependencies>GLESv2;EGL;screen;m;png;pps;bps;gestures;OpenAL;asound;gameplay;bullet;vorbis;lua</AdditionalDependencies>
       <AdditionalLibraryDirectories>../../external-deps/lua/lib/blackberry/arm;../../external-deps/bullet/lib/blackberry/arm;../../external-deps/oggvorbis/lib/blackberry/arm;../../gameplay/Device-$(Configuration)</AdditionalLibraryDirectories>
       <AdditionalLibraryDirectories>../../external-deps/lua/lib/blackberry/arm;../../external-deps/bullet/lib/blackberry/arm;../../external-deps/oggvorbis/lib/blackberry/arm;../../gameplay/Device-$(Configuration)</AdditionalLibraryDirectories>
     </Link>
     </Link>
     <PostBuildEvent>
     <PostBuildEvent>
@@ -346,14 +348,14 @@
       <WarningLevel>Level3</WarningLevel>
       <WarningLevel>Level3</WarningLevel>
       <Optimization>Disabled</Optimization>
       <Optimization>Disabled</Optimization>
       <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_ITERATOR_DEBUG_LEVEL=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_ITERATOR_DEBUG_LEVEL=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories>../../external-deps/lua/include;../../external-deps/bullet/include;../../gameplay/src;../../external-deps/openal/include/AL;../../external-deps/oggvorbis/include;../../external-deps/libpng/include;../../external-deps/zlib/include;../../external-deps/glew/include</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>../../external-deps/lua/include;../../external-deps/bullet/include;../../gameplay/src;../../external-deps/openal/include/AL;../../external-deps/oggvorbis/include;../../external-deps/png/include;../../external-deps/zlib/include;../../external-deps/glew/include</AdditionalIncludeDirectories>
       <RuntimeTypeInfo>true</RuntimeTypeInfo>
       <RuntimeTypeInfo>true</RuntimeTypeInfo>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
     </ClCompile>
     </ClCompile>
     <Link>
     <Link>
       <SubSystem>Windows</SubSystem>
       <SubSystem>Windows</SubSystem>
       <GenerateDebugInformation>true</GenerateDebugInformation>
       <GenerateDebugInformation>true</GenerateDebugInformation>
-      <AdditionalDependencies>GLESv2;EGL;screen;m;png14;pps;bps;gestures;OpenAL;asound;gameplay;bullet;vorbis;lua</AdditionalDependencies>
+      <AdditionalDependencies>GLESv2;EGL;screen;m;png;pps;bps;gestures;OpenAL;asound;gameplay;bullet;vorbis;lua</AdditionalDependencies>
       <AdditionalLibraryDirectories>../../external-deps/lua/lib/blackberry/x86;../../external-deps/bullet/lib/blackberry/x86;../../external-deps/oggvorbis/lib/blackberry/x86;../../gameplay/Simulator</AdditionalLibraryDirectories>
       <AdditionalLibraryDirectories>../../external-deps/lua/lib/blackberry/x86;../../external-deps/bullet/lib/blackberry/x86;../../external-deps/oggvorbis/lib/blackberry/x86;../../gameplay/Simulator</AdditionalLibraryDirectories>
     </Link>
     </Link>
     <PostBuildEvent>
     <PostBuildEvent>
@@ -376,17 +378,19 @@
       <WarningLevel>Level3</WarningLevel>
       <WarningLevel>Level3</WarningLevel>
       <Optimization>Disabled</Optimization>
       <Optimization>Disabled</Optimization>
       <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;GAMEPLAY_MEM_LEAK_DETECTION;_ITERATOR_DEBUG_LEVEL=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;GAMEPLAY_MEM_LEAK_DETECTION;_ITERATOR_DEBUG_LEVEL=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories>../../gameplay/src;../../external-deps/lua/include;../../external-deps/bullet/include;../../external-deps/openal/include/AL;../../external-deps/oggvorbis/include;../../external-deps/libpng/include;../../external-deps/zlib/include;../../external-deps/glew/include</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>../../gameplay/src;../../external-deps/lua/include;../../external-deps/bullet/include;../../external-deps/openal/include/AL;../../external-deps/oggvorbis/include;../../external-deps/png/include;../../external-deps/zlib/include;../../external-deps/glew/include</AdditionalIncludeDirectories>
       <RuntimeTypeInfo>true</RuntimeTypeInfo>
       <RuntimeTypeInfo>true</RuntimeTypeInfo>
       <ShowIncludes>false</ShowIncludes>
       <ShowIncludes>false</ShowIncludes>
       <PreprocessToFile>false</PreprocessToFile>
       <PreprocessToFile>false</PreprocessToFile>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
+      <DisableSpecificWarnings>
+      </DisableSpecificWarnings>
     </ClCompile>
     </ClCompile>
     <Link>
     <Link>
       <SubSystem>Windows</SubSystem>
       <SubSystem>Windows</SubSystem>
-      <GenerateDebugInformation>true</GenerateDebugInformation>
-      <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>../../external-deps/lua/lib/windows/x86;../../external-deps/bullet/lib/windows/x86;../../external-deps/openal/lib/windows/x86;../../external-deps/oggvorbis/lib/windows/x86;../../external-deps/glew/lib/windows/x86;../../external-deps/libpng/lib/windows/x86;../../external-deps/zlib/lib/windows/x86;../../gameplay/windows/x86/$(Configuration)</AdditionalLibraryDirectories>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <AdditionalDependencies>lua.lib;OpenAL32.lib;OpenGL32.lib;GLU32.lib;glew32.lib;libpng.lib;zlib.lib;gameplay.lib;libogg.lib;libvorbis.lib;libvorbisfile.lib;BulletDynamics.lib;BulletCollision.lib;LinearMath.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalLibraryDirectories>../../external-deps/lua/lib/windows/x86;../../external-deps/bullet/lib/windows/x86;../../external-deps/openal/lib/windows/x86;../../external-deps/oggvorbis/lib/windows/x86;../../external-deps/glew/lib/windows/x86;../../external-deps/png/lib/windows/x86;../../external-deps/zlib/lib/windows/x86;../../gameplay/windows/x86/$(Configuration)</AdditionalLibraryDirectories>
     </Link>
     </Link>
     <PostBuildEvent>
     <PostBuildEvent>
       <Command>
       <Command>
@@ -408,7 +412,7 @@
       <WarningLevel>Level3</WarningLevel>
       <WarningLevel>Level3</WarningLevel>
       <Optimization>Disabled</Optimization>
       <Optimization>Disabled</Optimization>
       <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;GAMEPLAY_MEM_LEAK_DETECTION;_ITERATOR_DEBUG_LEVEL=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;GAMEPLAY_MEM_LEAK_DETECTION;_ITERATOR_DEBUG_LEVEL=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories>../../gameplay/src;../../external-deps/lua/include;../../external-deps/bullet/include;../../external-deps/openal/include/AL;../../external-deps/oggvorbis/include;../../external-deps/libpng/include;../../external-deps/zlib/include;../../external-deps/glew/include</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>../../gameplay/src;../../external-deps/lua/include;../../external-deps/bullet/include;../../external-deps/openal/include/AL;../../external-deps/oggvorbis/include;../../external-deps/png/include;../../external-deps/zlib/include;../../external-deps/glew/include</AdditionalIncludeDirectories>
       <RuntimeTypeInfo>true</RuntimeTypeInfo>
       <RuntimeTypeInfo>true</RuntimeTypeInfo>
       <ShowIncludes>false</ShowIncludes>
       <ShowIncludes>false</ShowIncludes>
       <PreprocessToFile>false</PreprocessToFile>
       <PreprocessToFile>false</PreprocessToFile>
@@ -416,9 +420,9 @@
     </ClCompile>
     </ClCompile>
     <Link>
     <Link>
       <SubSystem>Windows</SubSystem>
       <SubSystem>Windows</SubSystem>
-      <GenerateDebugInformation>true</GenerateDebugInformation>
-      <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>../../external-deps/lua/lib/windows/x64;../../external-deps/bullet/lib/windows/x64;../../external-deps/openal/lib/windows/x64;../../external-deps/oggvorbis/lib/windows/x64;../../external-deps/glew/lib/windows/x64;../../external-deps/libpng/lib/windows/x64;../../external-deps/zlib/lib/windows/x64;../../gameplay/windows/x64/$(Configuration)</AdditionalLibraryDirectories>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <AdditionalDependencies>lua.lib;OpenAL32.lib;OpenGL32.lib;GLU32.lib;glew32.lib;libpng.lib;zlib.lib;gameplay.lib;libogg.lib;libvorbis.lib;libvorbisfile.lib;BulletDynamics.lib;BulletCollision.lib;LinearMath.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalLibraryDirectories>../../external-deps/lua/lib/windows/x64;../../external-deps/bullet/lib/windows/x64;../../external-deps/openal/lib/windows/x64;../../external-deps/oggvorbis/lib/windows/x64;../../external-deps/glew/lib/windows/x64;../../external-deps/png/lib/windows/x64;../../external-deps/zlib/lib/windows/x64;../../gameplay/windows/x64/$(Configuration)</AdditionalLibraryDirectories>
     </Link>
     </Link>
     <PostBuildEvent>
     <PostBuildEvent>
       <Command>
       <Command>
@@ -440,7 +444,7 @@
       <WarningLevel>Level3</WarningLevel>
       <WarningLevel>Level3</WarningLevel>
       <Optimization>Disabled</Optimization>
       <Optimization>Disabled</Optimization>
       <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;GAMEPLAY_MEM_LEAK_DETECTION;_ITERATOR_DEBUG_LEVEL=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;GAMEPLAY_MEM_LEAK_DETECTION;_ITERATOR_DEBUG_LEVEL=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories>../../external-deps/lua/include;../../external-deps/bullet/include;../../gameplay/src;../../external-deps/openal/include/AL;../../external-deps/oggvorbis/include;../../external-deps/libpng/include;../../external-deps/zlib/include;../../external-deps/glew/include</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>../../external-deps/lua/include;../../external-deps/bullet/include;../../gameplay/src;../../external-deps/openal/include/AL;../../external-deps/oggvorbis/include;../../external-deps/png/include;../../external-deps/zlib/include;../../external-deps/glew/include</AdditionalIncludeDirectories>
       <RuntimeTypeInfo>true</RuntimeTypeInfo>
       <RuntimeTypeInfo>true</RuntimeTypeInfo>
       <ShowIncludes>false</ShowIncludes>
       <ShowIncludes>false</ShowIncludes>
       <PreprocessToFile>false</PreprocessToFile>
       <PreprocessToFile>false</PreprocessToFile>
@@ -450,7 +454,7 @@
     <Link>
     <Link>
       <SubSystem>Windows</SubSystem>
       <SubSystem>Windows</SubSystem>
       <GenerateDebugInformation>true</GenerateDebugInformation>
       <GenerateDebugInformation>true</GenerateDebugInformation>
-      <AdditionalDependencies>GLESv2;EGL;screen;m;png14;pps;bps;gestures;OpenAL;asound;gameplay;bullet;vorbis;lua</AdditionalDependencies>
+      <AdditionalDependencies>GLESv2;EGL;screen;m;png;pps;bps;gestures;OpenAL;asound;gameplay;bullet;vorbis;lua</AdditionalDependencies>
       <AdditionalLibraryDirectories>../../external-deps/lua/lib/blackberry/arm;../../external-deps/bullet/lib/blackberry/arm;../../external-deps/oggvorbis/lib/blackberry/arm;../../gameplay/Device-$(Configuration)</AdditionalLibraryDirectories>
       <AdditionalLibraryDirectories>../../external-deps/lua/lib/blackberry/arm;../../external-deps/bullet/lib/blackberry/arm;../../external-deps/oggvorbis/lib/blackberry/arm;../../gameplay/Device-$(Configuration)</AdditionalLibraryDirectories>
     </Link>
     </Link>
     <PostBuildEvent>
     <PostBuildEvent>
@@ -473,7 +477,7 @@
       <WarningLevel>Level3</WarningLevel>
       <WarningLevel>Level3</WarningLevel>
       <Optimization>Disabled</Optimization>
       <Optimization>Disabled</Optimization>
       <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;GAMEPLAY_MEM_LEAK_DETECTION;_ITERATOR_DEBUG_LEVEL=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;GAMEPLAY_MEM_LEAK_DETECTION;_ITERATOR_DEBUG_LEVEL=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories>../../external-deps/lua/include;../../external-deps/bullet/include;../../gameplay/src;../../external-deps/openal/include/AL;../../external-deps/oggvorbis/include;../../external-deps/libpng/include;../../external-deps/zlib/include;../../external-deps/glew/include</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>../../external-deps/lua/include;../../external-deps/bullet/include;../../gameplay/src;../../external-deps/openal/include/AL;../../external-deps/oggvorbis/include;../../external-deps/png/include;../../external-deps/zlib/include;../../external-deps/glew/include</AdditionalIncludeDirectories>
       <RuntimeTypeInfo>true</RuntimeTypeInfo>
       <RuntimeTypeInfo>true</RuntimeTypeInfo>
       <ShowIncludes>false</ShowIncludes>
       <ShowIncludes>false</ShowIncludes>
       <PreprocessToFile>false</PreprocessToFile>
       <PreprocessToFile>false</PreprocessToFile>
@@ -482,7 +486,7 @@
     <Link>
     <Link>
       <SubSystem>Windows</SubSystem>
       <SubSystem>Windows</SubSystem>
       <GenerateDebugInformation>true</GenerateDebugInformation>
       <GenerateDebugInformation>true</GenerateDebugInformation>
-      <AdditionalDependencies>GLESv2;EGL;screen;m;png14;pps;bps;gestures;OpenAL;asound;gameplay;bullet;vorbis;lua</AdditionalDependencies>
+      <AdditionalDependencies>GLESv2;EGL;screen;m;png;pps;bps;gestures;OpenAL;asound;gameplay;bullet;vorbis;lua</AdditionalDependencies>
       <AdditionalLibraryDirectories>../../external-deps/lua/lib/blackberry/x86;../../external-deps/bullet/lib/blackberry/x86;../../external-deps/oggvorbis/lib/blackberry/x86;../../gameplay/Simulator</AdditionalLibraryDirectories>
       <AdditionalLibraryDirectories>../../external-deps/lua/lib/blackberry/x86;../../external-deps/bullet/lib/blackberry/x86;../../external-deps/oggvorbis/lib/blackberry/x86;../../gameplay/Simulator</AdditionalLibraryDirectories>
     </Link>
     </Link>
     <PostBuildEvent>
     <PostBuildEvent>
@@ -507,15 +511,15 @@
       <FunctionLevelLinking>true</FunctionLevelLinking>
       <FunctionLevelLinking>true</FunctionLevelLinking>
       <IntrinsicFunctions>true</IntrinsicFunctions>
       <IntrinsicFunctions>true</IntrinsicFunctions>
       <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_ITERATOR_DEBUG_LEVEL=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_ITERATOR_DEBUG_LEVEL=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories>../../gameplay/src;../../external-deps/lua/include;../../external-deps/bullet/include;../../external-deps/openal/include/AL;../../external-deps/oggvorbis/include;../../external-deps/libpng/include;../../external-deps/zlib/include;../../external-deps/glew/include</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>../../gameplay/src;../../external-deps/lua/include;../../external-deps/bullet/include;../../external-deps/openal/include/AL;../../external-deps/oggvorbis/include;../../external-deps/png/include;../../external-deps/zlib/include;../../external-deps/glew/include</AdditionalIncludeDirectories>
     </ClCompile>
     </ClCompile>
     <Link>
     <Link>
       <SubSystem>Windows</SubSystem>
       <SubSystem>Windows</SubSystem>
       <GenerateDebugInformation>true</GenerateDebugInformation>
       <GenerateDebugInformation>true</GenerateDebugInformation>
       <EnableCOMDATFolding>true</EnableCOMDATFolding>
       <EnableCOMDATFolding>true</EnableCOMDATFolding>
-      <OptimizeReferences>true</OptimizeReferences>
-      <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>../../external-deps/lua/lib/windows/x86;../../external-deps/bullet/lib/windows/x86;../../external-deps/openal/lib/windows/x86;../../external-deps/oggvorbis/lib/windows/x86;../../external-deps/glew/lib/windows/x86;../../external-deps/libpng/lib/windows/x86;../../external-deps/zlib/lib/windows/x86;../../gameplay/windows/x86/$(Configuration)</AdditionalLibraryDirectories>
+      <OptimizeReferences>true</OptimizeReferences>
+      <AdditionalDependencies>lua.lib;OpenAL32.lib;OpenGL32.lib;GLU32.lib;glew32.lib;libpng.lib;zlib.lib;gameplay.lib;BulletDynamics.lib;BulletCollision.lib;LinearMath.lib;libogg.lib;libvorbis.lib;libvorbisfile.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalLibraryDirectories>../../external-deps/lua/lib/windows/x86;../../external-deps/bullet/lib/windows/x86;../../external-deps/openal/lib/windows/x86;../../external-deps/oggvorbis/lib/windows/x86;../../external-deps/glew/lib/windows/x86;../../external-deps/png/lib/windows/x86;../../external-deps/zlib/lib/windows/x86;../../gameplay/windows/x86/$(Configuration)</AdditionalLibraryDirectories>
     </Link>
     </Link>
     <PostBuildEvent>
     <PostBuildEvent>
       <Command>
       <Command>
@@ -539,15 +543,15 @@
       <FunctionLevelLinking>true</FunctionLevelLinking>
       <FunctionLevelLinking>true</FunctionLevelLinking>
       <IntrinsicFunctions>true</IntrinsicFunctions>
       <IntrinsicFunctions>true</IntrinsicFunctions>
       <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_ITERATOR_DEBUG_LEVEL=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_ITERATOR_DEBUG_LEVEL=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories>../../gameplay/src;../../external-deps/lua/include;../../external-deps/bullet/include;../../external-deps/openal/include/AL;../../external-deps/oggvorbis/include;../../external-deps/libpng/include;../../external-deps/zlib/include;../../external-deps/glew/include</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>../../gameplay/src;../../external-deps/lua/include;../../external-deps/bullet/include;../../external-deps/openal/include/AL;../../external-deps/oggvorbis/include;../../external-deps/png/include;../../external-deps/zlib/include;../../external-deps/glew/include</AdditionalIncludeDirectories>
     </ClCompile>
     </ClCompile>
     <Link>
     <Link>
       <SubSystem>Windows</SubSystem>
       <SubSystem>Windows</SubSystem>
       <GenerateDebugInformation>true</GenerateDebugInformation>
       <GenerateDebugInformation>true</GenerateDebugInformation>
       <EnableCOMDATFolding>true</EnableCOMDATFolding>
       <EnableCOMDATFolding>true</EnableCOMDATFolding>
-      <OptimizeReferences>true</OptimizeReferences>
-      <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>../../external-deps/lua/lib/windows/x64;../../external-deps/bullet/lib/windows/x64;../../external-deps/openal/lib/windows/x64;../../external-deps/oggvorbis/lib/windows/x64;../../external-deps/glew/lib/windows/x64;../../external-deps/libpng/lib/windows/x64;../../external-deps/zlib/lib/windows/x64;../../gameplay/windows/x64/$(Configuration)</AdditionalLibraryDirectories>
+      <OptimizeReferences>true</OptimizeReferences>
+      <AdditionalDependencies>lua.lib;OpenAL32.lib;OpenGL32.lib;GLU32.lib;glew32.lib;libpng.lib;zlib.lib;gameplay.lib;BulletDynamics.lib;BulletCollision.lib;LinearMath.lib;libogg.lib;libvorbis.lib;libvorbisfile.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalLibraryDirectories>../../external-deps/lua/lib/windows/x64;../../external-deps/bullet/lib/windows/x64;../../external-deps/openal/lib/windows/x64;../../external-deps/oggvorbis/lib/windows/x64;../../external-deps/glew/lib/windows/x64;../../external-deps/png/lib/windows/x64;../../external-deps/zlib/lib/windows/x64;../../gameplay/windows/x64/$(Configuration)</AdditionalLibraryDirectories>
     </Link>
     </Link>
     <PostBuildEvent>
     <PostBuildEvent>
       <Command>
       <Command>
@@ -571,7 +575,7 @@
       <FunctionLevelLinking>true</FunctionLevelLinking>
       <FunctionLevelLinking>true</FunctionLevelLinking>
       <IntrinsicFunctions>true</IntrinsicFunctions>
       <IntrinsicFunctions>true</IntrinsicFunctions>
       <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_ITERATOR_DEBUG_LEVEL=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_ITERATOR_DEBUG_LEVEL=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories>../../external-deps/lua/include;../../external-deps/bullet/include;../../gameplay/src;../../external-deps/openal/include/AL;../../external-deps/oggvorbis/include;../../external-deps/libpng/include;../../external-deps/zlib/include;../../external-deps/glew/include</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>../../external-deps/lua/include;../../external-deps/bullet/include;../../gameplay/src;../../external-deps/openal/include/AL;../../external-deps/oggvorbis/include;../../external-deps/png/include;../../external-deps/zlib/include;../../external-deps/glew/include</AdditionalIncludeDirectories>
       <AdditionalOptions>-mfpu=neon %(AdditionalOptions)</AdditionalOptions>
       <AdditionalOptions>-mfpu=neon %(AdditionalOptions)</AdditionalOptions>
     </ClCompile>
     </ClCompile>
     <Link>
     <Link>
@@ -579,7 +583,7 @@
       <GenerateDebugInformation>true</GenerateDebugInformation>
       <GenerateDebugInformation>true</GenerateDebugInformation>
       <EnableCOMDATFolding>true</EnableCOMDATFolding>
       <EnableCOMDATFolding>true</EnableCOMDATFolding>
       <OptimizeReferences>true</OptimizeReferences>
       <OptimizeReferences>true</OptimizeReferences>
-      <AdditionalDependencies>GLESv2;EGL;screen;m;png14;pps;bps;gestures;OpenAL;asound;gameplay;bullet;vorbis;lua</AdditionalDependencies>
+      <AdditionalDependencies>GLESv2;EGL;screen;m;png;pps;bps;gestures;OpenAL;asound;gameplay;bullet;vorbis;lua</AdditionalDependencies>
       <AdditionalLibraryDirectories>../../external-deps/lua/lib/blackberry/arm;../../external-deps/bullet/lib/blackberry/arm;../../external-deps/oggvorbis/lib/blackberry/arm;../../gameplay/Device-$(Configuration)</AdditionalLibraryDirectories>
       <AdditionalLibraryDirectories>../../external-deps/lua/lib/blackberry/arm;../../external-deps/bullet/lib/blackberry/arm;../../external-deps/oggvorbis/lib/blackberry/arm;../../gameplay/Device-$(Configuration)</AdditionalLibraryDirectories>
     </Link>
     </Link>
     <PostBuildEvent>
     <PostBuildEvent>
@@ -604,14 +608,14 @@
       <FunctionLevelLinking>true</FunctionLevelLinking>
       <FunctionLevelLinking>true</FunctionLevelLinking>
       <IntrinsicFunctions>true</IntrinsicFunctions>
       <IntrinsicFunctions>true</IntrinsicFunctions>
       <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_ITERATOR_DEBUG_LEVEL=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_ITERATOR_DEBUG_LEVEL=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories>../../external-deps/lua/include;../../external-deps/bullet/include;../../gameplay/src;../../external-deps/openal/include/AL;../../external-deps/oggvorbis/include;../../external-deps/libpng/include;../../external-deps/zlib/include;../../external-deps/glew/include</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>../../external-deps/lua/include;../../external-deps/bullet/include;../../gameplay/src;../../external-deps/openal/include/AL;../../external-deps/oggvorbis/include;../../external-deps/png/include;../../external-deps/zlib/include;../../external-deps/glew/include</AdditionalIncludeDirectories>
     </ClCompile>
     </ClCompile>
     <Link>
     <Link>
       <SubSystem>Windows</SubSystem>
       <SubSystem>Windows</SubSystem>
       <GenerateDebugInformation>true</GenerateDebugInformation>
       <GenerateDebugInformation>true</GenerateDebugInformation>
       <EnableCOMDATFolding>true</EnableCOMDATFolding>
       <EnableCOMDATFolding>true</EnableCOMDATFolding>
       <OptimizeReferences>true</OptimizeReferences>
       <OptimizeReferences>true</OptimizeReferences>
-      <AdditionalDependencies>GLESv2;EGL;screen;m;png14;pps;bps;gestures;OpenAL;asound;gameplay;bullet;vorbis;lua</AdditionalDependencies>
+      <AdditionalDependencies>GLESv2;EGL;screen;m;png;pps;bps;gestures;OpenAL;asound;gameplay;bullet;vorbis;lua</AdditionalDependencies>
       <AdditionalLibraryDirectories>../../external-deps/lua/lib/blackberry/x86;../../external-deps/bullet/lib/blackberry/x86;../../external-deps/oggvorbis/lib/blackberry/x86;../../gameplay/Simulator</AdditionalLibraryDirectories>
       <AdditionalLibraryDirectories>../../external-deps/lua/lib/blackberry/x86;../../external-deps/bullet/lib/blackberry/x86;../../external-deps/oggvorbis/lib/blackberry/x86;../../gameplay/Simulator</AdditionalLibraryDirectories>
     </Link>
     </Link>
     <PostBuildEvent>
     <PostBuildEvent>

+ 63 - 67
samples/browser/sample-browser.xcodeproj/project.pbxproj

@@ -36,6 +36,7 @@
 		422FE594169690830062D1FE /* PostProcessSample.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 422FE592169690830062D1FE /* PostProcessSample.cpp */; };
 		422FE594169690830062D1FE /* PostProcessSample.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 422FE592169690830062D1FE /* PostProcessSample.cpp */; };
 		422FE595169690830062D1FE /* PostProcessSample.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 422FE592169690830062D1FE /* PostProcessSample.cpp */; };
 		422FE595169690830062D1FE /* PostProcessSample.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 422FE592169690830062D1FE /* PostProcessSample.cpp */; };
 		424CC030161F8E3000577827 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 424CC02F161F8E3000577827 /* IOKit.framework */; };
 		424CC030161F8E3000577827 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 424CC02F161F8E3000577827 /* IOKit.framework */; };
+		425F3A5617FBCBF00085454F /* libgameplay.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 425F3A5517FBCBF00085454F /* libgameplay.a */; };
 		428F7BDE15CB131A009ED24C /* game.config in Resources */ = {isa = PBXBuildFile; fileRef = 428F7BDD15CB131A009ED24C /* game.config */; };
 		428F7BDE15CB131A009ED24C /* game.config in Resources */ = {isa = PBXBuildFile; fileRef = 428F7BDD15CB131A009ED24C /* game.config */; };
 		42BE773016A68CE3008AFA65 /* GamepadSample.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 42BE772E16A68CE3008AFA65 /* GamepadSample.cpp */; };
 		42BE773016A68CE3008AFA65 /* GamepadSample.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 42BE772E16A68CE3008AFA65 /* GamepadSample.cpp */; };
 		42BE773116A68CE3008AFA65 /* GamepadSample.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 42BE772E16A68CE3008AFA65 /* GamepadSample.cpp */; };
 		42BE773116A68CE3008AFA65 /* GamepadSample.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 42BE772E16A68CE3008AFA65 /* GamepadSample.cpp */; };
@@ -53,18 +54,13 @@
 		42C933211491A6C70098216A /* libbullet.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 42C933201491A6C70098216A /* libbullet.a */; };
 		42C933211491A6C70098216A /* libbullet.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 42C933201491A6C70098216A /* libbullet.a */; };
 		42C933261491A6E50098216A /* libogg.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 42C933221491A6E50098216A /* libogg.a */; };
 		42C933261491A6E50098216A /* libogg.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 42C933221491A6E50098216A /* libogg.a */; };
 		42C933271491A6E50098216A /* libvorbis.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 42C933231491A6E50098216A /* libvorbis.a */; };
 		42C933271491A6E50098216A /* libvorbis.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 42C933231491A6E50098216A /* libvorbis.a */; };
-		42C933281491A6E50098216A /* libvorbisenc.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 42C933241491A6E50098216A /* libvorbisenc.a */; };
-		42C933291491A6E50098216A /* libvorbisfile.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 42C933251491A6E50098216A /* libvorbisfile.a */; };
 		42C9332C1491A7680098216A /* libpng.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 42C9332A1491A7390098216A /* libpng.a */; };
 		42C9332C1491A7680098216A /* libpng.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 42C9332A1491A7390098216A /* libpng.a */; };
 		42C9332F1491A78D0098216A /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 42C9332D1491A7810098216A /* libz.dylib */; };
 		42C9332F1491A78D0098216A /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 42C9332D1491A7810098216A /* libz.dylib */; };
-		42CACBDD16ADA456000D911A /* libgameplay.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 42DFABCD16AD95FD0000F342 /* libgameplay.a */; };
 		42CACBDE16ADA45C000D911A /* libbullet.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 42DFAB4D16AD8E7C0000F342 /* libbullet.a */; };
 		42CACBDE16ADA45C000D911A /* libbullet.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 42DFAB4D16AD8E7C0000F342 /* libbullet.a */; };
 		42CACBDF16ADA45F000D911A /* liblua.a in Frameworks */ = {isa = PBXBuildFile; fileRef = F1F6195416A71DD000C4FEA1 /* liblua.a */; };
 		42CACBDF16ADA45F000D911A /* liblua.a in Frameworks */ = {isa = PBXBuildFile; fileRef = F1F6195416A71DD000C4FEA1 /* liblua.a */; };
 		42CACBE016ADA463000D911A /* libogg.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 42DFAB9A16AD90080000F342 /* libogg.a */; };
 		42CACBE016ADA463000D911A /* libogg.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 42DFAB9A16AD90080000F342 /* libogg.a */; };
 		42CACBE116ADA466000D911A /* libpng.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 42F2377116AD99EA0019CAC9 /* libpng.a */; };
 		42CACBE116ADA466000D911A /* libpng.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 42F2377116AD99EA0019CAC9 /* libpng.a */; };
 		42CACBE216ADA468000D911A /* libvorbis.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 42DFAB9B16AD90080000F342 /* libvorbis.a */; };
 		42CACBE216ADA468000D911A /* libvorbis.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 42DFAB9B16AD90080000F342 /* libvorbis.a */; };
-		42CACBE316ADA46C000D911A /* libvorbisenc.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 42DFAB9C16AD90080000F342 /* libvorbisenc.a */; };
-		42CACBE416ADA46F000D911A /* libvorbisfile.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 42DFAB9D16AD90080000F342 /* libvorbisfile.a */; };
 		42CACBE516ADA473000D911A /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 42DFAB2316AD8C1C0000F342 /* libz.dylib */; };
 		42CACBE516ADA473000D911A /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 42DFAB2316AD8C1C0000F342 /* libz.dylib */; };
 		42DFAABC16AD89670000F342 /* CoreMotion.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 42DFAABB16AD89670000F342 /* CoreMotion.framework */; };
 		42DFAABC16AD89670000F342 /* CoreMotion.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 42DFAABB16AD89670000F342 /* CoreMotion.framework */; };
 		42DFAAD416AD8A8C0000F342 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 42DFAAD316AD8A8C0000F342 /* Foundation.framework */; };
 		42DFAAD416AD8A8C0000F342 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 42DFAAD316AD8A8C0000F342 /* Foundation.framework */; };
@@ -119,6 +115,7 @@
 		422FE592169690830062D1FE /* PostProcessSample.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PostProcessSample.cpp; sourceTree = "<group>"; };
 		422FE592169690830062D1FE /* PostProcessSample.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PostProcessSample.cpp; sourceTree = "<group>"; };
 		422FE593169690830062D1FE /* PostProcessSample.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PostProcessSample.h; sourceTree = "<group>"; };
 		422FE593169690830062D1FE /* PostProcessSample.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PostProcessSample.h; sourceTree = "<group>"; };
 		424CC02F161F8E3000577827 /* IOKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = IOKit.framework; path = System/Library/Frameworks/IOKit.framework; sourceTree = SDKROOT; };
 		424CC02F161F8E3000577827 /* IOKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = IOKit.framework; path = System/Library/Frameworks/IOKit.framework; sourceTree = SDKROOT; };
+		425F3A5517FBCBF00085454F /* libgameplay.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libgameplay.a; path = "/Users/setaylor/Code/GamePlay/samples/character/../../../../Library/Developer/Xcode/DerivedData/gameplay-exiunaubxxjndaapmcqkaoeboiob/Build/Products/Debug-iphoneos/libgameplay.a"; sourceTree = "<absolute>"; };
 		428F7BDD15CB131A009ED24C /* game.config */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = game.config; sourceTree = "<group>"; };
 		428F7BDD15CB131A009ED24C /* game.config */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = game.config; sourceTree = "<group>"; };
 		42BE772E16A68CE3008AFA65 /* GamepadSample.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GamepadSample.cpp; sourceTree = "<group>"; };
 		42BE772E16A68CE3008AFA65 /* GamepadSample.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GamepadSample.cpp; sourceTree = "<group>"; };
 		42BE772F16A68CE3008AFA65 /* GamepadSample.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GamepadSample.h; sourceTree = "<group>"; };
 		42BE772F16A68CE3008AFA65 /* GamepadSample.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GamepadSample.h; sourceTree = "<group>"; };
@@ -138,27 +135,22 @@
 		42C933201491A6C70098216A /* libbullet.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libbullet.a; path = "../../external-deps/bullet/lib/macosx/libbullet.a"; sourceTree = "<group>"; };
 		42C933201491A6C70098216A /* libbullet.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libbullet.a; path = "../../external-deps/bullet/lib/macosx/libbullet.a"; sourceTree = "<group>"; };
 		42C933221491A6E50098216A /* libogg.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libogg.a; path = "../../external-deps/oggvorbis/lib/macosx/libogg.a"; sourceTree = "<group>"; };
 		42C933221491A6E50098216A /* libogg.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libogg.a; path = "../../external-deps/oggvorbis/lib/macosx/libogg.a"; sourceTree = "<group>"; };
 		42C933231491A6E50098216A /* libvorbis.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libvorbis.a; path = "../../external-deps/oggvorbis/lib/macosx/libvorbis.a"; sourceTree = "<group>"; };
 		42C933231491A6E50098216A /* libvorbis.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libvorbis.a; path = "../../external-deps/oggvorbis/lib/macosx/libvorbis.a"; sourceTree = "<group>"; };
-		42C933241491A6E50098216A /* libvorbisenc.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libvorbisenc.a; path = "../../external-deps/oggvorbis/lib/macosx/libvorbisenc.a"; sourceTree = "<group>"; };
-		42C933251491A6E50098216A /* libvorbisfile.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libvorbisfile.a; path = "../../external-deps/oggvorbis/lib/macosx/libvorbisfile.a"; sourceTree = "<group>"; };
-		42C9332A1491A7390098216A /* libpng.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libpng.a; path = "../../external-deps/libpng/lib/macosx/libpng.a"; sourceTree = "<group>"; };
+		42C9332A1491A7390098216A /* libpng.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libpng.a; path = "../../external-deps/png/lib/macosx/libpng.a"; sourceTree = "<group>"; };
 		42C9332D1491A7810098216A /* libz.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libz.dylib; path = usr/lib/libz.dylib; sourceTree = SDKROOT; };
 		42C9332D1491A7810098216A /* libz.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libz.dylib; path = usr/lib/libz.dylib; sourceTree = SDKROOT; };
-		42DFAABB16AD89670000F342 /* CoreMotion.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreMotion.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.0.sdk/System/Library/Frameworks/CoreMotion.framework; sourceTree = DEVELOPER_DIR; };
-		42DFAAD316AD8A8C0000F342 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.0.sdk/System/Library/Frameworks/Foundation.framework; sourceTree = DEVELOPER_DIR; };
-		42DFAB1B16AD8BBC0000F342 /* OpenAL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenAL.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.0.sdk/System/Library/Frameworks/OpenAL.framework; sourceTree = DEVELOPER_DIR; };
-		42DFAB1C16AD8BBC0000F342 /* OpenGLES.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGLES.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.0.sdk/System/Library/Frameworks/OpenGLES.framework; sourceTree = DEVELOPER_DIR; };
-		42DFAB1D16AD8BBC0000F342 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.0.sdk/System/Library/Frameworks/QuartzCore.framework; sourceTree = DEVELOPER_DIR; };
-		42DFAB1E16AD8BBC0000F342 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.0.sdk/System/Library/Frameworks/UIKit.framework; sourceTree = DEVELOPER_DIR; };
-		42DFAB2316AD8C1C0000F342 /* libz.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libz.dylib; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.0.sdk/usr/lib/libz.dylib; sourceTree = DEVELOPER_DIR; };
-		42DFAB4D16AD8E7C0000F342 /* libbullet.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libbullet.a; path = "../../external-deps/bullet/lib/ios/armv7/libbullet.a"; sourceTree = "<group>"; };
-		42DFAB9A16AD90080000F342 /* libogg.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libogg.a; path = "../../external-deps/oggvorbis/lib/ios/armv7/libogg.a"; sourceTree = "<group>"; };
-		42DFAB9B16AD90080000F342 /* libvorbis.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libvorbis.a; path = "../../external-deps/oggvorbis/lib/ios/armv7/libvorbis.a"; sourceTree = "<group>"; };
-		42DFAB9C16AD90080000F342 /* libvorbisenc.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libvorbisenc.a; path = "../../external-deps/oggvorbis/lib/ios/armv7/libvorbisenc.a"; sourceTree = "<group>"; };
-		42DFAB9D16AD90080000F342 /* libvorbisfile.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libvorbisfile.a; path = "../../external-deps/oggvorbis/lib/ios/armv7/libvorbisfile.a"; sourceTree = "<group>"; };
-		42DFABCD16AD95FD0000F342 /* libgameplay.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libgameplay.a; path = "../../../Library/Developer/Xcode/DerivedData/gameplay-exiunaubxxjndaapmcqkaoeboiob/Build/Products/Debug-iphoneos/libgameplay.a"; sourceTree = "<group>"; };
+		42DFAABB16AD89670000F342 /* CoreMotion.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreMotion.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/System/Library/Frameworks/CoreMotion.framework; sourceTree = DEVELOPER_DIR; };
+		42DFAAD316AD8A8C0000F342 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/System/Library/Frameworks/Foundation.framework; sourceTree = DEVELOPER_DIR; };
+		42DFAB1B16AD8BBC0000F342 /* OpenAL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenAL.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/System/Library/Frameworks/OpenAL.framework; sourceTree = DEVELOPER_DIR; };
+		42DFAB1C16AD8BBC0000F342 /* OpenGLES.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGLES.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/System/Library/Frameworks/OpenGLES.framework; sourceTree = DEVELOPER_DIR; };
+		42DFAB1D16AD8BBC0000F342 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/System/Library/Frameworks/QuartzCore.framework; sourceTree = DEVELOPER_DIR; };
+		42DFAB1E16AD8BBC0000F342 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/System/Library/Frameworks/UIKit.framework; sourceTree = DEVELOPER_DIR; };
+		42DFAB2316AD8C1C0000F342 /* libz.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libz.dylib; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/usr/lib/libz.dylib; sourceTree = DEVELOPER_DIR; };
+		42DFAB4D16AD8E7C0000F342 /* libbullet.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libbullet.a; path = "../../external-deps/bullet/lib/ios/armv7s/libbullet.a"; sourceTree = "<group>"; };
+		42DFAB9A16AD90080000F342 /* libogg.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libogg.a; path = "../../external-deps/oggvorbis/lib/ios/armv7s/libogg.a"; sourceTree = "<group>"; };
+		42DFAB9B16AD90080000F342 /* libvorbis.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libvorbis.a; path = "../../external-deps/oggvorbis/lib/ios/armv7s/libvorbis.a"; sourceTree = "<group>"; };
 		42DFABD016AD961C0000F342 /* libgameplay.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libgameplay.a; path = "../../../Library/Developer/Xcode/DerivedData/gameplay-exiunaubxxjndaapmcqkaoeboiob/Build/Products/Debug/libgameplay.a"; sourceTree = "<group>"; };
 		42DFABD016AD961C0000F342 /* libgameplay.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libgameplay.a; path = "../../../Library/Developer/Xcode/DerivedData/gameplay-exiunaubxxjndaapmcqkaoeboiob/Build/Products/Debug/libgameplay.a"; sourceTree = "<group>"; };
 		42DFABD216AD96F10000F342 /* TerrainSample.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TerrainSample.cpp; sourceTree = "<group>"; };
 		42DFABD216AD96F10000F342 /* TerrainSample.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TerrainSample.cpp; sourceTree = "<group>"; };
 		42DFABD316AD96F10000F342 /* TerrainSample.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TerrainSample.h; sourceTree = "<group>"; };
 		42DFABD316AD96F10000F342 /* TerrainSample.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TerrainSample.h; sourceTree = "<group>"; };
-		42F2377116AD99EA0019CAC9 /* libpng.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libpng.a; path = "../../external-deps/libpng/lib/ios/armv7/libpng.a"; sourceTree = "<group>"; };
+		42F2377116AD99EA0019CAC9 /* libpng.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libpng.a; path = "../../external-deps/png/lib/ios/armv7s/libpng.a"; sourceTree = "<group>"; };
 		42F237A716AD9DD70019CAC9 /* [email protected] */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "[email protected]"; sourceTree = "<group>"; };
 		42F237A716AD9DD70019CAC9 /* [email protected] */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "[email protected]"; sourceTree = "<group>"; };
 		5B61611214CCC2200073B857 /* sample-browser-macosx.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "sample-browser-macosx.plist"; sourceTree = "<group>"; };
 		5B61611214CCC2200073B857 /* sample-browser-macosx.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "sample-browser-macosx.plist"; sourceTree = "<group>"; };
 		5B61612C14CCC24C0073B857 /* sample-browser-ios.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "sample-browser-ios.app"; sourceTree = BUILT_PRODUCTS_DIR; };
 		5B61612C14CCC24C0073B857 /* sample-browser-ios.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "sample-browser-ios.app"; sourceTree = BUILT_PRODUCTS_DIR; };
@@ -170,7 +162,7 @@
 		F1E4B3F81671372E007516A7 /* FormsSample.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FormsSample.cpp; sourceTree = "<group>"; };
 		F1E4B3F81671372E007516A7 /* FormsSample.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FormsSample.cpp; sourceTree = "<group>"; };
 		F1E4B3F91671372E007516A7 /* FormsSample.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FormsSample.h; sourceTree = "<group>"; };
 		F1E4B3F91671372E007516A7 /* FormsSample.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FormsSample.h; sourceTree = "<group>"; };
 		F1F6195116A71DB100C4FEA1 /* liblua.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = liblua.a; path = "../../external-deps/lua/lib/macosx/liblua.a"; sourceTree = "<group>"; };
 		F1F6195116A71DB100C4FEA1 /* liblua.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = liblua.a; path = "../../external-deps/lua/lib/macosx/liblua.a"; sourceTree = "<group>"; };
-		F1F6195416A71DD000C4FEA1 /* liblua.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = liblua.a; path = "../../external-deps/lua/lib/ios/armv7/liblua.a"; sourceTree = "<group>"; };
+		F1F6195416A71DD000C4FEA1 /* liblua.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = liblua.a; path = "../../external-deps/lua/lib/ios/armv7s/liblua.a"; sourceTree = "<group>"; };
 /* End PBXFileReference section */
 /* End PBXFileReference section */
 
 
 /* Begin PBXFrameworksBuildPhase section */
 /* Begin PBXFrameworksBuildPhase section */
@@ -183,8 +175,6 @@
 				42C933211491A6C70098216A /* libbullet.a in Frameworks */,
 				42C933211491A6C70098216A /* libbullet.a in Frameworks */,
 				42C933261491A6E50098216A /* libogg.a in Frameworks */,
 				42C933261491A6E50098216A /* libogg.a in Frameworks */,
 				42C933271491A6E50098216A /* libvorbis.a in Frameworks */,
 				42C933271491A6E50098216A /* libvorbis.a in Frameworks */,
-				42C933281491A6E50098216A /* libvorbisenc.a in Frameworks */,
-				42C933291491A6E50098216A /* libvorbisfile.a in Frameworks */,
 				42C9332C1491A7680098216A /* libpng.a in Frameworks */,
 				42C9332C1491A7680098216A /* libpng.a in Frameworks */,
 				42C9332F1491A78D0098216A /* libz.dylib in Frameworks */,
 				42C9332F1491A78D0098216A /* libz.dylib in Frameworks */,
 				424CC030161F8E3000577827 /* IOKit.framework in Frameworks */,
 				424CC030161F8E3000577827 /* IOKit.framework in Frameworks */,
@@ -199,19 +189,17 @@
 			isa = PBXFrameworksBuildPhase;
 			isa = PBXFrameworksBuildPhase;
 			buildActionMask = 2147483647;
 			buildActionMask = 2147483647;
 			files = (
 			files = (
-				42CACBDD16ADA456000D911A /* libgameplay.a in Frameworks */,
 				42CACBDE16ADA45C000D911A /* libbullet.a in Frameworks */,
 				42CACBDE16ADA45C000D911A /* libbullet.a in Frameworks */,
 				42CACBDF16ADA45F000D911A /* liblua.a in Frameworks */,
 				42CACBDF16ADA45F000D911A /* liblua.a in Frameworks */,
 				42CACBE016ADA463000D911A /* libogg.a in Frameworks */,
 				42CACBE016ADA463000D911A /* libogg.a in Frameworks */,
 				42CACBE116ADA466000D911A /* libpng.a in Frameworks */,
 				42CACBE116ADA466000D911A /* libpng.a in Frameworks */,
 				42CACBE216ADA468000D911A /* libvorbis.a in Frameworks */,
 				42CACBE216ADA468000D911A /* libvorbis.a in Frameworks */,
-				42CACBE316ADA46C000D911A /* libvorbisenc.a in Frameworks */,
-				42CACBE416ADA46F000D911A /* libvorbisfile.a in Frameworks */,
 				42CACBE516ADA473000D911A /* libz.dylib in Frameworks */,
 				42CACBE516ADA473000D911A /* libz.dylib in Frameworks */,
 				42DFAABC16AD89670000F342 /* CoreMotion.framework in Frameworks */,
 				42DFAABC16AD89670000F342 /* CoreMotion.framework in Frameworks */,
 				42DFAAD416AD8A8C0000F342 /* Foundation.framework in Frameworks */,
 				42DFAAD416AD8A8C0000F342 /* Foundation.framework in Frameworks */,
 				42DFAB1F16AD8BBC0000F342 /* OpenAL.framework in Frameworks */,
 				42DFAB1F16AD8BBC0000F342 /* OpenAL.framework in Frameworks */,
 				42DFAB2016AD8BBC0000F342 /* OpenGLES.framework in Frameworks */,
 				42DFAB2016AD8BBC0000F342 /* OpenGLES.framework in Frameworks */,
+				425F3A5617FBCBF00085454F /* libgameplay.a in Frameworks */,
 				42DFAB2116AD8BBC0000F342 /* QuartzCore.framework in Frameworks */,
 				42DFAB2116AD8BBC0000F342 /* QuartzCore.framework in Frameworks */,
 				42DFAB2216AD8BBC0000F342 /* UIKit.framework in Frameworks */,
 				42DFAB2216AD8BBC0000F342 /* UIKit.framework in Frameworks */,
 			);
 			);
@@ -226,11 +214,9 @@
 				42DFABD016AD961C0000F342 /* libgameplay.a */,
 				42DFABD016AD961C0000F342 /* libgameplay.a */,
 				42C933201491A6C70098216A /* libbullet.a */,
 				42C933201491A6C70098216A /* libbullet.a */,
 				F1F6195116A71DB100C4FEA1 /* liblua.a */,
 				F1F6195116A71DB100C4FEA1 /* liblua.a */,
-				42C933221491A6E50098216A /* libogg.a */,
 				42C9332A1491A7390098216A /* libpng.a */,
 				42C9332A1491A7390098216A /* libpng.a */,
+				42C933221491A6E50098216A /* libogg.a */,
 				42C933231491A6E50098216A /* libvorbis.a */,
 				42C933231491A6E50098216A /* libvorbis.a */,
-				42C933241491A6E50098216A /* libvorbisenc.a */,
-				42C933251491A6E50098216A /* libvorbisfile.a */,
 				42C9332D1491A7810098216A /* libz.dylib */,
 				42C9332D1491A7810098216A /* libz.dylib */,
 			);
 			);
 			name = MacOSX;
 			name = MacOSX;
@@ -239,14 +225,12 @@
 		4200E4C716AD881C00C94D0D /* iOS */ = {
 		4200E4C716AD881C00C94D0D /* iOS */ = {
 			isa = PBXGroup;
 			isa = PBXGroup;
 			children = (
 			children = (
-				42DFABCD16AD95FD0000F342 /* libgameplay.a */,
+				425F3A5517FBCBF00085454F /* libgameplay.a */,
 				42DFAB4D16AD8E7C0000F342 /* libbullet.a */,
 				42DFAB4D16AD8E7C0000F342 /* libbullet.a */,
 				F1F6195416A71DD000C4FEA1 /* liblua.a */,
 				F1F6195416A71DD000C4FEA1 /* liblua.a */,
-				42DFAB9A16AD90080000F342 /* libogg.a */,
 				42F2377116AD99EA0019CAC9 /* libpng.a */,
 				42F2377116AD99EA0019CAC9 /* libpng.a */,
+				42DFAB9A16AD90080000F342 /* libogg.a */,
 				42DFAB9B16AD90080000F342 /* libvorbis.a */,
 				42DFAB9B16AD90080000F342 /* libvorbis.a */,
-				42DFAB9C16AD90080000F342 /* libvorbisenc.a */,
-				42DFAB9D16AD90080000F342 /* libvorbisfile.a */,
 				42DFAB2316AD8C1C0000F342 /* libz.dylib */,
 				42DFAB2316AD8C1C0000F342 /* libz.dylib */,
 			);
 			);
 			name = iOS;
 			name = iOS;
@@ -586,7 +570,7 @@
 				ONLY_ACTIVE_ARCH = YES;
 				ONLY_ACTIVE_ARCH = YES;
 				PRODUCT_NAME = "$(TARGET_NAME)";
 				PRODUCT_NAME = "$(TARGET_NAME)";
 				SDKROOT = macosx;
 				SDKROOT = macosx;
-				VALID_ARCHS = "armv7 armv7s i386 x86_64";
+				VALID_ARCHS = "armv7 armv7s arm64 i386 x86_64";
 			};
 			};
 			name = Debug;
 			name = Debug;
 		};
 		};
@@ -610,7 +594,7 @@
 				MACOSX_DEPLOYMENT_TARGET = 10.7;
 				MACOSX_DEPLOYMENT_TARGET = 10.7;
 				PRODUCT_NAME = "$(TARGET_NAME)";
 				PRODUCT_NAME = "$(TARGET_NAME)";
 				SDKROOT = macosx;
 				SDKROOT = macosx;
-				VALID_ARCHS = "armv7 armv7s i386 x86_64";
+				VALID_ARCHS = "armv7 armv7s arm64 i386 x86_64";
 			};
 			};
 			name = Release;
 			name = Release;
 		};
 		};
@@ -618,6 +602,8 @@
 			isa = XCBuildConfiguration;
 			isa = XCBuildConfiguration;
 			buildSettings = {
 			buildSettings = {
 				ARCHS = "$(ARCHS_STANDARD_32_BIT)";
 				ARCHS = "$(ARCHS_STANDARD_32_BIT)";
+				CLANG_CXX_LANGUAGE_STANDARD = "gnu++98";
+				CLANG_CXX_LIBRARY = "libstdc++";
 				COMBINE_HIDPI_IMAGES = YES;
 				COMBINE_HIDPI_IMAGES = YES;
 				GCC_PRECOMPILE_PREFIX_HEADER = NO;
 				GCC_PRECOMPILE_PREFIX_HEADER = NO;
 				GCC_WARN_64_TO_32_BIT_CONVERSION = NO;
 				GCC_WARN_64_TO_32_BIT_CONVERSION = NO;
@@ -625,19 +611,20 @@
 				HEADER_SEARCH_PATHS = (
 				HEADER_SEARCH_PATHS = (
 					../../gameplay/src,
 					../../gameplay/src,
 					"../../external-deps/bullet/include",
 					"../../external-deps/bullet/include",
-					"../../external-deps/libpng/include",
+					"../../external-deps/png/include",
 					"../../external-deps/lua/include",
 					"../../external-deps/lua/include",
 					"../../external-deps/oggvorbis/include",
 					"../../external-deps/oggvorbis/include",
 				);
 				);
 				INFOPLIST_FILE = "sample-browser-macosx.plist";
 				INFOPLIST_FILE = "sample-browser-macosx.plist";
 				LIBRARY_SEARCH_PATHS = (
 				LIBRARY_SEARCH_PATHS = (
 					"$(inherited)",
 					"$(inherited)",
-					"\"../../external-deps/bullet/lib/macosx\"",
-					"\"../../external-deps/libpng/lib/macosx\"",
-					"\"../../external-deps/lua/lib/macosx\"",
-					"\"../../external-deps/oggvorbis/lib/macosx\"",
-					"\"~/Library/Developer/Xcode/DerivedData/gameplay-exiunaubxxjndaapmcqkaoeboiob/Build/Products/Debug\"",
+					"../../external-deps/bullet/lib/macosx",
+					"../../external-deps/png/lib/macosx",
+					"../../external-deps/lua/lib/macosx",
+					"../../external-deps/oggvorbis/lib/macosx",
+					"~/Library/Developer/Xcode/DerivedData/gameplay-exiunaubxxjndaapmcqkaoeboiob/Build/Products/Debug",
 				);
 				);
+				MACOSX_DEPLOYMENT_TARGET = 10.8;
 				PRODUCT_NAME = "$(TARGET_NAME)";
 				PRODUCT_NAME = "$(TARGET_NAME)";
 				USER_HEADER_SEARCH_PATHS = "";
 				USER_HEADER_SEARCH_PATHS = "";
 				VALID_ARCHS = "i386 x86_64";
 				VALID_ARCHS = "i386 x86_64";
@@ -649,6 +636,8 @@
 			isa = XCBuildConfiguration;
 			isa = XCBuildConfiguration;
 			buildSettings = {
 			buildSettings = {
 				ARCHS = "$(ARCHS_STANDARD_32_BIT)";
 				ARCHS = "$(ARCHS_STANDARD_32_BIT)";
+				CLANG_CXX_LANGUAGE_STANDARD = "gnu++98";
+				CLANG_CXX_LIBRARY = "libstdc++";
 				COMBINE_HIDPI_IMAGES = YES;
 				COMBINE_HIDPI_IMAGES = YES;
 				GCC_PRECOMPILE_PREFIX_HEADER = NO;
 				GCC_PRECOMPILE_PREFIX_HEADER = NO;
 				GCC_WARN_64_TO_32_BIT_CONVERSION = NO;
 				GCC_WARN_64_TO_32_BIT_CONVERSION = NO;
@@ -656,19 +645,20 @@
 				HEADER_SEARCH_PATHS = (
 				HEADER_SEARCH_PATHS = (
 					../../gameplay/src,
 					../../gameplay/src,
 					"../../external-deps/bullet/include",
 					"../../external-deps/bullet/include",
-					"../../external-deps/libpng/include",
+					"../../external-deps/png/include",
 					"../../external-deps/lua/include",
 					"../../external-deps/lua/include",
 					"../../external-deps/oggvorbis/include",
 					"../../external-deps/oggvorbis/include",
 				);
 				);
 				INFOPLIST_FILE = "sample-browser-macosx.plist";
 				INFOPLIST_FILE = "sample-browser-macosx.plist";
 				LIBRARY_SEARCH_PATHS = (
 				LIBRARY_SEARCH_PATHS = (
 					"$(inherited)",
 					"$(inherited)",
-					"\"../../external-deps/bullet/lib/macosx\"",
-					"\"../../external-deps/libpng/lib/macosx\"",
-					"\"../../external-deps/lua/lib/macosx\"",
-					"\"../../external-deps/oggvorbis/lib/macosx\"",
-					"\"~/Library/Developer/Xcode/DerivedData/gameplay-exiunaubxxjndaapmcqkaoeboiob/Build/Products/Debug\"",
+					"../../external-deps/bullet/lib/macosx",
+					"../../external-deps/png/lib/macosx",
+					"../../external-deps/lua/lib/macosx",
+					"../../external-deps/oggvorbis/lib/macosx",
+					"~/Library/Developer/Xcode/DerivedData/gameplay-exiunaubxxjndaapmcqkaoeboiob/Build/Products/Debug",
 				);
 				);
+				MACOSX_DEPLOYMENT_TARGET = 10.8;
 				PRODUCT_NAME = "$(TARGET_NAME)";
 				PRODUCT_NAME = "$(TARGET_NAME)";
 				USER_HEADER_SEARCH_PATHS = "";
 				USER_HEADER_SEARCH_PATHS = "";
 				VALID_ARCHS = "i386 x86_64";
 				VALID_ARCHS = "i386 x86_64";
@@ -679,7 +669,9 @@
 		5B61612A14CCC24C0073B857 /* Debug */ = {
 		5B61612A14CCC24C0073B857 /* Debug */ = {
 			isa = XCBuildConfiguration;
 			isa = XCBuildConfiguration;
 			buildSettings = {
 			buildSettings = {
-				ARCHS = "$(ARCHS_STANDARD_32_BIT)";
+				ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)";
+				CLANG_CXX_LANGUAGE_STANDARD = "gnu++98";
+				CLANG_CXX_LIBRARY = "libstdc++";
 				CODE_SIGN_IDENTITY = "iPhone Developer";
 				CODE_SIGN_IDENTITY = "iPhone Developer";
 				GCC_PRECOMPILE_PREFIX_HEADER = NO;
 				GCC_PRECOMPILE_PREFIX_HEADER = NO;
 				GCC_WARN_64_TO_32_BIT_CONVERSION = NO;
 				GCC_WARN_64_TO_32_BIT_CONVERSION = NO;
@@ -687,25 +679,26 @@
 				HEADER_SEARCH_PATHS = (
 				HEADER_SEARCH_PATHS = (
 					../../gameplay/src,
 					../../gameplay/src,
 					"../../external-deps/bullet/include",
 					"../../external-deps/bullet/include",
-					"../../external-deps/libpng/include",
+					"../../external-deps/png/include",
 					"../../external-deps/lua/include",
 					"../../external-deps/lua/include",
 					"../../external-deps/oggvorbis/include",
 					"../../external-deps/oggvorbis/include",
 				);
 				);
 				INFOPLIST_FILE = "sample-browser-ios.plist";
 				INFOPLIST_FILE = "sample-browser-ios.plist";
-				IPHONEOS_DEPLOYMENT_TARGET = 6.1;
+				IPHONEOS_DEPLOYMENT_TARGET = 7.0;
 				LIBRARY_SEARCH_PATHS = (
 				LIBRARY_SEARCH_PATHS = (
 					"$(inherited)",
 					"$(inherited)",
-					"\"../../external-deps/bullet/lib/ios/$(CURRENT_ARCH)\"",
-					"\"../../external-deps/libpng/lib/ios/$(CURRENT_ARCH)\"",
-					"\"../../external-deps/lua/lib/ios/$(CURRENT_ARCH)\"",
-					"\"../../external-deps/oggvorbis/lib/ios/$(CURRENT_ARCH)\"",
-					"\"~/Library/Developer/Xcode/DerivedData/gameplay-exiunaubxxjndaapmcqkaoeboiob/Build/Products/Debug-iphoneos\"",
+					"../../external-deps/bullet/lib/ios/$(CURRENT_ARCH)",
+					"../../external-deps/png/lib/ios/$(CURRENT_ARCH)",
+					"../../external-deps/lua/lib/ios/$(CURRENT_ARCH)",
+					"../../external-deps/oggvorbis/lib/ios/$(CURRENT_ARCH)",
+					"~/Library/Developer/Xcode/DerivedData/gameplay-exiunaubxxjndaapmcqkaoeboiob/Build/Products/Debug-iphoneos",
+					"/Users/setaylor/Code/GamePlay/samples/character/../../../../Library/Developer/Xcode/DerivedData/gameplay-exiunaubxxjndaapmcqkaoeboiob/Build/Products/Debug-iphoneos",
 				);
 				);
 				PROVISIONING_PROFILE = "";
 				PROVISIONING_PROFILE = "";
 				SDKROOT = iphoneos;
 				SDKROOT = iphoneos;
 				TARGETED_DEVICE_FAMILY = "1,2";
 				TARGETED_DEVICE_FAMILY = "1,2";
 				USER_HEADER_SEARCH_PATHS = "";
 				USER_HEADER_SEARCH_PATHS = "";
-				VALID_ARCHS = "armv7 armv7s ";
+				VALID_ARCHS = "armv7 armv7s arm64";
 				WRAPPER_EXTENSION = app;
 				WRAPPER_EXTENSION = app;
 			};
 			};
 			name = Debug;
 			name = Debug;
@@ -713,7 +706,9 @@
 		5B61612B14CCC24C0073B857 /* Release */ = {
 		5B61612B14CCC24C0073B857 /* Release */ = {
 			isa = XCBuildConfiguration;
 			isa = XCBuildConfiguration;
 			buildSettings = {
 			buildSettings = {
-				ARCHS = "$(ARCHS_STANDARD_32_BIT)";
+				ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)";
+				CLANG_CXX_LANGUAGE_STANDARD = "gnu++98";
+				CLANG_CXX_LIBRARY = "libstdc++";
 				CODE_SIGN_IDENTITY = "iPhone Distribution";
 				CODE_SIGN_IDENTITY = "iPhone Distribution";
 				GCC_PRECOMPILE_PREFIX_HEADER = NO;
 				GCC_PRECOMPILE_PREFIX_HEADER = NO;
 				GCC_WARN_64_TO_32_BIT_CONVERSION = NO;
 				GCC_WARN_64_TO_32_BIT_CONVERSION = NO;
@@ -721,25 +716,26 @@
 				HEADER_SEARCH_PATHS = (
 				HEADER_SEARCH_PATHS = (
 					../../gameplay/src,
 					../../gameplay/src,
 					"../../external-deps/bullet/include",
 					"../../external-deps/bullet/include",
-					"../../external-deps/libpng/include",
+					"../../external-deps/png/include",
 					"../../external-deps/oggvorbis/include",
 					"../../external-deps/oggvorbis/include",
 					"../../external-deps/lua/include",
 					"../../external-deps/lua/include",
 				);
 				);
 				INFOPLIST_FILE = "sample-browser-ios.plist";
 				INFOPLIST_FILE = "sample-browser-ios.plist";
-				IPHONEOS_DEPLOYMENT_TARGET = 6.1;
+				IPHONEOS_DEPLOYMENT_TARGET = 7.0;
 				LIBRARY_SEARCH_PATHS = (
 				LIBRARY_SEARCH_PATHS = (
 					"$(inherited)",
 					"$(inherited)",
-					"\"../../external-deps/bullet/lib/ios/$(CURRENT_ARCH)\"",
-					"\"../../external-deps/libpng/lib/ios/$(CURRENT_ARCH)\"",
-					"\"../../external-deps/lua/lib/ios/$(CURRENT_ARCH)\"",
-					"\"../../external-deps/oggvorbis/lib/ios/$(CURRENT_ARCH)\"",
-					"\"~/Library/Developer/Xcode/DerivedData/gameplay-exiunaubxxjndaapmcqkaoeboiob/Build/Products/Debug-iphoneos\"",
+					"../../external-deps/bullet/lib/ios/$(CURRENT_ARCH)",
+					"../../external-deps/png/lib/ios/$(CURRENT_ARCH)",
+					"../../external-deps/lua/lib/ios/$(CURRENT_ARCH)",
+					"../../external-deps/oggvorbis/lib/ios/$(CURRENT_ARCH)",
+					"~/Library/Developer/Xcode/DerivedData/gameplay-exiunaubxxjndaapmcqkaoeboiob/Build/Products/Debug-iphoneos",
+					"/Users/setaylor/Code/GamePlay/samples/character/../../../../Library/Developer/Xcode/DerivedData/gameplay-exiunaubxxjndaapmcqkaoeboiob/Build/Products/Debug-iphoneos",
 				);
 				);
 				PROVISIONING_PROFILE = "";
 				PROVISIONING_PROFILE = "";
 				SDKROOT = iphoneos;
 				SDKROOT = iphoneos;
 				TARGETED_DEVICE_FAMILY = "1,2";
 				TARGETED_DEVICE_FAMILY = "1,2";
 				USER_HEADER_SEARCH_PATHS = "";
 				USER_HEADER_SEARCH_PATHS = "";
-				VALID_ARCHS = "armv7 armv7s ";
+				VALID_ARCHS = "armv7 armv7s arm64";
 				WRAPPER_EXTENSION = app;
 				WRAPPER_EXTENSION = app;
 			};
 			};
 			name = Release;
 			name = Release;

Some files were not shown because too many files changed in this diff