# AddVirtualButton

## Description

Creates an on-screen button that can be controlled by a touch screen, mouse, or other pointer device. These are separate to physical joystick buttons or keyboard keys so you could have a virtual button with ID 1 and a real joystick button with ID 1. You may have up to 12 virtual buttons on screen at the same time. If a virtual button is on screen and is clicked or touched the button will capture that event and GetMouseLeftState will return 0 (up), and a touch event will not be generated for that action.

## Definition

AddVirtualButton( index, x, y, size )

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

## Parameters

- index - The ID of the virtual button to create, must be in the range 1 to 12.
- x - The x position of the center of the button in screen coordinates.
- y - The y position of the center of the button in screen coordinates.
- size - The diameter of the button in screen coordinates.