mirror of
https://github.com/ninjamuffin99/Funkin.git
synced 2024-12-28 15:57:42 +00:00
potential adobe animate texture atlas bullshit WIP
This commit is contained in:
parent
bdb74d29bc
commit
8f25fb29ef
|
@ -1,5 +1,6 @@
|
|||
package;
|
||||
|
||||
import animate.AnimationAtlas;
|
||||
import flixel.FlxG;
|
||||
import flixel.FlxSprite;
|
||||
import flixel.addons.transition.FlxTransitionSprite.GraphicTransTileDiamond;
|
||||
|
@ -50,6 +51,8 @@ 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];
|
||||
|
|
11
source/animate/Animation.hx
Normal file
11
source/animate/Animation.hx
Normal file
|
@ -0,0 +1,11 @@
|
|||
package animate;
|
||||
|
||||
import flixel.group.FlxGroup;
|
||||
|
||||
class Aniamtion extends FlxGroup
|
||||
{
|
||||
public function new(symbolName:String, atlas:AnimationAtlas):Void
|
||||
{
|
||||
super();
|
||||
}
|
||||
}
|
67
source/animate/AnimationAtlas.hx
Normal file
67
source/animate/AnimationAtlas.hx
Normal file
|
@ -0,0 +1,67 @@
|
|||
package animate;
|
||||
|
||||
import flixel.FlxG;
|
||||
import flixel.graphics.FlxGraphic;
|
||||
import flixel.graphics.frames.FlxAtlasFrames;
|
||||
import flixel.system.FlxAssets.FlxGraphicAsset;
|
||||
import haxe.Json;
|
||||
import openfl.Assets;
|
||||
|
||||
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;
|
||||
|
||||
trace(swagSprite);
|
||||
}
|
||||
|
||||
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