Surprisingly, the bonus comes first: Hello! I'm Hohoo, yet another beginning NDS developer. I'm currently making my first game with libnds and I have one short and quick question...
I'm interested in using PNG files and libpng (or PNG++ in my case, as I'm using C++) for graphics. Are there any tutorials about using it with libnds?
libpng question + bonus
Re: libpng question + bonus
Do you really need to read the png files at run time?
You can convert the images into pre-converted graphics ready for the nds files at compile time using grit.
You can convert the images into pre-converted graphics ready for the nds files at compile time using grit.
Re: libpng question + bonus
I'm just asking if it's possible.
How much slower would it be?
How much slower would it be?
Re: libpng question + bonus
It depends on how optimized is your code... It will be slow if you perform loading operations every frame, fast if you don't. I've found 2 methods to load external images (not in the NDS) and keep my game fast:
1-Loading every resource before starting the game (i don't use this anymore)
2-Writing a function that accepts filename as parameter and, if the selected resource hasn't already been loaded, loads it and stores it in an array (or map, or vector...) and returns its reference.
I'm looking forward to see the answer to your question, cause i'm interested too and i NEED to load resources outside the .nds file.
1-Loading every resource before starting the game (i don't use this anymore)
2-Writing a function that accepts filename as parameter and, if the selected resource hasn't already been loaded, loads it and stores it in an array (or map, or vector...) and returns its reference.
I'm looking forward to see the answer to your question, cause i'm interested too and i NEED to load resources outside the .nds file.
Re: libpng question + bonus
unless the user needs to change the images themselves, pre convert the images on compile time. grit has an option to convert to *.bin files that you can put in fat or internal filesystem.
if loading files during the actual game is to slow, then load the right before the game, like when loading the level.
if loading files during the actual game is to slow, then load the right before the game, like when loading the level.
-
- Site Admin
- Posts: 1986
- Joined: Tue Aug 09, 2005 3:21 am
- Location: UK
- Contact:
Re: libpng question + bonus
grit has a file format for combining resources too, still need to get together a tutorial and example code for that though :/
See http://www.coranac.com/man/grit/html/index.htm for some more details.
There are a few problems with using standard image formats for external resources - speed and memory requirements to start with. The biggie is the memory fragmentation caused by conversion.
If you want users to be able to manipulate your data then the best approach is to write tools to do it.
See http://www.coranac.com/man/grit/html/index.htm for some more details.
There are a few problems with using standard image formats for external resources - speed and memory requirements to start with. The biggie is the memory fragmentation caused by conversion.
If you want users to be able to manipulate your data then the best approach is to write tools to do it.
Re: libpng question + bonus
I forgot to mention that I'm using NitroFS to store the files.
Who is online
Users browsing this forum: No registered users and 0 guests