Archived

This topic is now archived and is closed to further replies.

key/mouse repeats too fast

This topic is 6014 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

hi, in my proggy, to get a mouse click i use:
  
GetAsyncKeyState(VK_LBUTTON);
  
however, it repeats too fast... for a keypress i the following and it works fine.
  
  if (g_keys->keyDown [AUX_S] == TRUE) {
      g_keys->keyDown [AUX_S] = FALSE;

      ...
  }
}
  
but i''m not sure how to get a mouse click not to repeat so quickly. Thanks, Scott Email Website
"If you try and don''t succeed, destroy all evidence that you tried."

Share this post


Link to post
Share on other sites
I have this problem myself, it just hasn''t bugged me enough for me to do anything about it yet You could do something like only checking that keystate every 10th frame or something, or every 100ms or some other time length, but that seems a bit of a kludge, because you might completely miss keys that are quickly pressed then unpressed in that time.

Buffered input with DirectInput would be better, you wouldn''t loose keystrokes that are pressed then unpressed in that time. That''s the best way I know of, but somone else probably knows the correct way of doing it.

FatalXC

Share this post


Link to post
Share on other sites
You could try something like this :

if (mousepressed && !reg_click)
{
//Do stuff
reg_click = TRUE;
}
if (!mousepressed)
{
reg_click = FALSE;
}


At least this would stop you from holding down
the mouse button!! Don''t know about really fast clicking!!
I never tried doing this, so i don''t know if it works...
But hey...it''s worth a shot!!

Take Care!


- -- ---[XaOs]--- -- -

Share this post


Link to post
Share on other sites
GetAsyncKeyState will not handle just clicks by itself. As the name suggests, it gets the current state of the button or key in question. So, unless you process the WM_LBUTTONDOWN message, you'll have to do the proper checks yourself: namely, when the mouse's state changes, let the state change register only once.

Edited by - merlin9x9 on June 27, 2001 9:19:05 PM

Share this post


Link to post
Share on other sites
hey,

XaOs, that work perfectly. It's for a map editor i'm working on and every mouse click is supposed to draw only one object (which it does now), but before as fast as i could click and release the mouse button to draw an object, i caught a good 5 states... which really sucked.

thank ya,
Scott

EDIT: spelt yer nick wrong

Email
Website

"If you try and don't succeed, destroy all evidence that you tried."

Edited by - wojtos on June 28, 2001 2:19:03 PM

Share this post


Link to post
Share on other sites
heyh....nice to see i am actually helping someone here...


Glad to hear that it worked!! Sending over a shot so that i can see what you actually are working on?


BTW: Never mind the nick spelling...i had some real trouble spelling your name right in the beginning to....
(Remember my link to your site?)


Take Care!


- -- ---[XaOs]--- -- -

Share this post


Link to post
Share on other sites
I almost forgot....

Penetrator
If you''d like to see another game engine using a terrain engine,
take a look at my current project...(not only me though...)!!

We are using ROAM in a QuadTree for fast rendering with a high LOD!! Check it out.. http://brunomtc.no.sapo.pt (No source available though...)!!

Let me know what you think....if you allready haven''t looked at it!!


Take Care!

- -- ---[XaOs]--- -- -

Share this post


Link to post
Share on other sites
hey,

same with me, whenever i try running that demo you have, i always get a memory/fatal error. whether i turn all the options off, or on.

Scott

p.s. my last name is Ukrainian, and yes, nobody seems to spell or pronouce it properly

Email
Website

"If you try and don''t succeed, destroy all evidence that you tried."

Share this post


Link to post
Share on other sites
Have any of you tried the download with enable/disable sound?
(If you have....never mind)

We had some problems with the audio handler, it even stopped working on my computer!!
If you allready haven''t done so, i suggest you download the FMOD update located on the same site!!


and one more thing......
If you are running Windows 2000!! Dont bother...it wont work!!
We haven''t come across one single computer running w2k making
the engine run!! Wonder why though....

And i definetly won''t install w2k just for debug purposes!!
NO FRIGIN WAY!!! Bill Gates has captured enough of my computer allready...

Well....if you make it run, let me know what you think of it!!

Take Care!





- -- ---[XaOs]--- -- -

Share this post


Link to post
Share on other sites
yeah i''m running win2k... 9x, and NT aren''t stable enough... I''m running Linux Mandrake 8 too, but i can''t get my nic to work, and i have cable for internet... so when i get my nic to work, i''ll start programming in linux too.

Scott


Email
Website

"If you try and don''t succeed, destroy all evidence that you tried."

Share this post


Link to post
Share on other sites
hmmm...nice!!

No wonder you won''t make it run!!

I am running 2 computers with Win98!
1 with Mandrake 7.0
1 with Mandrake 7.2

Getting them online using a LAN and a Proxy-Server!!

I was thinking of starting programming opwngl with Linux, but
i had a really hard time configuring the kernel mods. for my gf2!! So it all turned to be like it was before!! VC++ is the best!! ) WEB-Programming is done in a Linux environment though.

Take Care!
http://home.no.net/cybertux


- -- ---[XaOs]--- -- -

Share this post


Link to post
Share on other sites