I\'m creating a drawing app ( text ) for the iPad using OpenGL. I\'ve already had a look at Apple\'s example GLPaint, and my app is now based on that code. My app should be just
With regards to the second part of your question (how to vary the width of the line depending on the speed of writing), you should be able to achieve this by taking advantage of UITouch
's timestamp
property in your touchesBegan:withEvent:
and touchesMoved:withEvent:
method.
You can calculate the time difference between two subsequent touch events by storing the timestamp of the most recent UITouch
object and comparing it to the new one. Dividing the distance of the swiping motion by the time difference should give you some measurement of the movement speed.
Now all you need to do is to come up with a way to convert speed of writing into line width, which will probably come down to picking an arbitrary value and adjusting it until you're happy with the result.