Create Image

BlitzPlus Forums/BlitzPlus Beginners Area/Create Image

Kirkkaf(Posted 2011) [#1]
Hi everyone,

I am using Blitz+ to create an image (oval) to follow the mouse. I can't seem to get this to work this is what I have:

Graphics (300, 300)

Global imgBall = CreateImage (50, 50)
ImageBuffer (imgBall)
Oval (0, 0, 40, 40, 1)

SetBuffer BackBuffer ()

While Not KeyHit(1)
	Update()
	Flip ()
Wend 
End ()

Function Update()
	Cls ()
	Text (0, 0, "MouseX: " + MouseX () + " MouseY: " + MouseY ())
	DrawImage (imgBall, MouseX (), MouseY ())
End Function


It doesn't display the image created can you please let me know what I have done wrong what can be improved (any better way of doing things)

Thanks.


Kirkkaf(Posted 2011) [#2]
Anyone got any ideas oh why the oval isn't displaying where my mouse X and Y is?

Thanks.


Rafery(Posted 2011) [#3]
Hi Katogoon, this is your code adjusted.
sorry for my bad english.

Graphics 640,480,0,2

Global imgBall = CreateImage (50, 50)
SetBuffer ImageBuffer (imgBall) ; <--------------------------------
Oval (0, 0, 40, 40, 1)
SetBuffer BackBuffer ()

While Not KeyHit(1)
Update()
Flip ()
Wend
End ()

Function Update()
Cls ()
Text (0, 0, "MouseX: " + MouseX () + " MouseY: " + MouseY ())
DrawImage (imgBall, MouseX (), MouseY ())
End Function


Kirkkaf(Posted 2011) [#4]
Thanks for your help I didn't realise I missed "SetBuffer".