-- xtra VSync -- v0.2 (c) 2019 Valentin Schmidt new object me *waitForVerticalBlank object me -- returns when the vertical-blank interval begins *waitForVerticalBlankEnd object me -- returns when the vertical-blank interval ends and the display begins *getVerticalBlankStatus object me -- returns TRUE if currently in vertical-blank interval *getScanLine object me -- returns scan line currently being drawn on the monitor, or integer<0 if in vertical-blank interval *getMonitorFrequency object me -- retrieves the frequency of the monitor that the DirectDraw object controls All functions return a HRESULT in case of failure, so if the result is <0, some error occured. getScanLine() returns DDERR_VERTICALBLANKINPROGRESS (= -2005532135) if it was called during the vertical-blank interval (which is not really an "error"). For more details on all functions see https://docs.microsoft.com/en-us/windows/desktop/api/ddraw/nn-ddraw-idirectdraw7 ---------------------------------------- waitForVerticalBlank() ---------------------------------------- Function blocks until a vertical blank is reached, so calling it right before any screen update - e.g. updateStage() - assures that the display is refeshed in a vertical blank, i.e. without tearing. ---------------------------------------- waitForVerticalBlankEnd() ---------------------------------------- Function blocks until vertical blank ends and the display begins. ---------------------------------------- getVerticalBlankStatus() ---------------------------------------- Function returns TRUE if currently in vertical-blank interval, otherwise FALSE (or a number <0 if an error occured). ---------------------------------------- getScanLine() ---------------------------------------- Returns the scan line that is currently being drawn on the monitor, or integer<0 if called in vertical blank interval. ---------------------------------------- getMonitorFrequency() ---------------------------------------- Retrieves the frequency of the monitor that the DirectDraw object controls, e.g. 59 or 60.