3

I want to restore the position and size of my LibGDX application (LwjglApplication) window when started again.

I know that I can use LwjglApplicationConfiguration to set the position of the window before creating it as follows:

LwjglApplicationConfiguration cfg = new LwjglApplicationConfiguration();
cfg.x = lastX;
cfg.y = lasty;

LwjglApplication a = new LwjglApplication(new MyGame(), cfg);

But how can I read the last position of the window before quitting? The user might have moved and resized the window while playing my game. How to save the data?

Thanks a lot!

1 Answer 1

0

The only way I found is to use the LWJGL class Display (Javadoc) with methods getX() and getY() as you can see here:

int x = Display.getX();
int y = Display.getY();

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.