Skip to content

Commit c40a67b

Browse files
committed
things
1 parent caced90 commit c40a67b

File tree

129 files changed

+1554
-26592
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

129 files changed

+1554
-26592
lines changed

source/Main.hx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@ class Main extends Sprite {
3838
public static var fpsVar:FPSCounter;
3939
public static var closing:Bool = false;
4040

41+
public static var cmdArgs:Array<String> = Sys.args();
42+
public static var noTerminalColor:Bool = false;
43+
public static var playTest:Bool = false;
44+
public static var forceGPUOnlyBitmapsOff:Bool = #if windows false #else true #end;
45+
4146
public static inline function closeGame():Void
4247
{
4348
// if (Main.commandPrompt != null)
@@ -127,6 +132,7 @@ class Main extends Sprite {
127132

128133
@:dox(hide)
129134
public static var audioDisconnected:Bool = false;
135+
public static var changeID:Int = 0;
130136

131137
// You can pretty much ignore everything from here on - your code should go in your states.
132138

source/backend/AudioSwitchFix.hx

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
package backend;
2+
3+
import lime.media.AudioManager;
4+
import flixel.sound.FlxSound;
5+
import flixel.FlxState;
6+
import utils.NativeAPI;
7+
8+
/**
9+
* if youre stealing this keep this comment at least please lol
10+
*
11+
* hi gray itsa me yoshicrafter29 i fixed it hehe
12+
*/
13+
@:dox(hide)
14+
class AudioSwitchFix {
15+
@:noCompletion
16+
private static function onStateSwitch(state:FlxState):Void {
17+
#if windows
18+
if (Main.audioDisconnected) {
19+
20+
var playingList:Array<PlayingSound> = [];
21+
for(e in FlxG.sound.list) {
22+
if (e.playing) {
23+
playingList.push({
24+
sound: e,
25+
time: e.time
26+
});
27+
e.stop();
28+
}
29+
}
30+
if (FlxG.sound.music != null)
31+
FlxG.sound.music.stop();
32+
33+
AudioManager.shutdown();
34+
AudioManager.init();
35+
// #if !lime_doc_gen
36+
// if (AudioManager.context.type == OPENAL)
37+
// {
38+
// var alc = AudioManager.context.openal;
39+
40+
// var device = alc.openDevice();
41+
// var ctx = alc.createContext(device);
42+
// alc.makeContextCurrent(ctx);
43+
// alc.processContext(ctx);
44+
// }
45+
// #end
46+
Main.changeID++;
47+
48+
for(e in playingList) {
49+
e.sound.play(e.time);
50+
}
51+
52+
Main.audioDisconnected = false;
53+
}
54+
#end
55+
}
56+
57+
public static function init() {
58+
#if windows
59+
NativeAPI.registerAudio();
60+
FlxG.signals.preStateCreate.add(onStateSwitch);
61+
#end
62+
}
63+
}
64+
65+
typedef PlayingSound = {
66+
var sound:FlxSound;
67+
var time:Float;
68+
}

0 commit comments

Comments
 (0)