Guest User

Untitled

a guest
Jul 20th, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. @implementation TouchDraw
  2.  
  3. @synthesize drawPoints;
  4.  
  5. - (id) init
  6. {
  7. self = [super init];
  8. glEnable(GL_LINE_SMOOTH);
  9. glLineWidth(5.0f);
  10. return self;
  11. }
  12.  
  13. - (void) draw
  14. {
  15. if (drawPoints && [drawPoints count] < 2)
  16. {
  17. // not enough points to draw a line
  18. return;
  19. }
  20.  
  21. // draw a line from 1 point to the other
  22. for (unsigned int i = 0; i < [drawPoints count]; i += 2)
  23. {
  24. CGPoint first = CGPointFromString([drawPoints objectAtIndex:i]);
  25. CGPoint second = CGPointFromString([drawPoints objectAtIndex:i + 1]);
  26. ccDrawLine(first, second);
  27. }
  28. }
  29.  
  30. @end
Add Comment
Please, Sign In to add comment