Scrolling Game Development Kit Forum
Welcome, Guest. Please login or register.
2010-09-09, 05:42:33 PM

Login with username, password and session length
Search:     Advanced search
8920 Posts in 1007 Topics by 168 Members
Latest Member: mogzdogz
* Home Help Search Login Register
+  Scrolling Game Development Kit Forum
|-+  SGDK Version 2
| |-+  Help, Errors, FAQ
| | |-+  Could you add a MouseUp and initial only event?
« previous next »
Pages: [1] Print
Author Topic: Could you add a MouseUp and initial only event?  (Read 217 times)
SmartBoy16
Contributor
Fanatic
**
Posts: 554


Current Project: RANAT: BtT

joelag_2009@hotmail.com
View Profile WWW Email
« 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.
Logged

SmartBoy16


The RANAT Foundation: Before the Truth http://www.box.net/RANAT-BtT
bluemonkmn
SGDK Author
Administrator
Fanatic
*****
Posts: 2146


2678251 BlueMonkMN@gmail.com
View Profile WWW Email
« 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
Logged

SmartBoy16
Contributor
Fanatic
**
Posts: 554


Current Project: RANAT: BtT

joelag_2009@hotmail.com
View Profile WWW Email
« 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.
Logged

SmartBoy16


The RANAT Foundation: Before the Truth http://www.box.net/RANAT-BtT
bluemonkmn
SGDK Author
Administrator
Fanatic
*****
Posts: 2146


2678251 BlueMonkMN@gmail.com
View Profile WWW Email
« 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.
Logged

Pages: [1] Print 
« previous next »
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!