initial commit, kind of working.

This commit is contained in:
2026-10-10 15:50:17 -06:00
commit 4db96b0bae
1041 changed files with 51423 additions and 0 deletions
@@ -0,0 +1,33 @@
package org.flixel.system
{
public class FlxAnim
{
public var name:String;
public var delay:Number;
public var frames:Array;
public var looped:Boolean;
public function FlxAnim(param1:String, param2:Array, param3:Number = 0, param4:Boolean = true)
{
super();
this.name = param1;
this.delay = 0;
if(param3 > 0)
{
this.delay = 1 / param3;
}
this.frames = param2;
this.looped = param4;
}
public function destroy() : void
{
this.frames = null;
}
}
}
@@ -0,0 +1,173 @@
package org.flixel.system
{
import flash.display.Bitmap;
import flash.display.BitmapData;
import flash.display.Sprite;
import flash.events.MouseEvent;
import flash.geom.Point;
import flash.geom.Rectangle;
import flash.text.TextField;
import flash.text.TextFormat;
import org.flixel.FlxG;
import org.flixel.system.debug.Log;
import org.flixel.system.debug.Perf;
import org.flixel.system.debug.VCR;
import org.flixel.system.debug.Vis;
import org.flixel.system.debug.Watch;
public class FlxDebugger extends Sprite
{
public var perf:Perf;
public var log:Log;
public var watch:Watch;
public var vcr:VCR;
public var vis:Vis;
public var hasMouse:Boolean;
protected var _layout:uint;
protected var _screen:Point;
protected var _gutter:uint;
public function FlxDebugger(param1:Number, param2:Number)
{
super();
visible = false;
this.hasMouse = false;
this._screen = new Point(param1,param2);
addChild(new Bitmap(new BitmapData(param1,15,true,2130706432)));
var _loc3_:TextField = new TextField();
_loc3_.x = 2;
_loc3_.width = 160;
_loc3_.height = 16;
_loc3_.selectable = false;
_loc3_.multiline = false;
_loc3_.defaultTextFormat = new TextFormat("Courier",12,16777215);
var _loc4_:String = FlxG.getLibraryName();
if(FlxG.debug)
{
_loc4_ += " [debug]";
}
else
{
_loc4_ += " [release]";
}
_loc3_.text = _loc4_;
addChild(_loc3_);
this._gutter = 8;
var _loc5_:Rectangle = new Rectangle(this._gutter,15 + this._gutter / 2,this._screen.x - this._gutter * 2,this._screen.y - this._gutter * 1.5 - 15);
this.log = new Log("log",0,0,true,_loc5_);
addChild(this.log);
this.watch = new Watch("watch",0,0,true,_loc5_);
addChild(this.watch);
this.perf = new Perf("stats",0,0,false,_loc5_);
addChild(this.perf);
this.vcr = new VCR();
this.vcr.x = (param1 - this.vcr.width / 2) / 2;
this.vcr.y = 2;
addChild(this.vcr);
this.vis = new Vis();
this.vis.x = param1 - this.vis.width - 4;
this.vis.y = 2;
addChild(this.vis);
this.setLayout(FlxG.DEBUGGER_STANDARD);
addEventListener(MouseEvent.MOUSE_OVER,this.onMouseOver);
addEventListener(MouseEvent.MOUSE_OUT,this.onMouseOut);
}
public function destroy() : void
{
this._screen = null;
removeChild(this.log);
this.log.destroy();
this.log = null;
removeChild(this.watch);
this.watch.destroy();
this.watch = null;
removeChild(this.perf);
this.perf.destroy();
this.perf = null;
removeChild(this.vcr);
this.vcr.destroy();
this.vcr = null;
removeChild(this.vis);
this.vis.destroy();
this.vis = null;
removeEventListener(MouseEvent.MOUSE_OVER,this.onMouseOver);
removeEventListener(MouseEvent.MOUSE_OUT,this.onMouseOut);
}
protected function onMouseOver(param1:MouseEvent = null) : void
{
this.hasMouse = true;
}
protected function onMouseOut(param1:MouseEvent = null) : void
{
this.hasMouse = false;
}
public function setLayout(param1:uint) : void
{
this._layout = param1;
this.resetLayout();
}
public function resetLayout() : void
{
switch(this._layout)
{
case FlxG.DEBUGGER_MICRO:
this.log.resize(this._screen.x / 4,68);
this.log.reposition(0,this._screen.y);
this.watch.resize(this._screen.x / 4,68);
this.watch.reposition(this._screen.x,this._screen.y);
this.perf.reposition(this._screen.x,0);
break;
case FlxG.DEBUGGER_BIG:
this.log.resize((this._screen.x - this._gutter * 3) / 2,this._screen.y / 2);
this.log.reposition(0,this._screen.y);
this.watch.resize((this._screen.x - this._gutter * 3) / 2,this._screen.y / 2);
this.watch.reposition(this._screen.x,this._screen.y);
this.perf.reposition(this._screen.x,0);
break;
case FlxG.DEBUGGER_TOP:
this.log.resize((this._screen.x - this._gutter * 3) / 2,this._screen.y / 4);
this.log.reposition(0,0);
this.watch.resize((this._screen.x - this._gutter * 3) / 2,this._screen.y / 4);
this.watch.reposition(this._screen.x,0);
this.perf.reposition(this._screen.x,this._screen.y);
break;
case FlxG.DEBUGGER_LEFT:
this.log.resize(this._screen.x / 3,(this._screen.y - 15 - this._gutter * 2.5) / 2);
this.log.reposition(0,0);
this.watch.resize(this._screen.x / 3,(this._screen.y - 15 - this._gutter * 2.5) / 2);
this.watch.reposition(0,this._screen.y);
this.perf.reposition(this._screen.x,0);
break;
case FlxG.DEBUGGER_RIGHT:
this.log.resize(this._screen.x / 3,(this._screen.y - 15 - this._gutter * 2.5) / 2);
this.log.reposition(this._screen.x,0);
this.watch.resize(this._screen.x / 3,(this._screen.y - 15 - this._gutter * 2.5) / 2);
this.watch.reposition(this._screen.x,this._screen.y);
this.perf.reposition(0,0);
break;
case FlxG.DEBUGGER_STANDARD:
default:
this.log.resize((this._screen.x - this._gutter * 3) / 2,this._screen.y / 4);
this.log.reposition(0,this._screen.y);
this.watch.resize((this._screen.x - this._gutter * 3) / 2,this._screen.y / 4);
this.watch.reposition(this._screen.x,this._screen.y);
this.perf.reposition(this._screen.x,0);
}
}
}
}
@@ -0,0 +1,30 @@
package org.flixel.system
{
import org.flixel.FlxObject;
public class FlxList
{
public var object:FlxObject;
public var next:FlxList;
public function FlxList()
{
super();
this.object = null;
this.next = null;
}
public function destroy() : void
{
this.object = null;
if(this.next != null)
{
this.next.destroy();
}
this.next = null;
}
}
}
@@ -0,0 +1,468 @@
package org.flixel.system
{
import org.flixel.FlxBasic;
import org.flixel.FlxGroup;
import org.flixel.FlxObject;
import org.flixel.FlxRect;
public class FlxQuadTree extends FlxRect
{
public static var divisions:uint;
protected static var _min:uint;
protected static var _object:FlxObject;
protected static var _objectLeftEdge:Number;
protected static var _objectTopEdge:Number;
protected static var _objectRightEdge:Number;
protected static var _objectBottomEdge:Number;
protected static var _list:uint;
protected static var _useBothLists:Boolean;
protected static var _processingCallback:Function;
protected static var _notifyCallback:Function;
protected static var _iterator:FlxList;
protected static var _objectHullX:Number;
protected static var _objectHullY:Number;
protected static var _objectHullWidth:Number;
protected static var _objectHullHeight:Number;
protected static var _checkObjectHullX:Number;
protected static var _checkObjectHullY:Number;
protected static var _checkObjectHullWidth:Number;
protected static var _checkObjectHullHeight:Number;
public static const A_LIST:uint = 0;
public static const B_LIST:uint = 1;
protected var _canSubdivide:Boolean;
protected var _headA:FlxList;
protected var _tailA:FlxList;
protected var _headB:FlxList;
protected var _tailB:FlxList;
protected var _northWestTree:FlxQuadTree;
protected var _northEastTree:FlxQuadTree;
protected var _southEastTree:FlxQuadTree;
protected var _southWestTree:FlxQuadTree;
protected var _leftEdge:Number;
protected var _rightEdge:Number;
protected var _topEdge:Number;
protected var _bottomEdge:Number;
protected var _halfWidth:Number;
protected var _halfHeight:Number;
protected var _midpointX:Number;
protected var _midpointY:Number;
public function FlxQuadTree(param1:Number, param2:Number, param3:Number, param4:Number, param5:FlxQuadTree = null)
{
var _loc6_:FlxList = null;
var _loc7_:FlxList = null;
super(param1,param2,param3,param4);
this._headA = this._tailA = new FlxList();
this._headB = this._tailB = new FlxList();
if(param5 != null)
{
if(param5._headA.object != null)
{
_loc6_ = param5._headA;
while(_loc6_ != null)
{
if(this._tailA.object != null)
{
_loc7_ = this._tailA;
this._tailA = new FlxList();
_loc7_.next = this._tailA;
}
this._tailA.object = _loc6_.object;
_loc6_ = _loc6_.next;
}
}
if(param5._headB.object != null)
{
_loc6_ = param5._headB;
while(_loc6_ != null)
{
if(this._tailB.object != null)
{
_loc7_ = this._tailB;
this._tailB = new FlxList();
_loc7_.next = this._tailB;
}
this._tailB.object = _loc6_.object;
_loc6_ = _loc6_.next;
}
}
}
else
{
_min = (width + height) / (2 * divisions);
}
this._canSubdivide = width > _min || height > _min;
this._northWestTree = null;
this._northEastTree = null;
this._southEastTree = null;
this._southWestTree = null;
this._leftEdge = x;
this._rightEdge = x + width;
this._halfWidth = width / 2;
this._midpointX = this._leftEdge + this._halfWidth;
this._topEdge = y;
this._bottomEdge = y + height;
this._halfHeight = height / 2;
this._midpointY = this._topEdge + this._halfHeight;
}
public function destroy() : void
{
this._headA.destroy();
this._headA = null;
this._tailA.destroy();
this._tailA = null;
this._headB.destroy();
this._headB = null;
this._tailB.destroy();
this._tailB = null;
if(this._northWestTree != null)
{
this._northWestTree.destroy();
}
this._northWestTree = null;
if(this._northEastTree != null)
{
this._northEastTree.destroy();
}
this._northEastTree = null;
if(this._southEastTree != null)
{
this._southEastTree.destroy();
}
this._southEastTree = null;
if(this._southWestTree != null)
{
this._southWestTree.destroy();
}
this._southWestTree = null;
_object = null;
_processingCallback = null;
_notifyCallback = null;
}
public function load(param1:FlxBasic, param2:FlxBasic = null, param3:Function = null, param4:Function = null) : void
{
this.add(param1,A_LIST);
if(param2 != null)
{
this.add(param2,B_LIST);
_useBothLists = true;
}
else
{
_useBothLists = false;
}
_notifyCallback = param3;
_processingCallback = param4;
}
public function add(param1:FlxBasic, param2:uint) : void
{
var _loc3_:uint = 0;
var _loc4_:FlxBasic = null;
var _loc5_:Array = null;
var _loc6_:uint = 0;
_list = param2;
if(param1 is FlxGroup)
{
_loc3_ = 0;
_loc5_ = (param1 as FlxGroup).members;
_loc6_ = _loc5_.length;
while(_loc3_ < _loc6_)
{
_loc4_ = _loc5_[_loc3_++] as FlxBasic;
if(_loc4_ != null && _loc4_.exists)
{
if(_loc4_ is FlxGroup)
{
this.add(_loc4_,param2);
}
else if(_loc4_ is FlxObject)
{
_object = _loc4_ as FlxObject;
if(_object.exists && Boolean(_object.allowCollisions))
{
_objectLeftEdge = _object.x;
_objectTopEdge = _object.y;
_objectRightEdge = _object.x + _object.width;
_objectBottomEdge = _object.y + _object.height;
this.addObject();
}
}
}
}
}
else
{
_object = param1 as FlxObject;
if(_object.exists && Boolean(_object.allowCollisions))
{
_objectLeftEdge = _object.x;
_objectTopEdge = _object.y;
_objectRightEdge = _object.x + _object.width;
_objectBottomEdge = _object.y + _object.height;
this.addObject();
}
}
}
protected function addObject() : void
{
if(!this._canSubdivide || this._leftEdge >= _objectLeftEdge && this._rightEdge <= _objectRightEdge && this._topEdge >= _objectTopEdge && this._bottomEdge <= _objectBottomEdge)
{
this.addToList();
return;
}
if(_objectLeftEdge > this._leftEdge && _objectRightEdge < this._midpointX)
{
if(_objectTopEdge > this._topEdge && _objectBottomEdge < this._midpointY)
{
if(this._northWestTree == null)
{
this._northWestTree = new FlxQuadTree(this._leftEdge,this._topEdge,this._halfWidth,this._halfHeight,this);
}
this._northWestTree.addObject();
return;
}
if(_objectTopEdge > this._midpointY && _objectBottomEdge < this._bottomEdge)
{
if(this._southWestTree == null)
{
this._southWestTree = new FlxQuadTree(this._leftEdge,this._midpointY,this._halfWidth,this._halfHeight,this);
}
this._southWestTree.addObject();
return;
}
}
if(_objectLeftEdge > this._midpointX && _objectRightEdge < this._rightEdge)
{
if(_objectTopEdge > this._topEdge && _objectBottomEdge < this._midpointY)
{
if(this._northEastTree == null)
{
this._northEastTree = new FlxQuadTree(this._midpointX,this._topEdge,this._halfWidth,this._halfHeight,this);
}
this._northEastTree.addObject();
return;
}
if(_objectTopEdge > this._midpointY && _objectBottomEdge < this._bottomEdge)
{
if(this._southEastTree == null)
{
this._southEastTree = new FlxQuadTree(this._midpointX,this._midpointY,this._halfWidth,this._halfHeight,this);
}
this._southEastTree.addObject();
return;
}
}
if(_objectRightEdge > this._leftEdge && _objectLeftEdge < this._midpointX && _objectBottomEdge > this._topEdge && _objectTopEdge < this._midpointY)
{
if(this._northWestTree == null)
{
this._northWestTree = new FlxQuadTree(this._leftEdge,this._topEdge,this._halfWidth,this._halfHeight,this);
}
this._northWestTree.addObject();
}
if(_objectRightEdge > this._midpointX && _objectLeftEdge < this._rightEdge && _objectBottomEdge > this._topEdge && _objectTopEdge < this._midpointY)
{
if(this._northEastTree == null)
{
this._northEastTree = new FlxQuadTree(this._midpointX,this._topEdge,this._halfWidth,this._halfHeight,this);
}
this._northEastTree.addObject();
}
if(_objectRightEdge > this._midpointX && _objectLeftEdge < this._rightEdge && _objectBottomEdge > this._midpointY && _objectTopEdge < this._bottomEdge)
{
if(this._southEastTree == null)
{
this._southEastTree = new FlxQuadTree(this._midpointX,this._midpointY,this._halfWidth,this._halfHeight,this);
}
this._southEastTree.addObject();
}
if(_objectRightEdge > this._leftEdge && _objectLeftEdge < this._midpointX && _objectBottomEdge > this._midpointY && _objectTopEdge < this._bottomEdge)
{
if(this._southWestTree == null)
{
this._southWestTree = new FlxQuadTree(this._leftEdge,this._midpointY,this._halfWidth,this._halfHeight,this);
}
this._southWestTree.addObject();
}
}
protected function addToList() : void
{
var _loc1_:FlxList = null;
if(_list == A_LIST)
{
if(this._tailA.object != null)
{
_loc1_ = this._tailA;
this._tailA = new FlxList();
_loc1_.next = this._tailA;
}
this._tailA.object = _object;
}
else
{
if(this._tailB.object != null)
{
_loc1_ = this._tailB;
this._tailB = new FlxList();
_loc1_.next = this._tailB;
}
this._tailB.object = _object;
}
if(!this._canSubdivide)
{
return;
}
if(this._northWestTree != null)
{
this._northWestTree.addToList();
}
if(this._northEastTree != null)
{
this._northEastTree.addToList();
}
if(this._southEastTree != null)
{
this._southEastTree.addToList();
}
if(this._southWestTree != null)
{
this._southWestTree.addToList();
}
}
public function execute() : Boolean
{
var _loc2_:FlxList = null;
var _loc1_:Boolean = false;
if(this._headA.object != null)
{
_loc2_ = this._headA;
while(_loc2_ != null)
{
_object = _loc2_.object;
if(_useBothLists)
{
_iterator = this._headB;
}
else
{
_iterator = _loc2_.next;
}
if(_object.exists && _object.allowCollisions > 0 && _iterator != null && _iterator.object != null && _iterator.object.exists && this.overlapNode())
{
_loc1_ = true;
}
_loc2_ = _loc2_.next;
}
}
if(this._northWestTree != null && this._northWestTree.execute())
{
_loc1_ = true;
}
if(this._northEastTree != null && this._northEastTree.execute())
{
_loc1_ = true;
}
if(this._southEastTree != null && this._southEastTree.execute())
{
_loc1_ = true;
}
if(this._southWestTree != null && this._southWestTree.execute())
{
_loc1_ = true;
}
return _loc1_;
}
protected function overlapNode() : Boolean
{
var _loc2_:FlxObject = null;
var _loc1_:Boolean = false;
while(_iterator != null)
{
if(!_object.exists || _object.allowCollisions <= 0)
{
break;
}
_loc2_ = _iterator.object;
if(_object === _loc2_ || !_loc2_.exists || _loc2_.allowCollisions <= 0)
{
_iterator = _iterator.next;
}
else
{
_objectHullX = _object.x < _object.last.x ? _object.x : _object.last.x;
_objectHullY = _object.y < _object.last.y ? _object.y : _object.last.y;
_objectHullWidth = _object.x - _object.last.x;
_objectHullWidth = _object.width + (_objectHullWidth > 0 ? _objectHullWidth : -_objectHullWidth);
_objectHullHeight = _object.y - _object.last.y;
_objectHullHeight = _object.height + (_objectHullHeight > 0 ? _objectHullHeight : -_objectHullHeight);
_checkObjectHullX = _loc2_.x < _loc2_.last.x ? _loc2_.x : _loc2_.last.x;
_checkObjectHullY = _loc2_.y < _loc2_.last.y ? _loc2_.y : _loc2_.last.y;
_checkObjectHullWidth = _loc2_.x - _loc2_.last.x;
_checkObjectHullWidth = _loc2_.width + (_checkObjectHullWidth > 0 ? _checkObjectHullWidth : -_checkObjectHullWidth);
_checkObjectHullHeight = _loc2_.y - _loc2_.last.y;
_checkObjectHullHeight = _loc2_.height + (_checkObjectHullHeight > 0 ? _checkObjectHullHeight : -_checkObjectHullHeight);
if(_objectHullX + _objectHullWidth > _checkObjectHullX && _objectHullX < _checkObjectHullX + _checkObjectHullWidth && _objectHullY + _objectHullHeight > _checkObjectHullY && _objectHullY < _checkObjectHullY + _checkObjectHullHeight)
{
if(_processingCallback == null || Boolean(_processingCallback(_object,_loc2_)))
{
_loc1_ = true;
}
if(_loc1_ && _notifyCallback != null)
{
_notifyCallback(_object,_loc2_);
}
}
_iterator = _iterator.next;
}
}
return _loc1_;
}
}
}
@@ -0,0 +1,153 @@
package org.flixel.system
{
import org.flixel.FlxG;
import org.flixel.system.replay.FrameRecord;
import org.flixel.system.replay.MouseRecord;
public class FlxReplay
{
public var seed:Number;
public var frame:int;
public var frameCount:int;
public var finished:Boolean;
protected var _frames:Array;
protected var _capacity:int;
protected var _marker:int;
public function FlxReplay()
{
super();
this.seed = 0;
this.frame = 0;
this.frameCount = 0;
this.finished = false;
this._frames = null;
this._capacity = 0;
this._marker = 0;
}
public function destroy() : void
{
if(this._frames == null)
{
return;
}
var _loc1_:* = int(this.frameCount - 1);
while(_loc1_ >= 0)
{
(this._frames[_loc1_--] as FrameRecord).destroy();
}
this._frames = null;
}
public function create(param1:Number) : void
{
this.destroy();
this.init();
this.seed = param1;
this.rewind();
}
public function load(param1:String) : void
{
var _loc3_:String = null;
this.init();
var _loc2_:Array = param1.split("\n");
this.seed = Number(_loc2_[0]);
var _loc4_:uint = 1;
var _loc5_:uint = _loc2_.length;
while(_loc4_ < _loc5_)
{
_loc3_ = _loc2_[_loc4_++] as String;
if(_loc3_.length > 3)
{
var _loc6_:Number;
this._frames[_loc6_ = this.frameCount++] = new FrameRecord().load(_loc3_);
if(this.frameCount >= this._capacity)
{
this._capacity *= 2;
this._frames.length = this._capacity;
}
}
}
this.rewind();
}
protected function init() : void
{
this._capacity = 100;
this._frames = new Array(this._capacity);
this.frameCount = 0;
}
public function save() : String
{
if(this.frameCount <= 0)
{
return null;
}
var _loc1_:String = this.seed + "\n";
var _loc2_:uint = 0;
while(_loc2_ < this.frameCount)
{
_loc1_ += this._frames[_loc2_++].save() + "\n";
}
return _loc1_;
}
public function recordFrame() : void
{
var _loc1_:Array = FlxG.keys.record();
var _loc2_:MouseRecord = FlxG.mouse.record();
if(_loc1_ == null && _loc2_ == null)
{
++this.frame;
return;
}
this._frames[this.frameCount++] = new FrameRecord().create(this.frame++,_loc1_,_loc2_);
if(this.frameCount >= this._capacity)
{
this._capacity *= 2;
this._frames.length = this._capacity;
}
}
public function playNextFrame() : void
{
FlxG.resetInput();
if(this._marker >= this.frameCount)
{
this.finished = true;
return;
}
if((this._frames[this._marker] as FrameRecord).frame != this.frame++)
{
return;
}
var _loc1_:FrameRecord = this._frames[this._marker++];
if(_loc1_.keys != null)
{
FlxG.keys.playback(_loc1_.keys);
}
if(_loc1_.mouse != null)
{
FlxG.mouse.playback(_loc1_.mouse);
}
}
public function rewind() : void
{
this._marker = 0;
this.frame = 0;
this.finished = false;
}
}
}
@@ -0,0 +1,41 @@
package org.flixel.system
{
import org.flixel.FlxObject;
import org.flixel.FlxTilemap;
public class FlxTile extends FlxObject
{
public var callback:Function;
public var filter:Class;
public var tilemap:FlxTilemap;
public var index:uint;
public var mapIndex:uint;
public function FlxTile(param1:FlxTilemap, param2:uint, param3:Number, param4:Number, param5:Boolean, param6:uint)
{
super(0,0,param3,param4);
immovable = true;
moves = false;
this.callback = null;
this.filter = null;
this.tilemap = param1;
this.index = param2;
visible = param5;
allowCollisions = param6;
this.mapIndex = 0;
}
override public function destroy() : void
{
super.destroy();
this.callback = null;
this.tilemap = null;
}
}
}
@@ -0,0 +1,76 @@
package org.flixel.system
{
import flash.display.BitmapData;
import flash.geom.Point;
import flash.geom.Rectangle;
import org.flixel.FlxCamera;
import org.flixel.FlxG;
import org.flixel.FlxU;
public class FlxTilemapBuffer
{
public var x:Number;
public var y:Number;
public var width:Number;
public var height:Number;
public var dirty:Boolean;
public var rows:uint;
public var columns:uint;
protected var _pixels:BitmapData;
protected var _flashRect:Rectangle;
public function FlxTilemapBuffer(param1:Number, param2:Number, param3:uint, param4:uint, param5:FlxCamera = null)
{
super();
if(param5 == null)
{
param5 = FlxG.camera;
}
this.columns = FlxU.ceil(param5.width / param1) + 1;
if(this.columns > param3)
{
this.columns = param3;
}
this.rows = FlxU.ceil(param5.height / param2) + 1;
if(this.rows > param4)
{
this.rows = param4;
}
this._pixels = new BitmapData(this.columns * param1,this.rows * param2,true,0);
this.width = this._pixels.width;
this.height = this._pixels.height;
this._flashRect = new Rectangle(0,0,this.width,this.height);
this.dirty = true;
}
public function destroy() : void
{
this._pixels = null;
}
public function fill(param1:uint = 0) : void
{
this._pixels.fillRect(this._flashRect,param1);
}
public function get pixels() : BitmapData
{
return this._pixels;
}
public function draw(param1:FlxCamera, param2:Point) : void
{
param1.buffer.copyPixels(this._pixels,this._flashRect,param2,null,null,true);
}
}
}
@@ -0,0 +1,234 @@
package org.flixel.system
{
import flash.display.Bitmap;
import flash.display.BitmapData;
import flash.display.Sprite;
import flash.events.Event;
import flash.events.MouseEvent;
import flash.geom.Point;
import flash.geom.Rectangle;
import flash.text.TextField;
import flash.text.TextFormat;
import org.flixel.FlxU;
public class FlxWindow extends Sprite
{
protected var ImgHandle:Class = FlxWindow_ImgHandle;
public var minSize:Point;
public var maxSize:Point;
protected var _width:uint;
protected var _height:uint;
protected var _bounds:Rectangle;
protected var _background:Bitmap;
protected var _header:Bitmap;
protected var _shadow:Bitmap;
protected var _title:TextField;
protected var _handle:Bitmap;
protected var _overHeader:Boolean;
protected var _overHandle:Boolean;
protected var _drag:Point;
protected var _dragging:Boolean;
protected var _resizing:Boolean;
protected var _resizable:Boolean;
public function FlxWindow(param1:String, param2:Number, param3:Number, param4:Boolean = true, param5:Rectangle = null, param6:uint = 2139062143, param7:uint = 2130706432)
{
super();
this._width = param2;
this._height = param3;
this._bounds = param5;
this.minSize = new Point(50,30);
if(this._bounds != null)
{
this.maxSize = new Point(this._bounds.width,this._bounds.height);
}
else
{
this.maxSize = new Point(Number.MAX_VALUE,Number.MAX_VALUE);
}
this._drag = new Point();
this._resizable = param4;
this._shadow = new Bitmap(new BitmapData(1,2,true,4278190080));
addChild(this._shadow);
this._background = new Bitmap(new BitmapData(1,1,true,param6));
this._background.y = 15;
addChild(this._background);
this._header = new Bitmap(new BitmapData(1,15,true,param7));
addChild(this._header);
this._title = new TextField();
this._title.x = 2;
this._title.height = 16;
this._title.selectable = false;
this._title.multiline = false;
this._title.defaultTextFormat = new TextFormat("Courier",12,16777215);
this._title.text = param1;
addChild(this._title);
if(this._resizable)
{
this._handle = new this.ImgHandle();
addChild(this._handle);
}
if(this._width != 0 || this._height != 0)
{
this.updateSize();
}
this.bound();
addEventListener(Event.ENTER_FRAME,this.init);
}
public function destroy() : void
{
this.minSize = null;
this.maxSize = null;
this._bounds = null;
removeChild(this._shadow);
this._shadow = null;
removeChild(this._background);
this._background = null;
removeChild(this._header);
this._header = null;
removeChild(this._title);
this._title = null;
if(this._handle != null)
{
removeChild(this._handle);
}
this._handle = null;
this._drag = null;
}
public function resize(param1:Number, param2:Number) : void
{
this._width = param1;
this._height = param2;
this.updateSize();
}
public function reposition(param1:Number, param2:Number) : void
{
x = param1;
y = param2;
this.bound();
}
protected function init(param1:Event = null) : void
{
if(root == null)
{
return;
}
removeEventListener(Event.ENTER_FRAME,this.init);
stage.addEventListener(MouseEvent.MOUSE_MOVE,this.onMouseMove);
stage.addEventListener(MouseEvent.MOUSE_DOWN,this.onMouseDown);
stage.addEventListener(MouseEvent.MOUSE_UP,this.onMouseUp);
}
protected function onMouseMove(param1:MouseEvent = null) : void
{
if(this._dragging)
{
this._overHeader = true;
this.reposition(parent.mouseX - this._drag.x,parent.mouseY - this._drag.y);
}
else if(this._resizing)
{
this._overHandle = true;
this.resize(mouseX - this._drag.x,mouseY - this._drag.y);
}
else if(mouseX >= 0 && mouseX <= this._width && mouseY >= 0 && mouseY <= this._height)
{
this._overHeader = mouseX <= this._header.width && mouseY <= this._header.height;
if(this._resizable)
{
this._overHandle = mouseX >= this._width - this._handle.width && mouseY >= this._height - this._handle.height;
}
}
else
{
this._overHandle = this._overHeader = false;
}
this.updateGUI();
}
protected function onMouseDown(param1:MouseEvent = null) : void
{
if(this._overHeader)
{
this._dragging = true;
this._drag.x = mouseX;
this._drag.y = mouseY;
}
else if(this._overHandle)
{
this._resizing = true;
this._drag.x = this._width - mouseX;
this._drag.y = this._height - mouseY;
}
}
protected function onMouseUp(param1:MouseEvent = null) : void
{
this._dragging = false;
this._resizing = false;
}
protected function bound() : void
{
if(this._bounds != null)
{
x = FlxU.bound(x,this._bounds.left,this._bounds.right - this._width);
y = FlxU.bound(y,this._bounds.top,this._bounds.bottom - this._height);
}
}
protected function updateSize() : void
{
this._width = FlxU.bound(this._width,this.minSize.x,this.maxSize.x);
this._height = FlxU.bound(this._height,this.minSize.y,this.maxSize.y);
this._header.scaleX = this._width;
this._background.scaleX = this._width;
this._background.scaleY = this._height - 15;
this._shadow.scaleX = this._width;
this._shadow.y = this._height;
this._title.width = this._width - 4;
if(this._resizable)
{
this._handle.x = this._width - this._handle.width;
this._handle.y = this._height - this._handle.height;
}
}
protected function updateGUI() : void
{
if(this._overHeader || this._overHandle)
{
if(this._title.alpha != 1)
{
this._title.alpha = 1;
}
}
else if(this._title.alpha != 0.65)
{
this._title.alpha = 0.65;
}
}
}
}
@@ -0,0 +1,15 @@
package org.flixel.system
{
import mx.core.BitmapAsset;
[Embed(source="/_assets/110_org.flixel.system.FlxWindow_ImgHandle.png")]
public class FlxWindow_ImgHandle extends BitmapAsset
{
public function FlxWindow_ImgHandle()
{
super();
}
}
}
@@ -0,0 +1,75 @@
package org.flixel.system.debug
{
import flash.geom.Rectangle;
import flash.text.TextField;
import flash.text.TextFormat;
import org.flixel.system.FlxWindow;
public class Log extends FlxWindow
{
protected static const MAX_LOG_LINES:uint = 200;
protected var _text:TextField;
protected var _lines:Array;
public function Log(param1:String, param2:Number, param3:Number, param4:Boolean = true, param5:Rectangle = null, param6:uint = 2139062143, param7:uint = 2130706432)
{
super(param1,param2,param3,param4,param5,param6,param7);
this._text = new TextField();
this._text.x = 2;
this._text.y = 15;
this._text.multiline = true;
this._text.wordWrap = true;
this._text.selectable = true;
this._text.defaultTextFormat = new TextFormat("Courier",12,16777215);
addChild(this._text);
this._lines = new Array();
}
override public function destroy() : void
{
removeChild(this._text);
this._text = null;
this._lines = null;
super.destroy();
}
public function add(param1:String) : void
{
var _loc2_:String = null;
var _loc3_:uint = 0;
if(this._lines.length <= 0)
{
this._text.text = "";
}
this._lines.push(param1);
if(this._lines.length > MAX_LOG_LINES)
{
this._lines.shift();
_loc2_ = "";
_loc3_ = 0;
while(_loc3_ < this._lines.length)
{
_loc2_ += this._lines[_loc3_] + "\n";
_loc3_++;
}
this._text.text = _loc2_;
}
else
{
this._text.appendText(param1 + "\n");
}
this._text.scrollV = this._text.height;
}
override protected function updateSize() : void
{
super.updateSize();
this._text.width = _width - 10;
this._text.height = _height - 15;
}
}
}
@@ -0,0 +1,176 @@
package org.flixel.system.debug
{
import flash.geom.Rectangle;
import flash.system.System;
import flash.text.TextField;
import flash.text.TextFormat;
import flash.utils.getTimer;
import org.flixel.FlxG;
import org.flixel.system.FlxWindow;
public class Perf extends FlxWindow
{
protected var _text:TextField;
protected var _lastTime:int;
protected var _updateTimer:int;
protected var _flixelUpdate:Array;
protected var _flixelUpdateMarker:uint;
protected var _flixelDraw:Array;
protected var _flixelDrawMarker:uint;
protected var _flash:Array;
protected var _flashMarker:uint;
protected var _activeObject:Array;
protected var _objectMarker:uint;
protected var _visibleObject:Array;
protected var _visibleObjectMarker:uint;
public function Perf(param1:String, param2:Number, param3:Number, param4:Boolean = true, param5:Rectangle = null, param6:uint = 2139062143, param7:uint = 2130706432)
{
super(param1,param2,param3,param4,param5,param6,param7);
resize(90,66);
this._lastTime = 0;
this._updateTimer = 0;
this._text = new TextField();
this._text.width = _width;
this._text.x = 2;
this._text.y = 15;
this._text.multiline = true;
this._text.wordWrap = true;
this._text.selectable = true;
this._text.defaultTextFormat = new TextFormat("Courier",12,16777215);
addChild(this._text);
this._flixelUpdate = new Array(32);
this._flixelUpdateMarker = 0;
this._flixelDraw = new Array(32);
this._flixelDrawMarker = 0;
this._flash = new Array(32);
this._flashMarker = 0;
this._activeObject = new Array(32);
this._objectMarker = 0;
this._visibleObject = new Array(32);
this._visibleObjectMarker = 0;
}
override public function destroy() : void
{
removeChild(this._text);
this._text = null;
this._flixelUpdate = null;
this._flixelDraw = null;
this._flash = null;
this._activeObject = null;
this._visibleObject = null;
super.destroy();
}
public function update() : void
{
var _loc4_:uint = 0;
var _loc5_:String = null;
var _loc6_:Number = NaN;
var _loc7_:uint = 0;
var _loc8_:uint = 0;
var _loc9_:uint = 0;
var _loc10_:uint = 0;
var _loc11_:uint = 0;
var _loc1_:int = getTimer();
var _loc2_:int = _loc1_ - this._lastTime;
var _loc3_:uint = 500;
if(_loc2_ > _loc3_)
{
_loc2_ = int(_loc3_);
}
this._lastTime = _loc1_;
this._updateTimer += _loc2_;
if(this._updateTimer > _loc3_)
{
_loc5_ = "";
_loc6_ = 0;
_loc4_ = 0;
while(_loc4_ < this._flashMarker)
{
_loc6_ += this._flash[_loc4_++];
}
_loc6_ /= this._flashMarker;
_loc5_ += uint(1 / (_loc6_ / 1000)) + "/" + FlxG.flashFramerate + "fps\n";
_loc5_ = _loc5_ + (Number((System.totalMemory * 9.54e-7).toFixed(2)) + "MB\n");
_loc7_ = 0;
_loc4_ = 0;
while(_loc4_ < this._flixelUpdateMarker)
{
_loc7_ += this._flixelUpdate[_loc4_++];
}
_loc8_ = 0;
_loc9_ = 0;
_loc4_ = 0;
while(_loc4_ < this._objectMarker)
{
_loc8_ += this._activeObject[_loc4_];
_loc11_ += this._visibleObject[_loc4_++];
}
_loc8_ /= this._objectMarker;
_loc5_ += "U:" + _loc8_ + " " + uint(_loc7_ / this._flixelDrawMarker) + "ms\n";
_loc10_ = 0;
_loc4_ = 0;
while(_loc4_ < this._flixelDrawMarker)
{
_loc10_ += this._flixelDraw[_loc4_++];
}
_loc11_ = 0;
_loc4_ = 0;
while(_loc4_ < this._visibleObjectMarker)
{
_loc11_ += this._visibleObject[_loc4_++];
}
_loc11_ /= this._visibleObjectMarker;
_loc5_ += "D:" + _loc11_ + " " + uint(_loc10_ / this._flixelDrawMarker) + "ms";
this._text.text = _loc5_;
this._flixelUpdateMarker = 0;
this._flixelDrawMarker = 0;
this._flashMarker = 0;
this._objectMarker = 0;
this._visibleObjectMarker = 0;
this._updateTimer -= _loc3_;
}
}
public function flixelUpdate(param1:int) : void
{
this._flixelUpdate[this._flixelUpdateMarker++] = param1;
}
public function flixelDraw(param1:int) : void
{
this._flixelDraw[this._flixelDrawMarker++] = param1;
}
public function flash(param1:int) : void
{
this._flash[this._flashMarker++] = param1;
}
public function activeObjects(param1:int) : void
{
this._activeObject[this._objectMarker++] = param1;
}
public function visibleObjects(param1:int) : void
{
this._visibleObject[this._visibleObjectMarker++] = param1;
}
}
}
@@ -0,0 +1,490 @@
package org.flixel.system.debug
{
import flash.display.Bitmap;
import flash.display.Sprite;
import flash.events.Event;
import flash.events.IOErrorEvent;
import flash.events.MouseEvent;
import flash.net.FileFilter;
import flash.net.FileReference;
import flash.text.TextField;
import flash.text.TextFormat;
import flash.utils.ByteArray;
import org.flixel.FlxG;
import org.flixel.FlxU;
public class VCR extends Sprite
{
protected static const FILE_TYPES:Array = [new FileFilter("Flixel Game Recording","*.fgr")];
protected static const DEFAULT_FILE_NAME:String = "replay.fgr";
protected var ImgOpen:Class = VCR_ImgOpen;
protected var ImgRecordOff:Class = VCR_ImgRecordOff;
protected var ImgRecordOn:Class = VCR_ImgRecordOn;
protected var ImgStop:Class = VCR_ImgStop;
protected var ImgFlixel:Class = VCR_ImgFlixel;
protected var ImgRestart:Class = VCR_ImgRestart;
protected var ImgPause:Class = VCR_ImgPause;
protected var ImgPlay:Class = VCR_ImgPlay;
protected var ImgStep:Class = VCR_ImgStep;
public var paused:Boolean;
public var stepRequested:Boolean;
protected var _open:Bitmap;
protected var _recordOff:Bitmap;
protected var _recordOn:Bitmap;
protected var _stop:Bitmap;
protected var _flixel:Bitmap;
protected var _restart:Bitmap;
protected var _pause:Bitmap;
protected var _play:Bitmap;
protected var _step:Bitmap;
protected var _overOpen:Boolean;
protected var _overRecord:Boolean;
protected var _overRestart:Boolean;
protected var _overPause:Boolean;
protected var _overStep:Boolean;
protected var _pressingOpen:Boolean;
protected var _pressingRecord:Boolean;
protected var _pressingRestart:Boolean;
protected var _pressingPause:Boolean;
protected var _pressingStep:Boolean;
protected var _file:FileReference;
protected var _runtimeDisplay:TextField;
protected var _runtime:uint;
public function VCR()
{
super();
var _loc1_:uint = 7;
this._open = new this.ImgOpen();
addChild(this._open);
this._recordOff = new this.ImgRecordOff();
this._recordOff.x = this._open.x + this._open.width + _loc1_;
addChild(this._recordOff);
this._recordOn = new this.ImgRecordOn();
this._recordOn.x = this._recordOff.x;
this._recordOn.visible = false;
addChild(this._recordOn);
this._stop = new this.ImgStop();
this._stop.x = this._recordOff.x;
this._stop.visible = false;
addChild(this._stop);
this._flixel = new this.ImgFlixel();
this._flixel.x = this._recordOff.x + this._recordOff.width + _loc1_;
addChild(this._flixel);
this._restart = new this.ImgRestart();
this._restart.x = this._flixel.x + this._flixel.width + _loc1_;
addChild(this._restart);
this._pause = new this.ImgPause();
this._pause.x = this._restart.x + this._restart.width + _loc1_;
addChild(this._pause);
this._play = new this.ImgPlay();
this._play.x = this._pause.x;
this._play.visible = false;
addChild(this._play);
this._step = new this.ImgStep();
this._step.x = this._pause.x + this._pause.width + _loc1_;
addChild(this._step);
this._runtimeDisplay = new TextField();
this._runtimeDisplay.width = width;
this._runtimeDisplay.x = width;
this._runtimeDisplay.y = -2;
this._runtimeDisplay.multiline = false;
this._runtimeDisplay.wordWrap = false;
this._runtimeDisplay.selectable = false;
this._runtimeDisplay.defaultTextFormat = new TextFormat("Courier",12,16777215,null,null,null,null,null,"center");
this._runtimeDisplay.visible = false;
addChild(this._runtimeDisplay);
this._runtime = 0;
this.stepRequested = false;
this._file = null;
this.unpress();
this.checkOver();
this.updateGUI();
addEventListener(Event.ENTER_FRAME,this.init);
}
public function destroy() : void
{
this._file = null;
removeChild(this._open);
this._open = null;
removeChild(this._recordOff);
this._recordOff = null;
removeChild(this._recordOn);
this._recordOn = null;
removeChild(this._stop);
this._stop = null;
removeChild(this._flixel);
this._flixel = null;
removeChild(this._restart);
this._restart = null;
removeChild(this._pause);
this._pause = null;
removeChild(this._play);
this._play = null;
removeChild(this._step);
this._step = null;
stage.removeEventListener(MouseEvent.MOUSE_MOVE,this.onMouseMove);
stage.removeEventListener(MouseEvent.MOUSE_DOWN,this.onMouseDown);
stage.removeEventListener(MouseEvent.MOUSE_UP,this.onMouseUp);
}
public function recording() : void
{
this._stop.visible = false;
this._recordOff.visible = false;
this._recordOn.visible = true;
}
public function stopped() : void
{
this._stop.visible = false;
this._recordOn.visible = false;
this._recordOff.visible = true;
}
public function playing() : void
{
this._recordOff.visible = false;
this._recordOn.visible = false;
this._stop.visible = true;
}
public function updateRuntime(param1:uint) : void
{
this._runtime += param1;
this._runtimeDisplay.text = FlxU.formatTime(this._runtime / 1000,true);
if(!this._runtimeDisplay.visible)
{
this._runtimeDisplay.visible = true;
}
}
public function onOpen() : void
{
this._file = new FileReference();
this._file.addEventListener(Event.SELECT,this.onOpenSelect);
this._file.addEventListener(Event.CANCEL,this.onOpenCancel);
this._file.browse(FILE_TYPES);
}
protected function onOpenSelect(param1:Event = null) : void
{
this._file.removeEventListener(Event.SELECT,this.onOpenSelect);
this._file.removeEventListener(Event.CANCEL,this.onOpenCancel);
this._file.addEventListener(Event.COMPLETE,this.onOpenComplete);
this._file.addEventListener(IOErrorEvent.IO_ERROR,this.onOpenError);
this._file.load();
}
protected function onOpenComplete(param1:Event = null) : void
{
this._file.removeEventListener(Event.COMPLETE,this.onOpenComplete);
this._file.removeEventListener(IOErrorEvent.IO_ERROR,this.onOpenError);
var _loc2_:String = null;
var _loc3_:ByteArray = this._file.data;
if(_loc3_ != null)
{
_loc2_ = _loc3_.readUTFBytes(_loc3_.bytesAvailable);
}
this._file = null;
if(_loc2_ == null || _loc2_.length <= 0)
{
return FlxG.log("ERROR: Empty flixel gameplay record.");
}
FlxG.loadReplay(_loc2_);
}
protected function onOpenCancel(param1:Event = null) : void
{
this._file.removeEventListener(Event.SELECT,this.onOpenSelect);
this._file.removeEventListener(Event.CANCEL,this.onOpenCancel);
this._file = null;
}
protected function onOpenError(param1:Event = null) : void
{
this._file.removeEventListener(Event.COMPLETE,this.onOpenComplete);
this._file.removeEventListener(IOErrorEvent.IO_ERROR,this.onOpenError);
this._file = null;
FlxG.log("ERROR: Unable to open flixel gameplay record.");
}
public function onRecord(param1:Boolean = false) : void
{
if(this._play.visible)
{
this.onPlay();
}
FlxG.recordReplay(param1);
}
public function stopRecording() : void
{
var _loc1_:String = FlxG.stopRecording();
if(_loc1_ != null && _loc1_.length > 0)
{
this._file = new FileReference();
this._file.addEventListener(Event.COMPLETE,this.onSaveComplete);
this._file.addEventListener(Event.CANCEL,this.onSaveCancel);
this._file.addEventListener(IOErrorEvent.IO_ERROR,this.onSaveError);
this._file.save(_loc1_,DEFAULT_FILE_NAME);
}
}
protected function onSaveComplete(param1:Event = null) : void
{
this._file.removeEventListener(Event.COMPLETE,this.onSaveComplete);
this._file.removeEventListener(Event.CANCEL,this.onSaveCancel);
this._file.removeEventListener(IOErrorEvent.IO_ERROR,this.onSaveError);
this._file = null;
FlxG.log("FLIXEL: successfully saved flixel gameplay record.");
}
protected function onSaveCancel(param1:Event = null) : void
{
this._file.removeEventListener(Event.COMPLETE,this.onSaveComplete);
this._file.removeEventListener(Event.CANCEL,this.onSaveCancel);
this._file.removeEventListener(IOErrorEvent.IO_ERROR,this.onSaveError);
this._file = null;
}
protected function onSaveError(param1:Event = null) : void
{
this._file.removeEventListener(Event.COMPLETE,this.onSaveComplete);
this._file.removeEventListener(Event.CANCEL,this.onSaveCancel);
this._file.removeEventListener(IOErrorEvent.IO_ERROR,this.onSaveError);
this._file = null;
FlxG.log("ERROR: problem saving flixel gameplay record.");
}
public function onStop() : void
{
FlxG.stopReplay();
}
public function onRestart(param1:Boolean = false) : void
{
if(FlxG.reloadReplay(param1))
{
this._recordOff.visible = false;
this._recordOn.visible = false;
this._stop.visible = true;
}
}
public function onPause() : void
{
this.paused = true;
this._pause.visible = false;
this._play.visible = true;
}
public function onPlay() : void
{
this.paused = false;
this._play.visible = false;
this._pause.visible = true;
}
public function onStep() : void
{
if(!this.paused)
{
this.onPause();
}
this.stepRequested = true;
}
protected function init(param1:Event = null) : void
{
if(root == null)
{
return;
}
removeEventListener(Event.ENTER_FRAME,this.init);
stage.addEventListener(MouseEvent.MOUSE_MOVE,this.onMouseMove);
stage.addEventListener(MouseEvent.MOUSE_DOWN,this.onMouseDown);
stage.addEventListener(MouseEvent.MOUSE_UP,this.onMouseUp);
}
protected function onMouseMove(param1:MouseEvent = null) : void
{
if(!this.checkOver())
{
this.unpress();
}
this.updateGUI();
}
protected function onMouseDown(param1:MouseEvent = null) : void
{
this.unpress();
if(this._overOpen)
{
this._pressingOpen = true;
}
if(this._overRecord)
{
this._pressingRecord = true;
}
if(this._overRestart)
{
this._pressingRestart = true;
}
if(this._overPause)
{
this._pressingPause = true;
}
if(this._overStep)
{
this._pressingStep = true;
}
}
protected function onMouseUp(param1:MouseEvent = null) : void
{
if(this._overOpen && this._pressingOpen)
{
this.onOpen();
}
else if(this._overRecord && this._pressingRecord)
{
if(this._stop.visible)
{
this.onStop();
}
else if(this._recordOn.visible)
{
this.stopRecording();
}
else
{
this.onRecord(!param1.altKey);
}
}
else if(this._overRestart && this._pressingRestart)
{
this.onRestart(!param1.altKey);
}
else if(this._overPause && this._pressingPause)
{
if(this._play.visible)
{
this.onPlay();
}
else
{
this.onPause();
}
}
else if(this._overStep && this._pressingStep)
{
this.onStep();
}
this.unpress();
this.checkOver();
this.updateGUI();
}
protected function checkOver() : Boolean
{
return false;
}
protected function unpress() : void
{
this._pressingOpen = false;
this._pressingRecord = false;
this._pressingRestart = false;
this._pressingPause = false;
this._pressingStep = false;
}
protected function updateGUI() : void
{
if(this._recordOn.visible)
{
this._open.alpha = this._restart.alpha = this._pause.alpha = this._step.alpha = 0.35;
this._recordOn.alpha = 1;
return;
}
if(this._overOpen && this._open.alpha != 1)
{
this._open.alpha = 1;
}
else if(!this._overOpen && this._open.alpha != 0.8)
{
this._open.alpha = 0.8;
}
if(this._overRecord && this._recordOff.alpha != 1)
{
this._recordOff.alpha = this._recordOn.alpha = this._stop.alpha = 1;
}
else if(!this._overRecord && this._recordOff.alpha != 0.8)
{
this._recordOff.alpha = this._recordOn.alpha = this._stop.alpha = 0.8;
}
if(this._overRestart && this._restart.alpha != 1)
{
this._restart.alpha = 1;
}
else if(!this._overRestart && this._restart.alpha != 0.8)
{
this._restart.alpha = 0.8;
}
if(this._overPause && this._pause.alpha != 1)
{
this._pause.alpha = this._play.alpha = 1;
}
else if(!this._overPause && this._pause.alpha != 0.8)
{
this._pause.alpha = this._play.alpha = 0.8;
}
if(this._overStep && this._step.alpha != 1)
{
this._step.alpha = 1;
}
else if(!this._overStep && this._step.alpha != 0.8)
{
this._step.alpha = 0.8;
}
}
}
}
@@ -0,0 +1,15 @@
package org.flixel.system.debug
{
import mx.core.BitmapAsset;
[Embed(source="/_assets/108_org.flixel.system.debug.VCR_ImgFlixel.png")]
public class VCR_ImgFlixel extends BitmapAsset
{
public function VCR_ImgFlixel()
{
super();
}
}
}
@@ -0,0 +1,15 @@
package org.flixel.system.debug
{
import mx.core.BitmapAsset;
[Embed(source="/_assets/157_org.flixel.system.debug.VCR_ImgOpen.png")]
public class VCR_ImgOpen extends BitmapAsset
{
public function VCR_ImgOpen()
{
super();
}
}
}
@@ -0,0 +1,15 @@
package org.flixel.system.debug
{
import mx.core.BitmapAsset;
[Embed(source="/_assets/251_org.flixel.system.debug.VCR_ImgPause.png")]
public class VCR_ImgPause extends BitmapAsset
{
public function VCR_ImgPause()
{
super();
}
}
}
@@ -0,0 +1,15 @@
package org.flixel.system.debug
{
import mx.core.BitmapAsset;
[Embed(source="/_assets/86_org.flixel.system.debug.VCR_ImgPlay.png")]
public class VCR_ImgPlay extends BitmapAsset
{
public function VCR_ImgPlay()
{
super();
}
}
}
@@ -0,0 +1,15 @@
package org.flixel.system.debug
{
import mx.core.BitmapAsset;
[Embed(source="/_assets/71_org.flixel.system.debug.VCR_ImgRecordOff.png")]
public class VCR_ImgRecordOff extends BitmapAsset
{
public function VCR_ImgRecordOff()
{
super();
}
}
}
@@ -0,0 +1,15 @@
package org.flixel.system.debug
{
import mx.core.BitmapAsset;
[Embed(source="/_assets/286_org.flixel.system.debug.VCR_ImgRecordOn.png")]
public class VCR_ImgRecordOn extends BitmapAsset
{
public function VCR_ImgRecordOn()
{
super();
}
}
}
@@ -0,0 +1,15 @@
package org.flixel.system.debug
{
import mx.core.BitmapAsset;
[Embed(source="/_assets/301_org.flixel.system.debug.VCR_ImgRestart.png")]
public class VCR_ImgRestart extends BitmapAsset
{
public function VCR_ImgRestart()
{
super();
}
}
}
@@ -0,0 +1,15 @@
package org.flixel.system.debug
{
import mx.core.BitmapAsset;
[Embed(source="/_assets/113_org.flixel.system.debug.VCR_ImgStep.png")]
public class VCR_ImgStep extends BitmapAsset
{
public function VCR_ImgStep()
{
super();
}
}
}
@@ -0,0 +1,15 @@
package org.flixel.system.debug
{
import mx.core.BitmapAsset;
[Embed(source="/_assets/272_org.flixel.system.debug.VCR_ImgStop.png")]
public class VCR_ImgStop extends BitmapAsset
{
public function VCR_ImgStop()
{
super();
}
}
}
@@ -0,0 +1,129 @@
package org.flixel.system.debug
{
import flash.display.Bitmap;
import flash.display.Sprite;
import flash.events.Event;
import flash.events.MouseEvent;
import org.flixel.FlxG;
public class Vis extends Sprite
{
protected var ImgBounds:Class = Vis_ImgBounds;
protected var _bounds:Bitmap;
protected var _overBounds:Boolean;
protected var _pressingBounds:Boolean;
public function Vis()
{
super();
var _loc1_:uint = 7;
this._bounds = new this.ImgBounds();
addChild(this._bounds);
this.unpress();
this.checkOver();
this.updateGUI();
addEventListener(Event.ENTER_FRAME,this.init);
}
public function destroy() : void
{
removeChild(this._bounds);
this._bounds = null;
stage.removeEventListener(MouseEvent.MOUSE_MOVE,this.onMouseMove);
stage.removeEventListener(MouseEvent.MOUSE_DOWN,this.onMouseDown);
stage.removeEventListener(MouseEvent.MOUSE_UP,this.onMouseUp);
}
public function onBounds() : void
{
}
protected function init(param1:Event = null) : void
{
if(root == null)
{
return;
}
removeEventListener(Event.ENTER_FRAME,this.init);
stage.addEventListener(MouseEvent.MOUSE_MOVE,this.onMouseMove);
stage.addEventListener(MouseEvent.MOUSE_DOWN,this.onMouseDown);
stage.addEventListener(MouseEvent.MOUSE_UP,this.onMouseUp);
}
protected function onMouseMove(param1:MouseEvent = null) : void
{
if(!this.checkOver())
{
this.unpress();
}
this.updateGUI();
}
protected function onMouseDown(param1:MouseEvent = null) : void
{
this.unpress();
if(this._overBounds)
{
this._pressingBounds = true;
}
}
protected function onMouseUp(param1:MouseEvent = null) : void
{
if(this._overBounds && this._pressingBounds)
{
this.onBounds();
}
this.unpress();
this.checkOver();
this.updateGUI();
}
protected function checkOver() : Boolean
{
this._overBounds = false;
if(mouseX < 0 || mouseX > width || mouseY < 0 || mouseY > height)
{
return false;
}
if(mouseX > this._bounds.x || mouseX < this._bounds.x + this._bounds.width)
{
this._overBounds = true;
}
return true;
}
protected function unpress() : void
{
this._pressingBounds = false;
}
protected function updateGUI() : void
{
if(FlxG.visualDebug)
{
if(this._overBounds && this._bounds.alpha != 1)
{
this._bounds.alpha = 1;
}
else if(!this._overBounds && this._bounds.alpha != 0.9)
{
this._bounds.alpha = 0.9;
}
}
else if(this._overBounds && this._bounds.alpha != 0.6)
{
this._bounds.alpha = 0.6;
}
else if(!this._overBounds && this._bounds.alpha != 0.5)
{
this._bounds.alpha = 0.5;
}
}
}
}
@@ -0,0 +1,15 @@
package org.flixel.system.debug
{
import mx.core.BitmapAsset;
[Embed(source="/_assets/222_org.flixel.system.debug.Vis_ImgBounds.png")]
public class Vis_ImgBounds extends BitmapAsset
{
public function Vis_ImgBounds()
{
super();
}
}
}
@@ -0,0 +1,162 @@
package org.flixel.system.debug
{
import flash.display.Sprite;
import flash.geom.Rectangle;
import org.flixel.system.FlxWindow;
public class Watch extends FlxWindow
{
protected static const MAX_LOG_LINES:uint = 1024;
protected static const LINE_HEIGHT:uint = 15;
public var editing:Boolean;
protected var _names:Sprite;
protected var _values:Sprite;
protected var _watching:Array;
public function Watch(param1:String, param2:Number, param3:Number, param4:Boolean = true, param5:Rectangle = null, param6:uint = 2139062143, param7:uint = 2130706432)
{
super(param1,param2,param3,param4,param5,param6,param7);
this._names = new Sprite();
this._names.x = 2;
this._names.y = 15;
addChild(this._names);
this._values = new Sprite();
this._values.x = 2;
this._values.y = 15;
addChild(this._values);
this._watching = new Array();
this.editing = false;
this.removeAll();
}
override public function destroy() : void
{
removeChild(this._names);
this._names = null;
removeChild(this._values);
this._values = null;
var _loc1_:* = 0;
var _loc2_:uint = this._watching.length;
while(_loc1_ < _loc2_)
{
(this._watching[_loc1_++] as WatchEntry).destroy();
}
this._watching = null;
super.destroy();
}
public function add(param1:Object, param2:String, param3:String = null) : void
{
var _loc4_:WatchEntry = null;
var _loc5_:* = 0;
var _loc6_:uint = this._watching.length;
while(_loc5_ < _loc6_)
{
_loc4_ = this._watching[_loc5_++] as WatchEntry;
if(_loc4_.object == param1 && _loc4_.field == param2)
{
return;
}
}
_loc4_ = new WatchEntry(this._watching.length * LINE_HEIGHT,_width / 2,_width / 2 - 10,param1,param2,param3);
this._names.addChild(_loc4_.nameDisplay);
this._values.addChild(_loc4_.valueDisplay);
this._watching.push(_loc4_);
}
public function remove(param1:Object, param2:String = null) : void
{
var _loc3_:WatchEntry = null;
var _loc4_:* = int(this._watching.length - 1);
while(_loc4_ >= 0)
{
_loc3_ = this._watching[_loc4_];
if(_loc3_.object == param1 && (param2 == null || _loc3_.field == param2))
{
this._watching.splice(_loc4_,1);
this._names.removeChild(_loc3_.nameDisplay);
this._values.removeChild(_loc3_.valueDisplay);
_loc3_.destroy();
}
_loc4_--;
}
_loc3_ = null;
_loc4_ = 0;
var _loc5_:uint = this._watching.length;
while(_loc4_ < _loc5_)
{
(this._watching[_loc4_] as WatchEntry).setY(_loc4_ * LINE_HEIGHT);
_loc4_++;
}
}
public function removeAll() : void
{
var _loc1_:WatchEntry = null;
var _loc2_:int = 0;
var _loc3_:uint = this._watching.length;
while(_loc2_ < _loc3_)
{
_loc1_ = this._watching.pop();
this._names.removeChild(_loc1_.nameDisplay);
this._values.removeChild(_loc1_.valueDisplay);
_loc1_.destroy();
_loc2_++;
}
this._watching.length = 0;
}
public function update() : void
{
this.editing = false;
var _loc1_:uint = 0;
var _loc2_:uint = this._watching.length;
while(_loc1_ < _loc2_)
{
if(!(this._watching[_loc1_++] as WatchEntry).updateValue())
{
this.editing = true;
}
}
}
public function submit() : void
{
var _loc3_:WatchEntry = null;
var _loc1_:uint = 0;
var _loc2_:uint = this._watching.length;
while(_loc1_ < _loc2_)
{
_loc3_ = this._watching[_loc1_++] as WatchEntry;
if(_loc3_.editing)
{
_loc3_.submit();
}
}
this.editing = false;
}
override protected function updateSize() : void
{
if(_height < this._watching.length * LINE_HEIGHT + 17)
{
_height = this._watching.length * LINE_HEIGHT + 17;
}
super.updateSize();
this._values.x = _width / 2 + 2;
var _loc1_:* = 0;
var _loc2_:uint = this._watching.length;
while(_loc1_ < _loc2_)
{
(this._watching[_loc1_++] as WatchEntry).updateWidth(_width / 2,_width / 2 - 10);
}
}
}
}
@@ -0,0 +1,152 @@
package org.flixel.system.debug
{
import flash.events.KeyboardEvent;
import flash.events.MouseEvent;
import flash.text.TextField;
import flash.text.TextFieldType;
import flash.text.TextFormat;
import org.flixel.FlxU;
public class WatchEntry
{
public var object:Object;
public var field:String;
public var custom:String;
public var nameDisplay:TextField;
public var valueDisplay:TextField;
public var editing:Boolean;
public var oldValue:Object;
protected var _whiteText:TextFormat;
protected var _blackText:TextFormat;
public function WatchEntry(param1:Number, param2:Number, param3:Number, param4:Object, param5:String, param6:String = null)
{
super();
this.editing = false;
this.object = param4;
this.field = param5;
this.custom = param6;
this._whiteText = new TextFormat("Courier",12,16777215);
this._blackText = new TextFormat("Courier",12,0);
this.nameDisplay = new TextField();
this.nameDisplay.y = param1;
this.nameDisplay.multiline = false;
this.nameDisplay.selectable = true;
this.nameDisplay.defaultTextFormat = this._whiteText;
this.valueDisplay = new TextField();
this.valueDisplay.y = param1;
this.valueDisplay.height = 15;
this.valueDisplay.multiline = false;
this.valueDisplay.selectable = true;
this.valueDisplay.doubleClickEnabled = true;
this.valueDisplay.addEventListener(KeyboardEvent.KEY_UP,this.onKeyUp);
this.valueDisplay.addEventListener(MouseEvent.MOUSE_UP,this.onMouseUp);
this.valueDisplay.background = false;
this.valueDisplay.backgroundColor = 16777215;
this.valueDisplay.defaultTextFormat = this._whiteText;
this.updateWidth(param2,param3);
}
public function destroy() : void
{
this.object = null;
this.oldValue = null;
this.nameDisplay = null;
this.field = null;
this.custom = null;
this.valueDisplay.removeEventListener(MouseEvent.MOUSE_UP,this.onMouseUp);
this.valueDisplay.removeEventListener(KeyboardEvent.KEY_UP,this.onKeyUp);
this.valueDisplay = null;
}
public function setY(param1:Number) : void
{
this.nameDisplay.y = param1;
this.valueDisplay.y = param1;
}
public function updateWidth(param1:Number, param2:Number) : void
{
this.nameDisplay.width = param1;
this.valueDisplay.width = param2;
if(this.custom != null)
{
this.nameDisplay.text = this.custom;
}
else
{
this.nameDisplay.text = "";
if(param1 > 120)
{
this.nameDisplay.appendText(FlxU.getClassName(this.object,param1 < 240) + ".");
}
this.nameDisplay.appendText(this.field);
}
}
public function updateValue() : Boolean
{
if(this.editing)
{
return false;
}
this.valueDisplay.text = this.object[this.field].toString();
return true;
}
public function onMouseUp(param1:MouseEvent) : void
{
this.editing = true;
this.oldValue = this.object[this.field];
this.valueDisplay.type = TextFieldType.INPUT;
this.valueDisplay.setTextFormat(this._blackText);
this.valueDisplay.background = true;
}
public function onKeyUp(param1:KeyboardEvent) : void
{
if(param1.keyCode == 13 || param1.keyCode == 9 || param1.keyCode == 27)
{
if(param1.keyCode == 27)
{
this.cancel();
}
else
{
this.submit();
}
}
}
public function cancel() : void
{
this.valueDisplay.text = this.oldValue.toString();
this.doneEditing();
}
public function submit() : void
{
this.object[this.field] = this.valueDisplay.text;
this.doneEditing();
}
protected function doneEditing() : void
{
this.valueDisplay.type = TextFieldType.DYNAMIC;
this.valueDisplay.setTextFormat(this._whiteText);
this.valueDisplay.defaultTextFormat = this._whiteText;
this.valueDisplay.background = false;
this.editing = false;
}
}
}
@@ -0,0 +1,155 @@
package org.flixel.system.input
{
public class Input
{
internal var _lookup:Object;
internal var _map:Array;
internal const _total:uint = 256;
public function Input()
{
super();
this._lookup = new Object();
this._map = new Array(this._total);
}
public function update() : void
{
var _loc2_:Object = null;
var _loc1_:uint = 0;
while(_loc1_ < this._total)
{
_loc2_ = this._map[_loc1_++];
if(_loc2_ != null)
{
if(_loc2_.last == -1 && _loc2_.current == -1)
{
_loc2_.current = 0;
}
else if(_loc2_.last == 2 && _loc2_.current == 2)
{
_loc2_.current = 1;
}
_loc2_.last = _loc2_.current;
}
}
}
public function reset() : void
{
var _loc2_:Object = null;
var _loc1_:uint = 0;
while(_loc1_ < this._total)
{
_loc2_ = this._map[_loc1_++];
if(_loc2_ != null)
{
this[_loc2_.name] = false;
_loc2_.current = 0;
_loc2_.last = 0;
}
}
}
public function pressed(param1:String) : Boolean
{
return this[param1];
}
public function justPressed(param1:String) : Boolean
{
return this._map[this._lookup[param1]].current == 2;
}
public function unJustPressed(param1:String) : void
{
this._map[this._lookup[param1]].current = 1;
}
public function justReleased(param1:String) : Boolean
{
return this._map[this._lookup[param1]].current == -1;
}
public function record() : Array
{
var _loc3_:Object = null;
var _loc1_:Array = null;
var _loc2_:uint = 0;
while(_loc2_ < this._total)
{
_loc3_ = this._map[_loc2_++];
if(!(_loc3_ == null || _loc3_.current == 0))
{
if(_loc1_ == null)
{
_loc1_ = new Array();
}
_loc1_.push({
"code":_loc2_ - 1,
"value":_loc3_.current
});
}
}
return _loc1_;
}
public function playback(param1:Array) : void
{
var _loc4_:Object = null;
var _loc5_:Object = null;
var _loc2_:uint = 0;
var _loc3_:uint = param1.length;
while(_loc2_ < _loc3_)
{
_loc4_ = param1[_loc2_++];
_loc5_ = this._map[_loc4_.code];
_loc5_.current = _loc4_.value;
if(_loc4_.value > 0)
{
this[_loc5_.name] = true;
}
}
}
public function getKeyCode(param1:String) : int
{
return this._lookup[param1];
}
public function any() : Boolean
{
var _loc2_:Object = null;
var _loc1_:uint = 0;
while(_loc1_ < this._total)
{
_loc2_ = this._map[_loc1_++];
if(_loc2_ != null && _loc2_.current > 0)
{
return true;
}
}
return false;
}
protected function addKey(param1:String, param2:uint) : void
{
this._lookup[param1] = param2;
this._map[param2] = {
"name":param1,
"current":0,
"last":0
};
}
public function destroy() : void
{
this._lookup = null;
this._map = null;
}
}
}
@@ -0,0 +1,298 @@
package org.flixel.system.input
{
import flash.events.KeyboardEvent;
public class Keyboard extends Input
{
public var ESCAPE:Boolean;
public var F1:Boolean;
public var F2:Boolean;
public var F3:Boolean;
public var F4:Boolean;
public var F5:Boolean;
public var F6:Boolean;
public var F7:Boolean;
public var F8:Boolean;
public var F9:Boolean;
public var F10:Boolean;
public var F11:Boolean;
public var F12:Boolean;
public var ONE:Boolean;
public var TWO:Boolean;
public var THREE:Boolean;
public var FOUR:Boolean;
public var FIVE:Boolean;
public var SIX:Boolean;
public var SEVEN:Boolean;
public var EIGHT:Boolean;
public var NINE:Boolean;
public var ZERO:Boolean;
public var NUMPADONE:Boolean;
public var NUMPADTWO:Boolean;
public var NUMPADTHREE:Boolean;
public var NUMPADFOUR:Boolean;
public var NUMPADFIVE:Boolean;
public var NUMPADSIX:Boolean;
public var NUMPADSEVEN:Boolean;
public var NUMPADEIGHT:Boolean;
public var NUMPADNINE:Boolean;
public var NUMPADZERO:Boolean;
public var PAGEUP:Boolean;
public var PAGEDOWN:Boolean;
public var HOME:Boolean;
public var END:Boolean;
public var INSERT:Boolean;
public var MINUS:Boolean;
public var NUMPADMINUS:Boolean;
public var PLUS:Boolean;
public var NUMPADPLUS:Boolean;
public var DELETE:Boolean;
public var BACKSPACE:Boolean;
public var TAB:Boolean;
public var Q:Boolean;
public var W:Boolean;
public var E:Boolean;
public var R:Boolean;
public var T:Boolean;
public var Y:Boolean;
public var U:Boolean;
public var I:Boolean;
public var O:Boolean;
public var P:Boolean;
public var LBRACKET:Boolean;
public var RBRACKET:Boolean;
public var BACKSLASH:Boolean;
public var CAPSLOCK:Boolean;
public var A:Boolean;
public var S:Boolean;
public var D:Boolean;
public var F:Boolean;
public var G:Boolean;
public var H:Boolean;
public var J:Boolean;
public var K:Boolean;
public var L:Boolean;
public var SEMICOLON:Boolean;
public var QUOTE:Boolean;
public var ENTER:Boolean;
public var SHIFT:Boolean;
public var Z:Boolean;
public var X:Boolean;
public var C:Boolean;
public var V:Boolean;
public var B:Boolean;
public var N:Boolean;
public var M:Boolean;
public var COMMA:Boolean;
public var PERIOD:Boolean;
public var NUMPADPERIOD:Boolean;
public var SLASH:Boolean;
public var NUMPADSLASH:Boolean;
public var CONTROL:Boolean;
public var ALT:Boolean;
public var SPACE:Boolean;
public var UP:Boolean;
public var DOWN:Boolean;
public var LEFT:Boolean;
public var RIGHT:Boolean;
public function Keyboard()
{
var _loc1_:uint = 0;
super();
_loc1_ = 65;
while(_loc1_ <= 90)
{
addKey(String.fromCharCode(_loc1_),_loc1_++);
}
_loc1_ = 48;
addKey("ZERO",_loc1_++);
addKey("ONE",_loc1_++);
addKey("TWO",_loc1_++);
addKey("THREE",_loc1_++);
addKey("FOUR",_loc1_++);
addKey("FIVE",_loc1_++);
addKey("SIX",_loc1_++);
addKey("SEVEN",_loc1_++);
addKey("EIGHT",_loc1_++);
addKey("NINE",_loc1_++);
_loc1_ = 96;
addKey("NUMPADZERO",_loc1_++);
addKey("NUMPADONE",_loc1_++);
addKey("NUMPADTWO",_loc1_++);
addKey("NUMPADTHREE",_loc1_++);
addKey("NUMPADFOUR",_loc1_++);
addKey("NUMPADFIVE",_loc1_++);
addKey("NUMPADSIX",_loc1_++);
addKey("NUMPADSEVEN",_loc1_++);
addKey("NUMPADEIGHT",_loc1_++);
addKey("NUMPADNINE",_loc1_++);
addKey("PAGEUP",33);
addKey("PAGEDOWN",34);
addKey("HOME",36);
addKey("END",35);
addKey("INSERT",45);
_loc1_ = 1;
while(_loc1_ <= 12)
{
addKey("F" + _loc1_,111 + _loc1_++);
}
addKey("ESCAPE",27);
addKey("MINUS",189);
addKey("NUMPADMINUS",109);
addKey("PLUS",187);
addKey("NUMPADPLUS",107);
addKey("DELETE",46);
addKey("BACKSPACE",8);
addKey("LBRACKET",219);
addKey("RBRACKET",221);
addKey("BACKSLASH",220);
addKey("CAPSLOCK",20);
addKey("SEMICOLON",186);
addKey("QUOTE",222);
addKey("ENTER",13);
addKey("SHIFT",16);
addKey("COMMA",188);
addKey("PERIOD",190);
addKey("NUMPADPERIOD",110);
addKey("SLASH",191);
addKey("NUMPADSLASH",191);
addKey("CONTROL",17);
addKey("ALT",18);
addKey("SPACE",32);
addKey("UP",38);
addKey("DOWN",40);
addKey("LEFT",37);
addKey("RIGHT",39);
addKey("TAB",9);
}
public function handleKeyDown(param1:KeyboardEvent) : void
{
var _loc2_:Object = _map[param1.keyCode];
if(_loc2_ == null)
{
return;
}
if(_loc2_.current > 0)
{
_loc2_.current = 1;
}
else
{
_loc2_.current = 2;
}
this[_loc2_.name] = true;
}
public function handleKeyUp(param1:KeyboardEvent) : void
{
var _loc2_:Object = _map[param1.keyCode];
if(_loc2_ == null)
{
return;
}
if(_loc2_.current > 0)
{
_loc2_.current = -1;
}
else
{
_loc2_.current = 0;
}
this[_loc2_.name] = false;
}
}
}
@@ -0,0 +1,243 @@
package org.flixel.system.input
{
import flash.display.Bitmap;
import flash.display.Sprite;
import flash.events.MouseEvent;
import org.flixel.FlxCamera;
import org.flixel.FlxG;
import org.flixel.FlxPoint;
import org.flixel.system.replay.MouseRecord;
public class Mouse extends FlxPoint
{
protected var ImgDefaultCursor:Class = Mouse_ImgDefaultCursor;
public var wheel:int;
public var screenX:int;
public var screenY:int;
protected var _current:int;
protected var _last:int;
protected var _cursorContainer:Sprite;
protected var _cursor:Bitmap;
protected var _lastX:int;
protected var _lastY:int;
protected var _lastWheel:int;
protected var _point:FlxPoint;
protected var _screenPosition:FlxPoint;
public function Mouse(param1:Sprite)
{
super();
this._cursorContainer = param1;
this._lastX = this.screenX = 0;
this._lastY = this.screenY = 0;
this._lastWheel = this.wheel = 0;
this._current = 0;
this._last = 0;
this._cursor = null;
this._point = new FlxPoint();
this._screenPosition = new FlxPoint();
}
public function destroy() : void
{
this._cursorContainer = null;
this._cursor = null;
this._point = null;
this._screenPosition = null;
}
public function show(param1:Class = null, param2:Number = 1, param3:int = 0, param4:int = 0) : void
{
this._cursorContainer.visible = true;
if(param1 != null)
{
this.load(param1,param2,param3,param4);
}
else if(this._cursor == null)
{
this.load();
}
}
public function hide() : void
{
this._cursorContainer.visible = false;
}
public function get visible() : Boolean
{
return this._cursorContainer.visible;
}
public function load(param1:Class = null, param2:Number = 1, param3:int = 0, param4:int = 0) : void
{
if(this._cursor != null)
{
this._cursorContainer.removeChild(this._cursor);
}
if(param1 == null)
{
param1 = this.ImgDefaultCursor;
}
this._cursor = new param1();
this._cursor.x = param3;
this._cursor.y = param4;
this._cursor.scaleX = param2;
this._cursor.scaleY = param2;
this._cursorContainer.addChild(this._cursor);
}
public function unload() : void
{
if(this._cursor != null)
{
if(this._cursorContainer.visible)
{
this.load();
}
else
{
this._cursorContainer.removeChild(this._cursor);
this._cursor = null;
}
}
}
public function update(param1:int, param2:int) : void
{
this._screenPosition.make(param1,param2);
this.getScreenPosition(null,this._point);
this.screenX = this._point.x;
this.screenY = this._point.y;
this.updateCursor();
if(this._last == -1 && this._current == -1)
{
this._current = 0;
}
else if(this._last == 2 && this._current == 2)
{
this._current = 1;
}
this._last = this._current;
}
protected function updateCursor() : void
{
this.getWorldPosition(null,this);
this._cursorContainer.x = this._screenPosition.x;
this._cursorContainer.y = this._screenPosition.y;
}
public function getWorldPosition(param1:FlxCamera = null, param2:FlxPoint = null) : FlxPoint
{
if(param1 == null)
{
param1 = FlxG.camera;
}
if(param2 == null)
{
param2 = new FlxPoint();
}
this.getScreenPosition(param1,this._point);
return param2.make(this._point.x + param1.scroll.x,this._point.y + param1.scroll.y);
}
public function getScreenPosition(param1:FlxCamera = null, param2:FlxPoint = null) : FlxPoint
{
if(param1 == null)
{
param1 = FlxG.camera;
}
if(param2 == null)
{
param2 = new FlxPoint();
}
return param2.make(this._screenPosition.x / param1.zoom,this._screenPosition.y / param1.zoom);
}
public function reset() : void
{
this._current = 0;
this._last = 0;
}
public function pressed() : Boolean
{
return this._current > 0;
}
public function justPressed() : Boolean
{
return this._current == 2;
}
public function justReleased() : Boolean
{
return this._current == -1;
}
public function handleMouseDown(param1:MouseEvent) : void
{
if(this._current > 0)
{
this._current = 1;
}
else
{
this._current = 2;
}
}
public function handleMouseUp(param1:MouseEvent) : void
{
if(this._current > 0)
{
this._current = -1;
}
else
{
this._current = 0;
}
}
public function handleMouseWheel(param1:MouseEvent) : void
{
this.wheel = param1.delta;
}
public function record() : MouseRecord
{
if(this._lastX == this.screenX && this._lastY == this.screenY && this._current == 0 && this._lastWheel == this.wheel)
{
return null;
}
this._lastX = this.screenX;
this._lastY = this.screenY;
this._lastWheel = this.wheel;
return new MouseRecord(this.screenX,this.screenY,this._current,this.wheel);
}
public function playback(param1:MouseRecord) : void
{
this.screenX = param1.x;
this.screenY = param1.y;
this._current = param1.button;
this.wheel = param1.wheel;
this.updateCursor();
}
}
}
@@ -0,0 +1,15 @@
package org.flixel.system.input
{
import mx.core.BitmapAsset;
[Embed(source="/_assets/181_org.flixel.system.input.Mouse_ImgDefaultCursor.png")]
public class Mouse_ImgDefaultCursor extends BitmapAsset
{
public function Mouse_ImgDefaultCursor()
{
super();
}
}
}
@@ -0,0 +1,105 @@
package org.flixel.system.replay
{
public class FrameRecord
{
public var frame:int;
public var keys:Array;
public var mouse:MouseRecord;
public function FrameRecord()
{
super();
this.frame = 0;
this.keys = null;
this.mouse = null;
}
public function create(param1:Number, param2:Array = null, param3:MouseRecord = null) : FrameRecord
{
this.frame = param1;
this.keys = param2;
this.mouse = param3;
return this;
}
public function destroy() : void
{
this.keys = null;
this.mouse = null;
}
public function save() : String
{
var _loc2_:Object = null;
var _loc3_:uint = 0;
var _loc4_:uint = 0;
var _loc1_:String = this.frame + "k";
if(this.keys != null)
{
_loc3_ = 0;
_loc4_ = this.keys.length;
while(_loc3_ < _loc4_)
{
if(_loc3_ > 0)
{
_loc1_ += ",";
}
_loc2_ = this.keys[_loc3_++];
_loc1_ += _loc2_.code + ":" + _loc2_.value;
}
}
_loc1_ += "m";
if(this.mouse != null)
{
_loc1_ += this.mouse.x + "," + this.mouse.y + "," + this.mouse.button + "," + this.mouse.wheel;
}
return _loc1_;
}
public function load(param1:String) : FrameRecord
{
var _loc2_:uint = 0;
var _loc3_:uint = 0;
var _loc7_:Array = null;
var _loc4_:Array = param1.split("k");
this.frame = int(_loc4_[0] as String);
_loc4_ = (_loc4_[1] as String).split("m");
var _loc5_:String = _loc4_[0];
var _loc6_:String = _loc4_[1];
if(_loc5_.length > 0)
{
_loc4_ = _loc5_.split(",");
_loc2_ = 0;
_loc3_ = _loc4_.length;
while(_loc2_ < _loc3_)
{
_loc7_ = (_loc4_[_loc2_++] as String).split(":");
if(_loc7_.length == 2)
{
if(this.keys == null)
{
this.keys = new Array();
}
this.keys.push({
"code":int(_loc7_[0] as String),
"value":int(_loc7_[1] as String)
});
}
}
}
if(_loc6_.length > 0)
{
_loc4_ = _loc6_.split(",");
if(_loc4_.length >= 4)
{
this.mouse = new MouseRecord(int(_loc4_[0] as String),int(_loc4_[1] as String),int(_loc4_[2] as String),int(_loc4_[3] as String));
}
}
return this;
}
}
}
@@ -0,0 +1,24 @@
package org.flixel.system.replay
{
public class MouseRecord
{
public var x:int;
public var y:int;
public var button:int;
public var wheel:int;
public function MouseRecord(param1:int, param2:int, param3:int, param4:int)
{
super();
this.x = param1;
this.y = param2;
this.button = param3;
this.wheel = param4;
}
}
}