SHIP:Port:touch

From Serious Documentation
Jump to: navigation, search

Touch ports are used to read and configure the touch interface of the SIM and are usually referred to in the format "platform.TOUCH0", "platform.TOUCH1", etc.

Portvar Data Type Permissions Description
event Touch Read Only A complex datatype with several properties. (see Touch Events)
width Dimension Read Only This is the width (x), in pixels, of the SIM's display. (Default: platform specific)
height Dimension Read Only This is the height (y), in pixels, of the SIM's display. (Default: platform specific)
mirrorx Boolean Read/Write When set, the values received from touch events are mirrored in the x direction. Can be used in conjunction with flipxy. (Default: false)
mirrory Boolean Read/Write When set, the values received from touch events are mirrored in the y direction. Can be used in conjunction with flipxy. (Default: false)
flipxy Boolean Read/Write When set, the values received from touch events are flipped on the x-y axis (portrait mode). Can be used in conjunction with mirrorx and/or mirrory. (Default: false)

see GRM

Touch Events

Touch Datatype

Data Type Description
Touch Contains the type of the event, x coordinate, and y coordinate of the touch.

If the name of the touch port on your platform is "TOUCH0", access the information like so:

  • TOUCH0.event.e - contains the TOUCH.UP, TOUCH.DN, or TOUCH.MV event code
  • TOUCH0.event.x - contains the last x coordinate detected
  • TOUCH0.event.y - contains the last y coordinate detected
  • TOUCH0.event.value (or just TOUCH0.event) - used to detect whenever any sub-property (e, x, or y) changes.

Touch Constants

The name TOUCH refers to a group of constants used to abstract and simplify discernment of the specific type of touch event. The constants in this group are:

These constants can be referenced with their full names in the format "platform.TOUCH0.TOUCH.DN", where "TOUCH0" is the name of the touch port on your SIM platform (see your SIM's GRM).

However, it is recommended that you do not create any other node with the exact name "TOUCH" so that you may reference these in short form as TOUCH.DN etc.