paint program

Blitz3D Forums/Blitz3D Beginners Area/paint program

kmick(Posted 2005) [#1]
I have come across a few tutorials on creating a simple paint program. The problem is, they don't allow a solid line to be painted even with the mouse moving at medium speed.

Here is an example of how it is usually implimented:
(Super simplified)

Graphics 500,500,16,2

SetBuffer BackBuffer()

ClsColor 255,255,255

Color 0,0,0

Cls

While Not KeyDown(1)

If MouseDown(1) Oval MouseX() - 5,MouseY() - 5,10,10

Flip
Wend

End


I was wondering if anyone knows a better way to do this.
thanks.


WolRon(Posted 2005) [#2]
Graphics 500,500,16,2

SetBuffer BackBuffer()

ClsColor 255,255,255

Color 0,0,0

Cls

While Not KeyDown(1)

	If MouseDown(1)
		x2 = MouseX(): y2 = MouseY()
		Line x1, y1, x2, y2
		x1=x2:y1=y2
	Else
		x1 = MouseX():y1 = MouseY()
	EndIf

	Flip
Wend

End
And to look professional... What are the forum codes?

.


kmick(Posted 2005) [#3]
Thanks wolron, I'l have to give it a try when I get home.

And thanks for the [code] tip, I tried it earlier with <code>. And I couldn't find the forum codes page.


jfk EO-11110(Posted 2005) [#4]
BTW your problem seem to be you are using "oval", that's pretty slow. If you would use an Image instead (Drawimage), that would be much faster, especially together with Flip false. To use Drawimage like Oval, you'd have to create a little Image on the fly, draw the Oval to it and then Draw the Image to the screen in Painting Mode.


kmick(Posted 2005) [#5]
Thanks for the advice jfk. Actually I already tried that before I made the post. It didn't make much of a difference at all. In my example I used the simplest routine I could.
But you are right, It is slower.