Browse Source

Merge pull request #465 from seanpaultaylor/next

Next
Sean Paul Taylor 13 years ago
parent
commit
edcc47b4f0

+ 2 - 2
gameplay-encoder/README.md

@@ -32,9 +32,9 @@ Uncomment the root CMakeList.txt for the gameplay-encoder and run standard cmake
 - Edit the project properties of "gameplay-encoder" for Debug
 - Edit the project properties of "gameplay-encoder" for Debug
 - Add Preprocessor Definition "USE_FBX" (C++/Preprocessor)
 - Add Preprocessor Definition "USE_FBX" (C++/Preprocessor)
 - Add the FBX SDK include directory to Additional Include Directories (C++/General)
 - Add the FBX SDK include directory to Additional Include Directories (C++/General)
-  * Example: C:/Program Files/Autodesk/FBX/FbxSdk/2013.3/include
+  * Example: C:/Program Files/Autodesk/FBX/FBX SDK/2013.3/include
 - Add the FBX lib directory to the Additional Library Directories (Linker/General)
 - Add the FBX lib directory to the Additional Library Directories (Linker/General)
-  * Example: C:/Program Files/Autodesk/FBX/FbxSdk/2013.3/lib/vs2010/x86
+  * Example: C:/Program Files/Autodesk/FBX/FBX SDK/2013.3/lib/vs2010/x86
 - Add "fbxsdk-2013.3-mdd.lib"(Release) to the Additional Dependencies (Linker/Input)
 - Add "fbxsdk-2013.3-mdd.lib"(Release) to the Additional Dependencies (Linker/Input)
   * Example: fbxsdk-2013.3-mdd.lib
   * Example: fbxsdk-2013.3-mdd.lib
 - Build gameplay-encoder
 - Build gameplay-encoder

+ 9 - 13
gameplay-template/gameplay-template.xcodeproj/project.pbxproj

@@ -7,7 +7,6 @@
 	objects = {
 	objects = {
 
 
 /* Begin PBXBuildFile section */
 /* Begin PBXBuildFile section */
-		04AB98CB161F3A2100CF90C5 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 04AB98CA161F3A2100CF90C5 /* IOKit.framework */; };
 		42438B531491AD2000D218B8 /* libgameplay.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 42438B521491AD2000D218B8 /* libgameplay.a */; };
 		42438B531491AD2000D218B8 /* libgameplay.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 42438B521491AD2000D218B8 /* libgameplay.a */; };
 		428F7BDE15CB131A009ED24C /* game.config in Resources */ = {isa = PBXBuildFile; fileRef = 428F7BDD15CB131A009ED24C /* game.config */; };
 		428F7BDE15CB131A009ED24C /* game.config in Resources */ = {isa = PBXBuildFile; fileRef = 428F7BDD15CB131A009ED24C /* game.config */; };
 		42C932C11491A0DB0098216A /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 42C932C01491A0DB0098216A /* Cocoa.framework */; };
 		42C932C11491A0DB0098216A /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 42C932C01491A0DB0098216A /* Cocoa.framework */; };
@@ -44,9 +43,8 @@
 /* End PBXBuildFile section */
 /* End PBXBuildFile section */
 
 
 /* Begin PBXFileReference section */
 /* Begin PBXFileReference section */
-		04AB98CA161F3A2100CF90C5 /* IOKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = IOKit.framework; path = System/Library/Frameworks/IOKit.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>"; };
 		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>"; };
+		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>"; };
 		42C932BC1491A0DB0098216A /* TEMPLATE_PROJECT-macosx.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "TEMPLATE_PROJECT-macosx.app"; sourceTree = BUILT_PRODUCTS_DIR; };
 		42C932BC1491A0DB0098216A /* TEMPLATE_PROJECT-macosx.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "TEMPLATE_PROJECT-macosx.app"; sourceTree = BUILT_PRODUCTS_DIR; };
 		42C932C01491A0DB0098216A /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; };
 		42C932C01491A0DB0098216A /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; };
 		42C932ED1491A4CB0098216A /* icon.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = icon.png; sourceTree = "<group>"; };
 		42C932ED1491A4CB0098216A /* icon.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = icon.png; sourceTree = "<group>"; };
@@ -81,7 +79,6 @@
 			isa = PBXFrameworksBuildPhase;
 			isa = PBXFrameworksBuildPhase;
 			buildActionMask = 2147483647;
 			buildActionMask = 2147483647;
 			files = (
 			files = (
-				04AB98CB161F3A2100CF90C5 /* IOKit.framework in Frameworks */,
 				42438B531491AD2000D218B8 /* libgameplay.a in Frameworks */,
 				42438B531491AD2000D218B8 /* libgameplay.a in Frameworks */,
 				42C933211491A6C70098216A /* libbullet.a in Frameworks */,
 				42C933211491A6C70098216A /* libbullet.a in Frameworks */,
 				42C933261491A6E50098216A /* libogg.a in Frameworks */,
 				42C933261491A6E50098216A /* libogg.a in Frameworks */,
