Sync

Refreshes the screen. If the optional vwait parameter is set to true, vertical syncing will be enabled, which will lock the screen refresh rate at 60 hertz and prevent screen "tearing".

Syntax

Parameters

Example

window = Window:Create()
context = Context:Create(window)

while true do
if window:Closed() or window:KeyHit(Key.Escape) then return false end

Time:Update()

context:SetColor(0,0,1)
context:Clear()

context:SetColor(1,1,1)
context:SetBlendMode(Blend.Alpha)
context:DrawText("FPS: "..Time:UPS(),0,0)

local vsync = not window:KeyDown(Key.Space)
context:DrawText("VSync: "..tostring(vsync),0,20)

context:Sync(vsync)
end