Quick question.

Monkey Forums/User Modules/Quick question.

Paul - Taiphoz(Posted 2013) [#1]
when we load images the default root is the location of the source, we tend to as a result create graphics or sprite folders to keep things neat, and we then load our graphics from these folders.

but is it possible for a module to have its own graphics contained within the module, and if so, how would you load them, how would you get the path to the module for the loadimage call.


MikeHart(Posted 2013) [#2]
Add a "data" folder to your module, then in the modules source do something like
Import "data/mojo_font.png"


that is how mojo does it and I am convienced it would work with our modules too.


MikeHart(Posted 2013) [#3]
Just checked, that is how it works.


Paul - Taiphoz(Posted 2013) [#4]
Sweet thanks mike.


Paul - Taiphoz(Posted 2013) [#5]
How do you get at that once its imported tho, just a flat loadimage(mojo_font.png) ?


Paul - Taiphoz(Posted 2013) [#6]
Ignore me just checked mojo source and saw what it was doing , thanks again for pointing me in the right direction.


Raul(Posted 2013) [#7]
why would you do that? :D


Paul - Taiphoz(Posted 2013) [#8]
why would I want an image in with the module? , mojo's DrawText is a perfect example, if you want a default sprite sheet or sprite to be used with the module for when the programmer does not want to set his new new shiny image.

in my case it was going to be a default Virtual D-Pad and buttons, but I couldn't get it to load correctly. so just moved it into the project data folder. :/

oh well, might try again in the morning after I sort out my current admob issue.