@@ -195,7 +192,6 @@
 		5B61613A14CCC3590073B857 /* MacOSX */ = {
 		5B61613A14CCC3590073B857 /* MacOSX */ = {
 			isa = PBXGroup;
 			isa = PBXGroup;
 			children = (
 			children = (
-				04AB98CA161F3A2100CF90C5 /* IOKit.framework */,
 				42C932C01491A0DB0098216A /* Cocoa.framework */,
 				42C932C01491A0DB0098216A /* Cocoa.framework */,
 				42C9331C1491A6750098216A /* QuartzCore.framework */,
 				42C9331C1491A6750098216A /* QuartzCore.framework */,
 				42C933161491A5EB0098216A /* OpenGL.framework */,
 				42C933161491A5EB0098216A /* OpenGL.framework */,
@@ -243,7 +239,7 @@
 				5B61611714CCC24C0073B857 /* Frameworks */,
 				5B61611714CCC24C0073B857 /* Frameworks */,
 				5B61612414CCC24C0073B857 /* ShellScript */,
 				5B61612414CCC24C0073B857 /* ShellScript */,
 				5B61612514CCC24C0073B857 /* Resources */,
 				5B61612514CCC24C0073B857 /* Resources */,
-				5BAF20A3152F2FCE003E2AC3 /* Copy Gameplay Reousrces Run Script */,
+				5BAF20A3152F2FCE003E2AC3 /* Copy Gameplay Resources Run Script */,
 			);
 			);
 			buildRules = (
 			buildRules = (
 			);
 			);
@@ -329,7 +325,7 @@
 			shellPath = /bin/sh;
 			shellPath = /bin/sh;
 			shellScript = "touch -cm ${SRCROOT}/res";
 			shellScript = "touch -cm ${SRCROOT}/res";
 		};
 		};
