move rotationPadding into KissExtendedSprite
This commit is contained in:
@@ -155,7 +155,6 @@
|
|||||||
(prop &mut :Map<Int,JigsawPiece> pieceData (new Map))
|
(prop &mut :Map<Int,JigsawPiece> pieceData (new Map))
|
||||||
(prop &mut :Map<Int,Array<KissExtendedSprite>> connectedPieces (new Map))
|
(prop &mut :Map<Int,Array<KissExtendedSprite>> connectedPieces (new Map))
|
||||||
(prop &mut :Map<KissExtendedSprite,Int> indexMap (new Map))
|
(prop &mut :Map<KissExtendedSprite,Int> indexMap (new Map))
|
||||||
(prop &mut :Map<KissExtendedSprite,FlxPoint> rotationPaddingMap (new Map))
|
|
||||||
(prop &mut :Map<Int,KissExtendedSprite> spriteMap (new Map)) // Because rewardSprites will be re-ordered in depth handling, this is required
|
(prop &mut :Map<Int,KissExtendedSprite> spriteMap (new Map)) // Because rewardSprites will be re-ordered in depth handling, this is required
|
||||||
|
|
||||||
(prop &mut lastRewardFileIndex -1)
|
(prop &mut lastRewardFileIndex -1)
|
||||||
@@ -313,13 +312,7 @@
|
|||||||
(FlxSpriteUtil.alphaMask s source.pixels mask.pixels)
|
(FlxSpriteUtil.alphaMask s source.pixels mask.pixels)
|
||||||
**(#when debug
|
**(#when debug
|
||||||
(kiss_flixel.SpriteTools.writeOnSprite "$i" 32 s (object x (Percent 0.5) y (Percent 0.5)) FlxColor.RED))
|
(kiss_flixel.SpriteTools.writeOnSprite "$i" 32 s (object x (Percent 0.5) y (Percent 0.5)) FlxColor.RED))
|
||||||
(let [ow s.frameWidth
|
(s.loadRotatedGraphic s.pixels 4 -1 /*false true*/)
|
||||||
oh s.frameHeight]
|
|
||||||
(s.loadRotatedGraphic s.pixels 4 -1 /*false true*/)
|
|
||||||
(let [nw s.frameWidth
|
|
||||||
nh s.frameHeight]
|
|
||||||
(dictSet rotationPaddingMap s (.scale (new FlxPoint (- nw ow) (- nh oh)) 0.5))))
|
|
||||||
|
|
||||||
|
|
||||||
(set s.cameras [pieceCamera])
|
(set s.cameras [pieceCamera])
|
||||||
|
|
||||||
@@ -436,7 +429,7 @@
|
|||||||
maxY (/ (apply max pointsY) ros)
|
maxY (/ (apply max pointsY) ros)
|
||||||
tlc (.add (new FlxPoint minX minY) ROT_PADDING ROT_PADDING)
|
tlc (.add (new FlxPoint minX minY) ROT_PADDING ROT_PADDING)
|
||||||
brc (.add (new FlxPoint maxX maxY) ROT_PADDING ROT_PADDING)
|
brc (.add (new FlxPoint maxX maxY) ROT_PADDING ROT_PADDING)
|
||||||
rotationPadding (dictGet rotationPaddingMap s)
|
rotationPadding (s.getRotationPadding)
|
||||||
rect (.fromTwoPoints (new FlxRect) (tlc.addPoint rotationPadding) (brc.addPoint rotationPadding))
|
rect (.fromTwoPoints (new FlxRect) (tlc.addPoint rotationPadding) (brc.addPoint rotationPadding))
|
||||||
originOffset (new FlxPoint (- s.origin.x rect.x) (- s.origin.y rect.y))
|
originOffset (new FlxPoint (- s.origin.x rect.x) (- s.origin.y rect.y))
|
||||||
rotated (rect.getRotatedBounds s.angle originOffset)]
|
rotated (rect.getRotatedBounds s.angle originOffset)]
|
||||||
|
|||||||
@@ -33,6 +33,19 @@ class KissExtendedSprite extends flixel.addons.display.FlxExtendedSprite {
|
|||||||
resetStartPos();
|
resetStartPos();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private var rotationPadding = new FlxPoint();
|
||||||
|
public function getRotationPadding() {
|
||||||
|
return rotationPadding.copyTo();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override function loadRotatedGraphic(Graphic:FlxGraphicAsset, Rotations:Int = 16, Frame:Int = -1, AntiAliasing:Bool = false, AutoBuffer:Bool = false, ?Key:String) {
|
||||||
|
var ow = frameWidth;
|
||||||
|
var oh = frameHeight;
|
||||||
|
var g = super.loadRotatedGraphic(Graphic, Rotations, Frame, AntiAliasing, AutoBuffer, Key);
|
||||||
|
rotationPadding.set(frameWidth - ow, frameHeight - oh).scale(0.5);
|
||||||
|
return g;
|
||||||
|
}
|
||||||
|
|
||||||
// Sleazy method just for Habit Puzzles
|
// Sleazy method just for Habit Puzzles
|
||||||
public function rotate(deg:Float) {
|
public function rotate(deg:Float) {
|
||||||
if (deg < 0) {
|
if (deg < 0) {
|
||||||
|
|||||||
Reference in New Issue
Block a user