Dlean Jeans
Dlean Jeans

Reputation: 986

Cannot load without library assets in Haxe

I'm using a library I created myself to make a game. Inside a file there's this line:

    public static inline var LOGO_NAME:String = "assets/images/logo.svg";

And I use this constant to load the image. The program says the image is null. So my only solution is to copy the image logo.svg from the library's assets/images/ to the game project assets/images/. Is there any other way that I don't have to copy the image every time a make a game?

Upvotes: 1

Views: 232

Answers (1)

Gama11
Gama11

Reputation: 34138

From your past questions I'm pretty sure you use Lime and OpenFL (which is relevant to how assets are embedded). Also going to guess that by "library" you mean a haxelib.

In a regular project, there is a project.xml file that tells Lime what assets to include via an <assets> node. A haxelib can define an include.xml that behaves very much the same way, and you can also include assets from there. It should look something like this and be in the root directory of your haxelib to work for your use case:

<?xml version="1.0" encoding="utf-8"?>
<project>
    <assets path="assets" />
</project>

Of course there's much more you can do with include.xml files (see Flixel's include.xml - it sets an icon, defines some haxedefs, includes OpenFL etc...).

You can find OpenFL's official docs on the xml project format here.

Upvotes: 1

Related Questions