Skip to content

Commit

Permalink
lll
Browse files Browse the repository at this point in the history
  • Loading branch information
Hackx2 committed Jun 29, 2024
1 parent fa29ce0 commit 6052081
Show file tree
Hide file tree
Showing 6 changed files with 62 additions and 50 deletions.
12 changes: 5 additions & 7 deletions Project.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
<define name="DEBUG_SERVER_ALLOWED" if="debug desktop"/>

<!-- Remove "officialBuild" to use videos on source mod -->
<define name="VIDEOS_ALLOWED" if="(windows || linux || android) officialBuild" unless="32bits"/>
<define name="VIDEOS_ALLOWED" if="(windows || linux || android) officialBuild || debug" unless="32bits"/>

<!-- Crash handler -->
<define name="CRASH_HANDLER" if="desktop release" />
Expand All @@ -56,12 +56,10 @@
<define name="message.reporting" value="pretty"/>

<!--Place custom nodes like icons here (higher priority to override the HaxeFlixel icon)-->
<section embed="true">
<icon path="art/icons/icon16.png" size='16'/>
<icon path="art/icons/icon32.png" size='32'/>
<icon path="art/icons/icon64.png" size='64'/>
<icon path="art/icons/iconOG.png"/>
</section>
<icon path="art/icons/icon16.png" size='16'/>
<icon path="art/icons/icon32.png" size='32'/>
<icon path="art/icons/icon64.png" size='64'/>
<icon path="art/icons/iconOG.png"/>

<!-- ____________________________ Window Settings ___________________________ -->

Expand Down
2 changes: 1 addition & 1 deletion TODO.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# ```TODO```

* ~~finish Init State.~~
* Finsh Video Handler State
* ~~Finsh Video Handler State~~
*
OLD:
* Might add winning icons (only if i can get the icons for them :3)
Expand Down
50 changes: 50 additions & 0 deletions source/funkin/backend/handlers/VidHandler.hx
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
package funkin.backend.handlers;

// TODO: umm make video states easier :3
#if VIDEOS_ALLOWED
#if (hxCodec >= "2.6.1")
import hxcodec.VideoHandler as MP4Handler;
#elseif (hxCodec == "2.6.0")
import VideoHandler as MP4Handler;
#else
import vlc.MP4Handler;
#end
using StringTools;

class VidHandler extends MusicBeatState{
static var video:MP4Handler;

override function create()
{
super.create();
}
public static function startVideo(videoName:String) {
if(FlxG.sound.music != null)
FlxG.sound.music.fadeOut(1, 0, function(_) FlxG.sound.music.stop());
if (funkin.game.Main.fpsVar != null)
funkin.game.Main.fpsVar.visible = false;
FlxG.mouse.visible = false;
video = new MP4Handler();
video.playVideo(Paths.video(videoName));
trace(videoName);
video.finishCallback = function()
{
if (funkin.game.Main.fpsVar != null)
funkin.game.Main.fpsVar.visible = ClientPrefs.data.showFPS;
FlxG.sound.playMusic(Paths.music('freakyMenu'), 0);
FlxG.sound.music.fadeIn(4, 0, 0.7);
FlxG.mouse.visible = true;
MusicBeatState.switchState(new MainMenuState());
return;
}
}
override function update(elapsed:Float)
{
super.update(elapsed);
if ((FlxG.keys.justPressed.ANY && !controls.ACCEPT) && video != null)
{
video.finishVideo();
}
}
}
#end
3 changes: 0 additions & 3 deletions source/funkin/game/states/VideoHandlerState.hx

This file was deleted.

30 changes: 2 additions & 28 deletions source/funkin/game/videos/TemplateVideo.hx
Original file line number Diff line number Diff line change
@@ -1,39 +1,13 @@
package funkin.game.videos;

#if VIDEOS_ALLOWED
class TemplateVideo extends MusicBeatState
class TemplateVideo extends VidHandler
{
var video:MP4Handler;

override function create()
{
super.create();

FlxG.sound.music.fadeOut(1, 0, function(_) FlxG.sound.music.stop());
if (funkin.game.Main.fpsVar != null)
funkin.game.Main.fpsVar.visible = false;
FlxG.mouse.visible = false;
video = new MP4Handler();
video.playVideo(Paths.video('VIDEOPATHEHERE')); // ripped from the game
video.finishCallback = function()
{
if (funkin.game.Main.fpsVar != null)
funkin.game.Main.fpsVar.visible = ClientPrefs.data.showFPS;
FlxG.sound.playMusic(Paths.music('freakyMenu'), 0);
FlxG.sound.music.fadeIn(4, 0, 0.7);
FlxG.mouse.visible = true;
MusicBeatState.switchState(new MainMenuState());
return;
}
}

override function update(elapsed:Float)
{
super.update(elapsed);
if ((FlxG.keys.justPressed.ANY && !controls.ACCEPT) && video != null)
{
video.finishVideo();
}
VidHandler.startVideo('HEWWO');
}
}
#end
15 changes: 4 additions & 11 deletions source/funkin/game/videos/import.hx
Original file line number Diff line number Diff line change
@@ -1,14 +1,7 @@
package funkin.game.videos;

#if !macro
import funkin.backend.handlers.VidHandler;

#if VIDEOS_ALLOWED
#if (hxCodec >= "2.6.1")
import hxcodec.VideoHandler as MP4Handler;
#elseif (hxCodec == "2.6.0")
import VideoHandler as MP4Handler;
#else
import vlc.MP4Handler;
#end
#end

using StringTools;
using StringTools;
#end

0 comments on commit 6052081

Please sign in to comment.