Handling Inputs#

PVRShell simplified (mapped) input#

Nearly all SDK Examples use Simplified Input. This is a model that is suitable for demo applications. No matter the platform, common actions are mapped to a handful of events:

  • Action1

  • Action2

  • Action3

  • Left

  • Right

  • Up

  • Down

  • Quit

The Shell already does this mapping. All that is required is overriding the eventMappedInput function of pvr::Shell as follows:

pvr::Result::Enum pvr::Shell::eventMappedInput(pvr::SimplifiedEvent::Enum evt)

This function will be called every time one of the actions is performed that maps to a simplified event.

Lower-level input#

Besides this simplified input, it is possible to not use mappedInput and instead use the lower level input events:

  • onKeyDown

  • onKeyUp

  • onKeyPress

  • onPointingDeviceDown

  • onPointingDeviceUp

All these functions map differently to different platforms, and may not be present everywhere, for instance keyDown and so on for mobile devices without keyboards. They can enable custom programming of the developer’s own input scheme. These functions can be used normally by overriding them from pvr::Shell, exactly like eventMappedInput.

Input Events on Desktop#

INPUT EVENT

How to trigger on Desktop (Window)

How to trigger on Desktop (Console)

Action1

Space, Enter, Select centre of screen

Space, Enter

Action2

Select left 30% of screen, Key “1”

Key “1”

Action3

Select right 30% of screen, Key “2”

Key “2”

Left/Right/Up/Down

Left/Right/Up/Down keys, Drag mouse Left/Right/Up/Down

Left/Right/Up/Down keys

Quit

Escape, Q key, close window

Escape, Q key

Input Events on Android#

INPUT EVENT

How to trigger on Android

Action1

Touch centre of screen

Action2

Touch left 30% of screen

Action3

Touch right 30% of screen

Left/Right/Up/Down

Swipe Left/Right/Up/Down

Quit

“Back” key

Input Events on iOS#

INPUT EVENT

How to trigger on iOS

Action1

Touch centre of screen

Action2

Touch left 30% of screen

Action3

Touch right 30% of screen

Left/Right/Up/Down

Swipe Left/Right/Up/Down

Quit

“Home” key