Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: Gurok on Fri 31/10/2014 03:40:50

Title: Event before the mouse cursor is rendered?
Post by: Gurok on Fri 31/10/2014 03:40:50
I have a repeatedly_execute_always function that handles changing mouse cursors as the player moves his/her mouse around the screen. e.g. When the mouse is near an exit, it changes to an arrow. When it is over a hotspot, it animates with a glow. I think this is pretty standard and there are quite a few modules that do similar things.

I've noticed that AGS seems to process a frame in this order:
1. Update mouse x/y position
2. Render screen + mouse cursor
3. Process events

My problem is that when I change the mouse cursor to reflect the player hovering over an exit or a hotspot, it doesn't get shown until then next frame. That means there's always one frame of the previous cursor shown in the wrong place.

Is there a way to run an event before the screen+mouse are rendered? Alternatively, is there a way to force the mouse cursor to be redrawn after processing events like repeatedly_execute_always?
Title: Re: Event before the mouse cursor is rendered?
Post by: Snarky on Sat 01/11/2014 10:04:27
Have you tried running Mouse.Update() at suitable points in your method? I seem to remember that fixing similar problems for me.
Title: Re: Event before the mouse cursor is rendered?
Post by: Gurok on Sat 01/11/2014 14:30:50
Thanks, Snarky. Mouse.Update() worked!