1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2024-11-25 00:06:40 +00:00

initial haxeui for character offset editor

This commit is contained in:
Cameron Taylor 2022-09-08 04:03:50 -04:00
parent 36e6d6bd91
commit e15815afa8

View file

@ -1,13 +1,11 @@
package funkin.ui.animDebugShit;
import funkin.play.character.CharacterData.CharacterDataParser;
import funkin.play.character.SparrowCharacter;
import flixel.addons.display.FlxGridOverlay;
import flixel.addons.ui.FlxInputText;
import flixel.addons.ui.FlxUIDropDownMenu;
import flixel.FlxCamera;
import flixel.FlxSprite;
import flixel.FlxState;
import flixel.addons.display.FlxGridOverlay;
import flixel.addons.ui.FlxInputText;
import flixel.addons.ui.FlxUIDropDownMenu;
import flixel.graphics.frames.FlxAtlasFrames;
import flixel.graphics.frames.FlxFrame;
import flixel.group.FlxGroup;
@ -18,6 +16,13 @@ import flixel.util.FlxColor;
import flixel.util.FlxSpriteUtil;
import flixel.util.FlxTimer;
import funkin.play.character.BaseCharacter;
import funkin.play.character.CharacterData.CharacterDataParser;
import funkin.play.character.SparrowCharacter;
import haxe.ui.RuntimeComponentBuilder;
import haxe.ui.components.DropDown;
import haxe.ui.core.Component;
import haxe.ui.events.ItemEvent;
import haxe.ui.events.UIEvent;
import lime.utils.Assets as LimeAssets;
import openfl.Assets;
import openfl.events.Event;
@ -63,10 +68,37 @@ class DebugBoundingState extends FlxState
var onionSkinChar:FlxSprite;
var txtOffsetShit:FlxText;
var uiStuff:Component;
override function create()
{
Paths.setCurrentLevel('week1');
var str = Paths.xml('ui/offset-editor-view');
uiStuff = RuntimeComponentBuilder.fromAsset(str);
// uiStuff.findComponent("btnViewSpriteSheet").onClick = _ -> curView = SPRITESHEET;
var dropdown:DropDown = cast uiStuff.findComponent("swapper");
dropdown.onChange = function(e:UIEvent)
{
trace(e.type);
curView = cast e.data.curView;
trace(e.data);
// trace(e.data);
};
// lv.
// lv.onChange = function(e:UIEvent)
// {
// trace(e.type);
// // trace(e.data.curView);
// // var item:haxe.ui.core.ItemRenderer = cast e.target;
// trace(e.target);
// // if (e.type == "change")
// // {
// // curView = cast e.data;
// // }
// };
hudCam = new FlxCamera();
hudCam.bgColor.alpha = 0;
@ -86,6 +118,10 @@ class DebugBoundingState extends FlxState
// charInput.cameras = [hudCam];
// charInput.scrollFactor.set();
uiStuff.cameras = [hudCam];
add(uiStuff);
super.create();
}
@ -290,9 +326,16 @@ class DebugBoundingState extends FlxState
override function update(elapsed:Float)
{
if (FlxG.keys.justPressed.ONE)
{
var lv:DropDown = cast uiStuff.findComponent("swapper");
lv.selectedIndex = 0;
curView = SPRITESHEET;
}
if (FlxG.keys.justReleased.TWO)
{
var lv:DropDown = cast uiStuff.findComponent("swapper");
lv.selectedIndex = 1;
curView = OFFSETSHIT;
if (swagChar != null)
{
@ -528,8 +571,8 @@ class DebugBoundingState extends FlxState
}
}
enum ANIMDEBUGVIEW
enum abstract ANIMDEBUGVIEW(String)
{
SPRITESHEET;
OFFSETSHIT;
var SPRITESHEET;
var OFFSETSHIT;
}