Slick2d is zooming when fullscreen

Hi guys, I’m totally stuck! I’m using Slick2d in my game and during development I’ve mostly been working with the game windowed.

In my main() method I have this line:

game.setDisplayMode(800, 500, false);

Which looks like this:

When I change that to:

game.setDisplayMode(1440, 900, true);

But doing this makes the game look like this (the Quit button is approx. twice the size of the windowed version), the frame rate counter isn’t visible either which make me think that it’s somehow zooming in to the bottom right corner:

The “buttons” on the screen are defined and drawn like so:

	public void render(GUIContext container, Graphics graphics) throws SlickException {
		Color c = graphics.getColor();

		graphics.setColor(Color.white);
		graphics.draw(this.box);
		
		if (this.isMouseOver) {
			graphics.setColor(new Color(135, 206, 235));
		}
		graphics.drawString(this.t, this.getX()+5, this.getY()+5);
		
		graphics.setColor(c);

this.box is a Rectangle object, this.t is a String with the text to display, this.x/y are meant to be pixel co-ords to draw the button. This class extends AbstractComponent from Slick2d, only for the sake of using the render() method.

I’ve searched high and low for anything that could be calling a scale() method or something like that but I can’t find anything.

Does anyone have any suggestions as to what could be causing this strange behaviour? Thanks :slight_smile:

EDIT: I’ve tested in various resolutions and it seems that it’s when the game runs in FULL SCREEN that this scaling occurs, and it seems to be making the quit button the same size in inches on my monitor in each resolution.

If this was LibGDX I would suggest you to check how you handle display mode transitions.
It looks like you changed the resolution but didn’t update your renderer (graphics in slick) to use a new projection matrix/world size/etc.
Is 800x500 the default mode? If yes this might be exactly your problem. You could try (re)setting the transforms/scaling of the graphics object after changing resolution.

I’m no expert on slick tho, so you might get a more specific response from somebody else!

Thanks for your input, but this is where it’s all so confusing… I don’t switch resolutions in-game, I’ve been commenting out the line that sets the resolution on launch and changing it for different resolutions. So the game is starting fresh with its own projection matrix(?).

I’ve never encountered this before - all of my little games and apps run immediately without any fuss in the resolution they’re defined with. In fact, in all of my games I just copy the main class and rename it for my next project.