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.

DarkBASIC Professional Discussion / Mouse input buffer perhaps?

Author
Message
TheComet
18
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 8th Jun 2012 22:34 Edited at: 8th Jun 2012 22:36
Hey everyone


So here's the problem. I'm working on an RTS/RPG hybrid, and the game is all about reaction time and speed, so it's essential that the user can move the mouse as fast as possible. DBP however just doesn't allow the fast movement I'm after. Drawing boxes with the mouse to select units is slow and inaccurate, clicking is slow and inaccurate... The reason for this is that when the mouse is clicked/released, DBP only reads in the momentary coordinates of the mouse with mousex(),mousey(), even though the user may have clicked/released earlier, thus making the whole thing inaccurate.

I've programmed a simple game in C++ using SDL and they had the mouse actions logged in an event system. All you had to do is check if an event has been triggered, and retrieve the mouse positions/clicks. That was incredibly accurate.

Is there any way to do this in DBP? Maybe something similar to the Entry$() command, only for the mouse?

TheComet

zeroSlave
17
Years of Service
User Offline
Joined: 13th Jun 2009
Location: Springfield
Posted: 9th Jun 2012 00:21 Edited at: 9th Jun 2012 00:22
I'm probably not understanding what you mean, but couldn't you make a mouse function that gets the new data that you can call whenever you need it?


Everybody is a genius. But if you judge a fish by its ability to climb a tree, it will live its whole life believing that it is stupid.
TheComet
18
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 9th Jun 2012 00:53
Ah, I was being stupid. This problem is solved, thanks zeroSlave for pointing me in the right direction! Here's the code I used for testing, a modified version of your code. The frame rate is purposely that low to prove that all of the movements are being tracked correctly.



Thanks!

TheComet

Login to post a reply

Server time is: 2026-07-07 23:01:53
Your offset time is: 2026-07-07 23:01:53