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 / How to put actions to array in every 50 ms

Author
Message
Dark Gamers
16
Years of Service
User Offline
Joined: 17th Mar 2008
Location:
Posted: 31st Jul 2008 14:20
How can I make a array/matrix to store all mouse clicking actions, and select the latest action in every 50ms.

For example, in the first 50ms I clicked my mouse five times, these will be stored in an array with its mouse clicking position (x,y,z). When the 50ms expired, it will return the latest mouse clicking position so I would be able to drive my avatar to that position. And then another 50ms starts, and so on.

As you know, when I click the mouse button without immediately release, it will cause more than one clicking. I want to record just one clicking in every 50ms.

Thanx~
Lilith
16
Years of Service
User Offline
Joined: 12th Feb 2008
Location: Dallas, TX
Posted: 31st Jul 2008 17:34
The mouse functionality is something of a mess, especially if you're trying to handle it procedurally. I might suggest using my Mouse class. You'd have to modify it to accumulate the data you want but it does have the functionality to detect transitional events.

Mouse.h


Mouse.cpp



And the docs, not really code but it's better than mangling my Word document to add an attachment.



Bear in mind that the Mouse class is handled as a singleton, so no matter where you declare a pointer to the Mouse object or a reference to it you always get the status from the last time you ran a sync. For your purposes you may want to add some sort of FIFO queue to it so you can pull events in order.

Lilith, Night Butterfly
I'm not a programmer but I play one in the office
Lilith
16
Years of Service
User Offline
Joined: 12th Feb 2008
Location: Dallas, TX
Posted: 31st Jul 2008 17:43
Ach!!

Lilith, Night Butterfly
I'm not a programmer but I play one in the office
Dark Gamers
16
Years of Service
User Offline
Joined: 17th Mar 2008
Location:
Posted: 31st Jul 2008 20:44
awesome! I've selected some of your code to handle my problem

thanx Lilith~!

Login to post a reply

Server time is: 2024-11-20 17:38:31
Your offset time is: 2024-11-20 17:38:31