Przeglądaj źródła

Merge pull request #75 from blackberry-gaming/next-setaylor

Next setaylor
Sean Paul Taylor 14 lat temu
rodzic
commit
2fe68687d2

+ 0 - 12
gameplay-encoder/gameplay-encoder.xcodeproj/project.pbxproj

@@ -16,7 +16,6 @@
 		42C8EE0C14724CD700E43619 /* Animations.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 42C8EDBB14724CD700E43619 /* Animations.cpp */; };
 		42C8EE0D14724CD700E43619 /* Base.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 42C8EDBD14724CD700E43619 /* Base.cpp */; };
 		42C8EE0E14724CD700E43619 /* Camera.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 42C8EDBF14724CD700E43619 /* Camera.cpp */; };
-		42C8EE0F14724CD700E43619 /* CameraInstance.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 42C8EDC114724CD700E43619 /* CameraInstance.cpp */; };
 		42C8EE1014724CD700E43619 /* DAEChannelTarget.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 42C8EDC314724CD700E43619 /* DAEChannelTarget.cpp */; };
 		42C8EE1114724CD700E43619 /* DAEOptimizer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 42C8EDC514724CD700E43619 /* DAEOptimizer.cpp */; };
 		42C8EE1214724CD700E43619 /* DAESceneEncoder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 42C8EDC714724CD700E43619 /* DAESceneEncoder.cpp */; };
@@ -29,7 +28,6 @@
 		42C8EE1914724CD700E43619 /* GPBDecoder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 42C8EDD514724CD700E43619 /* GPBDecoder.cpp */; };
 		42C8EE1A14724CD700E43619 /* GPBFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 42C8EDD714724CD700E43619 /* GPBFile.cpp */; };
 		42C8EE1B14724CD700E43619 /* Light.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 42C8EDD914724CD700E43619 /* Light.cpp */; };
-		42C8EE1C14724CD700E43619 /* LightInstance.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 42C8EDDB14724CD700E43619 /* LightInstance.cpp */; };
 		42C8EE1D14724CD700E43619 /* main.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 42C8EDDD14724CD700E43619 /* main.cpp */; };
 		42C8EE1E14724CD700E43619 /* Material.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 42C8EDDE14724CD700E43619 /* Material.cpp */; };
 		42C8EE1F14724CD700E43619 /* MaterialParameter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 42C8EDE014724CD700E43619 /* MaterialParameter.cpp */; };
@@ -95,8 +93,6 @@
 		42C8EDBE14724CD700E43619 /* Base.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Base.h; path = src/Base.h; sourceTree = SOURCE_ROOT; };
 		42C8EDBF14724CD700E43619 /* Camera.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Camera.cpp; path = src/Camera.cpp; sourceTree = SOURCE_ROOT; };
 		42C8EDC014724CD700E43619 /* Camera.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Camera.h; path = src/Camera.h; sourceTree = SOURCE_ROOT; };
-		42C8EDC114724CD700E43619 /* CameraInstance.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CameraInstance.cpp; path = src/CameraInstance.cpp; sourceTree = SOURCE_ROOT; };
-		42C8EDC214724CD700E43619 /* CameraInstance.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CameraInstance.h; path = src/CameraInstance.h; sourceTree = SOURCE_ROOT; };
 		42C8EDC314724CD700E43619 /* DAEChannelTarget.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DAEChannelTarget.cpp; path = src/DAEChannelTarget.cpp; sourceTree = SOURCE_ROOT; };
 		42C8EDC414724CD700E43619 /* DAEChannelTarget.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DAEChannelTarget.h; path = src/DAEChannelTarget.h; sourceTree = SOURCE_ROOT; };
 		42C8EDC514724CD700E43619 /* DAEOptimizer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DAEOptimizer.cpp; path = src/DAEOptimizer.cpp; sourceTree = SOURCE_ROOT; };
@@ -121,8 +117,6 @@
 		42C8EDD814724CD700E43619 /* GPBFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GPBFile.h; path = src/GPBFile.h; sourceTree = SOURCE_ROOT; };
 		42C8EDD914724CD700E43619 /* Light.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Light.cpp; path = src/Light.cpp; sourceTree = SOURCE_ROOT; };
 		42C8EDDA14724CD700E43619 /* Light.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Light.h; path = src/Light.h; sourceTree = SOURCE_ROOT; };
-		42C8EDDB14724CD700E43619 /* LightInstance.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LightInstance.cpp; path = src/LightInstance.cpp; sourceTree = SOURCE_ROOT; };
-		42C8EDDC14724CD700E43619 /* LightInstance.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = LightInstance.h; path = src/LightInstance.h; sourceTree = SOURCE_ROOT; };
 		42C8EDDD14724CD700E43619 /* main.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = main.cpp; path = src/main.cpp; sourceTree = SOURCE_ROOT; };
 		42C8EDDE14724CD700E43619 /* Material.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Material.cpp; path = src/Material.cpp; sourceTree = SOURCE_ROOT; };
 		42C8EDDF14724CD700E43619 /* Material.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Material.h; path = src/Material.h; sourceTree = SOURCE_ROOT; };
@@ -227,8 +221,6 @@
 				4283905814896E6C00E2B2F5 /* BoundingVolume.h */,
 				42C8EDBF14724CD700E43619 /* Camera.cpp */,
 				42C8EDC014724CD700E43619 /* Camera.h */,
-				42C8EDC114724CD700E43619 /* CameraInstance.cpp */,
-				42C8EDC214724CD700E43619 /* CameraInstance.h */,
 				42C8EDC314724CD700E43619 /* DAEChannelTarget.cpp */,
 				42C8EDC414724CD700E43619 /* DAEChannelTarget.h */,
 				42C8EDC514724CD700E43619 /* DAEOptimizer.cpp */,
@@ -255,8 +247,6 @@
 				42C8EDD814724CD700E43619 /* GPBFile.h */,
 				42C8EDD914724CD700E43619 /* Light.cpp */,
 				42C8EDDA14724CD700E43619 /* Light.h */,
-				42C8EDDB14724CD700E43619 /* LightInstance.cpp */,
-				42C8EDDC14724CD700E43619 /* LightInstance.h */,
 				42C8EDDD14724CD700E43619 /* main.cpp */,
 				42C8EDDE14724CD700E43619 /* Material.cpp */,
 				42C8EDDF14724CD700E43619 /* Material.h */,
