Forum rules - please read before posting.

GetInvertedMouse off by 1 bug

Hi,

I have a menu that pops up when you move the mouse to the bottom of the screen (appear type "Mouse Over"). Just been looking into a bug on 16:10 displays where the menu vanishes if you move the pointer into the black bars (the game is always 16:9). I think the problem is an off-by-one bug in GetInvertedMouse().

It returns ACScreen.height - y, and I think it should be something like (ACScreen.height - 1) - y, otherwise the return value is 1 to screen height, rather than 0 to height-1. Making this change fixes my problem, anyway.

Sorry if this is already fixed in a newer version.

Comments

  • edited July 2022

    This may be platform-dependent. What are you running on, and does this occur in the Editor, builds, or both?

  • I'm having trouble recreating this - can you share the exact steps necessary to see the original issue? I can't make a suggested code change without seeing the original problem that it addresses.

    Is this a case of the return value being "1" when at the bottom, because the Cursor Manager's Confine system cursor to game window? being checked?

  • Sorry, I'm at Develop at the moment, but I'll try and get some repro steps when I'm back.
  • To reproduce, create a mouse over AC menu, position aligned lower left. Size manual, W 100, H 16. Set the camera settings to fixed aspect ratio with 1.7777777777 as the aspect ratio.

    Run the game and select 16:10 as the display aspect ratio. Move the mouse towards the bottom of the screen and the menu should appear, but when the hardware pointer goes into the black bars, the menu will vanish as the software pointer is effectively clamped to 1 pixel past the bottom of the menu.

    Having looked more, I'm not completely sure if it's that the output from GetInvertedMouse is off by 1, or if it's a rounding error from 1.7777777777 being rounded to 1.777778. Either change fixes the problem, but I'm not certain which is correct.

  • Thanks for the steps - I'll follow them and see how it goes.

    My gut'd say it's a rounding issue, though - have you tried setting to a fraction value, i.e. typing "16/9" into the box?

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.