1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2024-12-23 21:56:46 +00:00

video cutscene autopause magic

This commit is contained in:
AbnormalPoof 2024-06-24 03:55:59 -05:00 committed by EliteMasterEric
parent dd30012d80
commit 9d9d7a853c
2 changed files with 15 additions and 3 deletions

View file

@ -1301,12 +1301,18 @@ class PlayState extends MusicBeatSubState
super.closeSubState();
}
#if discord_rpc
/**
* Function called when the game window gains focus.
*/
public override function onFocus():Void
{
if (VideoCutscene.isPlaying() && FlxG.autoPause && isGamePaused) VideoCutscene.pauseVideo();
#if html5
else
VideoCutscene.resumeVideo();
#end
#if discord_rpc
if (health > Constants.HEALTH_MIN && !paused && FlxG.autoPause)
{
if (Conductor.instance.songPosition > 0.0) DiscordClient.changePresence(detailsText, currentSong.song
@ -1318,6 +1324,7 @@ class PlayState extends MusicBeatSubState
else
DiscordClient.changePresence(detailsText, currentSong.song + ' (' + storyDifficultyText + ')', iconRPC);
}
#end
super.onFocus();
}
@ -1327,12 +1334,17 @@ class PlayState extends MusicBeatSubState
*/
public override function onFocusLost():Void
{
#if html5
if (FlxG.autoPause) VideoCutscene.pauseVideo();
#end
#if discord_rpc
if (health > Constants.HEALTH_MIN && !paused && FlxG.autoPause) DiscordClient.changePresence(detailsPausedText,
currentSong.song + ' (' + storyDifficultyText + ')', iconRPC);
#end
super.onFocusLost();
}
#end
/**
* Removes any references to the current stage, then clears the stage cache,

View file

@ -145,7 +145,7 @@ class VideoCutscene
{
vid.zIndex = 0;
vid.bitmap.onEndReached.add(finishVideo.bind(0.5));
vid.autoPause = false;
vid.autoPause = FlxG.autoPause;
vid.cameras = [PlayState.instance.camCutscene];