How do I change the resolution dynamically? #712
Replies: 3 comments
-
This post has been migrated automatically from the old LITIENGINE forum (2018 - 2022). // the static Resolution classes provide common resolutions in different ratios
Game.window().setResolution(Resolution.Ratio4x3.RES_1024x768);
// create custom resolutions with
Resolution custom = Resolution.custom(1234, 555, "my-resolution") For that, you should also decide whether you want to scale the graphics proportionally: Game.config().graphics().enableResolutionScaling() If you want to persistently store the changed resolution, you can save it in the configuration (as you did is your previous post) Game.config().graphics().setResolution(...) Also, if you use the default |
Beta Was this translation helpful? Give feedback.
-
This post has been migrated automatically from the old LITIENGINE forum (2018 - 2022). List<Resolution> res;
res = Resolution.Ratio4x3.getAll();
for (Resolution r : res)
System.out.println(r.toDimensionString()); The only output from this is
Looking at
|
Beta Was this translation helpful? Give feedback.
-
This post has been migrated automatically from the old LITIENGINE forum (2018 - 2022). |
Beta Was this translation helpful? Give feedback.
-
This post has been migrated automatically from the old LITIENGINE forum (2018 - 2022).
Posted: 2020-03-10 15:05:10
User: Hyler [] (age: 965 days 🙌; posts: 2)
Good morning,
I'm trying to get my feet wet with LITIengine. and I need some help. One of the first things I wanted to try is set the window resolution with code, as the application is running. However, all I have been able to achieve is to change the config file, which causes the application to have the new resolution the next time it's run.
What I mean by this is that my code apparently produces changes in the config file, so if I change the code, recompile, run, I see the old resolution, as the config file gets updated with the newly-changed code. Then if I exit the application and start it again, it has the new resolution.
I have tried using Game.config().graphics().setResolution*, both before and after Game.init(), but the window never changes until the application is restarted and it reads the new config file. I also tried adding a configuration group, but that just caused a mix of settings in the config file (with similar results).
How do I change the resolution (and enable/disable scaling) dynamically, as the application is running? I want to see the window change size dynamically, for example I could bind the resolution change to a key event, etc.
Thank you for your help.
-gBeta Was this translation helpful? Give feedback.
All reactions