Skip to content

Commit 87dffc3

Browse files
Embed Folder + Default Sound + Window Icon
Signed-off-by: CrusherNotDrip <crushernotdrip@tilnotdrip.org>
1 parent e420af8 commit 87dffc3

6 files changed

Lines changed: 24 additions & 1 deletion

File tree

assets/embed/default.wav

42 KB
Binary file not shown.

assets/embed/icons/icon16.png

284 Bytes
Loading

assets/embed/icons/iconOG.png

90.7 KB
Loading

src/Main.hx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
package;
22

3+
import funkin.Paths;
4+
import funkin.graphics.FunkinImage;
35
import funkin.ui.overlay.FunkinOverlay;
46
import h3d.Engine;
57
import hxd.App;
8+
import hxd.Window;
69

710
class 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)

src/funkin/Paths.hx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package funkin;
22

33
import funkin.resource.FunkinContent;
44
import 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
}

src/funkin/resource/FunkinContent.hx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff 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);

0 commit comments

Comments
 (0)