# SetScreenResolution

## Description

Sets the resolution of the backbuffer where possible. If your chosen resolution is greater than the device can display than the device will use its highest possible resolution, you can use GetDeviceWidth and GetDeviceHeight to find out what was used. On mobile devices using a screen resolution with a different aspect ratio than the device will result in stetching. You can check the aspect ratio of the device with GetMaxDeviceWidth and GetMaxDeviceHeight. It is not recommended that you allow both portrait and landscape orientations when using this command as AGK cannot prevent stretching without undoing your desired screen resolution so it will not do so. If you want all orientations without stretching you will need to monitor GetMaxDeviceWidth and GetMaxDeviceHeight for changes and set an appropriate replacement resolution with SetScreenResolution to match the new aspect ratio. Using a resolution of 0 in either direction will reset the screen resolution to the maximum resolution supported on the device. Note that on Windows and Mac the backbuffer size is changed by modifying the size of the window, so it will overwrite any settings from SetWindowSize. This may not be the case in the future and AGK may be able to have separate window sizes and backbuffer sizes in a future version.

## Definition

SetScreenResolution( width, height )

void agk::SetScreenResolution( int width, int height )

## Parameters

- width - The desired width of the screen in pixels.
- height - The desired height of the screen in pixels.