# SetButtonScreenPosition

## Description

This function positions a virtual button at the given position only if it is necessary for this device, for example if a real joystick or keyboard are present then this command will have no noticable effect. It is recommended you call this command anyway, just in case a virtual button is needed.
The AGK buttons are an emulated input method that uses whatever device inputs are available to produce 5 buttons. If a real joystick is found then the first 5 buttons from that will be used for the AGK button commands. Otherwise the AGK looks for a fullsize keyboard and if found will use the following keys in the following order Space, E, R, Q, Control, to represent buttons 1 to 5 respectively. If neither a joystick nor keyboard is found then a virtual button is created that will appear on screen and can be pressed with either touch screen inputs or a mouse. Every platform is guaranteed to have a method of activating the AGK buttons. If a virtual button is created it will be centered on the given X,Y position.

## Definition

SetButtonScreenPosition( index, x, y, size )

void agk::SetButtonScreenPosition( UINT index, float x, float y, float size )

## Parameters

- index - The ID of the button to position, must be in the range 1 to 5 inclusive.
- x - The X coordinate of the button position in screen coordinates.
- y - The Y coordinate of the button position in screen coordinates.
- size - The diameter of the button position in screen coordinates.