mirror of
https://github.com/FunkinCrew/Funkin.git
synced 2025-03-13 16:43:57 -04:00
debug anim shit in progress
This commit is contained in:
parent
a2360dde70
commit
be4b35938b
4 changed files with 83 additions and 20 deletions
|
@ -44,6 +44,24 @@ class CoolUtil
|
|||
return dumbArray;
|
||||
}
|
||||
|
||||
static var oldCamPos:FlxPoint = new FlxPoint();
|
||||
static var oldMousePos:FlxPoint = new FlxPoint();
|
||||
|
||||
public static function mouseCamDrag():Void
|
||||
{
|
||||
if (FlxG.mouse.justPressedMiddle)
|
||||
{
|
||||
oldCamPos.set(FlxG.camera.scroll.x, FlxG.camera.scroll.y);
|
||||
oldMousePos.set(FlxG.mouse.screenX, FlxG.mouse.screenY);
|
||||
}
|
||||
|
||||
if (FlxG.mouse.pressedMiddle)
|
||||
{
|
||||
FlxG.camera.scroll.x = oldCamPos.x - (FlxG.mouse.screenX - oldMousePos.x);
|
||||
FlxG.camera.scroll.y = oldCamPos.y - (FlxG.mouse.screenY - oldMousePos.y);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Lerps camera, but accountsfor framerate shit?
|
||||
Right now it's simply for use to change the followLerp variable of a camera during update
|
||||
|
@ -57,10 +75,10 @@ class CoolUtil
|
|||
}
|
||||
|
||||
/*
|
||||
* frame dependant lerp kinda lol
|
||||
*/
|
||||
* frame dependant lerp kinda lol
|
||||
*/
|
||||
public static function coolLerp(base:Float, target:Float, ratio:Float):Float
|
||||
{
|
||||
return base + camLerpShit(ratio) * (target - base);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,6 +3,8 @@ package;
|
|||
import flixel.FlxG;
|
||||
import flixel.FlxSprite;
|
||||
import flixel.FlxState;
|
||||
import flixel.addons.display.FlxGridOverlay;
|
||||
import flixel.graphics.frames.FlxAtlasFrames;
|
||||
import openfl.Assets;
|
||||
import sys.io.File;
|
||||
|
||||
|
@ -10,7 +12,16 @@ class DebugBoundingState extends FlxState
|
|||
{
|
||||
override function create()
|
||||
{
|
||||
var bf:FlxSprite = new FlxSprite().loadGraphic(Paths.image('characters/temp'));
|
||||
var bg:FlxSprite = FlxGridOverlay.create(10, 10);
|
||||
|
||||
bg.scrollFactor.set();
|
||||
add(bg);
|
||||
|
||||
var tex = Paths.getSparrowAtlas('characters/temp');
|
||||
// tex.frames[0].uv
|
||||
|
||||
var bf:FlxSprite = new FlxSprite();
|
||||
bf.loadGraphic(tex.parent);
|
||||
add(bf);
|
||||
|
||||
FlxG.stage.window.onDropFile.add(function(path:String)
|
||||
|
@ -32,4 +43,10 @@ class DebugBoundingState extends FlxState
|
|||
|
||||
super.create();
|
||||
}
|
||||
|
||||
override function update(elapsed:Float)
|
||||
{
|
||||
CoolUtil.mouseCamDrag();
|
||||
super.update(elapsed);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -158,6 +158,8 @@ class TitleState extends MusicBeatState
|
|||
// netConnection.addEventListener(MouseEvent.MOUSE_DOWN, overlay_onMouseDown);
|
||||
#elseif STAGEBUILD
|
||||
FlxG.switchState(new StageBuilderState());
|
||||
#elseif ANIMDEBUG
|
||||
FlxG.switchState(new DebugBoundingState());
|
||||
#else
|
||||
new FlxTimer().start(1, function(tmr:FlxTimer)
|
||||
{
|
||||
|
|
|
@ -5,10 +5,8 @@ import flixel.FlxSprite;
|
|||
import flixel.addons.display.FlxGridOverlay;
|
||||
import flixel.group.FlxGroup;
|
||||
import flixel.math.FlxPoint;
|
||||
import flixel.system.FlxSound;
|
||||
import flixel.ui.FlxButton;
|
||||
import flixel.util.FlxTimer;
|
||||
import openfl.Assets;
|
||||
|
||||
class StageBuilderState extends MusicBeatState
|
||||
{
|
||||
|
@ -16,13 +14,51 @@ class StageBuilderState extends MusicBeatState
|
|||
|
||||
private var sprGrp:FlxGroup;
|
||||
|
||||
// var snd:Sound;
|
||||
// var sndChannel:SoundChannel;
|
||||
|
||||
override function create()
|
||||
{
|
||||
super.create();
|
||||
|
||||
FlxG.mouse.visible = true;
|
||||
|
||||
// var snd:Sound = new Sound();
|
||||
// var alsoSnd:FlxSound = new FlxSound();
|
||||
|
||||
// snd = new Sound();
|
||||
|
||||
// var swagBytes:ByteArray = new ByteArray(8192);
|
||||
|
||||
// for (shit in 0...8192)
|
||||
// {
|
||||
// swagBytes.writeFloat(Math.sin((shit) / Math.PI) * 0.25);
|
||||
// swagBytes.writeFloat(Math.sin((shit) / Math.PI) * 0.25);
|
||||
// trace('wweseosme???');
|
||||
// }
|
||||
|
||||
// snd.__buffer = AudioBuffer.fromBytes(swagBytes);
|
||||
// snd.dispatchEvent(new Event(Event.COMPLETE));
|
||||
|
||||
// swagBytes.writeFloat(Math.sin((shit + event.position) / Math.PI) * 0.25);
|
||||
// swagBytes.writeFloat(Math.sin((shit + event.position) / Math.PI) * 0.25);
|
||||
|
||||
// function sineShit(event:SampleDataEvent):Void
|
||||
// {
|
||||
// for (shit in 0...8192)
|
||||
// {
|
||||
// event.data.writeFloat(Math.sin((shit + event.position) / Math.PI) * 0.25);
|
||||
// event.data.writeFloat(Math.sin((shit + event.position) / Math.PI) * 0.25);
|
||||
// trace('wweseosme???');
|
||||
// }
|
||||
// }
|
||||
|
||||
// snd.addEventListener(SampleDataEvent.SAMPLE_DATA, sineShit);
|
||||
// snd.__buffer.
|
||||
// snd = Assets.getSound(Paths.music('freakyMenu'));
|
||||
// for (thing in snd.load)
|
||||
// thing = Std.int(thing / 2);
|
||||
// snd.play();
|
||||
// trace(snd.__buffer.data.toBytes().getData().bytes);
|
||||
|
||||
var bg:FlxSprite = FlxGridOverlay.create(10, 10);
|
||||
add(bg);
|
||||
|
@ -97,22 +133,12 @@ class StageBuilderState extends MusicBeatState
|
|||
// trace();
|
||||
}
|
||||
|
||||
var oldCamPos:FlxPoint = new FlxPoint();
|
||||
var oldMousePos:FlxPoint = new FlxPoint();
|
||||
|
||||
override function update(elapsed:Float)
|
||||
{
|
||||
if (FlxG.mouse.justPressedMiddle)
|
||||
{
|
||||
oldCamPos.set(FlxG.camera.scroll.x, FlxG.camera.scroll.y);
|
||||
oldMousePos.set(FlxG.mouse.screenX, FlxG.mouse.screenY);
|
||||
}
|
||||
// trace(sndChannel.position);
|
||||
// trace(snd
|
||||
|
||||
if (FlxG.mouse.pressedMiddle)
|
||||
{
|
||||
FlxG.camera.scroll.x = oldCamPos.x - (FlxG.mouse.screenX - oldMousePos.x);
|
||||
FlxG.camera.scroll.y = oldCamPos.y - (FlxG.mouse.screenY - oldMousePos.y);
|
||||
}
|
||||
CoolUtil.mouseCamDrag();
|
||||
|
||||
super.update(elapsed);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue