mirror of
https://github.com/FunkinCrew/Funkin.git
synced 2024-11-23 16:17:53 -05:00
moved animate bullshit into CoolUtil and gave up
This commit is contained in:
parent
b388ea9064
commit
32f1b509f4
4 changed files with 71 additions and 91 deletions
|
@ -1,5 +1,13 @@
|
|||
package;
|
||||
|
||||
import flixel.FlxG;
|
||||
import flixel.graphics.FlxGraphic;
|
||||
import flixel.graphics.frames.FlxAtlasFrames;
|
||||
import flixel.math.FlxPoint;
|
||||
import flixel.math.FlxRect;
|
||||
import flixel.system.FlxAssets.FlxGraphicAsset;
|
||||
import haxe.Json;
|
||||
import lime.math.Rectangle;
|
||||
import lime.utils.Assets;
|
||||
|
||||
using StringTools;
|
||||
|
@ -34,4 +42,63 @@ class CoolUtil
|
|||
}
|
||||
return dumbArray;
|
||||
}
|
||||
|
||||
public static function fromAnimate(Source:FlxGraphicAsset, Description:String):FlxAtlasFrames
|
||||
{
|
||||
var graphic:FlxGraphic = FlxG.bitmap.add(Source);
|
||||
if (graphic == null)
|
||||
return null;
|
||||
|
||||
var frames:FlxAtlasFrames = FlxAtlasFrames.findFrame(graphic);
|
||||
if (frames != null)
|
||||
return frames;
|
||||
|
||||
if (graphic == null || Description == null)
|
||||
return null;
|
||||
|
||||
frames = new FlxAtlasFrames(graphic);
|
||||
|
||||
var data:AnimateObject;
|
||||
|
||||
var json:String = Description;
|
||||
|
||||
trace(json);
|
||||
|
||||
if (Assets.exists(json))
|
||||
json = Assets.getText(json);
|
||||
|
||||
data = cast Json.parse(json).ATLAS;
|
||||
|
||||
for (sprite in data.SPRITES)
|
||||
{
|
||||
// probably nicer way to do this? Oh well
|
||||
var swagSprite:AnimateSprite = sprite.SPRITE;
|
||||
|
||||
var rect = FlxRect.get(swagSprite.x, swagSprite.y, swagSprite.w, swagSprite.h);
|
||||
|
||||
var size = new Rectangle(0, 0, rect.width, rect.height);
|
||||
|
||||
var offset = FlxPoint.get(-size.left, -size.top);
|
||||
var sourceSize = FlxPoint.get(size.width, size.height);
|
||||
|
||||
frames.addAtlasFrame(rect, sourceSize, offset, swagSprite.name);
|
||||
}
|
||||
|
||||
return frames;
|
||||
}
|
||||
}
|
||||
|
||||
typedef AnimateObject =
|
||||
{
|
||||
SPRITES:Array<Dynamic>
|
||||
}
|
||||
|
||||
typedef AnimateSprite =
|
||||
{
|
||||
var name:String;
|
||||
var x:Int;
|
||||
var y:Int;
|
||||
var w:Int;
|
||||
var h:Int;
|
||||
var rotated:Bool;
|
||||
}
|
||||
|
|
|
@ -53,8 +53,6 @@ class TitleState extends MusicBeatState
|
|||
polymod.Polymod.init({modRoot: "mods", dirs: ['introMod'], framework: OPENFL});
|
||||
#end
|
||||
|
||||
AnimationAtlas.fromAnimate(Paths.image('money'), Paths.file('images/money.json'));
|
||||
|
||||
swagShader = new ColorSwap();
|
||||
|
||||
FlxG.sound.muteKeys = [ZERO];
|
||||
|
@ -198,6 +196,10 @@ class TitleState extends MusicBeatState
|
|||
blackScreen = new FlxSprite().makeGraphic(FlxG.width, FlxG.height, FlxColor.BLACK);
|
||||
credGroup.add(blackScreen);
|
||||
|
||||
var atlasBullShit:FlxSprite = new FlxSprite();
|
||||
atlasBullShit.frames = CoolUtil.fromAnimate(Paths.image('money'), Paths.file('images/money.json'));
|
||||
credGroup.add(atlasBullShit);
|
||||
|
||||
credTextShit = new Alphabet(0, 0, "ninjamuffin99\nPhantomArcade\nkawaisprite\nevilsk8er", true);
|
||||
credTextShit.screenCenter();
|
||||
|
||||
|
|
|
@ -1,11 +0,0 @@
|
|||
package animate;
|
||||
|
||||
import flixel.group.FlxGroup;
|
||||
|
||||
class Aniamtion extends FlxGroup
|
||||
{
|
||||
public function new(symbolName:String, atlas:AnimationAtlas):Void
|
||||
{
|
||||
super();
|
||||
}
|
||||
}
|
|
@ -1,78 +0,0 @@
|
|||
package animate;
|
||||
|
||||
import flixel.FlxG;
|
||||
import flixel.addons.ui.FlxUIColorSwatchSelecter.SwatchGraphic;
|
||||
import flixel.graphics.FlxGraphic;
|
||||
import flixel.graphics.frames.FlxAtlasFrames;
|
||||
import flixel.math.FlxPoint;
|
||||
import flixel.math.FlxRect;
|
||||
import flixel.system.FlxAssets.FlxGraphicAsset;
|
||||
import haxe.Json;
|
||||
import openfl.Assets;
|
||||
import openfl.geom.Rectangle;
|
||||
|
||||
class AnimationAtlas
|
||||
{
|
||||
public function new(data:Dynamic, atlas:FlxAtlasFrames):Void {}
|
||||
|
||||
public static function fromAnimate(Source:FlxGraphicAsset, Description:String):FlxAtlasFrames
|
||||
{
|
||||
var graphic:FlxGraphic = FlxG.bitmap.add(Source);
|
||||
if (graphic == null)
|
||||
return null;
|
||||
|
||||
var frames:FlxAtlasFrames = FlxAtlasFrames.findFrame(graphic);
|
||||
if (frames != null)
|
||||
return frames;
|
||||
|
||||
if (graphic == null || Description == null)
|
||||
return null;
|
||||
|
||||
frames = new FlxAtlasFrames(graphic);
|
||||
|
||||
var data:AnimateObject;
|
||||
|
||||
var json:String = Description;
|
||||
|
||||
trace(json);
|
||||
|
||||
if (Assets.exists(json))
|
||||
json = Assets.getText(json);
|
||||
|
||||
trace(json);
|
||||
|
||||
data = cast Json.parse(json).ATLAS;
|
||||
|
||||
for (sprite in data.SPRITES)
|
||||
{
|
||||
// probably nicer way to do this? Oh well
|
||||
var swagSprite:AnimateSprite = sprite.SPRITE;
|
||||
|
||||
var rect = FlxRect.get(swagSprite.x, swagSprite.y, swagSprite.w, swagSprite.h);
|
||||
|
||||
var size = new Rectangle(0, 0, rect.width, rect.height);
|
||||
|
||||
var offset = FlxPoint.get(-size.left, -size.top);
|
||||
var sourceSize = FlxPoint.get(size.width, size.height);
|
||||
|
||||
frames.addAtlasFrame(rect, sourceSize, offset, swagSprite.name);
|
||||
}
|
||||
|
||||
return frames;
|
||||
}
|
||||
}
|
||||
|
||||
typedef AnimateObject =
|
||||
{
|
||||
SPRITES:Array<Dynamic>
|
||||
}
|
||||
|
||||
typedef AnimateSprite =
|
||||
{
|
||||
var name:String;
|
||||
var x:Int;
|
||||
var y:Int;
|
||||
var w:Int;
|
||||
var h:Int;
|
||||
var rotated:Bool;
|
||||
}
|
Loading…
Reference in a new issue