0

Hello I am creating a 2D RPG game in my free time and I have been mostly working on it from my laptop but when I brought it to school to work on it it crashes and gives me the error in the eclipse console:

org.newdawn.slick.SlickException: Failed to find value mode: 1366x768 fs=true
          at org.newdawn.slick.AppGameContainer.setDisplayMode(AppGameContainer.java:146)
          at com.states.Core.main(Core.java:49)

The resolution i have been using is WIDTH = 1366, HEIGHT = 768 please let me know if there are better ones and thank you to the ones that can help

Richard Dallaway
  • 4,250
  • 1
  • 28
  • 39

1 Answers1

1

This bit of code will give you the usable screen width and height on any system.

import java.awt.GraphicsEnvironment;
import java.awt.Rectangle;

public class ScreenResolution {

    public static void main(String[] args) {
        Rectangle r = GraphicsEnvironment.getLocalGraphicsEnvironment()
                .getMaximumWindowBounds();
        System.out.println(r);
    }

}

On my system the result is:

java.awt.Rectangle[x=0,y=0,width=1280,height=984]

The GraphicsEnvironment class gives you information about fonts and screen devices.

Gilbert Le Blanc
  • 50,182
  • 6
  • 67
  • 111