File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11package ;
22
3+ import funkin .Paths ;
4+ import funkin .graphics .FunkinImage ;
35import funkin .ui .overlay .FunkinOverlay ;
46import h3d .Engine ;
57import hxd .App ;
8+ import hxd .Window ;
69
710class Main extends App
811{
@@ -31,6 +34,8 @@ class Main extends App
3134 {
3235 setScene (new funkin.ui.title. TitleScene ());
3336 overlay = new FunkinOverlay ();
37+
38+ Window .getInstance ().setIcon (new FunkinImage (Paths .embedFileSystem .get (' icons/iconOG.png' )).toBitmap ());
3439 }
3540
3641 override function update (dt : Float )
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ package funkin;
22
33import funkin .resource .FunkinContent ;
44import funkin .resource .FunkinFileSystem ;
5+ import hxd .fs .EmbedFileSystem ;
56
67/**
78 * This is a paths class mostly used for getting content from files.
@@ -31,12 +32,19 @@ class Paths
3132 */
3233 public static final fileSystem : FunkinFileSystem = new FunkinFileSystem ();
3334
35+ /**
36+ * The embedded assets file system.
37+ */
38+ public static final embedFileSystem : FunkinFileSystem = new FunkinFileSystem ();
39+
3440 /**
3541 * (Re)initializes the File System.
3642 */
3743 public static function init (): Void
3844 {
3945 // TODO: This is very temporary, and looks very awful!
4046 fileSystem .child = new hxd.fs. LocalFileSystem (' ../../../assets' , null );
47+
48+ embedFileSystem .child = EmbedFileSystem .create (' ../../../assets/embed' );
4149 }
4250}
Original file line number Diff line number Diff line change @@ -14,7 +14,17 @@ class FunkinContent
1414 public function audio (key : String ): Sound
1515 {
1616 final path : String = PathTools .withExtension (key , Paths .AUDIO_EXT );
17- final entry : FileEntry = Paths .fileSystem .get (path );
17+ var entry : FileEntry = null ;
18+
19+ try
20+ {
21+ entry = Paths .fileSystem .get (path );
22+ }
23+ catch (e )
24+ {
25+ trace (' [ERROR] ` $path ` was not found. Returning default sound...' );
26+ entry = Paths .embedFileSystem .get (' default.wav' );
27+ }
1828
1929 // TODO: Cache this instead of creating a new one every time.
2030 return new Sound (entry );
You can’t perform that action at this time.
0 commit comments