Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to resize a Libgdx desktop window in-code during runtime

Tags:

java

libgdx

I have a Problem finding out how to resize a window in-code during runtime.

I have tried using Gdx.graphics.setDisplayMode(); but it removes the ability to resize the window, wich is a must in my game. I tried to access the Display class from openGL but without any luck, since it is not referenced in the Core part of gradle.

Any Idea how to get this done?

like image 553
Wicpar Avatar asked Sep 02 '26 01:09

Wicpar


1 Answers

I was stuck with exactly the same problem, and then I figured out, that instead of the direct call to Display.setDisplayMode(new DisplayMode(width, height)), we should use Gdx.graphics.setWindowedMode(width, height) to change the window size.

like image 158
Metaphore Avatar answered Sep 03 '26 16:09

Metaphore