Hide Mouse? (HideCursor)
Monkey Forums/Monkey Programming/Hide Mouse? (HideCursor)
| ||
Is there a HideMouse command? I guess certain targets wont need it, since they dont have a cursor... but what about Win/Mac? |
| ||
I found (I think) a way to 'hide' or 'change' cursor on a HTML page (the cursor: url () propriety) http://www.anicursor.com/webcursor.html If I go on that site the example works...(the cursors is a big blue arrow) I've tried to test on local (on my machine I have a Apache system, and I uploaded on my site too) but nothing works. The idea is - simply - to replace .ani with a 'null/void' animation, so you have still the 'cursor', only invisible. If anyone has more luck with this I would like to see the solution! Thanks! |
| ||
Ok I think I've resolved this! the propriety under FireFox should be cursor: url(cursor_null.cur), auto; Just add this on the MonkeyGame.html and the cursor_null.cur where cursor_null is a 'void' image. edit: http://www.rw-designer.com/online-cursor-editor You could use this on-line editor to create your 'void' cursor or one personalized! Enjoy You can see the result here You can grab a cursor (it's a 1x1 pixel with light alpha to avoid a problem under Chrome) HERE PS: I've placed the cursor:url in the BODY tag, of course you could decide to use it only on CANVAS (the 'screen' of Monkey's app) |
| ||
You can also encode the png file as Base64, so you don't need any files: http://www.greywyvern.com/code/php/binary2base64 I think a 1x1 gif would be smaller in this case. |
| ||
Lumooja: thanks, I didnt' think to this simple solution. Now I'm just trying to implement a 'HidePointer' function following your tutorials on Monkeytools.net This should be added to your 'monkeytools.monkey', but at the moment I need to imagine how to 'pass' to xxx.build folder the 'cursor_null.cur' (or just implements your 'base64' suggestion) |
| ||
You can simply put any data files in the targets/<targetname>/data directory, and it will be copied to your monkey program's build directory. |
| ||
Oh, thanks for the hints. But this mean that everytime I build something in HTML5 monkey copies all the resources-data present, right? I just embedded the base64 codification in the file. (Not very elegant to see, but it works) I still looking for information about the CUR dimensions: 32x32 - and relative base64 codification - is quite big for 1x1 pixels... So we have HidePointer and ShowPointer working in HTML5 MokeyTools.monkey (add to previous commands) HidePointer.js |
| ||
You don't have to use a 32x32 .cur file, I tried it with a 1x1 gif and it works too in Chrome (although I saw a black dot, so maybe 1x1 png works better). For other browsers you can just use the cursor:none tag (although it's not w3c, but it works). Or if other browsers need a .cur instead of a .gif of .png file, then your solution is of course better. |
| ||
I got ShowMouse/HideMouse working on all targets now. I think it's time to release MonkeyTools 0.0.0.0 in the Monkey Code area :) |