Forums

OverviewV-Play 1 Support › Drawing with Mouse/Finger

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

    JJ

    I have been using V-Play 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
    V-Play Team

    Hi JJ,

    great that you like it so far, and welcome to the V-Play 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.

Voted #1 for:

  • Easiest to learn
  • Most time saving
  • Best support

Develop Cross-Platform Apps and Games 50% Faster!

  • Voted the best supported, most time-saving and easiest to learn cross-platform development tool
  • Based on the Qt framework, with native performance and appearance on all platforms including iOS and Android
  • Offers a variety of plugins to monetize, analyze and engage users
FREE!
create apps
create games
cross platform
native performance
3rd party services
game network
multiplayer
level editor
easiest to learn
biggest time saving
best support