2014-03-25 33 views
0

你好,我在我的空閒時間創建了一個2D RPG遊戲,我一直在從我的筆記本電腦大部分工作,但是當我把它帶到學校工作時,它崩潰並給了我錯誤在Eclipse控制檯:爲多屏幕和分辨率優化java

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) 

我一直在使用的分辨率爲WIDTH = 1366,HEIGHT = 768,請讓我知道,如果有更好的,謝謝你的那些可以幫助

+0

相關:http://stackoverflow.com/questions/16452784/java-and-libgdx-lwjgl-game-fullscreen-wrong-size-for-multiple-monitors-on-ubun –

回答

1

這一點點的代碼會給你在任何系統上可用的屏幕寬度和高度。

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

} 

在我的系統的結果是:

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

GraphicsEnvironment中類爲您提供有關字體和屏幕設備的信息。