The icon is a plate wearing headphones with a red Nordic house cookie on it. It replaces the default Godot icon, so the game window, Windows and macOS builds use it. Linux programs can't carry their own icon, so the build now also makes MusicPlayer_<version>_linux.tar.gz with the game, the icon as a PNG, a .desktop menu entry and install.sh, which installs them for the current user. The bare Linux binary is still published.
25 lines
987 B
GDScript
25 lines
987 B
GDScript
extends SceneTree
|
|
## Renders an SVG to a square PNG, used to package the icon for Linux.
|
|
##
|
|
## Usage: godot --headless -s render_icon.gd -- <input.svg> <output.png> <size>
|
|
|
|
|
|
func _initialize() -> void:
|
|
var args: PackedStringArray = OS.get_cmdline_user_args()
|
|
if args.size() != 3:
|
|
printerr("Usage: godot --headless -s render_icon.gd -- <input.svg> <output.png> <size>")
|
|
quit(1)
|
|
return
|
|
var svg: String = FileAccess.get_file_as_string(args[0])
|
|
var source: Image = Image.new()
|
|
# Load at 1x to read the SVG's own size, then scale so the result is <size> pixels
|
|
var error: int = source.load_svg_from_string(svg)
|
|
if error == OK:
|
|
var image: Image = Image.new()
|
|
error = image.load_svg_from_string(svg, float(args[2]) / source.get_width())
|
|
if error == OK:
|
|
error = image.save_png(args[1])
|
|
if error != OK:
|
|
printerr("Could not render %s to %s (error %d)" % [args[0], args[1], error])
|
|
quit(error)
|