Skip to content

Commit

Permalink
test remove pre/post update
Browse files Browse the repository at this point in the history
  • Loading branch information
impaler committed Mar 11, 2013
1 parent 4a0079f commit 3e47516
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 53 deletions.
15 changes: 1 addition & 14 deletions src/org/flixel/FlxBasic.hx
Original file line number Diff line number Diff line change
Expand Up @@ -99,24 +99,11 @@ class FlxBasic
#end
}

/**
* Pre-update is called right before <code>update()</code> on each object in the game loop.
*/
public function preUpdate():Void
{
_ACTIVECOUNT++;
}

/**
* Override this function to update your class's position and appearance.
* This is where most of your game rules and behavioral code will go.
*/
public function update():Void { }

/**
* Post-update is called right after <code>update()</code> on each object in the game loop.
*/
public function postUpdate():Void { }
public function update():Void { _ACTIVECOUNT++; }

/**
* Override this function to control how the object is drawn.
Expand Down
18 changes: 6 additions & 12 deletions src/org/flixel/FlxButton.hx
Original file line number Diff line number Diff line change
Expand Up @@ -192,15 +192,12 @@ class FlxTypedButton<T:FlxSprite> extends FlxSprite
super.destroy();
}


/**
* Since button uses its own mouse handler for thread reasons,
* we run a little pre-check here to make sure that we only add
* the mouse handler when it is actually safe to do so.
* Called by the game loop automatically, handles mouseover and click detection.
*/
override public function preUpdate():Void
override public function update():Void
{
super.preUpdate();

if (!_initialized)
{
if (FlxG.stage != null)
Expand All @@ -214,13 +211,10 @@ class FlxTypedButton<T:FlxSprite> extends FlxSprite
_initialized = true;
}
}
}

super.update();


/**
* Called by the game loop automatically, handles mouseover and click detection.
*/
override public function update():Void
{
updateButton(); //Basic button logic

//Default button appearance is to simply update
Expand Down
2 changes: 1 addition & 1 deletion src/org/flixel/FlxG.hx
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -1877,4 +1877,4 @@ class FlxG
return tween;
}

}
}
32 changes: 22 additions & 10 deletions src/org/flixel/FlxObject.hx
Original file line number Diff line number Diff line change
Expand Up @@ -354,8 +354,23 @@ class FlxObject extends FlxBasic
* tracking the last coordinates for collision purposes,
* and checking if the object is moving along a path or not.
*/
override public function preUpdate():Void
//override public function preUpdate():Void
//{
//
//}

/**
* Post-update is called right after <code>update()</code> on each object in the game loop.
* In <code>FlxObject</code> this function handles integrating the objects motion
* based on the velocity and acceleration settings, and tracking/clearing the <code>touching</code> flags.
*/
override public function update():Void
{



super.update();

FlxBasic._ACTIVECOUNT++;

if(_flickerTimer > 0)
Expand All @@ -375,22 +390,19 @@ class FlxObject extends FlxBasic
{
updatePathMotion();
}
}

/**
* Post-update is called right after <code>update()</code> on each object in the game loop.
* In <code>FlxObject</code> this function handles integrating the objects motion
* based on the velocity and acceleration settings, and tracking/clearing the <code>touching</code> flags.
*/
override public function postUpdate():Void
{


super.update();

if (moves)
{
updateMotion();
}

wasTouching = touching;
touching = NONE;


}

/**
Expand Down
2 changes: 2 additions & 0 deletions src/org/flixel/FlxParticle.hx
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ class FlxParticle extends FlxSprite
drag.x = 0;
}
}

super.update();
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/org/flixel/FlxSprite.hx
Original file line number Diff line number Diff line change
Expand Up @@ -621,9 +621,9 @@ class FlxSprite extends FlxObject
* Automatically called after update() by the game loop,
* this function just calls updateAnimation().
*/
override public function postUpdate():Void
override public function update():Void
{
super.postUpdate();
super.update();
updateAnimation();
}

Expand Down
11 changes: 0 additions & 11 deletions src/org/flixel/FlxState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -233,15 +233,4 @@ class FlxState extends FlxGroup
{

}

/**
* This function is inlined because it never gets called on FlxState objects.
* Put your code in the update() function.
*/
override public inline function preUpdate():Void {}
/**
* This function is inlined because it never gets called on FlxState objects.
* Put your code in the update() function.
*/
override public inline function postUpdate():Void {}
}
6 changes: 3 additions & 3 deletions src/org/flixel/FlxTypedGroup.hx
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ class FlxTypedGroup<T:FlxBasic> extends FlxBasic
/**
* Just making sure we don't increment the active objects count.
*/
override public function preUpdate():Void { }
//override public function preUpdate():Void { }

/**
* Automatically goes through and calls update on everything you added.
Expand All @@ -105,15 +105,15 @@ class FlxTypedGroup<T:FlxBasic> extends FlxBasic
basic = members[i++];
if ((basic != null) && basic.exists && basic.active)
{
basic.preUpdate();

basic.update();

if (basic.hasTween)
{
basic.updateTweens();
}

basic.postUpdate();

}
}

Expand Down

0 comments on commit 3e47516

Please sign in to comment.