idk what to do lol

This commit is contained in:
Yoshman29
2022-10-28 02:33:39 +02:00
parent 6f0585a12a
commit 9a72f0893a
6 changed files with 110 additions and 6 deletions
+1 -1
View File
@@ -1 +1 @@
810
822
+2
View File
@@ -68,6 +68,8 @@ class DesktopMain extends MusicBeatState {
windows.add(new Window(new HelloWorld()));
if (FlxG.keys.justPressed.F1)
windows.add(new Window(new CharacterEditor('dad')));
if (FlxG.keys.justPressed.F2)
windows.add(new Window(new EditorPlayState()));
}
public function openWindow(content:WindowContent) {
@@ -0,0 +1,94 @@
package funkin.desktop.editors;
import flixel.FlxG;
import flixel.FlxCamera;
import flixel.math.FlxPoint;
class EditorPlayState extends WindowContent {
var state:PlayState;
public function new() {
super("PlayState", 120, 120, 1280, 720);
state = new PlayState();
}
public override function create() {
super.create();
beforeStateShit();
state.camera = parent.windowCameras[0].camera;
state.create();
afterStateShit();
parent.windowCameras[0].resizeScroll = false;
parent.windowCameras.push(
{
camera: state.camHUD,
width: 1280,
height: 720,
resizeScroll: true
}
);
parent.move(winX, winY);
parent.resize(1280, 720);
beforeStateShit();
state.createPost();
afterStateShit();
}
var oldSize = FlxPoint.get(FlxG.width, FlxG.height);
var oldCamList:Array<FlxCamera>;
var oldCam:FlxCamera;
public function beforeStateShit() {
oldSize.set(FlxG.width, FlxG.height);
@:privateAccess
FlxG.width = 1280;
@:privateAccess
FlxG.height = 720;
oldCamList = FlxG.cameras.list;
oldCam = FlxG.camera;
@:privateAccess
FlxG.cameras.list = [for(e in parent.windowCameras) e.camera];
FlxG.camera = parent.windowCameras[0].camera;
}
public function afterStateShit() {
@:privateAccess
FlxG.width = Std.int(oldSize.x);
@:privateAccess
FlxG.height = Std.int(oldSize.y);
parent.windowCameras = [for(e in FlxG.cameras.list) {
camera: e,
width: 1280,
height: 720,
resizeScroll: false
}];
@:privateAccess
FlxG.cameras.list = oldCamList;
FlxG.camera = oldCam;
oldCamList = null;
oldCam = null;
}
public override function update(elapsed:Float) {
beforeStateShit();
super.update(elapsed);
state.update(elapsed);
afterStateShit();
}
public override function destroy() {
beforeStateShit();
super.destroy();
state.destroy();
afterStateShit();
}
public override function draw() {
beforeStateShit();
super.draw();
state.draw();
afterStateShit();
}
}
+7 -4
View File
@@ -153,11 +153,10 @@ class PlayState extends MusicBeatState
scripts = new ScriptPack("PlayState");
scripts.setParent(this);
camGame = new FlxCamera();
camGame = camera;
camHUD = new FlxCamera();
camHUD.bgColor.alpha = 0;
FlxG.cameras.reset(camGame);
FlxG.cameras.add(camHUD, false);
// camGame.widescreen = true;
@@ -170,6 +169,7 @@ class PlayState extends MusicBeatState
scrollSpeed = SONG.speed;
Conductor.reset();
Conductor.mapBPMChanges(SONG);
Conductor.changeBPM(SONG.bpm);
@@ -413,6 +413,9 @@ class PlayState extends MusicBeatState
super.destroy();
FlxDestroyUtil.destroy(scripts);
instance = null;
if (vocals != null) {
vocals.destroy();
}
}
public var debugNum:Int = 0;
@@ -800,8 +803,8 @@ class PlayState extends MusicBeatState
songTime += FlxG.game.ticks - previousFrameTime;
previousFrameTime = FlxG.game.ticks;
// if (Math.abs(FlxG.sound.music.time - Conductor.songPosition) > 20)
// resyncVocals();
if (Math.abs(FlxG.sound.music.time - Conductor.songPosition) > 25)
resyncVocals();
}
// Conductor.lastSongPos = FlxG.sound.music.time;
+1 -1
View File
@@ -44,7 +44,7 @@ class Strum extends FlxSprite {
public function updateNotePosition(daNote:Note) {
if (!daNote.exists) return;
var offset = FlxPoint.get(daNote.isSustainNote ? ((Note.swagWidth - daNote.width) / 2) : 0, (Conductor.songPosition - daNote.strumTime) * (0.45 * FlxMath.roundDecimal(PlayState.instance.scrollSpeed, 2)));
var offset = FlxPoint.get(daNote.isSustainNote ? ((Note.swagWidth - daNote.width) / 2) : 0, (Conductor.songPosition - daNote.strumTime) * (0.45 * FlxMath.roundDecimal(getScrollSpeed(), 2)));
var realOffset = FlxPoint.get(0, 0);
if (daNote.isSustainNote) offset.y -= Note.swagWidth / 2;
+5
View File
@@ -49,6 +49,11 @@ class Conductor
@:dox(hide) public function new() {}
public static function reset() {
songPosition = lastSongPos = 0;
bpmChangeMap = [];
changeBPM(100);
}
/**
* Maps BPM changes from a song.
* @param song Song to map BPM changes from.