January 2014
Intermediate to advanced
736 pages
70h 43m
English
The touchStarted method (Fig. 7.29) is called when a finger first touches the screen. The coordinates of the touch and its ID are supplied as arguments. If a Path already exists for the given ID (line 198), we call Path’s reset method to clear any existing points so we can reuse the Path for a new stroke. Otherwise, we create a new Path, add it to pathMap, then add a new Point to the previousPointMap. Lines 213–215 call Path’s moveTo method to set the Path’s starting coordinates and specify the new Point’s x and y values.
Read now
Unlock full access