How do I change the icon for my HaxeFlixel project?

Overview

It’s quite simple to swap out the icon for your haxeflixel project. Supposing you already have a project created, there are two main steps:
1. Create a new icon and export it as a SVG file.
2. Update your Project.xml file

Step One – Create a SVG file

An SVG file is used to save vector art – something that can, essentially, be scaled in any direction infinitely without losing it’s clarity. This is especially important for icons, that may needed in various sizes, especially on Android.

Because I love open-source technology, I chose to create my dinky Face Defender game logo using InkScape. Load it up and make your logo!

Once you’re done, save it as icon.svg and put it in your projects assets/images folder.

Step Two – Update your project.xml file

This part’s easy. Add the following to your project.xml file:

<icon path="assets/icon.svg"/>

That’s it! Build and test with “lime test Android” and see the icon difference. Haxe uses built in tools to scale the svg file appropriately and encode as a png file.



Share this post


facebooktwittergoogle_plusredditpinterestlinkedinmail

Tags: , ,

4 Responses to “How do I change the icon for my HaxeFlixel project?”

  1. james t Says:

    I also noticed a bug in the version I was doing this on where if you had an svg and pngs in your xml file – it would always use the svg. Not sure if you noticed but perhaps something to look out for.

  2. Gimmicky Apps Says:

    It should be noted that you cannot just add the tag anywhere in Project.xml and expect it to work. I had added it in the middle of the file, and not seen anything in the documentation (i.e. http://haxeflixel.com/documentation/openfl-project-xml-format/ ) to the contrary, but actually, if you read the very last comment in the template, you’ll find that it must go after the inclusion of the flixel library for it to override the haxeflixel icon.

  3. Gimmicky Apps Says:

    Also I had written <icon> and it got filtered out…

  4. Gimmicky Apps Says:

    (I mean, it got filtered out posting the comment.)