han-yaeger / yaeger

Yaeger is Another Education Game Engine Runtime
http://han-yaeger.github.io/yaeger/
GNU General Public License v3.0
13 stars 25 forks source link

Scene width and height change in DynamicCompositeEntity #220

Open Kevin-Vink opened 2 years ago

Kevin-Vink commented 2 years ago

When parsing the scene to a DynamicCompositeEntity the width and height change to a value multiplied by 1.25.

The initial size of the game: image

the size im getting in the DynamicCompositeEntity image

meronbrouwer commented 2 years ago

This cannot be reproduces on my Mac. Is it possibly related to #208, which makes it a Windows-only bug. Lets test this again after an update to JavaFX 17.

meronbrouwer commented 2 years ago

Anyone running Windows that wants to test this one, would be much appreciated.

RyanAelen commented 2 years ago

Found the place the multiplication happens. Inside one of the javaFX class GlassViewEventHandler.class program gets the system scale. Running your windows system on 125% scale cause the 1.25 multiplication. Changing the scale to 100% in side windows. will 'fix' this.

It looks like you need to work with the Pane object and not with the Scene object of the abstract StaticScene.

meronbrouwer commented 2 years ago

Thanks @RyanAelen ! If you have the time, you're welcome to implement a fix. :-)

Jaapapa commented 1 year ago

Using environment variable / java property glass.win.uiScale=100% works for me! It should tell glass/javafx to use 100% scaling no matter what the option in windows is configured to.

Jaapapa commented 1 year ago

I tried setting the property in code (using System.setProperty()) in the YaegerGame class but this had no effect. I also tried prism.allowhidpi=false without effect. Maybe add the environment variable hint to the docs somewhere?

meronbrouwer commented 1 year ago

Interesting, I didn't know about this setting. I'll try to figure out how to set this property from code. It should be possible... I guess.

meronbrouwer commented 1 year ago

The post in the link seems to state an example that solves the problem. Main thing seems to set the property before calling the run-method. Could you (@Jaapapa ) perhaps test this on windows?

https://stackoverflow.com/questions/67264613/system-setpropertyprism-allowhidpi-false-does-not-work

Jaapapa commented 1 year ago

I couldnt get it to work. Tried all the props and also creating a seperate launcher class like so:


    public static void main(String[] args) {
        System.setProperty("glass.win.uiScale","100%"); // :(
//        System.setProperty("prism.lcdtext", "false"); // :(
//        System.setProperty("prism.subpixeltext", "false"); // :(
//        System.setProperty("prism.allowhidpi", "false"); // :(
        JGame.launch(args);
    }
}
meronbrouwer commented 1 year ago

I'll leave this issue as is for now. Maybe someone will find a solution for this in the future.