Preloading graphics

BlitzMax Forums/BlitzMax Beginners Area/Preloading graphics

Lillpeter(Posted 2005) [#1]
I´m wondering how i do to preload the graphics for my game correctly, as i do right now i´m creating variables + the loadimage command as i start the game.

And then as i play i assign those variables to "image" variables inside my types such as effects and stuff, i guess i don´t want to use the loadimage command inside the game loop, or?

what would you recommend?


Hotcakes(Posted 2005) [#2]
Sounds about right.


FlameDuck(Posted 2005) [#3]
What Toby said.


xlsior(Posted 2005) [#4]
Yup.

The one thing you may want to do though, is first load & display an intro screen, and then load all your additional images -- otherwise you'll be staring at a black screen until it's finished downloading everything first.


Grey Alien(Posted 2005) [#5]
or show a black screen with a loading bar, that's what I do.


FlameDuck(Posted 2005) [#6]
Or not go into graphics mode until you're done loading.


JazzieB(Posted 2005) [#7]
Or not go into graphics mode until you're done loading.


Don't you need to be in a graphics mode to load your graphics? A change (or starting of) a graphics mode will flush any graphics already loaded.

Or have I missed something?


tonyg(Posted 2005) [#8]
It doesn't matter any more.
Although I have had an odd result.
This
image:timage=LoadImage("max.png")
Graphics 640,480
DrawImage image,0,0
Flip
WaitKey()

only loads 1/4 of the image. Other images are fine and loading after graphics is fine. Very odd.


Hotcakes(Posted 2005) [#9]
Yeh I think the images aren't really cleared, but could become corrupt under certain situations... sort of like not relying on the compiler to pass function parameters in any particular order. Loading an image before using a Graphics command is generally not good. Shame on you ducky.