Difference between revisions of "love.window.setVSync"

(Created page with "{{newin|11.3|113|type=function}} Sets vertical synchronization mode without recreating the window. == Function == === Synopsis === <source lang="lua"> love.window.setVSyn...")
 
m (60/3 = 20)
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
{{newin|[[11.3]]|113|type=function}}
 
{{newin|[[11.3]]|113|type=function}}
Sets vertical synchronization mode without recreating the window.
+
Sets vertical synchronization mode.
  
 
== Function ==
 
== Function ==
Line 8: Line 8:
 
</source>
 
</source>
 
=== Arguments ===
 
=== Arguments ===
{{param|number|vsync|VSync number: 1 to enable, 0 to disable, and -1 for adaptive vsync.}}
+
{{param|number|vsync|VSync number: 1 to enable, 0 to disable, -1 for adaptive vsync, 2 or larger will wait that many frames before syncing.}}
 
=== Returns ===
 
=== Returns ===
 
Nothing.
 
Nothing.
=== Notes ===
+
 
* Not all graphics drivers support adaptive vsync (-1 value). In that case, it will be automatically set to 1.
+
== Notes ==
 +
* Not all graphics drivers support adaptive vsync (-1 value) and values more than 1 (vsync at other intervals). In that case, it will be automatically set to 1.
 +
* Having vsync be a number larger than one means that the game will sync to the nearest whole number of the screen's refresh rate divided by the given number; e.g. on a 60 Hz screen, vsync being 2 means it'll run at 30 FPS, 3 means 20 FPS, etc.
 +
* It is recommended to keep vsync activated if you don't know about the possible implications of turning it off.
 
* This function doesn't recreate the window, unlike [[love.window.setMode]] and [[love.window.updateMode]].
 
* This function doesn't recreate the window, unlike [[love.window.setMode]] and [[love.window.updateMode]].
  

Latest revision as of 12:28, 28 August 2021

Available since LÖVE 11.3
This function is not supported in earlier versions.

Sets vertical synchronization mode.

Function

Synopsis

love.window.setVSync( vsync )

Arguments

number vsync
VSync number: 1 to enable, 0 to disable, -1 for adaptive vsync, 2 or larger will wait that many frames before syncing.

Returns

Nothing.

Notes

  • Not all graphics drivers support adaptive vsync (-1 value) and values more than 1 (vsync at other intervals). In that case, it will be automatically set to 1.
  • Having vsync be a number larger than one means that the game will sync to the nearest whole number of the screen's refresh rate divided by the given number; e.g. on a 60 Hz screen, vsync being 2 means it'll run at 30 FPS, 3 means 20 FPS, etc.
  • It is recommended to keep vsync activated if you don't know about the possible implications of turning it off.
  • This function doesn't recreate the window, unlike love.window.setMode and love.window.updateMode.

See Also


Other Languages