Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / Mouse Click Input

Author
Message
ReiKumar
16
Years of Service
User Offline
Joined: 23rd Sep 2008
Location:
Posted: 5th Oct 2008 02:13
So, I trying to register mouse input, right and left clicks.

The built in fuction didn't seem to work so I took a look at DirectX, but its a little confusing.

Basically, heres what I want:



Zuka
16
Years of Service
User Offline
Joined: 21st Apr 2008
Location: They locked me in the insane asylum.
Posted: 5th Oct 2008 02:15


change to

SushiBox
16
Years of Service
User Offline
Joined: 20th Sep 2008
Location: Ohio
Posted: 5th Oct 2008 02:16


That should do it. 2 = Right, 1 = Left.

www.Helios-Online.net
ReiKumar
16
Years of Service
User Offline
Joined: 23rd Sep 2008
Location:
Posted: 5th Oct 2008 02:23
Thanks Guys that worked great.

BTW I'm sorry if I'm asking too many simple questions... I'm still trying to learn.
SushiBox
16
Years of Service
User Offline
Joined: 20th Sep 2008
Location: Ohio
Posted: 5th Oct 2008 02:24
Your just fine Rei Kumar, thats why we are here haha. You have to start somewhere, and at least you are willing to go the extra mile with C++ rather than with Game Maker where most nub's end up.

Kudos

P.S. Jynx

www.Helios-Online.net
Zuka
16
Years of Service
User Offline
Joined: 21st Apr 2008
Location: They locked me in the insane asylum.
Posted: 5th Oct 2008 02:27 Edited at: 5th Oct 2008 02:27
joo be welcome foo.


You can use a basic timer so it doesn't shoot every frame.

ReiKumar
16
Years of Service
User Offline
Joined: 23rd Sep 2008
Location:
Posted: 5th Oct 2008 02:49
Quote: "P.S. Jynx"

???


Quote: "joo be welcome foo.


You can use a basic timer so it doesn't shoot every frame.

+ Code Snippet

//save the time of the last shot
int last_shot;
//we need a delay time.
int delay_time = 500; //this could be good, its half a second.
//now initialize last_shot
last_shot = dbTimer() - delay_time;

//...
//...
//in the loop

if (dbMouseClick() == 1)
{
if (dbTimer() - last_shot > delay_time)
{
FireLeftHandGun();
}
}
"


Thats helpful. I was going to set it in the gun class but that might work better.
Zuka
16
Years of Service
User Offline
Joined: 21st Apr 2008
Location: They locked me in the insane asylum.
Posted: 5th Oct 2008 03:50
Jynx = me and SushiBox posted at the same time.
dark coder
22
Years of Service
User Offline
Joined: 6th Oct 2002
Location: Japan
Posted: 5th Oct 2008 09:31
Of course if you wish to independently use left and right click while allowing for them both to be pressed you should use a bit mask to check for them, i.e. using dbMouseClick() & 0x01, and 0x02. You can do this for the other mouse clicks too.

Login to post a reply

Server time is: 2024-11-25 03:59:54
Your offset time is: 2024-11-25 03:59:54