mirror of
https://github.com/ninjamuffin99/Funkin.git
synced 2024-09-12 05:07:06 +00:00
different offset view shit
This commit is contained in:
parent
44ba266b88
commit
7e213cb5cb
|
@ -8,6 +8,7 @@ import flixel.addons.display.FlxGridOverlay;
|
||||||
import flixel.addons.ui.FlxInputText;
|
import flixel.addons.ui.FlxInputText;
|
||||||
import flixel.addons.ui.FlxUIDropDownMenu;
|
import flixel.addons.ui.FlxUIDropDownMenu;
|
||||||
import flixel.graphics.frames.FlxAtlasFrames;
|
import flixel.graphics.frames.FlxAtlasFrames;
|
||||||
|
import flixel.graphics.frames.FlxFrame;
|
||||||
import flixel.group.FlxGroup;
|
import flixel.group.FlxGroup;
|
||||||
import flixel.math.FlxPoint;
|
import flixel.math.FlxPoint;
|
||||||
import flixel.text.FlxText;
|
import flixel.text.FlxText;
|
||||||
|
@ -29,7 +30,7 @@ class DebugBoundingState extends FlxState
|
||||||
/*
|
/*
|
||||||
TODAY'S TO-DO
|
TODAY'S TO-DO
|
||||||
- Cleaner UI
|
- Cleaner UI
|
||||||
- Data to show offset positioning
|
- Loading the spritesheet and spritesheet data from offsetview
|
||||||
*/
|
*/
|
||||||
var bg:FlxSprite;
|
var bg:FlxSprite;
|
||||||
var fileInfo:FlxText;
|
var fileInfo:FlxText;
|
||||||
|
@ -75,6 +76,9 @@ class DebugBoundingState extends FlxState
|
||||||
super.create();
|
super.create();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var bf:FlxSprite;
|
||||||
|
var swagOutlines:FlxSprite;
|
||||||
|
|
||||||
function initSpritesheetView():Void
|
function initSpritesheetView():Void
|
||||||
{
|
{
|
||||||
spriteSheetView = new FlxGroup();
|
spriteSheetView = new FlxGroup();
|
||||||
|
@ -83,24 +87,13 @@ class DebugBoundingState extends FlxState
|
||||||
var tex = Paths.getSparrowAtlas('characters/temp');
|
var tex = Paths.getSparrowAtlas('characters/temp');
|
||||||
// tex.frames[0].uv
|
// tex.frames[0].uv
|
||||||
|
|
||||||
var bf:FlxSprite = new FlxSprite();
|
bf = new FlxSprite();
|
||||||
bf.loadGraphic(tex.parent);
|
bf.loadGraphic(tex.parent);
|
||||||
spriteSheetView.add(bf);
|
spriteSheetView.add(bf);
|
||||||
|
|
||||||
var swagGraphic:FlxSprite = new FlxSprite().makeGraphic(tex.parent.width, tex.parent.height, FlxColor.TRANSPARENT);
|
swagOutlines = new FlxSprite().makeGraphic(tex.parent.width, tex.parent.height, FlxColor.TRANSPARENT);
|
||||||
|
|
||||||
for (i in tex.frames)
|
generateOutlines(tex.frames);
|
||||||
{
|
|
||||||
var lineStyle:LineStyle = {color: FlxColor.RED, thickness: 2};
|
|
||||||
|
|
||||||
var uvW:Float = (i.uv.width * i.parent.width) - (i.uv.x * i.parent.width);
|
|
||||||
var uvH:Float = (i.uv.height * i.parent.height) - (i.uv.y * i.parent.height);
|
|
||||||
|
|
||||||
// trace(Std.int(i.uv.width * i.parent.width));
|
|
||||||
swagGraphic.drawRect(i.uv.x * i.parent.width, i.uv.y * i.parent.height, uvW, uvH, FlxColor.TRANSPARENT, lineStyle);
|
|
||||||
// swagGraphic.setPosition(, );
|
|
||||||
// trace(uvH);
|
|
||||||
}
|
|
||||||
|
|
||||||
txtGrp = new FlxGroup();
|
txtGrp = new FlxGroup();
|
||||||
txtGrp.cameras = [hudCam];
|
txtGrp.cameras = [hudCam];
|
||||||
|
@ -110,8 +103,8 @@ class DebugBoundingState extends FlxState
|
||||||
addInfo('Width', bf.width);
|
addInfo('Width', bf.width);
|
||||||
addInfo('Height', bf.height);
|
addInfo('Height', bf.height);
|
||||||
|
|
||||||
swagGraphic.antialiasing = true;
|
swagOutlines.antialiasing = true;
|
||||||
spriteSheetView.add(swagGraphic);
|
spriteSheetView.add(swagOutlines);
|
||||||
|
|
||||||
FlxG.stage.window.onDropFile.add(function(path:String)
|
FlxG.stage.window.onDropFile.add(function(path:String)
|
||||||
{
|
{
|
||||||
|
@ -131,6 +124,24 @@ class DebugBoundingState extends FlxState
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function generateOutlines(frameShit:Array<FlxFrame>):Void
|
||||||
|
{
|
||||||
|
swagOutlines.pixels.fillRect(new Rectangle(0, 0, swagOutlines.width, swagOutlines.height), 0x00000000);
|
||||||
|
|
||||||
|
for (i in frameShit)
|
||||||
|
{
|
||||||
|
var lineStyle:LineStyle = {color: FlxColor.RED, thickness: 2};
|
||||||
|
|
||||||
|
var uvW:Float = (i.uv.width * i.parent.width) - (i.uv.x * i.parent.width);
|
||||||
|
var uvH:Float = (i.uv.height * i.parent.height) - (i.uv.y * i.parent.height);
|
||||||
|
|
||||||
|
// trace(Std.int(i.uv.width * i.parent.width));
|
||||||
|
swagOutlines.drawRect(i.uv.x * i.parent.width, i.uv.y * i.parent.height, uvW, uvH, FlxColor.TRANSPARENT, lineStyle);
|
||||||
|
// swagGraphic.setPosition(, );
|
||||||
|
// trace(uvH);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function initOffsetView():Void
|
function initOffsetView():Void
|
||||||
{
|
{
|
||||||
offsetView = new FlxGroup();
|
offsetView = new FlxGroup();
|
||||||
|
@ -145,7 +156,7 @@ class DebugBoundingState extends FlxState
|
||||||
txtOffsetShit.cameras = [hudCam];
|
txtOffsetShit.cameras = [hudCam];
|
||||||
offsetView.add(txtOffsetShit);
|
offsetView.add(txtOffsetShit);
|
||||||
|
|
||||||
animDropDownMenu = new FlxUIDropDownMenu(650, 20, FlxUIDropDownMenu.makeStrIdLabelArray(['weed'], true));
|
animDropDownMenu = new FlxUIDropDownMenu(630, 20, FlxUIDropDownMenu.makeStrIdLabelArray(['weed'], true));
|
||||||
animDropDownMenu.cameras = [hudCam];
|
animDropDownMenu.cameras = [hudCam];
|
||||||
offsetView.add(animDropDownMenu);
|
offsetView.add(animDropDownMenu);
|
||||||
|
|
||||||
|
@ -362,13 +373,16 @@ class DebugBoundingState extends FlxState
|
||||||
{
|
{
|
||||||
if (swagChar != null)
|
if (swagChar != null)
|
||||||
{
|
{
|
||||||
remove(swagChar);
|
offsetView.remove(swagChar);
|
||||||
swagChar.destroy();
|
swagChar.destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
swagChar = new Character(100, 100, char);
|
swagChar = new Character(100, 100, char);
|
||||||
swagChar.debugMode = true;
|
swagChar.debugMode = true;
|
||||||
add(swagChar);
|
offsetView.add(swagChar);
|
||||||
|
|
||||||
|
generateOutlines(swagChar.frames.frames);
|
||||||
|
bf.pixels = swagChar.pixels;
|
||||||
|
|
||||||
var animThing:Array<String> = [];
|
var animThing:Array<String> = [];
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue