cant load or draw an image

BlitzMax Forums/BlitzMax Beginners Area/cant load or draw an image

slenkar(Posted 2007) [#1]
Ive tried every combination but it always says 'trying to access null object'
whenever I use drawimage

e.g.
Global bullet_image:timage=LoadImage:timage("bullet.bmp",MASKEDIMAGE)
DrawImage bullet_image,x,y


tonyg(Posted 2007) [#2]
Global bullet_image:timage=LoadImage("bullet.bmp",MASKEDIMAGE)
DrawImage bullet_image,x,y


Retimer(Posted 2007) [#3]
Have you declared graphics, and are you sure the image is located in the .bmx's directory?

also,

Global bullet_image:timage=LoadImage("bullet.bmp",MASKEDIMAGE)

would work, no need to add the :timage.


jhocking(Posted 2007) [#4]
Declaring graphics is the biggie, I often have confusing errors because I accidentally used an image/drawing command before calling Graphics.


slenkar(Posted 2007) [#5]
still getting the error message

Strict
Graphics 640, 480, 0

Global ship_image:timage=LoadImage("ship.bmp",MASKEDIMAGE)
Global bullet_image:timage=LoadImage("bullet.bmp",MASKEDIMAGE)
If bullet_image=Null
RuntimeError "image=null"
EndIf

While Not KeyDown(key_escape)
Cls
DrawImage (ship_image,300,300)

Flip
Wend
End


the image always equals NULL

also, I cant find the flag that makes the window NOT fullscreen


Czar Flavius(Posted 2007) [#6]
Have you made sure the pictures exist :P


slenkar(Posted 2007) [#7]
yeh they are 16bit bitmaps
in the same directory as the BMX file
is that the right kind of bitmap?


Dreamora(Posted 2007) [#8]
no, it must be 24bit (altogether not per channel!) bmps


slenkar(Posted 2007) [#9]
thanks!
it works now after i converted the images
argh-


GfK(Posted 2007) [#10]
Windowed: Graphics 800,600[,0]
Fullscreen: Graphics 800,600,16 (or 32)


slenkar(Posted 2007) [#11]
thanks, thats a bit confusing for a previous B3D user


GfK(Posted 2007) [#12]
There are a lot of things that are confusing about Blitzmax if you've moved from BB3D, but you get used to it. Its all for the better.

I wonder how I ever managed to write anything in BB3D now.


jhocking(Posted 2007) [#13]
I'm using both right now (finishing up a project in Blitz3D, using BlitzMax for all my new projects.) I was worried that I'd be confused using them both at the same time, but the only problem I have really is that I keep trying to use semicolons for comments in BlitzMax.