Difference between revisions of "SHIP:Data Types:Touch"

From Serious Documentation
Jump to: navigation, search
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
A {{Port|touch}} port's {{Portvar|touch|event}} portvar is a complex {{DataType|Touch}} datatype with several properties. For example:
+
<onlyinclude>
 +
{{DataTypeTableStart|}}
 +
|{{DataType|Touch}}||Contains the type of the event, x coordinate, and y coordinate of the touch.
 +
|}
  
* '''TOUCH0.event.e''' contains the {{Const|touch|TOUCH.UP}}, {{Const|touch|TOUCH.DN}}, {{Const|touch|TOUCH.MV}} event code
+
If the name of the {{Port|touch}} port on your platform is "'''TOUCH0'''", access the information like so:
* '''TOUCH0.event.x''' contains the most recent x position of the touch
+
* '''TOUCH0.event.e''' - contains the {{Const|TOUCH|TOUCH.UP}}, {{Const|TOUCH|TOUCH.DN}}, or {{Const|TOUCH|TOUCH.MV}} event code
* '''TOUCH0.event.y''' contains the most recent y position of the touch
+
* '''TOUCH0.event.x''' - contains the last x coordinate detected
* '''TOUCH0.event.value''' (or in short form, '''TOUCH0.event''') changes whenever any sub-property ('''e''', '''x''', or '''y''') changes.
+
* '''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.</onlyinclude>
To listen in a SHIP GUI for a touch event in a {{Node|box}}, create a listener in that box and set the {{Node|listener|listener}}'s {{Prop|listener|listeningto}} property to, for example, '''TOUCH0.event.e'''. You may want to be more specific and only listen for a release. In that case, you would add '''(TOUCH0.event.e == TOUCH.UP)''' to the same {{Node|listener|listener}}'s {{Prop|listener|condition}} property.
 

Latest revision as of 17:02, 4 February 2013

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.