Jump to content

Assets Issue

Recommended Posts

Basically I'm trying to port the loading screens to DS, but I'm having problems applying assets.

When printing the Assets table, it is possible to see that my asset (Wilson) is registered, but for some reason I still have errors.

[Others Assets...]

[00:06:00]: ../mods/Nightmaer HUD/modmain.lua(50,1) ATLAS	
[00:06:00]: ../mods/Nightmaer HUD/modmain.lua(50,1) loading_images/wilson.xml	
[00:06:00]: ../mods/Nightmaer HUD/modmain.lua(50,1) IMAGE	
[00:06:00]: ../mods/Nightmaer HUD/modmain.lua(50,1) loading_images/wilson.tex	
[00:06:00]: WARNING! Invalid resource handle for atlas '../mods/Nightmaer HUD/loading_images/wilson.xml', 
did you remember to load the asset?

The .tex and .xml files are in the folder in question, everything looks correct.
Here is the code. I didn't create the Assets variable here because I use it first in another location.

local load_backgrounds = {"wilson"}

if not Assets then
	Assets = {}

for _, image in pairs(load_backgrounds) do
	table.insert( Assets, Asset("ATLAS", "loading_images/" ..image.. ".xml"))
	table.insert( Assets, Asset("IMAGE", "loading_images/" ..image.. ".tex"))

local Image = require "widgets/image"

AddGlobalClassPostConstruct("widgets/loadingwidget", "LoadingWidget", function(self)

	local random_image = math.random(#load_backgrounds) or 1

	local atlas = "loading_images/" ..load_backgrounds[random_image].. ".xml"

	self.bg = self:AddChild(Image(atlas, load_backgrounds[random_image].. ".tex"))


I made it dynamically to facilitate the registration of multiple load_backgounds.

However, I've already tried to do it the traditional way and it didn't work either...

Thanks for any help.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...