Handling input for a toggled mode
Blitz3D Forums/Blitz3D Beginners Area/Handling input for a toggled mode
| ||
Any suggestions on how to control the sensitivity of a toggle like this...If MouseDown(1) Then gridvisible = 1 - gridvisible If gridvisible Then ShowEntity gridmesh Else HideEntity gridmesh EndIf EndIf Current thinking is to only flip for +10 or -10 (tweakable) so that the mouse needs to be down for a reasonable amount of time, rather than oscillating between on/off every input cycle. I could poll the input cycle less frequently of course, but I am using MouseX and MouseY to select pickable objects. I could also implement a decaying 'blocked' timer every time there is a flip - it just seems a bit sledgehammer-like. So how do other people deal with this ? |
| ||
what about MouseHit(1) ? |
| ||
In a kind of long-winded way, I check against my timing variable and take no action if it has been actioned withini the last 100 ms or so. I understand calls to millisecs() are quite slow, though. To maintain accuracy of MouseX and MouseY, convert these to variables at the moment of clicking. _________EDIT_______________ Here's some edited code from Galactic Allegiance. very simply, there is a little routine where ANY button-press controls are dealt with, only the routine is skipped if any of the keys were pressed within 150ms... You would simply substitute in for your code like this: |
| ||
@Perturbatio: MouseHit() seems to do the trick. Cheers mate. @Malice: I know I can just use the search feature for "badger" or "sandwich", but I feel you should drop a few more hints about the source of your quotes of the moment. Some people don't have the time to keep up with every single thread y'know ;-) |
| ||
*Profile edited* :) |