Input Handling Tips and Tricks

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 frompvr::Shell, exactly like eventMappedInput.