Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

tweaked flxgame to always clear the bitmap cache on state change

  • Loading branch information...
commit 61fd4dbb70e380ead0d26db9aab8b3f9c32a6ba3 1 parent f5a3ff6
Adam 'Atomic' Saltsman authored May 02, 2011
3  org/flixel/FlxG.as
@@ -706,7 +706,8 @@ package org.flixel
706 706
 			if(!checkBitmapCache(Key))
707 707
 			{
708 708
 				_cache[Key] = (new Graphic).bitmapData;
709  
-				if(Reverse) needReverse = true;
  709
+				if(Reverse)
  710
+					needReverse = true;
710 711
 			}
711 712
 			var pixels:BitmapData = _cache[Key];
712 713
 			if(!needReverse && Reverse && (pixels.width == (new Graphic).bitmapData.width))
9  org/flixel/FlxGame.as
@@ -470,19 +470,20 @@ package org.flixel
470 470
 			FlxG.resetCameras();
471 471
 			FlxG.resetInput();
472 472
 			FlxG.destroySounds();
  473
+			FlxG.clearBitmapCache();
  474
+			
  475
+			//Clear the debugger overlay's Watch window
473 476
 			if(_debugger != null)
474 477
 				_debugger.watch.removeAll();
  478
+			
  479
+			//Clear any timers left in the timer manager
475 480
 			var timerManager:TimerManager = FlxTimer.manager;
476 481
 			if(timerManager != null)
477 482
 				timerManager.clear();
478 483
 			
479 484
 			//Destroy the old state (if there is an old state)
480 485
 			if(_state != null)
481  
-			{
482 486
 				_state.destroy();
483  
-				if(FlxU.getClassName(_state) != FlxU.getClassName(_requestedState))
484  
-					FlxG.clearBitmapCache();
485  
-			}
486 487
 			
487 488
 			//Finally assign and create the new state
488 489
 			_state = _requestedState;
15  org/flixel/FlxU.as
@@ -438,7 +438,20 @@ package org.flixel
438 438
 			if(Simple)
439 439
 				string = string.substr(string.lastIndexOf(".")+1);
440 440
 			return string;
441  
-		};
  441
+		}
  442
+		
  443
+		/**
  444
+		 * Check to see if two objects have the same class name.
  445
+		 * 
  446
+		 * @param	Object1		The first object you want to check.
  447
+		 * @param	Object2		The second object you want to check.
  448
+		 * 
  449
+		 * @return	Whether they have the same class name or not.
  450
+		 */
  451
+		static public function compareClassNames(Object1:Object,Object2:Object):Boolean
  452
+		{
  453
+			return getQualifiedClassName(Object1) == getQualifiedClassName(Object2);
  454
+		}
442 455
 		
443 456
 		/**
444 457
 		 * Look up a <code>Class</code> object by its string name.

0 notes on commit 61fd4db

Please sign in to comment.
Something went wrong with that request. Please try again.