Jump to content


Photo

Mouse Gesture Recognition Engine


  • Please log in to reply
14 replies to this topic

#1 Boreal

Boreal

    C++ Wackjob

  • GMC Member
  • 417 posts
  • Version:None

Posted 15 November 2011 - 12:41 AM

Moved temporarily to Rejected Forum, awaiting new download link.

-- chance

  •  
  • Title: Mouse Gesture Recognition Engine
  • Description: Converts shapes drawn by the user's mouse to simple strings of directions
  • GM Version: GM 8.1
  • Registered: Yes, because it uses ds_lists
  • File Type: .gm81
  • File Size: 10.01KB
  • File Link: http://www.mediafire...mjojqdqf249jxqi
  • Required Extensions: None
  • Required DLLs: None

Summary
This is a simple engine that converts a shape drawn by the mouse (well, a list of 2D vectors to be precise) to a string of cardinal directions (Left, Up, Right, Down). It can be used to change handwriting into text, for quick navigation in a complex program, drawing symbols to perform actions in an RPG, and really anything that can use mouse gestures.

I've commented the larger and less obvious blocks of code, and indicated which parts are not part of the core engine, that is, just for testing purposes. You will probably be using something similar to the large switch statement that picks the right action for each correctly drawn gesture, however.

Spoiler

Edited by chance, 19 June 2014 - 08:42 PM.

  • 0

#2 icuurd12b42

icuurd12b42

    Self Formed Sentient

  • GMC Member
  • 15783 posts
  • Version:GM:Studio

Posted 15 November 2011 - 12:51 AM

Well done, but the circle does not work when you start it from the top
  • 0

#3 Boreal

Boreal

    C++ Wackjob

  • GMC Member
  • 417 posts
  • Version:None

Posted 15 November 2011 - 01:29 AM

Well done, but the circle does not work when you start it from the top

Ah, that is due to how the gesture is recognized. It is currently only set to be R-U-L-D-R, not L-D-R-U-L :)

And an instant staff pick? Wow!
  • 0

#4 icuurd12b42

icuurd12b42

    Self Formed Sentient

  • GMC Member
  • 15783 posts
  • Version:GM:Studio

Posted 15 November 2011 - 03:33 AM

Yeah, it's simple to understand and efficient. You may want to change the way you round the angle to get the 0-3 value using this code here:

d = floor(((point_direction(0,0,u,v)+180/4) mod 360)/(360/4))


The method you use has some shortfalls which I describe and demonstrate here
http://gmc.yoyogames...howtopic=345666
  • 0

#5 Boreal

Boreal

    C++ Wackjob

  • GMC Member
  • 417 posts
  • Version:None

Posted 15 November 2011 - 04:06 AM

Yeah, it's simple to understand and efficient. You may want to change the way you round the angle to get the 0-3 value using this code here:

d = floor(((point_direction(0,0,u,v)+180/4) mod 360)/(360/4))


The method you use has some shortfalls which I describe and demonstrate here
http://gmc.yoyogames...howtopic=345666

Wouldn't using point_direction() to get the angle never go under 0 or above/equal to 360? :huh:
  • 0

#6 icuurd12b42

icuurd12b42

    Self Formed Sentient

  • GMC Member
  • 15783 posts
  • Version:GM:Studio

Posted 15 November 2011 - 04:26 AM

Yes, I just copied the line from my tut and dropped your point direction and your 4 in it.


Actually, never mind what I said. you used round() so the result is proper.
  • 0

#7 napalmgamer

napalmgamer

    GMC Member

  • New Member
  • 13 posts
  • Version:GM8

Posted 31 December 2011 - 08:29 PM

What the heck is a GM81 file? :wacko:
Isn't it supposed to be GMK?
How do you make Game maker :GM8: Read This?

Please Help
  • 0

#8 Dark Matter

Dark Matter

    RPG Expert

  • GMC Member
  • 3196 posts
  • Version:GM:Studio

Posted 01 January 2012 - 01:30 PM

What the heck is a GM81 file? :wacko:
Isn't it supposed to be GMK?
How do you make Game maker :GM8: Read This?

Please Help

It's a GameMaker 8.1 file. You can find a converter here.
  • 0

#9 martan92

martan92

    GMC Member

  • GMC Member
  • 30 posts
  • Version:GM8.1

Posted 11 January 2012 - 09:03 PM

My computer crashed(blue screen then reboot) when running the game(when drawing). Could have something to do with memory(memory leak or something), maybe you should give a heads up or something.
  • 0

#10 Boreal

Boreal

    C++ Wackjob

  • GMC Member
  • 417 posts
  • Version:None

Posted 13 January 2012 - 09:53 PM

My computer crashed(blue screen then reboot) when running the game(when drawing). Could have something to do with memory(memory leak or something), maybe you should give a heads up or something.

All I'm doing in terms of memory when drawing is adding to lists and clearing lists. I don't have any idea what could be happening to you.
  • 0

#11 Nocturne

Nocturne

    Nocturne Games

  • Administrators
  • 21261 posts
  • Version:GM:Studio

Posted 13 January 2012 - 10:08 PM

My computer crashed(blue screen then reboot) when running the game(when drawing). Could have something to do with memory(memory leak or something), maybe you should give a heads up or something.


It is more than likely just an unhappy coincidence... I think that this certainly could not cause a BSOD! Check your hardware...
  • 0

#12 martan92

martan92

    GMC Member

  • GMC Member
  • 30 posts
  • Version:GM8.1

Posted 15 January 2012 - 06:25 PM


My computer crashed(blue screen then reboot) when running the game(when drawing). Could have something to do with memory(memory leak or something), maybe you should give a heads up or something.


It is more than likely just an unhappy coincidence... I think that this certainly could not cause a BSOD! Check your hardware...

I don't think so, it happened 3 times in a row whenever I just click when running this program.
  • 0

#13 ddan49

ddan49

    GMC Member

  • New Member
  • 101 posts
  • Version:GM8

Posted 22 February 2012 - 02:19 AM

Okay, so I just want to say...

WOW. This is really, really nice... in fact, this is probably a massive component of a successful game. I'm pretty sure this is what differentiates a cheap homemade game from a commercial one. Keep up the good work!

P.S. I would be very surprised if this wasn't an instant staff pick... it works and is easy to read (I'm COMPLETELY new to GML), and is also a coveted gameplay mechanic.
  • 0

#14 greyzebra

greyzebra

    GMC Member

  • GMC Member
  • 116 posts
  • Version:GM:Studio

Posted 27 February 2012 - 03:51 AM

Very nice. Thank you!
  • 0

#15 Draiden2kx

Draiden2kx

    GMC Member

  • New Member
  • 1 posts
  • Version:GM8

Posted 03 April 2014 - 10:47 PM

Hello everyone,

 

I would really like this engine, but apparently the link is down, can you guys please re-upload it?

 

thx!!!


  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users