cant load or draw an image
BlitzMax Forums/BlitzMax Beginners Area/cant load or draw an image
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
Global bullet_image:timage=LoadImage("bullet.bmp",MASKEDIMAGE)
DrawImage bullet_image,x,y
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.
Declaring graphics is the biggie, I often have confusing errors because I accidentally used an image/drawing command before calling Graphics.
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
Have you made sure the pictures exist :P
yeh they are 16bit bitmaps
in the same directory as the BMX file
is that the right kind of bitmap?
no, it must be 24bit (altogether not per channel!) bmps
thanks!
it works now after i converted the images
argh-
Windowed: Graphics 800,600[,0]
Fullscreen: Graphics 800,600,16 (or 32)
thanks, thats a bit confusing for a previous B3D user
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.
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.