AGK for Pascal
ContentsIndexHome
PreviousUpNext
TAgkJoystick.SetButtonPosition Method (Integer, Single, Single, Single)

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.

Syntax
Pascal
class procedure SetButtonPosition(const Button: Integer; const X: Single; const Y: Single; const Size: Single); overload;
Parameters 
Description 
const Button: Integer 
The index of the button (1-5). 
const X: Single 
The X coordinate of the button in screen coordinates. 
const Y: Single 
The Y coordinate of the button in screen coordinates. 
const Size: Single 
The diameter of the button in screen coordinates. 

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.

Copyright (c) 2012. All rights reserved.