@@ -388,7 +378,6 @@
 				42C8EE0C14724CD700E43619 /* Animations.cpp in Sources */,
 				42C8EE0D14724CD700E43619 /* Base.cpp in Sources */,
 				42C8EE0E14724CD700E43619 /* Camera.cpp in Sources */,
-				42C8EE0F14724CD700E43619 /* CameraInstance.cpp in Sources */,
 				42C8EE1014724CD700E43619 /* DAEChannelTarget.cpp in Sources */,
 				42C8EE1114724CD700E43619 /* DAEOptimizer.cpp in Sources */,
 				42C8EE1214724CD700E43619 /* DAESceneEncoder.cpp in Sources */,
@@ -401,7 +390,6 @@
 				42C8EE1914724CD700E43619 /* GPBDecoder.cpp in Sources */,
 				42C8EE1A14724CD700E43619 /* GPBFile.cpp in Sources */,
 				42C8EE1B14724CD700E43619 /* Light.cpp in Sources */,
-				42C8EE1C14724CD700E43619 /* LightInstance.cpp in Sources */,
 				42C8EE1D14724CD700E43619 /* main.cpp in Sources */,
 				42C8EE1E14724CD700E43619 /* Material.cpp in Sources */,
 				42C8EE1F14724CD700E43619 /* MaterialParameter.cpp in Sources */,

+ 14 - 2
gameplay-newproject.bat

@@ -158,7 +158,7 @@ mkdir %projPath%
 mkdir %projPath%\src
 mkdir %projPath%\res
 
-REM Copy project files
+REM Copy Microsoft Visual Studio project files
 copy gameplay-template\gameplay-template.vcxproj %projPath%\%projName%.vcxproj
 call:replace %projPath%\%projName%.vcxproj TEMPLATE_PROJECT "%projName%"
 call:replace %projPath%\%projName%.vcxproj TemplateGame "%className%"
@@ -170,6 +170,18 @@ call:replace %projPath%\%projName%.vcxproj.filters TemplateGame "%className%"
 copy gameplay-template\gameplay-template.vcxproj.user %projPath%\%projName%.vcxproj.user
 call:replace %projPath%\%projName%.vcxproj.user GAMEPLAY_PATH "%gpPath%"
 
+REM Copy Apple XCode project files
+mkdir %projPath%\%projName%.xcodeproj
+copy gameplay-template\gameplay-template.xcodeproj\project.pbxproj %projPath%\%projName%.xcodeproj\project.pbxproj
+call:replace %projPath%\%projName%.xcodeproj\project.pbxproj GAMEPLAY_PATH "%gpPath%"
+call:replace %projPath%\%projName%.xcodeproj\project.pbxproj TemplateGame "%className%"
+call:replace %projPath%\%projName%.xcodeproj\project.pbxproj TEMPLATE_PROJECT "%projName%"
+
+copy gameplay-template\gameplay-template-macos.plist %projPath%\%projName%-macos.plist
+call:replace %projPath%\%projName%-macos.plist TEMPLATE_UUID "%uuid%"
+call:replace %projPath%\%projName%-macos.plist TEMPLATE_AUTHOR "%author%"
+
+REM Copy BlackBerry NDK project files
 copy gameplay-template\template.cproject %projPath%\.cproject
 call:replace %projPath%\.cproject TEMPLATE_PROJECT "%projName%"
 call:replace %projPath%\.cproject TEMPLATE_UUID "%uuid%"
@@ -195,7 +207,7 @@ REM Copy resource files
 copy gameplay-template\res\* %projPath%\res\
 copy gameplay\res\shaders\colored.* %projPath%\res\
 
-RIM Copy icon
+REM Copy icon
 copy gameplay-template\icon.png %projPath%\icon.png
 
 REM Open new project folder

+ 34 - 0
gameplay-template/gameplay-template-macos.plist

@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+	<key>CFBundleDevelopmentRegion</key>
+	<string>en</string>
+	<key>CFBundleExecutable</key>
+	<string>${EXECUTABLE_NAME}</string>
+	<key>CFBundleIconFile</key>
+	<string>icon.png</string>
+	<key>CFBundleIdentifier</key>
+	<string>TEMPLATE_UUID</string>
+	<key>CFBundleInfoDictionaryVersion</key>
+	<string>6.0</string>
+	<key>CFBundleName</key>
+	<string>${PRODUCT_NAME}</string>
+	<key>CFBundlePackageType</key>
+	<string>APPL</string>
+	<key>CFBundleShortVersionString</key>
+	<string>1.0</string>
+	<key>CFBundleSignature</key>
+	<string>????</string>
+	<key>CFBundleVersion</key>
+	<string>1</string>
+	<key>LSApplicationCategoryType</key>
+	<string>public.app-category.games</string>
+	<key>LSMinimumSystemVersion</key>
+	<string>${MACOSX_DEPLOYMENT_TARGET}</string>
+	<key>NSHumanReadableCopyright</key>
+	<string>Copyright © 2011 TEMPLATE_AUTHOR. All rights reserved.</string>
+	<key>NSPrincipalClass</key>
+	<string>NSApplication</string>
+</dict>
+</plist>

+ 343 - 0
gameplay-template/gameplay-template.xcodeproj/project.pbxproj

