Skip to content

Commit

Permalink
Merge pull request #1 from HaxeFlixel/master
Browse files Browse the repository at this point in the history
Updating Master
  • Loading branch information
SeiferTim committed Jan 23, 2014
2 parents 2650b8b + 690755e commit e63cbd7
Show file tree
Hide file tree
Showing 12 changed files with 1,720 additions and 41 deletions.
8 changes: 3 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,9 @@ before_script:
- sudo apt-get install -qq --force-yes libgd2-xpm ia32-libs ia32-libs-multiarch
- mkdir ~/haxelib
- haxelib setup ~/haxelib
- haxelib install openfl
- haxelib install openfl-native
- haxelib install openfl-html5
- haxelib install openfl-tools
- haxelib run openfl setup linux
- haxelib install lime
- haxelib install lime-tools
- haxelib run lime install openfl
- haxelib install systools
- haxelib install spinehx
- haxelib install actuate
Expand Down
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
v1.0.1
------------------------------
* FlxWeapon: Now works with different bullet classes (that extend FlxBullet)
* FlxBitmapFont.setFontGraphics() is now public
* FlxSpriteAniRot: Fix for non-flash targets
* api.FlxGameJolt added
* TiledLayer: Bugfix for "End of file error"
* text.FlxTypeText added
* FlxNapeState: ShapeDebug works correctly with FlxCamera again, is now also drawn below the flixel debugger, added a button to toggle nape debugging to the debugger
* ui.FlxClickArea added

