# SetSyncRate

## Description

Sets the desired rate that frames will be drawn to the screen, in frames per second (fps). Additionally there are two modes to choose from that can limit the CPU, the first (mode=0) sleeps the application between frames to save CPU and battery life where possible. The second (mode=1) uses a continuous loop to check the time before the next frame, which can be more accurate but hogs the CPU.
The preferred method of limiting frame rate is SetVSync() which set the refresh rate to the monitor refresh rate, and will prevent any screen tearing or stuttering. Using SetSyncRate will automatically turn VSync off since the two commands would fight each other for control of the frame rate.
Use an fps of 0 to remove all limits and draw frames as quickly as possible. This may be up to thousands of frames per second on the most powerful graphics cards.
Note that on HTML5 the use of SetSyncRate is highly discouraged as it uses the Javascript SetTimeout function for timing, which can cause inaccurate frame rates and stuttering. On HTML5 the preferred method of frame rate control is SetVSync.

## Definition

SetSyncRate( fps, mode )

void agk::SetSyncRate( float fps, int mode )

## Parameters

- fps - The desired frame rate in frames per second, 0 for unlimited.
- mode - 1 to use a possibly more accurate but CPU intensive method, 0 (default) to save CPU and battery.