Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411576 Posts in 69386 Topics- by 58444 Members - Latest Member: darkcitien

May 04, 2024, 09:40:41 PM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsDeveloperTechnical (Moderator: ThemsAllTook)Programming Mouse Gestures
Pages: [1]
Print
Author Topic: Programming Mouse Gestures  (Read 3215 times)
AaronAardvark
Level 1
*


Formerly RazputinOleander


View Profile WWW
« on: May 05, 2009, 09:35:46 AM »

Hey all.  I'm interested in incorporating some DS-style mouse gestures for some game prototypes.

It seems to me, that the thing to do would be along the lines of:

  • cache all mouse points when some activator key is held
  • compare mouse cache to list of known gestures using a curve matching algorithm

The first step is reasonable, since the game idea I have involves pressing a 'manipulate' key anyway.  The second step seems fairly straightforward, but I'm not particularly familiar with any curve matching algorithms, or any best practices on the topic.

Do any of you have experience on doing something like this?
Can you recommend any third party libraries?

Keep in mind, my development environment is on Linux in C/C++, so any Mac or Windows specific stuff should automatically be discounted.

I foraged for some old threads on the topic and uncovered this Game Maker specific one: http://forums.tigsource.com/index.php?topic=4090.0

Doing some Google searches turns up quite a few results for a Java implementation (http://www.smardec.com/products/mouse-gestures.html), some results for an IE plugin, some for a Firefox Addon, several for Opera's mouse gesture support, etc., etc.
Logged
increpare
Guest
« Reply #1 on: May 05, 2009, 09:44:09 AM »

i made a quick c++ implementation made from this as3 one, and found it worked pretty well [and easy to transcribe to c++ (my implementation, in case you're curious, can be found here)].
Logged
AaronAardvark
Level 1
*


Formerly RazputinOleander


View Profile WWW
« Reply #2 on: May 05, 2009, 10:03:23 AM »

Thanks Stephen, that looks perfect.

On a side note: I've seen that game of yours before, but I never bothered to try it because it looked like there were big arrow buttons you needed to press to interact with it.  I had no idea there was mouse gesture support!
Logged
ZeroByte
TIGBaby
*


View Profile
« Reply #3 on: May 06, 2009, 08:44:58 PM »

I've implemented this gesture algorithm before in flash but I've since lost the implementation. I've also recently implemented it in python but I'm fairly sure my python implementation is buggy.
Logged
Guillaume
Level 7
**



View Profile
« Reply #4 on: May 06, 2009, 11:06:04 PM »

For the gestures, you don't need a really complex curve matching algorithm, depending on what gestures you wish to recognize.

You can just have a number of pre-definite check points (with relative offsets to each other) and see if the user's input goes through those points.

For example, the PA library for the nintendo DS has a built in letter recognition (via the stylus); it uses the following check points for the letters:

http://www.palib.info/Reco/PAGraffiti.gif
Logged
archagon
Level 0
***



View Profile
« Reply #5 on: May 11, 2009, 10:40:01 AM »

i made a quick c++ implementation made from this as3 one, and found it worked pretty well [and easy to transcribe to c++ (my implementation, in case you're curious, can be found here)].

Seconding this. I used it recently for a CS project and it worked pretty well. The algorithm is also pretty easy to fiddle with.
Logged
Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic