Author Topic: Two questions about mouse pointers/cursors  (Read 480 times)  Share 

Two questions about mouse pointers/cursors
« on: 02 Feb 2013, 12:12 »
Hello!

Two quick questions about mouse pointers/cursors.

1) With a 640x400 game, when playing in full-screen, the mouse is ridiculously sensitive. How can I tone down the speed at which the mouse moves?

2) For some reason, when the mouse pointer changes to 'wait', it moves about 15-20 pixels. When it goes back to an active pointer, it moves back again. The sprites are exactly the same size. What's with that?

Thanks guys!
Richard & Alice, our first proper game, is out now!  Download the free demo!  |  Buy it for just $5.99!

4/5 - Digital Spy | "Incredibly moving" - Rock Paper Shotgun | www.richardandalice.com

icey games

  • Official Nintendo Dev, Square Enix affiliate next
    • I can help with backgrounds
    •  
    • I can help with characters
    •  
    • I can help with play testing
    •  
    • I can help with story design
    •  
    • I can help with voice acting
    •  
Re: Two questions about mouse pointers/cursors
« Reply #1 on: 02 Feb 2013, 17:13 »
Try putting this in the repeatably execute always function near the top of the globalscrript.asc

Mouse.Update();

geork

  • measure once, cut twice, say it was already broken
    • I can help with scripting
    •  
    • I can help with voice acting
    •  
Re: Two questions about mouse pointers/cursors
« Reply #2 on: 02 Feb 2013, 17:36 »
For 2): It might be that the 'cursor hotspot' for the pointer mode and wait mode are different, which would might (I haven't tested this) cause a jump.

Khris

    • Lifetime Achievement Award Winner
    •  
    • I can help with play testing
    •  
    • I can help with scripting
    •  
    • I can help with translating
    •  
Re: Two questions about mouse pointers/cursors
« Reply #3 on: 02 Feb 2013, 19:02 »
1) Mouse.Update() will do nothing to fix the problem.
Try using the x2 filter for playing fullscreen, this will run the game @ 1280x800 and might fix the issue.

Re: Two questions about mouse pointers/cursors
« Reply #4 on: 02 Feb 2013, 19:58 »
1) Mouse.Update() will do nothing to fix the problem.
Try using the x2 filter for playing fullscreen, this will run the game @ 1280x800 and might fix the issue.

Nope!
Richard & Alice, our first proper game, is out now!  Download the free demo!  |  Buy it for just $5.99!

4/5 - Digital Spy | "Incredibly moving" - Rock Paper Shotgun | www.richardandalice.com

MurrayL

    • I can help with AGS tutoring
    •  
    • I can help with backgrounds
    •  
    • I can help with play testing
    •  
    • I can help with proof reading
    •  
    • I can help with scripting
    •  
    • I can help with story design
    •  
    • I can help with voice acting
    •  
    • I can help with web design
    •  
Re: Two questions about mouse pointers/cursors
« Reply #5 on: 02 Feb 2013, 20:20 »
Code: Adventure Game Studio
  1. // Global script
  2. float mouseSensitivity = 0.5; // Modify this value to change how sensitive the mouse is (1.0 = default sensitivity)
  3. int prevMouse[2]; // Store the last known position of the cursor, so we can check if it has moved
  4.  
  5. function game_start(){
  6.     prevMouse[0] = mouse.x;
  7.     prevMouse[1] = mouse.y;
  8. }
  9.  
  10. function repeatedly_execute_always(){
  11.     if(mouse.x != prevMouse[0] || mouse.y != prevMouse[1]){ // Mouse has moved from last stored location
  12.         // Work out the mouse movement delta, multiply it with our sensitivity modifier, and round it to an integer
  13.         int newPos[2];
  14.         newPos[0] = prevMouse[0] + FloatToInt(IntToFloat(mouse.x - prevMouse[0]) * mouseSensitivity, eRoundNearest);
  15.         newPos[1] = prevMouse[1] + FloatToInt(IntToFloat(mouse.y - prevMouse[1]) * mouseSensitivity, eRoundNearest);
  16.        
  17.         Mouse.SetPosition(newPos[0], newPos[1]);
  18.         prevMouse[0] = mouse.x; // Update stored location
  19.         prevMouse[1] = mouse.y;
  20.     }
  21. }
  22.  

Not sure if this will look really weird though. It depends if AGS manages to draw the cursor momentarily before the script moves it. Hopefully not.

Naturally, provided this actually works, you can link that sensitivity variable to a slider in your game options!
« Last Edit: 02 Feb 2013, 21:02 by MurrayL »

Re: Two questions about mouse pointers/cursors
« Reply #6 on: 02 Feb 2013, 20:49 »
"GlobalScript.asc(187): Error (line 187): Type mismatch: cannot convert 'int' to 'float'"


(Which corresponds to Line 13 above)
Richard & Alice, our first proper game, is out now!  Download the free demo!  |  Buy it for just $5.99!

4/5 - Digital Spy | "Incredibly moving" - Rock Paper Shotgun | www.richardandalice.com

MurrayL

    • I can help with AGS tutoring
    •  
    • I can help with backgrounds
    •  
    • I can help with play testing
    •  
    • I can help with proof reading
    •  
    • I can help with scripting
    •  
    • I can help with story design
    •  
    • I can help with voice acting
    •  
    • I can help with web design
    •  
Re: Two questions about mouse pointers/cursors
« Reply #7 on: 02 Feb 2013, 20:58 »
Whoops - sorry, I completely forgot to convert those floats to integers. I've corrected the script in my earlier post to round the updated positions to whole numbers.

Re: Two questions about mouse pointers/cursors
« Reply #8 on: 03 Feb 2013, 09:45 »
Sadly, this doesn't work - or rather, it does indeed slow the mouse down, but it's trying to draw both positions as you move it, thus creating something that looks really jerky.
Richard & Alice, our first proper game, is out now!  Download the free demo!  |  Buy it for just $5.99!

4/5 - Digital Spy | "Incredibly moving" - Rock Paper Shotgun | www.richardandalice.com

Re: Two questions about mouse pointers/cursors
« Reply #9 on: 03 Feb 2013, 09:47 »
For 2): It might be that the 'cursor hotspot' for the pointer mode and wait mode are different, which would might (I haven't tested this) cause a jump.

*slaps forehead*

Okay, I'm an idiot. Yes, this was why. So one problem solved. Thanks!
Richard & Alice, our first proper game, is out now!  Download the free demo!  |  Buy it for just $5.99!

4/5 - Digital Spy | "Incredibly moving" - Rock Paper Shotgun | www.richardandalice.com

MurrayL

    • I can help with AGS tutoring
    •  
    • I can help with backgrounds
    •  
    • I can help with play testing
    •  
    • I can help with proof reading
    •  
    • I can help with scripting
    •  
    • I can help with story design
    •  
    • I can help with voice acting
    •  
    • I can help with web design
    •  
Re: Two questions about mouse pointers/cursors
« Reply #10 on: 03 Feb 2013, 15:08 »
Sadly, this doesn't work - or rather, it does indeed slow the mouse down, but it's trying to draw both positions as you move it, thus creating something that looks really jerky.

Ah, yes I thought that might happen. It's a shame there's no way to override/delay the default AGS cursor drawing routines.