Hi,
I have a slight problem. I use a windowed screen in my application for displaying an image. When the image changes I simply draw to the screen and then call FlipBuffers(). If I need to repaint the whole of the image, I call FlipBuffers() twice.
The problem is that if the mouse pointer is over the area of my window which is the screen, then the area under the mouse pointer gets restored (along with the mouse pointer) *after* I draw my new image.
I don't know if this is due to Windows (98), but it is probably due to me not knowing exactly how to update windows (and what happens internally) in the case of windowed screens.
Any advice would be appreciated. I can also send code to anyone interested.
Cheers.
Update: Here is some code to illustrate (you need to move the mouse to get it to redraw the area under it on my system - so put the mouse over the shape, click with the left button and move it away):
Code: Select all
#WindowWidth = 400
#WindowHeight = 300
#ScreenWidth = #WindowWidth - 4 - 4
#ScreenHeight = #WindowHeight - 4 - 4
#NumberVertices = 5
If InitSprite()=0 : End : EndIf
ds_Zoom.w = 10
Procedure DrawStuff()
Shared ds_Zoom
StartDrawing(ScreenOutput())
FrontColor(0,0,0)
Box(0, 0, #ScreenWidth, #ScreenHeight)
FrontColor(255, 0, 0)
For vertex = 0 To #NumberVertices-1
x_start = #ScreenWidth/2 + ds_Zoom * Sin((vertex * 360 / #NumberVertices) * 3.1412 / 180)
y_start = #ScreenHeight/2 + ds_Zoom * Cos((vertex * 360 / #NumberVertices) * 3.1412 / 180)
For vertoo = 0 To #NumberVertices-1
If vertex vertoo
x_end = #ScreenWidth/2 + ds_Zoom * Sin((vertoo * 360 / #NumberVertices) * 3.1412 / 180)
y_end = #ScreenHeight/2 + ds_Zoom * Cos((vertoo * 360 / #NumberVertices) * 3.1412 / 180)
LineXY(x_start, y_start, x_end, y_end)
EndIf
Next
Next
StopDrawing()
FlipBuffers()
EndProcedure
If OpenWindow(0, 0, 0, #WindowWidth, #WindowHeight, #PB_Window_SystemMenu|#PB_Window_MinimizeGadget|#PB_Window_MaximizeGadget|#PB_Window_SizeGadget, "foo")
SetFrameRate(120)
If OpenWindowedScreen(WindowID(0), (#WindowWidth-#ScreenWidth)/2, (#WindowHeight-#ScreenHeight)/2, #ScreenWidth, #ScreenHeight, 0, #WindowWidth-(#WindowWidth-#ScreenWidth)/2, #WindowHeight-(#WindowHeight-#ScreenHeight)/2)
DrawStuff()
quit.w=0
Repeat
ev.l=WaitWindowEvent()
While ev0
Select ev
Case #PB_EventCloseWindow
quit = 1
Case #PB_EventRePaint
FlipBuffers() : FlipBuffers()
Case #WM_LBUTTONUP
ds_Zoom + 10
DrawStuff()
Case #WM_RBUTTONUP
ds_Zoom - 10
If ds_Zoom
--
It's not minimalist - I'm increasing efficiency by reducing input effort.
(Win98first ed. + SP1, PB3.40)