Is there any sample available to draw a texture path based on the touchMove event?
Draw shape on touchMove
(6 posts) (3 voices)-
Posted 1 year ago #
-
What do you mean with a texture path?
The next version of Sparrow (which will be out this week, or you can grab it via SVN) contains a new feature called "SPRenderTexture" which lets you draw other display objects onto a texture. Perhaps that could help.
Posted 1 year ago # -
Hi,
Thanks for your quick response. I'm a newbie to Sparrow and looking for a sample by which I can draw line based on user touchMove.
Posted 1 year ago # -
Hm, line drawing is not so easy per default, because you would have to create custom OpenGL code (a custom render method) to do it efficiently.
However, you can cheat a little to make that easier
For one, if you draw an SPQuad that is very narrow, it looks like a line.So you could just create an SPQuad in your mouse event listener, in a way that it lies between the current and the previous touch position. (Look at the Demo application, class 'TouchSheet' for a sample on how to find out those positions.)
As soon as Sparrow 1.1 is out, you can draw this quad to a render texture instead of adding it to the scene. That way, everything should be very fast, no matter how many line segments you have already created.
The Demo application will get a simple demo on how to draw something on the screen with the render texture (in v1.1) - I'm sure this will get you started!
Posted 1 year ago # -
If you're still interested, you can check out my new custom SHLine class here: http://shilo.coarsemode.com/sparrow/addons/#7A.
Posted 1 year ago # -
Thanks for your reply. These inputs should help me move further with Sparrow.
Posted 1 year ago #
Reply
You must log in to post.