This section shows how to define and use tags.
/* Initialize CleO */
/* Start drawing the screen shot */
CleO.StringExt(FONT_SANS_6, 400, 75, LIGHT_GREEN, MM, 0, 0, "TOUCH OBJECTS");
int line_len = 266;
CleO.Line(400 - (line_len/2), 150, 400 + (line_len/2), 150);
CleO.StringExt(FONT_SANS_6, 400, 230, LIGHT_GREEN, MM, 0, 0,
CleO.StringExt(FONT_SANS_6, 400, 430, LIGHT_GREEN, MM, 0, 0,
/* Show the screenshot */
int16_t x, y, dur, tag, newval;
CleO.TouchCoordinates(x, y, dur, tag);
if (tag == 1)
lineTouched = true;
else if (tag == 2)
pointTouched = true;
pointTouched = lineTouched = false;
Using the Tag(int tag_no) routine, you can draw the CleO primitives which get assigned a tag.
This tag is used to identify touch on drawing.
The display() function draws a line with tag 1 and point with tag 2.
It checks whether these drawings are touched and if so, it creates an effect of a button press.
The control() routine checks for touch using the TouchCoordinates() command and fills up the tag value based on which drawing was touched.
It checks the tag value and updates the boolean to notify which drawing was affected.
Note: A tag is applicable on all the objects after which it is used. In this case, the object point (400,330) starts with tag 2 and ends with END tag 255.
Here is the output displayed upon executing the code snippet -