Note: v0.3 does not minify correctly. v0.5, despite the version increase, merely fixes this minify glitch. Grab 0.3 for test capx and documentation. Will update the rest of the page when I roll in some real changes (response curves). Link to 0.5 plugin below:
Download Mouse Lock v0.5 (Plugin Only)
Version 0.3
:
v0.3 Changelog
Download Mouse Lock v0.3
Mouse Lock:
This my first -- <img src="{SMILIES_PATH}/icon_e_biggrin.gif" alt=":D" title="Very Happy"> -- c2 plugin, Mouse Lock v0.3:
This plugin lets you lock the cursor. That's about it. However, I'm making an attempt to complicate this plugin beyond all reason. <img src="{SMILIES_PATH}/icon_eek.gif" alt=":shock:" title="Shocked">
Some info:
It works in Firefox and Chrome. Other browsers are NOT supported.
When activated, your normal cursor disappears. Press ESC to get it back.
When cursor is locked, the normal mouse plugin x/y readouts won't work <img src="{SMILIES_PATH}/icon_e_sad.gif" alt=":(" title="Sad"> . However, clicks and mouse wheelies still work. So, you may want to use this with the mouse/touch plugin(s), as opposed to by itself.
Released under Creative Commons Attribution 4.0 International license. Basically, do what you want with the plugin, but if you do modify it, just make it clear it's a fork, and not one of my versions. <img src="{SMILIES_PATH}/icon_e_wink.gif" alt=";)" title="Wink">
What's working (
I hope
):
1. Pointer lock should work for firefox and chrome. Again: will not work in any other browsers.
2. Can get Raw values(X/Y) which indicate movement change per tick. No settings affect raw except for 'Disable if Unlocked', which disables getting raw x/y or MouseLock x/y readout (you can still see them under debug, but their expressions return an impossible value).
3. Can get MouseLock values(X/Y). For now, this bounds the cursor to the current window size. This value is also affected by Cursor Speed, Deadzone, Speed Cap, and Invert(X/Y).
4. Can enable/disable pointer lock programatically... <img src="{SMILIES_PATH}/icon_e_ugeek.gif" alt=":ugeek:" title="Uber Geek"> ...er, in other words, you can lock/unlock with events (the SetMouseLock action). HOWEVER, the initial lock request must be activated by a button or click (for now, your options are a single or double click; custom key isn't implemented yet). Once that's done, you can use events to lock/unlock to your hearts content.
5. Bounding now works. Can bound to window, layout, or be unbounded. See changelog for details.
What's not done:
1. Smoothing will eventually add an option to smooth the cursor (for example, if you are moving the cursor fast and suddenly stop, it would take a few tick to slow down).
2. Response Curve. This will allow linear or curved. In other words:
if your response curve is 1.0, your curve is linear(no difference.)
if you have a negative curve (< 1.0), your sensitivity will be less when moving your cursor slowly (lets you make fine adjustments).
if positive, your sensitivity (> 1.0) slows as you move it faster (let you move your mouse rapidly with small movements, without larger movements hitting speed cap or moving too far)
More Info on Pointer Lock API:
API Info on MDN: https://developer.mozilla.org/en-US/doc ... inter_Lock
Specification (Currently, working draft): https://dvcs.w3.org/hg/pointerlock/raw- ... index.html
Plugin Download:
Contains plugin, readme, and test capx (r168 or later).
Download Mouse Lock v0.5 (Plugin Only)
Mouse Lock v0.3(FIXED)
Final Words:
Hope this is useful for someone. I made it for my WIP space shooter, because I kept clicking outside of the screen during gameplay. <img src="{SMILIES_PATH}/icon_redface.gif" alt=":oops:" title="Embarrassed"> Suggestions are welcome.
Cheers,
Tim