Hello,
I do not understand why I can not copy or recover what I draw?
Is there a function for this?
/* TEST */
Function p_Move()
If IsLeftMouse()
If (EndX<>1)&(EndY<>1)
StartX=EndX
StartY=EndY
Else
StartX=MouseX()
StartY=MouseY()
EndIf
EndX=MouseX()
EndY=MouseY()
Line(StartX,StartY,EndX,EndY,#WHITE,1)
Else If IsRightMouse()
Cls()
Else
EndX=1
EndY=1
EndIf
EndIf
EndFunction
/********************************************************************************************************/
Createbrush(0,100,50,#BLUE) DisplayBrush(0,0,0) TextOut(2,25,"Copy BGPic")
MakeButton(1,#SIMPLEBUTTON,0,0,100,50,{OnMouseUp = Function() CopyBGPic(1,2) DisplayBGPic(2) endfunction})
/********************************************************************************************************/
SetInterval(1, p_Move, 1000/150) ; 50fps
/********************************************************************************************************/
/* Loop */
Repeat
WaitEvent
Forever
recover what I draw
- airsoftsoftwair
- Posts: 5433
- Joined: Fri Feb 12, 2010 2:33 pm
- Location: Germany
- Contact:
Re: recover what I draw
You could use a back buffer brush and recover from that back buffer brush, i.e. you draw everything to the back buffer brush instead of directly to the display. Then you draw the part of your back buffer brush that has changed to the display. If you need to restore anything, just draw the respective area of the back buffer brush to your display.
Re: recover what I draw
Have you an example if you like it ?
Re: recover what I draw
I don't know what Andreas meant with "back buffer brush" but I also would like some small example of that.
I have been playing with your code and managed to draw the same line() to a brush and the display. When clearing the display the drawing is still in the brush. And can be displayed again, and drawn to some more.
I have been playing with your code and managed to draw the same line() to a brush and the display. When clearing the display the drawing is still in the brush. And can be displayed again, and drawn to some more.
Code: Select all
Function p_Move()
If IsLeftMouse()
If (EndX<>1)&(EndY<>1)
StartX=EndX
StartY=EndY
Else
StartX=MouseX()
StartY=MouseY()
EndIf
EndX=MouseX()
EndY=MouseY()
SelectBrush(1)
Line(StartX,StartY,EndX,EndY,#WHITE,1)
EndSelect()
Line(StartX,StartY,EndX,EndY,#WHITE,1)
Else
If IsRightMouse() ;Clear all
Cls()
CreateBrush(1, 640, 480)
p_button()
Else
EndX=1
EndY=1
EndIf
EndIf
EndFunction
Function p_Arne()
Cls(); Clear Screen
Wait(1,#SECONDS);symbolic wait just to se it's gone
DisplayBrush(1,0,0);restore whats been drawn
p_button()
EndFunction
Function p_button()
CreateBrush(0,100,50,#BLUE)
DisplayBrush(0,0,0)
TextOut(4,16,"Clr Screen\nAnd restore")
MakeButton(1,#SIMPLEBUTTON,0,0,100,50,{OnMouseUp = p_Arne})
EndFunction
CreateBrush(1, 640, 480)
;CreateBGPic(1,640,480)
p_button()
SetInterval(1, p_Move, 1000/50)
Repeat
WaitEvent
Forever
_____________________________________
Hollywood 6.1
Hollywood 6.1
Re: recover what I draw
Fjudde thank you but I do not see what I draw :-/
Re: recover what I draw
Strange? I do see what I draw! Did copy and past code I posted in a new file and run it standalone? What wersion do you have (I have 6.1) and IDE (I have Windows IDE)?sinisrus wrote:Fjudde thank you but I do not see what I draw :-/
The lines are beeing drawn twice. First to the brush and then to the display. The "EndSelect()" is supposed to select the display as output device.
Code: Select all
SelectBrush(1)
Line(StartX,StartY,EndX,EndY,#WHITE,1)
EndSelect()
Line(StartX,StartY,EndX,EndY,#WHITE,1)
Code: Select all
SelectBrush(1)
Line(StartX,StartY,EndX,EndY,#WHITE,1)
EndSelect()
SelectDisplay(1)
Line(StartX,StartY,EndX,EndY,#WHITE,1)
Cause you do see what you have drawn, When you press the button? Right?
Code: Select all
Line(StartX+3,StartY+3,EndX+3,EndY+3,#WHITE,1)
_____________________________________
Hollywood 6.1
Hollywood 6.1
Re: recover what I draw
Should have been:Did copy and past code I posted in a new file and run it standalone?
Did you copy and past the code I posted in a new file and ran it standalone?
_____________________________________
Hollywood 6.1
Hollywood 6.1
Re: recover what I draw
fjudde
Work now very tank )
Work now very tank )