java slick2D - problem using ScalableGame class

Posted by nellykvist on Game Development See other posts from Game Development or by nellykvist
Published on 2013-10-20T11:41:44Z Indexed on 2013/10/20 16:12 UTC
Read the original article Hit count: 524

Filed under:
|
|
|

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();

enter image description here

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();

enter image description here

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();

enter image description here

© Game Development or respective owner

Related posts about java

Related posts about graphics