Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

tweaked flxgame to always clear the bitmap cache on state change

  • Loading branch information...
commit 61fd4dbb70e380ead0d26db9aab8b3f9c32a6ba3 1 parent f5a3ff6
@AdamAtomic authored
Showing with 21 additions and 6 deletions.
  1. +2 −1  org/flixel/FlxG.as
  2. +5 −4 org/flixel/FlxGame.as
  3. +14 −1 org/flixel/FlxU.as
View
3  org/flixel/FlxG.as
@@ -706,7 +706,8 @@ package org.flixel
if(!checkBitmapCache(Key))
{
_cache[Key] = (new Graphic).bitmapData;
- if(Reverse) needReverse = true;
+ if(Reverse)
+ needReverse = true;
}
var pixels:BitmapData = _cache[Key];
if(!needReverse && Reverse && (pixels.width == (new Graphic).bitmapData.width))
View
9 org/flixel/FlxGame.as
@@ -470,19 +470,20 @@ package org.flixel
FlxG.resetCameras();
FlxG.resetInput();
FlxG.destroySounds();
+ FlxG.clearBitmapCache();
+
+ //Clear the debugger overlay's Watch window
if(_debugger != null)
_debugger.watch.removeAll();
+
+ //Clear any timers left in the timer manager
var timerManager:TimerManager = FlxTimer.manager;
if(timerManager != null)
timerManager.clear();
//Destroy the old state (if there is an old state)
if(_state != null)
- {
_state.destroy();
- if(FlxU.getClassName(_state) != FlxU.getClassName(_requestedState))
- FlxG.clearBitmapCache();
- }
//Finally assign and create the new state
_state = _requestedState;
View
15 org/flixel/FlxU.as
@@ -438,7 +438,20 @@ package org.flixel
if(Simple)
string = string.substr(string.lastIndexOf(".")+1);
return string;
- };
+ }
+
+ /**
+ * Check to see if two objects have the same class name.
+ *
+ * @param Object1 The first object you want to check.
+ * @param Object2 The second object you want to check.
+ *
+ * @return Whether they have the same class name or not.
+ */
+ static public function compareClassNames(Object1:Object,Object2:Object):Boolean
+ {
+ return getQualifiedClassName(Object1) == getQualifiedClassName(Object2);
+ }
/**
* Look up a <code>Class</code> object by its string name.
Please sign in to comment.
Something went wrong with that request. Please try again.