# GetButtonPressed

## Description

This function returns 1 if the specified button has just been pressed, then returns 0 while the button is held down. 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.

## Definition

integer GetButtonPressed( index )

int agk::GetButtonPressed( UINT index )

## Parameters

- index - The ID of the button to check, must be in the range 1 to 5 inclusive.