stephengold / jme-vehicles

A tech demo and library for simulating vehicles in jMonkeyEngine
BSD 3-Clause "New" or "Revised" License
17 stars 7 forks source link

Mouse and ui buttons misaligned #6

Closed jamessbull closed 2 years ago

jamessbull commented 2 years ago

When I run the mav demo at first glance the buttons appear not to work. On closer inspection they do but the mouse must be about half the screen down from where the button actually is and then the button will be highlighted

I have placed an arrow in the screenshot approximately where the mouse was.

mav-button-error

With a bit of patience it is possible to use the ui but obviously the mouse is not where the program thinks it is. I am running jdk 11 64bit windows 10 with a resolution of 4k. on primary screen 2k on second screen.

If I drag the window from the primary monitor to the secondary monitor then the buttons highlight as they should when the mouse is over them.

Interestingly if you drag the screen so that it straddles the two monitors with >50% of the display on the secondary monitor but the buttons on the primary monitor (primary screen to left of secondary) everything lines up fine.

As soon as there is more than 50% of the display on the primary monitor the cursor is positioned incorrectly again.

A ui lib bug perhaps?

To run I opened intellij (2020.3) cloned from the git repo and just hit run. Apart from the issue with the mouse being in the 'wrong' place the program seems to work as intended and does not generate any exceptions or other errors. (A few warnings on startup but thats it, an example below)

`"WARNING:` The texture /Models/classic_motorcycle/textures/MTA_Metales_metallicRoughness.png has linear color space, but the material parameter LightMap specifies no color space requirement, this may lead to unexpected behavior.
Check if the image was not set to another material parameter with a linear color space, or that you did not set the ColorSpace to Linear using texture.getImage.setColorSpace()." 
stephengold commented 2 years ago

A ui lib bug perhaps?

That's a reasonable guess.

Would you do one thing for me, please? At the command line, cd to your repo and then do a git rev-parse HEAD and report back with the output. That way I can be sure which libraries were in use.

jamessbull commented 2 years ago

Hi Stephen, The result of that is

07549eecf38f25c9cd811e59d93a84e99083081c

stephengold commented 2 years ago

So your build was using JMonkeyEngine v3.5.0-beta5. Good to know!

If you don't want to test beta software (you just want to run the demo) I suggest you follow the instruction in the README: https://github.com/stephengold/jme-vehicles/blob/master/readme.md#build

which will check out tag "project-1.5.0" (hash a84846b), which uses JMonkeyEngine v3.4.0-stable

Please let me know if "project-1.5.0" has the misalignment issue.

jamessbull commented 2 years ago

project-1.5.0 is absolutely fine. No issue with misalignment there

stephengold commented 2 years ago

Thanks for letting me know!

stephengold commented 2 years ago

@jamessbull I can't reproduce this issue on my system because I only have one monitor. Will you have time to test some possible fixes during the coming week?

stephengold commented 2 years ago

Probably related to https://github.com/jMonkeyEngine/jmonkeyengine/issues/1745

stephengold commented 2 years ago

In which case, 1c86e45e should solve this issue.