DrawImage(NoThanks!)

Blitz3D Forums/Blitz3D Beginners Area/DrawImage(NoThanks!)

Hello, All

Sorry to be a pain, i'm prolly asking all the same old questions, but i've done the following code:

Graphics 600,600

SetBuffer BackBuffer()

Global GameDevelopment = LoadImage("Cubies.bmp")

DrawImage GameDevelopment,0,0

When i hit F5 to run the code, it loads the window but forgets to load the image, and it also brings up a window "Programe Ended" when I move the promtp window the image appears, why does this happen?

You need to add a 'Flip' after DrawImage.

Yes, flip is needed, because you are currently drawing to the BackBuffer and need to FLIP it to the front.

Also, you might want to add the following to the end:

[code]
While not keydown(1)

wend
End
[code]

this will wait for escape to be pressed before closing the program.

What you need is a delay, or a loop to prevent it to draw it so fast that the user won't see it. A program like that will run for about 0.5 seconds, because it reaches the end of the code. Add Delay 5000 to delay the program for 5 seconds after it has drawn the image, to prevent it to close before you see it.

You can also add a loop like this:
Graphics 600,600
SetBuffer BackBuffer()
Global GameDevelopment = LoadImage("Cubies.bmp")
while not keydown(1)
DrawImage GameDevelopment,0,0
flip
wend

That will continueisly draw the image, until you press key 1, also Escape.