DebugLayer use zoom-independent thickness of 1
This commit is contained in:
@@ -35,14 +35,9 @@
|
|||||||
(method &override :Void update [:Float elapsed]
|
(method &override :Void update [:Float elapsed]
|
||||||
(super.update elapsed)
|
(super.update elapsed)
|
||||||
|
|
||||||
(debugLayer.clear)
|
|
||||||
(debugLayer.drawRect 0 0 100 100 FlxColor.TRANSPARENT (object thickness t color FlxColor.LIME))
|
|
||||||
(when FlxG.keys.justPressed.ONE
|
|
||||||
(+= t 1))
|
|
||||||
(when FlxG.keys.justPressed.TWO
|
|
||||||
(-= t 1))
|
|
||||||
|
|
||||||
(#when debug
|
(#when debug
|
||||||
|
(debugLayer.clear)
|
||||||
(doFor s rewardSprites
|
(doFor s rewardSprites
|
||||||
//(s.drawCircle s.origin.x s.origin.y 5 FlxColor.LIME)
|
//(s.drawCircle s.origin.x s.origin.y 5 FlxColor.LIME)
|
||||||
//(debugLayer.drawCircle (- s.x cameraBounds.x) (- s.y cameraBounds.y) 5 FlxColor.LIME)
|
//(debugLayer.drawCircle (- s.x cameraBounds.x) (- s.y cameraBounds.y) 5 FlxColor.LIME)
|
||||||
@@ -50,7 +45,7 @@
|
|||||||
(let [matchZones [(matchZoneLeft s) (matchZoneRight s)(matchZoneUp s)(matchZoneDown s)]]
|
(let [matchZones [(matchZoneLeft s) (matchZoneRight s)(matchZoneUp s)(matchZoneDown s)]]
|
||||||
(doFor z matchZones
|
(doFor z matchZones
|
||||||
(unless z.isEmpty
|
(unless z.isEmpty
|
||||||
(debugLayer.drawFlxRect z FlxColor.TRANSPARENT (object thickness 1 color FlxColor.RED)))))))
|
(debugLayer.drawFlxRect z FlxColor.RED))))))
|
||||||
|
|
||||||
(pieceCamera.updateScrollWheelZoom elapsed 5)
|
(pieceCamera.updateScrollWheelZoom elapsed 5)
|
||||||
(pieceCamera.updateMouseBorderControl elapsed KEYBOARD_SCROLL_SPEED 0.002 uiCamera)
|
(pieceCamera.updateMouseBorderControl elapsed KEYBOARD_SCROLL_SPEED 0.002 uiCamera)
|
||||||
|
@@ -12,23 +12,20 @@ using kiss_flixel.DebugLayer;
|
|||||||
|
|
||||||
@:build(kiss.Kiss.build())
|
@:build(kiss.Kiss.build())
|
||||||
class DebugLayer extends FlxTypedGroup<FlxSprite> {
|
class DebugLayer extends FlxTypedGroup<FlxSprite> {
|
||||||
public function drawRect(X:Float, Y:Float, Width:Float, Height:Float, FillColor:FlxColor = FlxColor.WHITE, ?lineStyle:Null<LineStyle>, ?drawStyle:Null<DrawStyle>):FlxSprite {
|
public function drawRect(X:Float, Y:Float, Width:Float, Height:Float, outlineColor:FlxColor = FlxColor.WHITE):FlxSprite {
|
||||||
var thickness = 1.0;
|
var thickness = 1.0 / cameras[0].zoom;
|
||||||
if (lineStyle != null) {
|
|
||||||
thickness = lineStyle.thickness;
|
|
||||||
}
|
|
||||||
|
|
||||||
var s = new FlxSprite(X-thickness/2, Y-thickness/2);
|
var s = new FlxSprite(X-thickness/2, Y-thickness/2);
|
||||||
|
|
||||||
// TODO test where thickness appears - is it center-out from the given border?
|
// TODO test where thickness appears - is it center-out from the given border?
|
||||||
s.mg(Width + thickness, Height + thickness);
|
s.mg(Width + thickness, Height + thickness);
|
||||||
s.drawRect(thickness/2, thickness/2, Width, Height, FillColor, lineStyle, drawStyle);
|
s.drawRect(thickness/2, thickness/2, Width, Height, FlxColor.TRANSPARENT, {color: outlineColor, thickness: thickness});
|
||||||
add(s);
|
add(s);
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function drawFlxRect(rect:FlxRect, FillColor:FlxColor = FlxColor.WHITE, ?lineStyle:Null<LineStyle>, ?drawStyle:Null<DrawStyle>):FlxSprite {
|
public function drawFlxRect(rect:FlxRect, outlineColor:FlxColor = FlxColor.WHITE):FlxSprite {
|
||||||
return drawRect(rect.x, rect.y, rect.width, rect.height, FillColor, lineStyle, drawStyle);
|
return drawRect(rect.x, rect.y, rect.width, rect.height, outlineColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function mg(s:FlxSprite, Width:Float, Height:Float):FlxSprite {
|
public static function mg(s:FlxSprite, Width:Float, Height:Float):FlxSprite {
|
||||||
|
Reference in New Issue
Block a user