Skip to content
This repository was archived by the owner on Oct 18, 2025. It is now read-only.

Commit 9c3cacb

Browse files
this isnt the repo
1 parent b561a89 commit 9c3cacb

File tree

1 file changed

+101
-0
lines changed

1 file changed

+101
-0
lines changed
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
package core.backend;
2+
3+
import funkin.visuals.objects.DebugText;
4+
5+
import core.enums.PrintType;
6+
7+
class MusicBeatSubState extends flixel.FlxSubState
8+
{
9+
public var curStep:Int = 0;
10+
public var curBeat:Int = 0;
11+
public var curSection:Int = 0;
12+
13+
public static var instance:MusicBeatSubState;
14+
15+
private var debugTexts:FlxTypedGroup<DebugText>;
16+
17+
override public function create()
18+
{
19+
instance = this;
20+
21+
debugTexts = new FlxTypedGroup<DebugText>();
22+
add(debugTexts);
23+
24+
super.create();
25+
}
26+
27+
public inline function debugPrint(text:Dynamic, ?type:Null<PrintType> = TRACE, ?customType:String = '', ?customColor:FlxColor = FlxColor.GRAY)
28+
{
29+
text = haxe.Log.formatOutput(text, null);
30+
31+
if (debugTexts != null)
32+
{
33+
var newText:DebugText = debugTexts.recycle(DebugText);
34+
newText.text = (type == CUSTOM ? customType : PrintType.typeToString(type)) + ' | ' + text;
35+
newText.color = (type == CUSTOM ? customColor : PrintType.typeToColor(type));
36+
newText.disableTime = 6;
37+
newText.alpha = 1;
38+
newText.setPosition(10, 8 - newText.height);
39+
newText.scrollFactor.set();
40+
41+
debugTexts.cameras = [FlxG.cameras.list[FlxG.cameras.list.length - 1]];
42+
43+
debugTexts.forEachAlive(
44+
function (text:DebugText)
45+
{
46+
text.y += newText.height + 2;
47+
}
48+
);
49+
50+
debugTexts.add(newText);
51+
}
52+
53+
debugTrace(text, type, customType, customColor);
54+
}
55+
56+
override public function destroy()
57+
{
58+
instance = null;
59+
60+
debugTexts = null;
61+
62+
super.destroy();
63+
}
64+
65+
override public function update(elapsed:Float)
66+
{
67+
super.update(elapsed);
68+
69+
updateMusic();
70+
}
71+
72+
private function updateMusic()
73+
{
74+
if (curStep != Conductor.curStep)
75+
{
76+
curStep = Conductor.curStep;
77+
78+
stepHit(curStep);
79+
}
80+
81+
if (curBeat != Conductor.curBeat)
82+
{
83+
curBeat = Conductor.curBeat;
84+
85+
beatHit(curBeat);
86+
}
87+
88+
if (curSection != Conductor.curSection)
89+
{
90+
curSection = Conductor.curSection;
91+
92+
sectionHit(curSection);
93+
}
94+
}
95+
96+
public function stepHit(curStep:Int) {}
97+
98+
public function beatHit(curBeat:Int) {}
99+
100+
public function sectionHit(curSection:Int) {}
101+
}

0 commit comments

Comments
 (0)