# AddVirtualJoystick

## Description

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

## Definition

AddVirtualJoystick( index, x, y, size )

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

## Parameters

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