v1.0.0
------------------------------
* Initial haxelib release
Binary file added assets/images/napeDebug.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/sounds/typetext.wav
Binary file not shown.
875 changes: 875 additions & 0 deletions flixel/addons/api/FlxGameJolt.hx

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion flixel/addons/editors/tiled/TiledLayer.hx
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ class TiledLayer
while (i < data.length - 3)
{
// Ignore whitespace
if (data.charAt(i) == " " || data.charAt(i) == "\n")
if (data.charAt(i) == " " || data.charAt(i) == "\n" || data.charAt(i) == "\r")
{
i++; continue;
}
Expand Down
51 changes: 34 additions & 17 deletions flixel/addons/nape/FlxNapeState.hx
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
package flixel.addons.nape;

import flixel.FlxG;
import flixel.FlxState;
import flixel.system.ui.FlxSystemButton;
import nape.geom.Vec2;
import nape.phys.Body;
import nape.phys.BodyType;
import nape.phys.Material;
import nape.shape.Polygon;
import nape.space.Space;
import flixel.FlxG;
import flixel.FlxState;

#if !FLX_NO_DEBUG
import nape.util.ShapeDebug;
#end

/**
* <code>FlxNapeState</code> is an <code>FlxState</code> that integrates <code>nape.space.Space</code>
* <code>FlxNapeState</code> is a <code>FlxState</code> that integrates <code>nape.space.Space</code>
* to provide Nape physics simulation in Flixel.
*
* Extend this state, add some <code>FlxNapeSprite(s)</code> to start using flixel + nape physics.
Expand Down Expand Up @@ -55,6 +56,11 @@ class FlxNapeState extends FlxState
{
return cast(FlxG.state, FlxNapeState)._physDbgSpr;
}

/**
* Contains a reference to the Nape button in the debugger.
*/
private var _button:FlxSystemButton;
#end

/**
Expand All @@ -69,6 +75,8 @@ class FlxNapeState extends FlxState
}

#if !FLX_NO_DEBUG
// Add a button to toggle Nape debug shapes to the debugger
_button = FlxG.debugger.addButton(RIGHT, "flixel/img/napeDebug.png", toggleDebug, true, true);
napeDebugEnabled = true;
#end
}
Expand Down Expand Up @@ -152,6 +160,8 @@ class FlxNapeState extends FlxState

#if !FLX_NO_DEBUG
napeDebugEnabled = false;
FlxG.debugger.removeButton(_button);
_button = null;
#end
}

Expand All @@ -163,18 +173,21 @@ class FlxNapeState extends FlxState
public function set_napeDebugEnabled(Value:Bool):Bool
{
#if !FLX_NO_DEBUG
_button.toggled = !Value;

if (Value)
{
if (_physDbgSpr == null)
{
_physDbgSpr = new ShapeDebug(FlxG.width, FlxG.height);
_physDbgSpr.drawConstraints = true;
FlxG.stage.addChild(_physDbgSpr.display);
_physDbgSpr.display.scrollRect = null;
FlxG.addChildBelowMouse(_physDbgSpr.display);
}
}
else if (_physDbgSpr != null)
{
FlxG.stage.removeChild(_physDbgSpr.display);
FlxG.removeChild(_physDbgSpr.display);
_physDbgSpr = null;
}
#end
Expand All @@ -198,22 +211,26 @@ class FlxNapeState extends FlxState

var cam = FlxG.camera;
var zoom = cam.zoom;
var sprite = _physDbgSpr.display;

_physDbgSpr.display.scaleX = zoom;
_physDbgSpr.display.scaleY = zoom;
sprite.scaleX = zoom;
sprite.scaleY = zoom;

if (cam.target == null)
{
_physDbgSpr.display.x = cam.scroll.x * zoom;
_physDbgSpr.display.y = cam.scroll.y * zoom;
}
else
sprite.x = -cam.scroll.x * zoom;
sprite.y = -cam.scroll.y * zoom;

if (cam.target != null)
{
_physDbgSpr.display.x = -cam.scroll.x * zoom;
_physDbgSpr.display.y = -cam.scroll.y * zoom;
_physDbgSpr.display.x += (FlxG.width - FlxG.width * zoom) / 2;
_physDbgSpr.display.y += (FlxG.height - FlxG.height * zoom) / 2;
sprite.x += (FlxG.width - FlxG.width * zoom) / 2;
sprite.y += (FlxG.height - FlxG.height * zoom) / 2;
}
#end
}

#if !FLX_NO_DEBUG
private function toggleDebug():Void
{
napeDebugEnabled = !napeDebugEnabled;
}
#end
}
31 changes: 15 additions & 16 deletions flixel/addons/plugin/effects/fx/StarfieldFX.hx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import flixel.util.FlxAngle;
import flixel.util.FlxColor;
import flixel.util.FlxColorUtil;
import flixel.util.FlxGradient;
import flixel.util.FlxMisc;
import flixel.system.layer.DrawStackItem;
import flixel.system.layer.Region;
import flixel.FlxBasic;
Expand Down Expand Up @@ -225,13 +224,13 @@ class StarfieldFX extends BaseFX
canvas.setPixel32(star.x, star.y, _depthColours[Std.int(star.speed - 1)]);
#else
var starColor:Int = _depthColours[Std.int(star.speed - 1)];
var rgba:RGBA = FlxColorUtil.getRGBA(starColor);
var argb:ARGB = FlxColorUtil.getARGB(starColor);

var starDef:StarDef = starArray[i];
starDef.red = rgba.red / 255;
starDef.green = rgba.green / 255;
starDef.blue = rgba.blue / 255;
starDef.alpha = rgba.alpha;
starDef.red = argb.red / 255;
starDef.green = argb.green / 255;
starDef.blue = argb.blue / 255;
starDef.alpha = argb.alpha;
#end

if (star.x > sprite.width)
Expand Down Expand Up @@ -285,15 +284,15 @@ class StarfieldFX extends BaseFX
#if flash
canvas.setPixel32(star.x, star.y, 0xffffffff);
#else
var rgba:RGBA = FlxColorUtil.getRGBA(FlxColor.WHITE);
var argb:ARGB = FlxColorUtil.getARGB(FlxColor.WHITE);
#end

#if !flash
var starDef:StarDef = starArray[i];
starDef.red = rgba.red / 255;
starDef.green = rgba.green / 255;
starDef.blue = rgba.blue / 255;
starDef.alpha = rgba.alpha;
starDef.red = argb.red / 255;
starDef.green = argb.green / 255;
starDef.blue = argb.blue / 255;
starDef.alpha = argb.alpha;
#end
// canvas.setPixel32(star.x, star.y, FlxColorUtil.getColor32(255, star.alpha, star.alpha, star.alpha));

Expand Down Expand Up @@ -394,11 +393,11 @@ private class StarSprite extends FlxSprite

public function setBackgroundColor(bgColor:Int):Void
{
var rgba:RGBA = FlxColorUtil.getRGBA(bgColor);
bgRed = rgba.red / 255;
bgGreen = rgba.green / 255;
bgBlue = rgba.blue / 255;
bgAlpha = rgba.alpha;
var argb:ARGB = FlxColorUtil.getARGB(bgColor);
bgRed = argb.red / 255;
bgGreen = argb.green / 255;
bgBlue = argb.blue / 255;
bgAlpha = argb.alpha;
}

override public function destroy():Void
Expand Down
Loading

0 comments on commit e63cbd7

Please sign in to comment.