Find the Best Demos and Examples

Check out this quick tour to find the best demos and examples for you, and to see how the Felgo SDK can help you to develop your next app or game!

Forums

OverviewFelgo 1 Support › Drawing with Mouse/Finger

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #6284

    JJ

    I have been using Felgo for a week now and so far I am very impressed.

    I am a bit stuck on one thing at the moment and was hoping someone can point me in the right direction.

    I would like to allow the user to draw on screen with a mouse/finger. I assume I would activate a mouse area and while the mouse is down draw a line of 1 pixel at the mouse position. Not sure if this is the most effective way.

    I would also like to add the ability to erase a line. How do I approach this?

    I am a bit of a noob when it comes to game development, so apologies if this is a noob question.

    #6285

    Christian
    Felgo Team

    Hi JJ,

    great that you like it so far, and welcome to the Felgo community. 🙂

    For your example, I can see 2 ways to do this:

    1.) Use the LineItem component and add to the points array when the mouse position changes by a given delta (to avoid performance getting too bad due to loads of points added).

    2.) Add a new SingleSpriteFromFile object when the mouse position changed by a given delta. The image you are using should have the color of the line you prefer and probably it’s best to make it a circle with smooth edges. This has the advantage that it is more performant, because only a single draw call is needed for all “points” along the line. However, this solution is also a bit more complex and for a proof of concept I would go for the above approach first.

    Cheers, Chris

Viewing 2 posts - 1 through 2 (of 2 total)

RSS feed for this thread

You must be logged in to reply to this topic.