@@ -0,0 +1,343 @@
+// !$*UTF8*$!
+{
+	archiveVersion = 1;
+	classes = {
+	};
+	objectVersion = 46;
+	objects = {
+
+/* Begin PBXBuildFile section */
+		42C932F11491A5160098216A /* TemplateGame.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 42C932EF1491A5160098216A /* TemplateGame.cpp */; };
+		42C932EE1491A4CB0098216A /* icon.png in Resources */ = {isa = PBXBuildFile; fileRef = 42C932ED1491A4CB0098216A /* icon.png */; };
+		42C932F31491A53E0098216A /* res in Resources */ = {isa = PBXBuildFile; fileRef = 42C932F21491A53E0098216A /* res */; };
+		42C932C11491A0DB0098216A /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 42C932C01491A0DB0098216A /* Cocoa.framework */; };
+		42C9331D1491A6750098216A /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 42C9331C1491A6750098216A /* QuartzCore.framework */; };
+		42C933171491A5EB0098216A /* OpenGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 42C933161491A5EB0098216A /* OpenGL.framework */; };
+		42C9331F1491A67F0098216A /* OpenAL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 42C9331E1491A67F0098216A /* OpenAL.framework */; };
+		42438B531491AD2000D218B8 /* libgameplay.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 42438B521491AD2000D218B8 /* libgameplay.a */; };
+		42C933211491A6C70098216A /* libbullet.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 42C933201491A6C70098216A /* libbullet.a */; };
+		42C933261491A6E50098216A /* libogg.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 42C933221491A6E50098216A /* libogg.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 */; };
+		42C9332F1491A78D0098216A /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 42C9332D1491A7810098216A /* libz.dylib */; };
+/* End PBXBuildFile section */
+
+/* Begin PBXFileReference section */
+		42C932BC1491A0DB0098216A /* TEMPLATE_PROJECT.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "TEMPLATE_PROJECT.app"; sourceTree = BUILT_PRODUCTS_DIR; };
+		42C9336B1491AA0E0098216A /* TEMPLATE_PROJECT-macos.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "TEMPLATE_PROJECT-macos.plist"; sourceTree = "<group>"; };
+		42C932ED1491A4CB0098216A /* icon.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = icon.png; sourceTree = "<group>"; };
+		42C932F21491A53E0098216A /* res */ = {isa = PBXFileReference; lastKnownFileType = folder; path = res; sourceTree = "<group>"; };
+		42C932EF1491A5160098216A /* TemplateGame.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = TemplateGame.cpp; path = src/TemplateGame.cpp; sourceTree = SOURCE_ROOT; };
+		42C932F01491A5160098216A /* TemplateGame.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TemplateGame.h; path = src/TemplateGame.h; sourceTree = SOURCE_ROOT; };
+		42C932C01491A0DB0098216A /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; };
+		42C9331C1491A6750098216A /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; };
+		42C933161491A5EB0098216A /* OpenGL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGL.framework; path = System/Library/Frameworks/OpenGL.framework; sourceTree = SDKROOT; };
+		42C9331E1491A67F0098216A /* OpenAL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenAL.framework; path = System/Library/Frameworks/OpenAL.framework; sourceTree = SDKROOT; };
+		42438B521491AD2000D218B8 /* libgameplay.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libgameplay.a; path = "~/Library/Developer/Xcode/DerivedData/gameplay-exiunaubxxjndaapmcqkaoeboiob/Build/Products/Debug/libgameplay.a"; sourceTree = "<group>"; };
+		42C933201491A6C70098216A /* libbullet.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libbullet.a; path = "GAMEPLAY_PATH/external-deps/bullet/lib/macos/libbullet.a"; sourceTree = "<group>"; };
+		42C933221491A6E50098216A /* libogg.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libogg.a; path = "GAMEPLAY_PATH/external-deps/oggvorbis/lib/macos/libogg.a"; sourceTree = "<group>"; };
+		42C933231491A6E50098216A /* libvorbis.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libvorbis.a; path = "GAMEPLAY_PATH/external-deps/oggvorbis/lib/macos/libvorbis.a"; sourceTree = "<group>"; };
+		42C933241491A6E50098216A /* libvorbisenc.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libvorbisenc.a; path = "GAMEPLAY_PATH/external-deps/oggvorbis/lib/macos/libvorbisenc.a"; sourceTree = "<group>"; };
+		42C933251491A6E50098216A /* libvorbisfile.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libvorbisfile.a; path = "GAMEPLAY_PATH/external-deps/oggvorbis/lib/macos/libvorbisfile.a"; sourceTree = "<group>"; };
+		42C9332A1491A7390098216A /* libpng.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libpng.a; path = "GAMEPLAY_PATH/external-deps/libpng/lib/macos/libpng.a"; sourceTree = "<group>"; };
+		42C9332D1491A7810098216A /* libz.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libz.dylib; path = usr/lib/libz.dylib; sourceTree = SDKROOT; };
+/* End PBXFileReference section */
+
+/* Begin PBXFrameworksBuildPhase section */
+		42C932B91491A0DB0098216A /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				42438B531491AD2000D218B8 /* libgameplay.a in Frameworks */,
+				42C933211491A6C70098216A /* libbullet.a in Frameworks */,
+				42C933261491A6E50098216A /* libogg.a in Frameworks */,
+				42C933271491A6E50098216A /* libvorbis.a in Frameworks */,
+				42C933281491A6E50098216A /* libvorbisenc.a in Frameworks */,
+				42C933291491A6E50098216A /* libvorbisfile.a in Frameworks */,
+				42C9332C1491A7680098216A /* libpng.a in Frameworks */,
+				42C9332F1491A78D0098216A /* libz.dylib in Frameworks */,
+				42C932C11491A0DB0098216A /* Cocoa.framework in Frameworks */,
+				42C9331D1491A6750098216A /* QuartzCore.framework in Frameworks */,
+				42C933171491A5EB0098216A /* OpenGL.framework in Frameworks */,
+				42C9331F1491A67F0098216A /* OpenAL.framework in Frameworks */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+/* End PBXFrameworksBuildPhase section */
+
+/* Begin PBXGroup section */
+		42C932B11491A0DB0098216A = {
+			isa = PBXGroup;
+			children = (
+				42C9336B1491AA0E0098216A /* TEMPLATE_PROJECT-macos.plist */,
+				42C932ED1491A4CB0098216A /* icon.png */,
+				42C932F21491A53E0098216A /* res */,
+				42C932C61491A0DB0098216A /* src */,
+				42C932DD1491A1050098216A /* Libraries */,
+				42C932BF1491A0DB0098216A /* Frameworks */,
+				42C932BD1491A0DB0098216A /* Products */,
+			);
+			sourceTree = "<group>";
+		};
+		42C932BD1491A0DB0098216A /* Products */ = {
+			isa = PBXGroup;
+			children = (
+				42C932BC1491A0DB0098216A /* TEMPLATE_PROJECT.app */,
+			);
+			name = Products;
+			sourceTree = "<group>";
+		};
+		42C932BF1491A0DB0098216A /* Frameworks */ = {
+			isa = PBXGroup;
+			children = (
+				42C932C01491A0DB0098216A /* Cocoa.framework */,
+				42C9331C1491A6750098216A /* QuartzCore.framework */,
+				42C933161491A5EB0098216A /* OpenGL.framework */,
+				42C9331E1491A67F0098216A /* OpenAL.framework */,
+			);
+			name = Frameworks;
+			sourceTree = "<group>";
+		};
+		42C932C61491A0DB0098216A /* src */ = {
+			isa = PBXGroup;
+			children = (
+				42C932EF1491A5160098216A /* TemplateGame.cpp */,
+				42C932F01491A5160098216A /* TemplateGame.h */,
+			);
+			name = src;
+			path = "src";
+			sourceTree = "<group>";
+		};
+		42C932DD1491A1050098216A /* Libraries */ = {
+			isa = PBXGroup;
+			children = (
+				42438B521491AD2000D218B8 /* libgameplay.a */,
+				42C933201491A6C70098216A /* libbullet.a */,
+				42C933221491A6E50098216A /* libogg.a */,
+				42C933231491A6E50098216A /* libvorbis.a */,
+				42C933241491A6E50098216A /* libvorbisenc.a */,
+				42C933251491A6E50098216A /* libvorbisfile.a */,
+				42C9332A1491A7390098216A /* libpng.a */,
+				42C9332D1491A7810098216A /* libz.dylib */,
+			);
+			name = Libraries;
+			sourceTree = "<group>";
+		};
+/* End PBXGroup section */
+
+/* Begin PBXNativeTarget section */
+		42C932BB1491A0DB0098216A /* TEMPLATE_PROJECT */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 42C932DA1491A0DB0098216A /* Build configuration list for PBXNativeTarget "TEMPLATE_PROJECT" */;
+			buildPhases = (
+				42C932B81491A0DB0098216A /* Sources */,
+				42C932B91491A0DB0098216A /* Frameworks */,
+				42C933301491A7B50098216A /* ShellScript */,
+				42C932BA1491A0DB0098216A /* Resources */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+			);
+			name = "TEMPLATE_PROJECT";
+			productName = "TEMPLATE_PROJECT";
+			productReference = 42C932BC1491A0DB0098216A /* TEMPLATE_PROJECT.app */;
+			productType = "com.apple.product-type.application";
+		};
+/* End PBXNativeTarget section */
+
+/* Begin PBXProject section */
+		42C932B31491A0DB0098216A /* Project object */ = {
+			isa = PBXProject;
+			attributes = {
+				LastUpgradeCheck = 0420;
+			};
+			buildConfigurationList = 42C932B61491A0DB0098216A /* Build configuration list for PBXProject "TEMPLATE_PROJECT" */;
+			compatibilityVersion = "Xcode 3.2";
+			developmentRegion = English;
+			hasScannedForEncodings = 0;
+			knownRegions = (
+				en,
+			);
+			mainGroup = 42C932B11491A0DB0098216A;
+			productRefGroup = 42C932BD1491A0DB0098216A /* Products */;
+			projectDirPath = "";
+			projectRoot = "";
+			targets = (
+				42C932BB1491A0DB0098216A /* TEMPLATE_PROJECT */,
+			);
+		};
+/* End PBXProject section */
+
+/* Begin PBXResourcesBuildPhase section */
+		42C932BA1491A0DB0098216A /* Resources */ = {
+			isa = PBXResourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				42C932EE1491A4CB0098216A /* icon.png in Resources */,
+				42C932F31491A53E0098216A /* res in Resources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+/* End PBXResourcesBuildPhase section */
+
+/* Begin PBXShellScriptBuildPhase section */
+		42C933301491A7B50098216A /* ShellScript */ = {
+			isa = PBXShellScriptBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			inputPaths = (
+			);
+			outputPaths = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+			shellPath = /bin/sh;
+			shellScript = "touch -cm ${SRCROOT}/res";
+		};
+/* End PBXShellScriptBuildPhase section */
+
+/* Begin PBXSourcesBuildPhase section */
+		42C932B81491A0DB0098216A /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				42C932F11491A5160098216A /* TemplateGame.cpp in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+/* End PBXSourcesBuildPhase section */
+
+/* Begin XCBuildConfiguration section */
+		42C932D81491A0DB0098216A /* Debug */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ALWAYS_SEARCH_USER_PATHS = NO;
+				ARCHS = "$(ARCHS_STANDARD_32_BIT)";
+				COPY_PHASE_STRIP = NO;
+				GCC_C_LANGUAGE_STANDARD = gnu99;
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_ENABLE_OBJC_EXCEPTIONS = YES;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				GCC_PREPROCESSOR_DEFINITIONS = (
+					"DEBUG=1",
+					"$(inherited)",
+				);
+				GCC_SYMBOLS_PRIVATE_EXTERN = NO;
+				GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
+				GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+				GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES;
+				GCC_WARN_ABOUT_RETURN_TYPE = YES;
+				GCC_WARN_UNUSED_VARIABLE = YES;
+				GENERATE_PKGINFO_FILE = YES;
+				INFOPLIST_FILE = "TEMPLATE_PROJECT-macos.plist";
+				MACOSX_DEPLOYMENT_TARGET = 10.7;
+				ONLY_ACTIVE_ARCH = YES;
+				PRODUCT_NAME = "$(TARGET_NAME)";
+				SDKROOT = macosx;
+			};
+			name = Debug;
+		};
+		42C932D91491A0DB0098216A /* Release */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ALWAYS_SEARCH_USER_PATHS = NO;
+				ARCHS = "$(ARCHS_STANDARD_32_BIT)";
+				COPY_PHASE_STRIP = YES;
+				DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
+				GCC_C_LANGUAGE_STANDARD = gnu99;
+				GCC_ENABLE_OBJC_EXCEPTIONS = YES;
+				GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
+				GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+				GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES;
+				GCC_WARN_ABOUT_RETURN_TYPE = YES;
+				GCC_WARN_UNUSED_VARIABLE = YES;
+				GENERATE_PKGINFO_FILE = YES;
+				INFOPLIST_FILE = "TEMPLATE_PROJECT-macos.plist";
+				MACOSX_DEPLOYMENT_TARGET = 10.7;
+				PRODUCT_NAME = "$(TARGET_NAME)";
+				SDKROOT = macosx;
+			};
+			name = Release;
+		};
+		42C932DB1491A0DB0098216A /* Debug */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = "$(ARCHS_STANDARD_32_BIT)";
+				GCC_PRECOMPILE_PREFIX_HEADER = NO;
+				GCC_WARN_64_TO_32_BIT_CONVERSION = NO;
+				GCC_WARN_UNUSED_VARIABLE = NO;
+				HEADER_SEARCH_PATHS = (
+					"GAMEPLAY_PATH/gameplay/src",
+					"GAMEPLAY_PATH/external-deps/libpng/include",
+					"GAMEPLAY_PATH/external-deps/bullet/include",
+					"GAMEPLAY_PATH/external-deps/oggvorbis/include",
+				);
+				INFOPLIST_FILE = "TEMPLATE_PROJECT-macos.plist";
+				LIBRARY_SEARCH_PATHS = (
+					"$(inherited)",
+					"\"GAMEPLAY_PATH/external-deps/libpng/lib/macos\"",
+					"\"GAMEPLAY_PATH/external-deps/bullet/lib/macos\"",
+					"\"GAMEPLAY_PATH/external-deps/oggvorbis/lib/macos\"",
+					"\"~/Library/Developer/Xcode/DerivedData/gameplay-exiunaubxxjndaapmcqkaoeboiob/Build/Products/Debug\"",
+				);
+				PRODUCT_NAME = "$(TARGET_NAME)";
+				USER_HEADER_SEARCH_PATHS = "";
+				WRAPPER_EXTENSION = app;
+			};
+			name = Debug;
+		};
+		42C932DC1491A0DB0098216A /* Release */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = "$(ARCHS_STANDARD_32_BIT)";
+				GCC_PRECOMPILE_PREFIX_HEADER = NO;
+				GCC_WARN_64_TO_32_BIT_CONVERSION = NO;
+				GCC_WARN_UNUSED_VARIABLE = NO;
+				HEADER_SEARCH_PATHS = (
+					"GAMEPLAY_PATH/gameplay/src",
+					"GAMEPLAY_PATH/external-deps/libpng/include",
+					"GAMEPLAY_PATH/external-deps/bullet/include",
+					"GAMEPLAY_PATH/external-deps/oggvorbis/include",
+				);
+				INFOPLIST_FILE = "TEMPLATE_PROJECT-macos.plist";
+				LIBRARY_SEARCH_PATHS = (
+					"$(inherited)",
+					"\"GAMEPLAY_PATH/external-deps/libpng/lib/macos\"",
+					"\"GAMEPLAY_PATH/external-deps/bullet/lib/macos\"",
+					"\"GAMEPLAY_PATH/external-deps/oggvorbis/lib/macos\"",
+					"\"~/Library/Developer/Xcode/DerivedData/gameplay-exiunaubxxjndaapmcqkaoeboiob/Build/Products/Debug\"",
+				);
+				PRODUCT_NAME = "$(TARGET_NAME)";
+				USER_HEADER_SEARCH_PATHS = "";
+				WRAPPER_EXTENSION = app;
+			};
+			name = Release;
+		};
+/* End XCBuildConfiguration section */
+
+/* Begin XCConfigurationList section */
+		42C932B61491A0DB0098216A /* Build configuration list for PBXProject "TEMPLATE_PROJECT" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				42C932D81491A0DB0098216A /* Debug */,
+				42C932D91491A0DB0098216A /* Release */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Release;
+		};
+		42C932DA1491A0DB0098216A /* Build configuration list for PBXNativeTarget "TEMPLATE_PROJECT" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				42C932DB1491A0DB0098216A /* Debug */,
+				42C932DC1491A0DB0098216A /* Release */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Release;
+		};
+/* End XCConfigurationList section */
+	};
+	rootObject = 42C932B31491A0DB0098216A /* Project object */;
+}

