If you are using a touch-based input device, you can make use of the built-in touch controllers. These controllers are specifically designed for touch input, making use of multi-touch input and providing visual and touch-based alternatives for the traditional mouse and keyboard input.

The main touch implementations are:

The standard controllers all extend from ALcdGXYChainableController, which allows controllers to be chained. If one controller cannot handle the input, or only partially, the next controller in the chain can react as well on this input. A possible use case is to chain the TLcdGXYTouchSelectEditController with a TLcdGXYTouchNavigateController. Such a controller would allow to select, edit, and navigate without switching controllers.

Note that in order to use these controllers, you need a compatible touch device. Refer to Handling non-standard input for more information on the touch device support in LuciadLightspeed.

Creating a custom touch controller

LuciadLightspeed offers ALcdGXYTouchChainableController, a base class which simplifies the process of writing your own implementation of ILcdGXYChainableController. This base class provides three abstract methods that allow you to indicate which points will be handled by the controller, and how to react to changes to those points:

  • touchPointAvailable: this method is called every time a new touch point becomes available and determines which points are handled by the controller.

  • touchPointMoved: this method is called whenever one of the tracked touch points has moved. It allows to stop tracking certain points.

  • touchPointWithDrawn: this method is called every time a touch point is no longer available. Similar to the touchPointMoved method, it allows to stop the tracking of certain points by this controller.

When touch points are tracked by the custom controller, utility methods are available to retrieve the original, previous, and current locations of the tracked point(s). Refer to the API reference for more information on ALcdGXYTouchChainableController.