Author Topic: Could you add a MouseUp and initial only event?  (Read 2528 times)

SmartBoy16

  • Contributor
  • Fanatic
  • **
  • Posts: 587
  • Looking for inspiration.....
    • View Profile
    • Email
Could you add a MouseUp and initial only event?
« on: 2010-02-22, 08:02:13 AM »
I'm just throwing out a few suggestions for the next release.

For the IsMousePressed function, is there a way to add an "Initial Only" thingy to it?
And how about a IsMouseUp Function?

I've completed both on my own by using a series of flags and if/elseif statements (On my next Midnight release) but it would be nice to have those built in.
Looking to the skies.....

bluemonkmn

  • SGDK Author
  • Administrator
  • Fanatic
  • *****
  • Posts: 2761
    • ICQ Messenger - 2678251
    • MSN Messenger - BlueMonkMN@gmail.com
    • View Profile
    • http://sgdk2.sf.net/
    • Email
Re: Could you add a MouseUp and initial only event?
« Reply #1 on: 2010-02-22, 09:12:53 AM »
IsMouseUp is the same as Not IsMousePressed, right?  Why not just use that (check the "Not" box)?
To implement Initial Only for the mouse, you could add a parameter to the mouse pointer sprite (assuming you have a mouse pointer sprite) called "WasMousePressed" and then check:
1. If IsMousePressed
2. If WasMousePressed != 1
  a. WasMousePressed = 1
  b. Do Stuff for intial only mouse press ...
3. Else (if IsMousePressed was false) WasMousePressed = 0

SmartBoy16

  • Contributor
  • Fanatic
  • **
  • Posts: 587
  • Looking for inspiration.....
    • View Profile
    • Email
Re: Could you add a MouseUp and initial only event?
« Reply #2 on: 2010-02-22, 10:00:18 AM »
that's exactly what i did! except for the last else i made a new function, copied the IsMousePressed, and changed the "!=" to "==". it works, but I guess your way is a lot easier.
Looking to the skies.....

bluemonkmn

  • SGDK Author
  • Administrator
  • Fanatic
  • *****
  • Posts: 2761
    • ICQ Messenger - 2678251
    • MSN Messenger - BlueMonkMN@gmail.com
    • View Profile
    • http://sgdk2.sf.net/
    • Email
Re: Could you add a MouseUp and initial only event?
« Reply #3 on: 2010-02-23, 06:15:57 AM »
The reason IsMouseUp is not built in is because it just seems silly to create another whole function when all you have to do is check a box on an existing function.
The reason Initial Only isn't available for the mouse (I see now) is because if you use MapMouseToSprite, you should be able to use IsInputPressed (which already has InitialOnly) to check the state of the mouse buttons on that sprite.