|
VSYNC
Jul 19, 2015 0:47:44 GMT 1
Post by troycheek on Jul 19, 2015 0:47:44 GMT 1
Just curious, but is there an equivalent of the old GFA BASIC for ST command VSYNC for GB32? I'm fiddling with a 3D maze game and the screen draws have a bit of flickering and tearing.
VSYNC Syntax: VSYNC Action: Enables synchronization with the screen by waiting until the next vertical sync pulse is received - helps avoid flickering of the screen during animation when using GET and PUT.
|
|
|
VSYNC
Jul 19, 2015 1:43:26 GMT 1
Post by dragonjim on Jul 19, 2015 1:43:26 GMT 1
There is no ~Vsync command but you can use the following which is one of my own library subs:
Procedure FlickerControl(frm As Form, state%) // state% : 0 - Suspend Rendering; 1 - Reinstate and Redraw ~SendMessage(frm.hWnd, WM_SETREDRAW, state%, 0) If state% = 1 Then ~RedrawWindow(frm.hWnd, Null, Null, RDW_ERASE | RDW_FRAME | RDW_INVALIDATE | RDW_ALLCHILDREN) EndProcedure
This can do some odd things if you try redrawing after a MouseMove event (which can be fixed with DoEvents), but otherwise it seems to work well. Basically, use it like this:
FlickerControl(Win_1, 0) // Change Win_1 for the window/form you are drawing to ... ... Do your drawing ... FlickerControl(Win_1, 1)
Hope that helps.
|
|
|
VSYNC
Jul 22, 2015 19:07:36 GMT 1
Post by troycheek on Jul 22, 2015 19:07:36 GMT 1
For the record, this does help, so thank you. Immediately after implementing it, I made some minor changes and suddenly it doesn't seem necessary anymore. Not sure what that's all about. I meant to do more experimentation, but got distracted by other projects.
|
|