LoadImage issues

Blitz3D Forums/Blitz3D Beginners Area/LoadImage issues

HippyGoth(Posted 2005) [#1]
I'm not sure if this is a bug or just me missing the obvious, so I'm posting this here before going into the bug report section.

If I use a global variable to load an image it doesn't appear to be accessed in other code, even though it's been included, but using a global for sound works fine. Probably easier to give an example...

Here's my graphics code
---------------------------------
Global FloorBlocks
global boing ; just a test
FloorBlocks=LoadImage("C:\BlowStuffUp\Graphics\numbers.bmp")
;DrawImage FloorBlocks, 10,10 ;un-remming this displays the image
---------------------------------
Here's the line accessing it in the main code:

DrawImage FloorBlocks, 10,10 ; gives error unless remmed out
print boing; just a test, this shows up
--------------------------------------------------
When trying to access the global outside of the include, I get an error of "The Image Does not exist" The inbclude is working as the global variable "boing" prints with the correct value.

Am I missing something really simple?

Ed.


slenkar(Posted 2005) [#2]
the filename path may be wrong

Try looking at the Filetype command to check if images exist before loading them


tonyg(Posted 2005) [#3]
Is your include before the graphics command in the main program?


GitTech(Posted 2005) [#4]
Are you loading the image *after* the Graphics() (or Graphics3D() for 3d mode) command?


EDIT: Oops, didn't see TonyG's reply :)


HippyGoth(Posted 2005) [#5]
Yes, the include for the graphics is actually the 2nd down (the first is a bunch of types).

The path is correct. If I run the graphics.bb code by itself the image actually appears, it's only when I try to access the image from the maingame.bb code it throws a fit.

Looks like I may have fixed it anyway. I was calling the includes, then setting the screenup. I moved the screen setup into the graphics.bb and now everything is working.

Although bizarre, it kinda makes sense. :)

Ed.

Edit: :p post the same time as GitTech, yes that was exactly the problem. Thanks for the help and advice chaps! :)

Edit2: Darn typos...