This might be the best haxelib it has it all
I want to make this be the only haxelib you need to build FNF so i need to put lime open fl and alot of other ones in here so look out for all that stuff coming to this lib right here
How To Install
Go To PowerShell Or CMD and enter this
bash
haxelib install text-haxe-extension
Credits for the libs
TODO
- [x] Add HxCodec
- [x] Add HxShaders
- [x] Make This a official Haxelib
## instructions
hxCodec
A library which adds native video support for OpenFL and HaxeFlixel.
Original repository
Click here to check the roadmap
Instructions for Friday Night Funkin'
- Install the Haxelib You can install it through haxelib:
haxelib install hxCodec
You can also install it through Git for the latest updates:
haxelib git hxCodec https://github.com/polybiusproxy/hxCodec- Add this code in
Project.xml
<haxelib name="hxCodec" if="desktop || android" />
OPTIONAL: If you want debug traces in your console, add this code:
<!-- Show debug traces for hxCodec -->
<haxedef name="HXC_DEBUG_TRACE" if="debug" />-
Create a folder called
videosin yourassets/preloadfolder. -
Add this code in
Paths.hx:
inline static public function video(key:String)
{
return 'assets/videos/$key';
}
Playing videos
- Put your video in the videos folder.
Note: hxCodec supports all the video formats VLC can play!
- Add somewhere in PlayState:
function playCutscene(name:String, atEndOfSong:Bool = false)
{
inCutscene = true;
FlxG.sound.music.stop();
var video:VideoHandler = new VideoHandler();
video.finishCallback = function()
{
if (atEndOfSong)
{
if (storyPlaylist.length <= 0)
FlxG.switchState(new StoryMenuState());
else
{
SONG = Song.loadFromJson(storyPlaylist[0].toLowerCase());
FlxG.switchState(new PlayState());
}
}
else
startCountdown();
}
video.playVideo(Paths.video(name));
}
Examples
At the PlayState "create()" function:
switch (curSong.toLowerCase())
{
case 'song1':
playCutscene('song1scene.asf');
case 'song2':
playCutscene('song2scene.avi');
default:
startCountdown();
}
At the PlayState "endSong()" function:
if (SONG.song.toLowerCase() == 'song1')
playCutscene('song1scene.mjpeg', true);
Examples for Kade Engine 1.8
At the PlayState "create()" function:
generateSong(SONG.songId);
switch (curSong.toLowerCase())
{
case 'song1':
playCutscene('song1scene.mp4');
default:
startCountdown();
}
At the PlayState "endSong()" function:
PlayState.SONG = Song.loadFromJson(PlayState.storyPlaylist[0], diff);
FlxG.sound.music.stop();
switch (curSong.toLowerCase())
{
case 'song1':
playCutscene('song1scene.ogg', true);
case 'song2':
playCutscene('song2scene.wav', true);
}
Building
Windows and MacOS
You don't need any special instructions in order to build for Windows or MacOS.
Just pull the lime build windows / lime build mac command and the library will be building with your game.
Linux
In order to make your game work with the library, you have to install libvlc-dev and libvlccore-dev from your distro's package manager.
Example with APT:
sudo apt-get install libvlc-dev
sudo apt-get install libvlccore-dev
sudo apt-get install vlc-bin
Android
In order for hxCodec to work on Android, you will need a library called extension-androidtools.
To install it, enter the following in a terminal:
haxelib git extension-androidtools https://github.com/MAJigsaw77/extension-androidtools.git
Next, add this into Project.xml
<haxelib name="extension-androidtools" if="android" />
Currently, hxCodec will search the videos only on the external storage of the device (/storage/emulated/0/MyAppName/assets/videos/yourvideo.mp4).
You will also have to put the location manually in the paths.
HxShaders
- Paste this
in your project.xml - Go to your shader code. Remove the code that says import flixel.system.FlxAssets.FlxShader; and replace it with import tools.FlxShader;