-		5BAF20A3152F2FCE003E2AC3 /* Copy Gameplay Reousrces Run Script */ = {
+		5BAF20A3152F2FCE003E2AC3 /* Copy Gameplay Resources Run Script */ = {
 			isa = PBXShellScriptBuildPhase;
 			isa = PBXShellScriptBuildPhase;
 			buildActionMask = 2147483647;
 			buildActionMask = 2147483647;
 			files = (
 			files = (
@@ -487,7 +483,7 @@
 		5B61612A14CCC24C0073B857 /* Debug */ = {
 		5B61612A14CCC24C0073B857 /* Debug */ = {
 			isa = XCBuildConfiguration;
 			isa = XCBuildConfiguration;
 			buildSettings = {
 			buildSettings = {
-				ARCHS = "$(ARCHS_STANDARD_32_BIT)";
+                ARCHS = "$(ARCHS_STANDARD_32_BIT)";
 				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;
@@ -500,7 +496,7 @@
 					"GAMEPLAY_PATH/external-deps/lua/include",
 					"GAMEPLAY_PATH/external-deps/lua/include",
 				);
 				);
 				INFOPLIST_FILE = "TEMPLATE_PROJECT-ios.plist";
 				INFOPLIST_FILE = "TEMPLATE_PROJECT-ios.plist";
-				IPHONEOS_DEPLOYMENT_TARGET = 5.1;
+                IPHONEOS_DEPLOYMENT_TARGET = 5.1;
 				LIBRARY_SEARCH_PATHS = (
 				LIBRARY_SEARCH_PATHS = (
 					"$(inherited)",
 					"$(inherited)",
 					"\"GAMEPLAY_PATH/external-deps/libpng/lib/ios/$(CURRENT_ARCH)\"",
 					"\"GAMEPLAY_PATH/external-deps/libpng/lib/ios/$(CURRENT_ARCH)\"",
@@ -508,7 +504,7 @@
 					"\"GAMEPLAY_PATH/external-deps/oggvorbis/lib/ios/$(CURRENT_ARCH)\"",
 					"\"GAMEPLAY_PATH/external-deps/oggvorbis/lib/ios/$(CURRENT_ARCH)\"",
 				);
 				);
 				SDKROOT = iphoneos;
 				SDKROOT = iphoneos;
-				TARGETED_DEVICE_FAMILY = "1,2";
+                TARGETED_DEVICE_FAMILY = "1,2";
 				USER_HEADER_SEARCH_PATHS = "";
 				USER_HEADER_SEARCH_PATHS = "";
 				WRAPPER_EXTENSION = app;
 				WRAPPER_EXTENSION = app;
 			};
 			};
@@ -517,7 +513,7 @@
 		5B61612B14CCC24C0073B857 /* Release */ = {
 		5B61612B14CCC24C0073B857 /* Release */ = {
 			isa = XCBuildConfiguration;
 			isa = XCBuildConfiguration;
 			buildSettings = {
 			buildSettings = {
-				ARCHS = "$(ARCHS_STANDARD_32_BIT)";
+                ARCHS = "$(ARCHS_STANDARD_32_BIT)";
 				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;
@@ -530,7 +526,7 @@
 					"GAMEPLAY_PATH/external-deps/lua/include",
 					"GAMEPLAY_PATH/external-deps/lua/include",
 				);
 				);
 				INFOPLIST_FILE = "TEMPLATE_PROJECT-ios.plist";
 				INFOPLIST_FILE = "TEMPLATE_PROJECT-ios.plist";
-				IPHONEOS_DEPLOYMENT_TARGET = 5.1;
+                IPHONEOS_DEPLOYMENT_TARGET = 5.1;
 				LIBRARY_SEARCH_PATHS = (
 				LIBRARY_SEARCH_PATHS = (
 					"$(inherited)",
 					"$(inherited)",
 					"\"GAMEPLAY_PATH/external-deps/libpng/lib/ios/$(CURRENT_ARCH)\"",
 					"\"GAMEPLAY_PATH/external-deps/libpng/lib/ios/$(CURRENT_ARCH)\"",
@@ -538,7 +534,7 @@
 					"\"GAMEPLAY_PATH/external-deps/oggvorbis/lib/ios/$(CURRENT_ARCH)\"",
 					"\"GAMEPLAY_PATH/external-deps/oggvorbis/lib/ios/$(CURRENT_ARCH)\"",
 				);
 				);
 				SDKROOT = iphoneos;
 				SDKROOT = iphoneos;
-				TARGETED_DEVICE_FAMILY = "1,2";
+                TARGETED_DEVICE_FAMILY = "1,2";
 				USER_HEADER_SEARCH_PATHS = "";
 				USER_HEADER_SEARCH_PATHS = "";
 				WRAPPER_EXTENSION = app;
 				WRAPPER_EXTENSION = app;
 			};
 			};

+ 1 - 111
gameplay/src/Material.cpp

@@ -6,18 +6,12 @@
 #include "Pass.h"
 #include "Pass.h"
 #include "Properties.h"
 #include "Properties.h"
 #include "Node.h"
 #include "Node.h"
-#include "Game.h"
-
-#define MATERIAL_DEFAULT_BIT 1
-#define MATERIAL_BUILTIN_BIT 2
 
 
 namespace gameplay
 namespace gameplay
 {
 {
 
 
-static Effect* __defaultEffect = NULL;
-
 Material::Material() :
 Material::Material() :
-    _currentTechnique(NULL), _bits(0)
+    _currentTechnique(NULL)
 {
 {
 }
 }
 
 
@@ -29,13 +23,6 @@ Material::~Material()
         Technique* technique = _techniques[i];
         Technique* technique = _techniques[i];
         SAFE_RELEASE(technique);
         SAFE_RELEASE(technique);
     }
     }
-
-    // If we're the last material that was using __defaultEffect, then release
-    // and unassign it.
-    if ((_bits & MATERIAL_DEFAULT_BIT) && __defaultEffect && __defaultEffect->getRefCount() == 1)
-    {
-        SAFE_RELEASE(__defaultEffect);
-    }
 }
 }
 
 
 Material* Material::create(const char* url)
 Material* Material::create(const char* url)
@@ -137,103 +124,6 @@ Material* Material::create(const char* vshPath, const char* fshPath, const char*
     return material;
     return material;
 }
 }
 
 
-bool isDefaultMaterialEnabled(const char*& customMaterial)
-{
-    customMaterial = NULL;
-
-    // Default materials are always enabled unless explicitly turned off in config
-    Properties* config = Game::getInstance()->getConfig()->getNamespace("graphics", true);
-    if (config)
-    {
-        const char* str = config->getString("defaultMaterial");
-        if (str && strlen(str) > 0)
-        {
-            // User set 'defaultMaterial = none', which disabled default materials
-            if (strcmp(str, "none") == 0)
-                return false;
-
-            customMaterial = str;
-        }
-    }
-
-    return true;
-}
-
-Material* Material::createDefault()
-{
-    // Check whether default materials are enabled only once, for performance reasons
-    static const char* customMaterial = NULL;
-    static bool enabled = isDefaultMaterialEnabled(customMaterial);
-    if (!enabled)
-        return NULL;
-
-    // If we've already loaded __defaultEffect, use that.
-    if (__defaultEffect)
-    {
-        Material* material = create(__defaultEffect);
-        if (material)
-        {
-            material->_bits = MATERIAL_DEFAULT_BIT | MATERIAL_BUILTIN_BIT;
-            return material;
-        }
-    }
-
-    // Attempt to load a custom material (if configured)
-    if (customMaterial)
-    {
-        Material* material = create(customMaterial);
-        if (material)
-        {
-            material->_bits = MATERIAL_DEFAULT_BIT;
-            return material;
-        }
-    }
-
-    // Create the built-in default material
-    const char* vshSource =
-        "uniform mat4 u_worldViewProjectionMatrix;\n" \
-        "attribute vec3 a_position;\n" \
-        "void main()\n" \
-        "{\n" \
-            "gl_Position = u_worldViewProjectionMatrix * vec4(a_position, 1);\n" \
-        "}\n";
-
-    const char* fshSource =
-        "#ifdef OPENGL_ES\n" \
-        "precision highp float;\n" \
-        "#endif\n" \
-        "void main()\n" \
-        "{\n" \
-            "gl_FragColor = vec4(0.97, 0.88, 0.83, 1.0);\n" \
-        "}\n";
-
-    // Create our default effect and leave the initial reference count so that it is not
-    // automatically released when the last Material/Pass referencing it is released.
-    // We use this to perform additional cleanup in ~Material() when we detect a
-    // default material being released and __defaultEffect has a ref count == 1.
-    __defaultEffect = Effect::createFromSource(vshSource, fshSource);
-    if (!__defaultEffect)
-        return NULL;
-
-    Material* material = create(__defaultEffect);
-    if (material)
-    {
-        material->_bits = MATERIAL_DEFAULT_BIT | MATERIAL_BUILTIN_BIT;
-    }
-
-    return material;
-}
-
-bool Material::isDefault() const
-{
-    return (_bits & MATERIAL_DEFAULT_BIT) == MATERIAL_DEFAULT_BIT;
-}
-
-bool Material::isBuiltin() const
-{
-    return (_bits & MATERIAL_BUILTIN_BIT) == MATERIAL_BUILTIN_BIT;
-}
-
 unsigned int Material::getTechniqueCount() const
 unsigned int Material::getTechniqueCount() const
 {
 {
     return _techniques.size();
     return _techniques.size();

+ 0 - 32
gameplay/src/Material.h

@@ -78,37 +78,6 @@ public:
      */
      */
     static Material* create(const char* vshPath, const char* fshPath, const char* defines = NULL);
     static Material* create(const char* vshPath, const char* fshPath, const char* defines = NULL);
 
 
-    /**
-     * Creates a default material.
-     *
-     * The material returned from this method is normally used to draw
-     * models that have no explicitly defined material. By default, this
-     * method returns a material that draws objects using a solid pink color,
-     * which in intended to be easily spotted in a scene. However, if the
-     * graphics/defaultMaterial property is specified in a game.confg file,
-     * that material will be used as the default instead of the built-in one.
-     * It is also valid to specify 'none' for the defaultMaterial config
-     * property, in which case this method will return NULL and no default
-     * material will be used by models without explicitly set materials.
-     *
-     * @return A new default material, or NULL if no default material is available.
-     */
-    static Material* createDefault();
-
-    /**
-     * Determines if this is the default material (i.e. returned from createDefault).
-     *
-     * @return True if this is the default material, false otherwise.
-     */
-    bool isDefault() const;
-
-    /**
-     * Determines if this is the default built-in material (i.e. returned from createDefault).
-     *
-     * @return True if this is the default built-in material, false otherwise.
-     */
-    bool isBuiltin() const;
-
     /**
     /**
      * Returns the number of techniques in the material.
      * Returns the number of techniques in the material.
      *
      *
@@ -192,7 +161,6 @@ private:
 
 
     Technique* _currentTechnique;
     Technique* _currentTechnique;
     std::vector<Technique*> _techniques;
     std::vector<Technique*> _techniques;
-    int _bits;
 };
 };
 
 
 }
 }

+ 20 - 53
gameplay/src/Model.cpp

@@ -54,12 +54,24 @@ unsigned int Model::getMeshPartCount() const
 
 
 Material* Model::getMaterial(int partIndex)
 Material* Model::getMaterial(int partIndex)
 {
 {
-    Material* m = getMaterialInternal(partIndex, false);
+    GP_ASSERT(partIndex == -1 || (partIndex >= 0 && partIndex < (int)getMeshPartCount()));
 
 
-    // If our material is the default one, return NULL to signify that we
-    // don't actually have a specified material.
-    if (m && m->isDefault())
-        return NULL;
+    Material* m = NULL;
+
+    if (partIndex >= 0 && partIndex < (int)_partCount)
+    {
+        // Look up explicitly specified part material.
+        if (_partMaterials)
+        {
+            m = _partMaterials[partIndex];
+        }
+    }
+
+    if (m == NULL)
+    {
+        // Return the shared material.
+         m = _material;
+    }
 
 
     return m;
     return m;
 }
 }
@@ -241,50 +253,6 @@ void Model::setNode(Node* node)
     }
     }
 }
 }
 
 
-Material* Model::getMaterialInternal(int partIndex, bool draw)
-{
-    GP_ASSERT(partIndex == -1 || (partIndex >= 0 && partIndex < (int)getMeshPartCount()));
-
-    Material* m = NULL;
-
-    if (partIndex >= 0 && partIndex < (int)_partCount)
-    {
-        // Look up explicitly specified part material.
-        if (_partMaterials)
-        {
-            m = _partMaterials[partIndex];
-        }
-    }
-
-    if (m == NULL)
-    {
-        // Return the shared material.
-         m = _material;
-    }
-
-    // If we were called during a draw operation and no material is currently assigned,
-    // attempt to load a default material.
-    if (m == NULL && draw)
-    {
-        m = Material::createDefault();
-        if (m)
-        {
-            GP_WARN("No material defined for model in node '%s'. Setting default material.", _node->getId());
-
-            setMaterial(m);
-            m->release();
-
-            // If the returned material is the built-in one, setup auto-bindings
-            if (m->isBuiltin())
-            {
-                m->setParameterAutoBinding("u_worldViewProjectionMatrix", RenderState::WORLD_VIEW_PROJECTION_MATRIX);
-            }
-        }
-    }
-
-    return m;
-}
-
 void Model::draw(bool wireframe)
 void Model::draw(bool wireframe)
 {
 {
     GP_ASSERT(_mesh);
     GP_ASSERT(_mesh);
@@ -293,10 +261,9 @@ void Model::draw(bool wireframe)
     if (partCount == 0)
     if (partCount == 0)
     {
     {
         // No mesh parts (index buffers).
         // No mesh parts (index buffers).
-        Material* material = getMaterialInternal(-1, true);
-        if (material)
+        if (_material)
         {
         {
-            Technique* technique = material->getTechnique();
+            Technique* technique = _material->getTechnique();
             GP_ASSERT(technique);
             GP_ASSERT(technique);
             unsigned int passCount = technique->getPassCount();
             unsigned int passCount = technique->getPassCount();
             for (unsigned int i = 0; i < passCount; ++i)
             for (unsigned int i = 0; i < passCount; ++i)
@@ -329,7 +296,7 @@ void Model::draw(bool wireframe)
             GP_ASSERT(part);
             GP_ASSERT(part);
 
 
             // Get the material for this mesh part.
             // Get the material for this mesh part.
-            Material* material = getMaterialInternal(i, true);
+            Material* material = getMaterial(i);
             if (material)
             if (material)
             {
             {
                 Technique* technique = material->getTechnique();
                 Technique* technique = material->getTechnique();

+ 0 - 7
gameplay/src/Model.h

@@ -182,13 +182,6 @@ private:
      */
      */
     void setMaterialNodeBinding(Material *m);
     void setMaterialNodeBinding(Material *m);
 
 
-    /**
-     * Gets the material used to draw with (this is potentially different than
-     * the result of the public getMaterial method if no explicit material is
-     * defined and a default material is being used.
-     */
-    Material* getMaterialInternal(int partIndex, bool draw);
-
     void validatePartCount();
     void validatePartCount();
 
 
     /**
     /**

+ 1 - 1
gameplay/src/PlatformAndroid.cpp

@@ -109,7 +109,7 @@ static EGLenum checkErrorEGL(const char* msg)
 static bool initEGL()
 static bool initEGL()
 {
 {
 	int samples = 0;
 	int samples = 0;
-	Properties* config = Game::getInstance()->getConfig()->getNamespace("graphics", true);
+	Properties* config = Game::getInstance()->getConfig()->getNamespace("window", true);
 	if (config)
 	if (config)
 	{
 	{
 		samples = std::max(config->getInt("samples"), 0);
 		samples = std::max(config->getInt("samples"), 0);

+ 5 - 23
gameplay/src/PlatformMacOSX.mm

@@ -7,8 +7,6 @@
 #include "Form.h"
 #include "Form.h"
 #include "ScriptController.h"
 #include "ScriptController.h"
 #include <unistd.h>
 #include <unistd.h>
-#include <IOKit/hid/IOHIDElement.h>
-#include <IOKit/hid/IOHIDDevice.h>
 #include <IOKit/hid/IOHIDLib.h>
 #include <IOKit/hid/IOHIDLib.h>
 #import <Cocoa/Cocoa.h>
 #import <Cocoa/Cocoa.h>
 #import <QuartzCore/CVDisplayLink.h>
 #import <QuartzCore/CVDisplayLink.h>
@@ -362,8 +360,7 @@ double getMachTimeInMilliseconds()
 }
 }
 - (NSNumber*)locationID
 - (NSNumber*)locationID
 {
 {
-    NSNumber *n = (NSNumber*)IOHIDDeviceGetProperty([self rawDevice], CFSTR(kIOHIDLocationIDKey));
-    return [NSNumber numberWithUnsignedInt:[n unsignedIntValue]];
+    return (NSNumber*)IOHIDDeviceGetProperty([self rawDevice], CFSTR(kIOHIDLocationIDKey));
 }
 }
 
 
 - (void)initializeGamepadElements
 - (void)initializeGamepadElements
@@ -683,7 +680,7 @@ static CVReturn MyDisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTime
 {
 {
     _game = Game::getInstance();
     _game = Game::getInstance();
     
     
-    Properties* config = _game->getConfig()->getNamespace("graphics", true);
+    Properties* config = _game->getConfig()->getNamespace("window", true);
     int samples = config ? config->getInt("samples") : 0;
     int samples = config ? config->getInt("samples") : 0;
     if (samples < 0)
     if (samples < 0)
         samples = 0;
         samples = 0;
@@ -1281,17 +1278,9 @@ Platform::Platform(Game* game)
     IOHIDManagerRegisterDeviceMatchingCallback(__hidManagerRef, hidDeviceDiscoveredCallback, NULL);
     IOHIDManagerRegisterDeviceMatchingCallback(__hidManagerRef, hidDeviceDiscoveredCallback, NULL);
     IOHIDManagerRegisterDeviceRemovalCallback(__hidManagerRef, hidDeviceRemovalCallback, NULL);
     IOHIDManagerRegisterDeviceRemovalCallback(__hidManagerRef, hidDeviceRemovalCallback, NULL);
     
     
-    CFDictionaryRef matchingJoystickCFDictRef = IOHIDCreateDeviceMatchingDictionary(kHIDPage_GenericDesktop, kHIDUsage_GD_Joystick);
-    CFDictionaryRef matchingGamepadCFDictRef = IOHIDCreateDeviceMatchingDictionary(kHIDPage_GenericDesktop, kHIDUsage_GD_GamePad);
-    CFMutableArrayRef matchingDicts = CFArrayCreateMutable(kCFAllocatorDefault, 2, NULL);
-    CFArrayAppendValue(matchingDicts, matchingJoystickCFDictRef);
-    CFArrayAppendValue(matchingDicts, matchingGamepadCFDictRef);
-
-    if (matchingDicts) IOHIDManagerSetDeviceMatchingMultiple(__hidManagerRef, matchingDicts);
-    
-    CFRelease(matchingJoystickCFDictRef);
-    CFRelease(matchingGamepadCFDictRef);
-    CFRelease(matchingDicts);
+    CFDictionaryRef matchingCFDictRef = IOHIDCreateDeviceMatchingDictionary(kHIDPage_GenericDesktop, kHIDUsage_GD_Joystick);
+    if (matchingCFDictRef) IOHIDManagerSetDeviceMatching(__hidManagerRef, matchingCFDictRef);
+    CFRelease(matchingCFDictRef);
     
     
     IOHIDManagerScheduleWithRunLoop(__hidManagerRef, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode);
     IOHIDManagerScheduleWithRunLoop(__hidManagerRef, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode);
     IOReturn kr = IOHIDManagerOpen(__hidManagerRef, kIOHIDOptionsTypeNone);
     IOReturn kr = IOHIDManagerOpen(__hidManagerRef, kIOHIDOptionsTypeNone);
@@ -1346,13 +1335,6 @@ int Platform::enterMessagePump()
 
 
             // Read fullscreen state.
             // Read fullscreen state.
             __fullscreen = config->getBool("fullscreen");
             __fullscreen = config->getBool("fullscreen");
-            
-            // If fullscreen is specified, and width is not, interpret this
-            // as meaning, "use the current resolution".
-            if (__fullscreen && width == 0){
-			    __width = [[NSScreen mainScreen] frame].size.width;
-                __height = [[NSScreen mainScreen] frame].size.height;
-            }
         }
         }
     }
     }
 
 

+ 1 - 1
gameplay/src/PlatformQNX.cpp

@@ -546,7 +546,7 @@ Platform* Platform::create(Game* game, void* attachToWindow)
 
 
     // Query game config
     // Query game config
     int samples = 0;
     int samples = 0;
-    Properties* config = Game::getInstance()->getConfig()->getNamespace("graphics", true);
+    Properties* config = Game::getInstance()->getConfig()->getNamespace("window", true);
     if (config)
     if (config)
     {
     {
         samples = std::max(config->getInt("samples"), 0);
         samples = std::max(config->getInt("samples"), 0);

+ 1 - 10
gameplay/src/PlatformWin32.cpp

@@ -889,19 +889,10 @@ Platform* Platform::create(Game* game, void* attachToWindow)
             params.fullscreen = config->getBool("fullscreen");
             params.fullscreen = config->getBool("fullscreen");
 
 
             // Read multisampling state.
             // Read multisampling state.
-            Properties* graphicsConfig = game->getConfig()->getNamespace("graphics", true);
-            if (graphicsConfig)
-                params.samples = std::max(graphicsConfig->getInt("samples"), 0);
+            params.samples = config->getInt("samples");
         }
         }
     }
     }
 
 
-    // If fullscreen is specified, and width is not, interpret this
-    // as meaning, "use the current resolution".
-    if (params.fullscreen && params.rect.right == 0){
-        params.rect.right = params.rect.left + GetSystemMetrics(SM_CXSCREEN);
-        params.rect.bottom = params.rect.top + GetSystemMetrics(SM_CYSCREEN);
-    }
-    
     // If window size was not specified, set it to a default value
     // If window size was not specified, set it to a default value
     if (params.rect.right == 0)
     if (params.rect.right == 0)
         params.rect.right = params.rect.left + DEFAULT_RESOLUTION_X;
         params.rect.right = params.rect.left + DEFAULT_RESOLUTION_X;

+ 1 - 1
gameplay/src/PlatformiOS.mm

@@ -226,7 +226,7 @@ int getKey(unichar keyCode);
     NSLog(@"width: %d, height: %d", framebufferWidth, framebufferHeight);
     NSLog(@"width: %d, height: %d", framebufferWidth, framebufferHeight);
     
     
     // If multisampling is enabled in config, create and setup a multisample buffer
     // If multisampling is enabled in config, create and setup a multisample buffer
-    Properties* config = Game::getInstance()->getConfig()->getNamespace("graphics", true);
+    Properties* config = Game::getInstance()->getConfig()->getNamespace("window", true);
     int samples = config ? config->getInt("samples") : 0;
     int samples = config ? config->getInt("samples") : 0;
     if (samples < 0)
     if (samples < 0)
         samples = 0;
         samples = 0;