logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

SDL_SetWindowSurfaceVSync - Toggle VSync for the window surface.

Availability

       This function is available since SDL 3.2.0.

Description

       When a window surface is created, vsync defaults to SDL_WINDOW_SURFACE_VSYNC_DISABLED.

       The vsync parameter can be 1 to synchronize present with every vertical refresh, 2 to synchronize present
       with  every  second  vertical  refresh,  etc.,  SDL_WINDOW_SURFACE_VSYNC_ADAPTIVE  for  late swap tearing
       (adaptive vsync), or SDL_WINDOW_SURFACE_VSYNC_DISABLED to disable. Not every value is supported by  every
       driver, so you should check the return value to see whether the requested setting is supported.

Function Parameters

window the window.

       vsync  the vertical refresh sync interval.

Name

       SDL_SetWindowSurfaceVSync - Toggle VSync for the window surface.

Return Value

       for more information.

See Also

SDL_GetWindowSurfaceVSync(3)

Simple Directmedia Layer                           SDL 3.2.20                       SDL_SetWindowSurfaceVSync(3)

Synopsis

#include<SDL3/SDL_video.h>boolSDL_SetWindowSurfaceVSync(SDL_Window*window,intvsync);#defineSDL_WINDOW_SURFACE_VSYNC_DISABLED0#defineSDL_WINDOW_SURFACE_VSYNC_ADAPTIVE(-1)

Thread Safety

       This function should only be called on the main thread.

See Also