Looking for code

Blitz3D Forums/Blitz3D Programming/Looking for code

Tri|Ga|De(Posted 2004) [#1]
Hi

I making a little program and in that program i need to grab a piece of thw screen with my mouse.

I need to grab a rect by dragging the mouse, and maybe resize the rect.

I have tried but with no luck.
I can draw a rect with my mouse but can't resize it.

Anyone have some sample code to draw/resize a rect on screen with the mouse?

Thanx in avance!


elseano(Posted 2004) [#2]
You'll probably need to use something like CopyRect....I'm not sure, though. Check the help file for stuff on buffers and copyrect.


Rob(Posted 2004) [#3]
Here you go:

Graphics 640,480,0,2
SetBuffer BackBuffer()

x=0
y=0
width=0
height=0

;a main loop
While Not KeyHit(1)

	;if the user clicks
	If MouseHit(1)
	
		;first coords
		x=MouseX()
		y=MouseY()
		
		;keep doing this while the user holds the mouse down
		While MouseDown(1)
			width = MouseX()-x
			height = MouseY()-y

			Cls
			Rect x,y,width,height,1			
			
			Flip
		Wend
		
	EndIf
	
Wend
End



Tri|Ga|De(Posted 2004) [#4]
Thanks alot Rob, your the man!!!

Now how about that resizing?