Looking for code
Blitz3D Forums/Blitz3D Programming/Looking for code
| ||
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! |
| ||
You'll probably need to use something like CopyRect....I'm not sure, though. Check the help file for stuff on buffers and copyrect. |
| ||
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 |
| ||
Thanks alot Rob, your the man!!! Now how about that resizing? |