+ 1 - 0
gameplay-template/src/TemplateGame.h

@@ -2,6 +2,7 @@
 #define TEMPLATEGAME_H_
 
 #include "gameplay.h"
+
 using namespace gameplay;
 
 /**

+ 2 - 2
gameplay-template/template.bar-descriptor.xml

@@ -29,13 +29,13 @@
 
     <!-- Description, displayed in the BlackBerry Tablet OS application installer.
          May have multiple values for each language. See samples or xsd schema file. Optional. -->
-
+    <description>TEMPLATE_DESCRIPTION</description>
+    
     <!-- Copyright information. Optional. -->
     <!-- <copyright></copyright> -->
 
     <!--  Name of author which is used for signing. Must match the developer name of your development certificate. -->
     <author>TEMPLATE_AUTHOR</author>
-    <description>TEMPLATE_DESCRIPTION</description>
 
     <!--  Unique author ID assigned by signing authority. Required if using debug tokens. -->
     <!-- <authorId>ABC1234YjsnUk235h</authorId> -->

+ 1 - 0
gameplay/gameplay.vcxproj

@@ -171,6 +171,7 @@
     <None Include="res\textures\particle-default.png" />
     <None Include="src\BoundingBox.inl" />
     <None Include="src\BoundingSphere.inl" />
+    <None Include="src\Game.inl" />
     <None Include="src\gameplay-main-macos.mm" />
     <None Include="src\Matrix.inl" />
     <None Include="src\Plane.inl" />

+ 3 - 0
gameplay/gameplay.vcxproj.filters

@@ -475,6 +475,9 @@
     <None Include="res\textures\particle-default.png">
       <Filter>res\textures</Filter>
     </None>
+    <None Include="src\Game.inl">
+      <Filter>src</Filter>
+    </None>
   </ItemGroup>
   <ItemGroup>
     <None Include="src\PhysicsFixedConstraint.inl">

+ 2 - 0
gameplay/gameplay.xcodeproj/project.pbxproj

@@ -165,6 +165,7 @@
 		428390981489D6E800E2B2F5 /* SceneLoader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SceneLoader.h; path = src/SceneLoader.h; sourceTree = SOURCE_ROOT; };
 		4299EFA8146AC94300FF4A73 /* OpenGL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGL.framework; path = SDKs/MacOSX10.7.sdk/System/Library/Frameworks/OpenGL.framework; sourceTree = DEVELOPER_DIR; };
 		4299EFAA146AC94B00FF4A73 /* OpenAL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenAL.framework; path = SDKs/MacOSX10.7.sdk/System/Library/Frameworks/OpenAL.framework; sourceTree = DEVELOPER_DIR; };
+		42C932AF14919FD10098216A /* Game.inl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = Game.inl; path = src/Game.inl; sourceTree = SOURCE_ROOT; };
 		42CCD553146EC1DD00353661 /* libz.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libz.dylib; path = SDKs/MacOSX10.7.sdk/usr/lib/libz.dylib; sourceTree = DEVELOPER_DIR; };
 		42CCD555146EC1EB00353661 /* libpng.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libpng.a; path = "../external-deps/libpng/lib/macos/libpng.a"; sourceTree = "<group>"; };
 		42CD0DA6147D8EA80000361E /* libbullet.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libbullet.a; path = "../external-deps/bullet/lib/macos/libbullet.a"; sourceTree = "<group>"; };
@@ -411,6 +412,7 @@
 				42CD0DDB147D8FF50000361E /* Frustum.h */,
 				42CD0DDC147D8FF50000361E /* Game.cpp */,
 				42CD0DDD147D8FF50000361E /* Game.h */,
