java slick2D - problem using ScalableGame class
- by nellykvist
I have problem adjusting the size of the screen, using the ScalableGame class from Slick2D library.
So, what I want to achieve, whenever I change display size, background should adjust to screen size, and objects (images, grahpic shapes) should fit (scale).
Alright, so this is how state looks by default. I can change screen size, but images and graphic shapes does not
appGameContainer = new AppGameContainer(
new ScalableGame(new AppStateController(), Settings.video.getWidth(), Settings.video.getHeight(), true)
);
appGameContainer.setDisplayMode(Settings.video.getWidth(), Settings.video.getHeight(), Settings.video.isFullScreen());
appGameContainer.start();
If I assign to width/height +100, ScalableGame constructor:
appGameContainer = new AppGameContainer(
new ScalableGame(new AppStateController(), Settings.video.getWidth() + 100, Settings.video.getHeight() + 100, true)
);
appGameContainer.setDisplayMode(Settings.video.getWidth(), Settings.video.getHeight(), Settings.video.isFullScreen());
appGameContainer.start();
If I assign to width/height +100, to display:
appGameContainer = new AppGameContainer(
new ScalableGame(new AppStateController(), Settings.video.getWidth(), Settings.video.getHeight(), true)
);
appGameContainer.setDisplayMode(Settings.video.getWidth() + 100, Settings.video.getHeight() + 100, Settings.video.isFullScreen());
appGameContainer.start();