Skip to content

SVG Support for CNE and HScript (Co-authored by Til) #529

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 11 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions libs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
<git name="flxanimate" url="https://github.com/CodenameCrew/cne-flxanimate" />
<git name="hxdiscord_rpc" url="https://github.com/CodenameCrew/cne-hxdiscord_rpc" />
<lib name="hxvlc" version="1.9.3" skipDeps="true" />
<git name="flxsvg" url="https://github.com/KadePleaseHelpMe/cne-flxsvg" />

<!-- Documentation and other features -->
<git name="away3d" url="https://github.com/CodenameCrew/away3d" />
Expand Down
2 changes: 2 additions & 0 deletions project.xml
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,8 @@
<haxelib name="hxdiscord_rpc" if="DISCORD_RPC"/>
<haxelib name="markdown" />

<haxelib name="flxsvg" />

<!-- _________________________________ Additional stuff _______________________________ -->

<section if="COMPILE_ALL_CLASSES">
Expand Down
5 changes: 4 additions & 1 deletion source/funkin/backend/assets/Paths.hx
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,9 @@ class Paths
return tempFramesCache[key] = loadFrames(assetsPath ? key : Paths.image(key, library, true));
}

inline static public function svg(key:String, ?library:String)
return Assets.getText(image(key, library, false, "svg"));

/**
* Checks if the images needed for using getFrames() exist.
* @param key Path to the image
Expand Down Expand Up @@ -363,4 +366,4 @@ class ScriptPathInfo {
this.file = file;
this.library = library;
}
}
}
3 changes: 2 additions & 1 deletion source/funkin/backend/system/macros/Macros.hx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class Macros {
#if THREE_D_SUPPORT "away3d", "flx3d", #end
#if VIDEO_CUTSCENES "hxvlc.flixel", "hxvlc.openfl", #end
#if NAPE_ENABLED "nape", "flixel.addons.nape", #end
"flxsvg",
// BASE HAXE
"DateTools", "EReg", "Lambda", "StringBuf", "haxe.crypto", "haxe.display", "haxe.exceptions", "haxe.extern", "scripting"
])
Expand All @@ -48,4 +49,4 @@ class Macros {
HashLinkFixer.init();
}
}
#end
#end