+				42C932AF14919FD10098216A /* Game.inl */,
 				42CD0DDE147D8FF50000361E /* gameplay-main-macos.mm */,
 				42CD0DDF147D8FF50000361E /* gameplay-main-qnx.cpp */,
 				42CD0DE0147D8FF50000361E /* gameplay-main-win32.cpp */,

+ 3 - 3
gameplay/src/Base.h

@@ -158,7 +158,6 @@ extern void printError(const char* format, ...);
 #elif WIN32
     #define WIN32_LEAN_AND_MEAN
     #include <GL/glew.h>
-    #include <GL/wglew.h>
 #elif __APPLE__
 #include <OpenGL/gl.h>
 #include <OpenGL/glext.h>
@@ -182,8 +181,8 @@ extern void printError(const char* format, ...);
 namespace gameplay
 {
 typedef GLint VertexAttribute;
-typedef GLuint VertexBuffer;
-typedef GLuint IndexBuffer;
+typedef GLuint VertexBufferHandle;
+typedef GLuint IndexBufferHandle;
 typedef GLuint TextureHandle;
 typedef GLuint FrameBufferHandle;
 typedef GLuint RenderBufferHandle;
@@ -250,4 +249,5 @@ extern GLenum __gl_error_code;
     #pragma warning( disable : 4996 )
 #endif
 
+
 #endif

+ 4 - 38
gameplay/src/Game.cpp

@@ -48,9 +48,9 @@ long Game::getAbsoluteTime()
     return Platform::getAbsoluteTime();
 }
 
