Browse Source

Reduced numRays on mobile/web platforms for the physics platformer, hid quit button from space game UI.

Lara Engebretson 10 years ago
parent
commit
cd5b61152e

+ 1 - 2
PhysicsPlatformer/Resources/Components/DayTime.js

@@ -7,9 +7,8 @@ var component = function(self) {
 
   self.start = function() {
     if(!dayTime) {
-      //if it's night, make TheSun color darker
+      //if it's night, make TheSun color darker - ambient isn't being set properly, see GitHub issue: https://github.com/AtomicGameEngine/AtomicGameEngine/issues/340
       self.scene.getComponent("Zone").ambientColor = [0, 0, 0, 0.2];
-      console.log("----------------->", self.scene.getComponent("Zone").ambientColor);// = [0, 0, 0, 0];
       var sun = self.node.getChild("TheSun").getComponent("DirectionalLight2D");
       sun.enabled = false;
     }

+ 5 - 0
PhysicsPlatformer/Resources/Components/Level.js

@@ -68,6 +68,11 @@ var component = function (self) {
         var vnode  = self.scene.createChild("Vine");
         vnode.createJSComponent("Components/Vine.js", {startPosition : vines[i].position});
     }
+    
+    //reduce num rays on mobile/web platforms for better performance
+    if(Atomic.platform == "Android" || Atomic.platform == "iOS" || Atomic.platform == "WebGL") {
+      self.scene.getChild("TheSun").getComponent("DirectionalLight2D").numRays = 256;
+    }
 
   }
 

+ 7 - 1
SpaceGame/Resources/UI/mainMenu.js

@@ -27,6 +27,12 @@ exports.init = function() {
   view.addChild(window);
   window.center();
 
+  //Explicitly quitting an app is not allowed on iOS
+  if(Atomic.platform == "iOS") {
+   window.getWidget("quit").visibility = Atomic.UI_WIDGET_VISIBILITY_GONE;
+  }
+    
+
   window.getWidget("new_game").onClick = function () {
 
     closeWindow();
@@ -58,7 +64,7 @@ exports.init = function() {
 
 
   window.getWidget("quit").onClick = function () {
-
+    
     game.engine.exit();
 
   }