# SetDisplayAspect

## Description

This command is used in conjunction with the default percentage based positioning system in AGK. If using this approach you will need to specify a display aspect, so that AGK knows how to correctly display entities on screen. If your artwork was originally designed for a resolution of 1024 x 768, this would result in an aspect ratio of 4:3, which is also the same as saying 1024 / 768 = 1.33, therefore you would call SetDisplayAspect and pass in a 1.33 as your aspect ratio. On platforms where the resolution was different AGK will take care of things internally so that your application still maintains this aspect ratio and looks correct.
The alternative approach is to call SetVirtualResolution to control the coordinate system and place sprites using screen coordinates instead of using percentages, in which case you should not call this command.
If sprites already exist when this is called they will become distorted. If the aspect ratio given does not fit exactly on the current device, black borders will be drawn around the rendering area to center it on screen.
Use an aspect ratio of 0 to use the current coordinate system as the aspect ratio.
Use an aspect ratio of -1 to use the device aspect ratio (fills the whole screen without black borders, but will cause stretching and look different on every device) An alternative method of filling the screen which avoids this problem is to use SetScissor with the values 0,0,0,0.

## Definition

SetDisplayAspect( aspect )

void agk::SetDisplayAspect( float aspect )

## Parameters

- aspect - the aspect ratio to use from now on, in the form of width/height.