-bool Game::isVsync()
+long Game::getGameTime()
 {
-    return Platform::isVsync();
+    return Platform::getAbsoluteTime() - _pausedTimeTotal;
 }
 
 void Game::setVsync(bool enable)
@@ -58,20 +58,11 @@ void Game::setVsync(bool enable)
     Platform::setVsync(enable);
 }
 
-long Game::getGameTime()
-{
-    return (Platform::getAbsoluteTime() - _pausedTimeTotal);
-}
-
-Game::State Game::getState() const
+bool Game::isVsync()
 {
-    return _state;
+    return Platform::isVsync();
 }
 
-unsigned int Game::getFrameRate() const
-{
-    return _frameRate;
-}
 
 int Game::run(int width, int height)
 {
@@ -197,16 +188,6 @@ void Game::frame()
     }
 }
 
-unsigned int Game::getWidth() const
-{
-    return _width;
-}
-
-unsigned int Game::getHeight() const
-{
-    return _height;
-}
-
 void Game::clear(ClearFlags flags, const Vector4& clearColor, float clearDepth, int clearStencil)
 {
     GLbitfield bits = 0;
@@ -245,21 +226,6 @@ void Game::clear(ClearFlags flags, const Vector4& clearColor, float clearDepth,
     glClear(bits);
 }
 
-AnimationController* Game::getAnimationController()
-{
-    return _animationController;
-}
-
-const AudioController* Game::getAudioController() const
-{
-    return _audioController;
-}
-
-PhysicsController* Game::getPhysicsController()
-{
-    return _physicsController;
-}
-
 void Game::menu()
 {
 }

+ 22 - 14
gameplay/src/Game.h

@@ -53,13 +53,6 @@ public:
      */
     static Game* getInstance();
 
-    /**
-     * Gets the total absolute running time (in milliseconds) since Game::run().
-     * 
-     * @return The total absolute running time (in milliseconds).
-     */
-    static long getAbsoluteTime();
-
     /**
      * Gets whether vertical sync is enabled for the game display.
      * 
@@ -74,6 +67,13 @@ public:
      */
     static void setVsync(bool enable);
 
+    /**
+     * Gets the total absolute running time (in milliseconds) since Game::run().
+     * 
+     * @return The total absolute running time (in milliseconds).
+     */
+    static long getAbsoluteTime();
+
     /**
      * Gets the total game time (in milliseconds). This is the total accumulated game time (unpaused).
      *
@@ -89,7 +89,7 @@ public:
      *
      * @return The current game state.
      */
-    State getState() const;
+    inline State getState() const;
 
     /**
      * Call this method to initialize the game, and begin running the game.
@@ -129,21 +129,21 @@ public:
      * 
      * @return The current frame rate.
      */
-    unsigned int getFrameRate() const;
+    inline unsigned int getFrameRate() const;
 
     /**
      * Gets the game window width.
      * 
      * @return The game window width.
      */
-    unsigned int getWidth() const;
+    inline unsigned int getWidth() const;
 
     /**
      * Gets the game window height.
      * 
      * @return The game window height.
      */
-    unsigned int getHeight() const;
+    inline unsigned int getHeight() const;
 
     /**
      * Clears the specified resource buffers to the specified clear values. 
@@ -161,7 +161,7 @@ public:
      *
      * @return The audio controller for this game.
      */
-    const AudioController* getAudioController() const;
+    inline AudioController* getAudioController() const;
 
     /**
      * Gets the animation controller for managing control of animations
@@ -169,7 +169,7 @@ public:
      * 
      * @return The animation controller for this game.
      */
-    AnimationController* getAnimationController();
+    inline AnimationController* getAnimationController() const;
 
     /**
      * Gets the physics controller for managing control of physics
@@ -177,7 +177,7 @@ public:
      * 
      * @return The physics controller for this game.
      */
-    PhysicsController* getPhysicsController();
+    inline PhysicsController* getPhysicsController() const;
 
     /**
      * Menu callback on menu events.
@@ -250,6 +250,12 @@ protected:
      */
     virtual void render(long elapsedTime) = 0;
 
+    /**
+     * Renders a single frame once and then swaps it to the display.
+     */
+    template <class T>
+    void renderOnce(T* instance, void (T::*method)(long), long cookie);
+
 private:
 
     /**
@@ -287,4 +293,6 @@ private:
 
 }
 
+#include "Game.inl"
+
 #endif

+ 49 - 0
gameplay/src/Game.inl

@@ -0,0 +1,49 @@
+#include "Game.h"
+#include "Platform.h"
+
+namespace gameplay
+{
+
+inline Game::State Game::getState() const
+{
+    return _state;
+}
+
+inline unsigned int Game::getFrameRate() const
+{
+    return _frameRate;
+}
+
+inline unsigned int Game::getWidth() const
+{
+    return _width;
+}
+
+inline unsigned int Game::getHeight() const
+{
+    return _height;
+}
+
+inline AnimationController* Game::getAnimationController() const
+{
+    return _animationController;
+}
+
+inline AudioController* Game::getAudioController() const
+{
+    return _audioController;
+}
+
+inline PhysicsController* Game::getPhysicsController() const
+{
+    return _physicsController;
+}
+
+template <class T>
+void  Game::renderOnce(T* instance, void (T::*method)(long), long cookie)
+{
+    (instance->*method)(cookie);
+    Platform::swapBuffers();
+}
+
+}

+ 1 - 1
gameplay/src/Mesh.cpp

@@ -262,7 +262,7 @@ unsigned int Mesh::getVertexSize() const
     return _vertexFormat->getVertexSize();
 }
 
-VertexBuffer Mesh::getVertexBuffer() const
+VertexBufferHandle Mesh::getVertexBuffer() const
 {
     return _vertexBuffer;
 }

+ 2 - 2
gameplay/src/Mesh.h

@@ -148,7 +148,7 @@ public:
      *
      * @return The vertex buffer object handle.
      */
-    VertexBuffer getVertexBuffer() const;
+    VertexBufferHandle getVertexBuffer() const;
 
     /**
      * Determines if the mesh is dynamic.
@@ -296,7 +296,7 @@ private:
 
     VertexFormat* _vertexFormat;
     unsigned int _vertexCount;
-    VertexBuffer _vertexBuffer;
+    VertexBufferHandle _vertexBuffer;
     PrimitiveType _primitiveType;
     unsigned int _partCount;
     MeshPart** _parts;

+ 1 - 1
gameplay/src/MeshPart.cpp

@@ -91,7 +91,7 @@ Mesh::IndexFormat MeshPart::getIndexFormat() const
     return _indexFormat;
 }
 
-IndexBuffer MeshPart::getIndexBuffer() const
+IndexBufferHandle MeshPart::getIndexBuffer() const
 {
     return _indexBuffer;
 }

+ 2 - 2
gameplay/src/MeshPart.h

@@ -55,7 +55,7 @@ public:
      *
      * @return The index buffer object handle.
      */
-    IndexBuffer getIndexBuffer() const;
+    IndexBufferHandle getIndexBuffer() const;
 
     /**
      * Determines if the indices are dynamic.
@@ -102,7 +102,7 @@ private:
     Mesh::PrimitiveType _primitiveType;
     Mesh::IndexFormat _indexFormat;
     unsigned int _indexCount;
-    IndexBuffer _indexBuffer;
+    IndexBufferHandle _indexBuffer;
     bool _dynamic;
 };
 

+ 5 - 0
gameplay/src/Platform.h

@@ -87,6 +87,11 @@ public:
      */
     static void getAccelerometerPitchAndRoll(float* pitch, float* roll);
 
+    /**
+     * Swaps the 
+     */
+    static void swapBuffers();
+
 private:
 
     /**

+ 14 - 4
gameplay/src/PlatformMacOS.mm

@@ -54,6 +54,8 @@ long getMachTimeInMilliseconds()
 @end
 
 
+static View* __view = NULL;
+
 @implementation View
 
 -(void)windowWillClose:(NSNotification*)note 
@@ -83,8 +85,10 @@ long getMachTimeInMilliseconds()
     [[self openGLContext] makeCurrentContext];
     
     CGLLockContext((CGLContextObj)[[self openGLContext] CGLContextObj]);
+    
     if (_game && _game->getState() == Game::RUNNING)       
         _game->frame();
+    
     CGLFlushDrawable((CGLContextObj)[[self openGLContext] CGLContextObj]);
     CGLUnlockContext((CGLContextObj)[[self openGLContext] CGLContextObj]);  
     
@@ -531,7 +535,7 @@ int Platform::enterMessagePump()
     NSRect screenBounds = [[NSScreen mainScreen] frame];
     NSRect viewBounds = NSMakeRect(0, 0, WINDOW_WIDTH, WINDOW_HEIGHT);
     
-    View* view = [[View alloc] initWithFrame:viewBounds];
+    __view = [[View alloc] initWithFrame:viewBounds];
     
     NSRect centered = NSMakeRect(NSMidX(screenBounds) - NSMidX(viewBounds),
                                  NSMidY(screenBounds) - NSMidY(viewBounds),
@@ -544,9 +548,9 @@ int Platform::enterMessagePump()
                         backing:NSBackingStoreBuffered
                         defer:NO];
     
-    [window setContentView:view];
-    [window setDelegate:view];
-    [view release];
+    [window setContentView:__view];
+    [window setDelegate:__view];
+    [__view release];
     
     [NSApp run];
     
@@ -590,6 +594,12 @@ void Platform::getAccelerometerPitchAndRoll(float* pitch, float* roll)
     *pitch = __pitch;
     *roll = __roll;
 }
+
+void Platform::swapBuffers()
+{
+    if (__view)
+        CGLFlushDrawable((CGLContextObj)[[__view openGLContext] CGLContextObj]);
+}
     
 }
 

+ 9 - 3
gameplay/src/PlatformQNX.cpp

@@ -24,9 +24,9 @@ static screen_context_t __screenContext;
 static screen_window_t __screenWindow;
 static screen_event_t __screenEvent;
 static int __screenWindowSize[2];
-static EGLDisplay __eglDisplay;
-static EGLContext __eglContext;
-static EGLSurface __eglSurface;
+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;
 
@@ -832,6 +832,12 @@ void Platform::getAccelerometerPitchAndRoll(float* pitch, float* roll)
         *roll = atan(tx / sqrt(ty * ty + tz * tz)) * 180.0f * M_1_PI;
 }
 
+void Platform::swapBuffers()
+{
+    if (__eglDisplay && __eglSurface)
+        eglSwapBuffers(__eglDisplay, __eglSurface);
+}
+
 }
 
 #endif

+ 13 - 2
gameplay/src/PlatformWin32.cpp

@@ -4,6 +4,7 @@
 #include "Platform.h"
 #include "FileSystem.h"
 #include "Game.h"
+#include <GL/wglew.h>
 
 static long __timeTicksPerMillis;
 static long __timeStart;
@@ -11,8 +12,8 @@ static long __timeAbsolute;
 static bool __vsync = WINDOW_VSYNC;
 static float __roll;
 static float __pitch;
-static HWND __hwnd = 0;
 static HINSTANCE __hinstance = 0;
+static HWND __hwnd = 0;
 static HDC __hdc = 0;
 static HGLRC __hrc = 0;
 
@@ -472,6 +473,7 @@ Platform* Platform::create(Game* game)
     // Vertical sync.
     wglSwapIntervalEXT(__vsync ? 1 : 0);
 
+    // Show the window
     ShowWindow(__hwnd, SW_SHOW);
 
     return platform;
@@ -499,7 +501,10 @@ int Platform::enterMessagePump()
     __pitch = 0.0;
     __roll = 0.0;
 
-    _game->run(WINDOW_WIDTH, WINDOW_HEIGHT);
+    SwapBuffers(__hdc);
+
+    if (_game->getState() != Game::RUNNING)
+        _game->run(WINDOW_WIDTH, WINDOW_HEIGHT);
 
     // Enter event dispatch loop.
     MSG msg;
@@ -572,6 +577,12 @@ void Platform::getAccelerometerPitchAndRoll(float* pitch, float* roll)
     *roll = __roll;
 }
 
+void Platform::swapBuffers()
+{
+    if (__hdc)
+        SwapBuffers(__hdc);
+}
+
 }
 
 #endif

+ 10 - 1
gameplay/src/SpriteBatch.cpp

@@ -48,7 +48,7 @@ namespace gameplay
 static Effect* __spriteEffect = NULL;
 
 SpriteBatch::SpriteBatch() :
-    _effect(NULL), _stateBlock(NULL), _sampler(NULL), _samplerUniform(NULL), _projectionUniform(NULL), _vaPosition(-1), _vaTexCoord(-1), _vaColor(-1),
+    _texture(NULL), _effect(NULL), _stateBlock(NULL), _sampler(NULL), _samplerUniform(NULL), _projectionUniform(NULL), _vaPosition(-1), _vaTexCoord(-1), _vaColor(-1),
     _textureWidthRatio(0.0f), _textureHeightRatio(0.0f), _capacity(0), _count(0),
     _vertices(NULL), _verticesPtr(NULL), _indices(NULL), _indicesPtr(NULL), _index(0),
     _drawing(false), _projectionMatrix(NULL), _customProjectionMatrix(false)
@@ -72,6 +72,15 @@ SpriteBatch::~SpriteBatch()
     SAFE_DELETE(_projectionMatrix);
     SAFE_RELEASE(_sampler);
     SAFE_RELEASE(_effect);
+    SAFE_RELEASE(_texture);
+}
+
+SpriteBatch* SpriteBatch::create(const char* texturePath, Effect* effect, unsigned int initialCapacity)
+{
+    Texture* texture = Texture::create(texturePath);
+    SpriteBatch* batch = SpriteBatch::create(texture);
+    batch->_texture = texture;
+    return batch;
 }
 
 SpriteBatch* SpriteBatch::create(Texture* texture, Effect* effect, unsigned int initialCapacity)

+ 27 - 0
gameplay/src/SpriteBatch.h

@@ -27,6 +27,32 @@ class SpriteBatch
 
 public:
 
+    /**
+     * Creates a new SpriteBatch for drawing sprites with the given texture.
+     *
+     * If the effect parameter is NULL, a default effect is used which
+     * applies an orthographic projection for the currently bound viewport.
+     * A custom projection matrix can be used with the default effect by passing
+     * a new projection matrix into the SpriteBatch via the setProjectionMatrix
+     * method.
+     *
+     * If a custom effect is specified, it must meet the following requirements:
+     * <ol>
+     * <li>The vertex shader inputs must include a vec3 position, a vec2 tex coord
+     * and a vec4 color.
+     * <li>The names of the the vertex shader inputs must match the names defined
+     * by the VERTEX_ATTRIBUTE_XXX constants.
+     * <li>The fragment shader must define at least a single sampler/texture uniform.
+     * </ol>
+     *
+     * @param texturePath The path of the texture for this sprite batch.
+     * @param effect An optional effect to use with the SpriteBatch.
+     * @param initialCapacity An optional initial capacity of the batch (number of sprites).
+     * 
+     * @return A new SpriteBatch for drawing sprites using the given texture.
+     */
+    static SpriteBatch* create(const char* texturePath, Effect* effect = NULL, unsigned int initialCapacity = 0);
+
     /**
      * Creates a new SpriteBatch for drawing sprites with the given texture.
      *
@@ -204,6 +230,7 @@ private:
 
     void resizeBatch(unsigned int capacity);
 
+    Texture* _texture;
     Effect* _effect;
     RenderState::StateBlock* _stateBlock;
     Texture::Sampler* _sampler;

+ 0 - 5
gameplay/src/gameplay-main-macos.mm

@@ -1,6 +1,3 @@
-#ifndef GAMEPLAYMAINMACOS_H_
-#define GAMEPLAYMAINMACOS_H_
-
 #ifdef __APPLE__
 
 #include "gameplay.h"
@@ -18,6 +15,4 @@ int main(int argc, char** argv)
     return platform->enterMessagePump();
 }
 
-#endif
-
 #endif

+ 0 - 5
gameplay/src/gameplay-main-qnx.cpp

@@ -1,6 +1,3 @@
-#ifndef GAMEPLAYMAINQNX_H_
-#define GAMEPLAYMAINQNX_H_
-
 #ifdef __QNX__
 
 #include "gameplay.h"
@@ -21,5 +18,3 @@ int main(int argc, char** argv)
 }
 
 #endif
-
-#endif

+ 1 - 8
gameplay/src/gameplay-main-win32.cpp

@@ -1,14 +1,9 @@
-#ifndef GAMEPLAYMAINWIN32_H_
-#define GAMEPLAYMAINWIN32_H_
-
 #ifdef WIN32
 
 #include "gameplay.h"
+
 using namespace gameplay;
 
-#define GL_VERSION3
-#include <GL/glew.h>
-#include <GL/wglew.h>
 #ifndef _WINDOWS_
     #define WIN32_LEAN_AND_MEAN
     #include <windows.h>
@@ -28,5 +23,3 @@ extern "C" int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LP
 }
 
 #endif
-
-#endif