Java 屏幕分辨率更改
我正在关注 Youtube 上 thenewboston 提供的一系列关于 Java 游戏开发的教程。我现在可以制作全屏窗口,但分辨率拒绝调整为 800x600。我已经测试了 vc(一个 GraphicsEnvironment.getDefaultScreenDevice 对象)和 dm(一个 DisplayMode),它们似乎不是问题。我正在运行雪豹。有什么想法吗?
if(dm != null && vc.isDisplayChangeSupported()){
try{
vc.setDisplayMode(dm);
System.out.println("Display mode set");
}catch(Exception ex){System.out.println("Despite the vc saying it is display change supported and the DM is not null, something went wrong");}
}
}
I am following a series of tutorials on game development in Java by thenewboston on Youtube. I am at the point where I can make a fullscreen window, but the resolution refuses to resize to 800x600. I have tested vc, a GraphicsEnvironment.getDefaultScreenDevice object, and dm, a DisplayMode, and they don't seem to be the problem. I am running Snow Leopard. Any ideas?
if(dm != null && vc.isDisplayChangeSupported()){
try{
vc.setDisplayMode(dm);
System.out.println("Display mode set");
}catch(Exception ex){System.out.println("Despite the vc saying it is display change supported and the DM is not null, something went wrong");}
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
将此代码添加到您的 Core.java(或 GameClient.java)类中。问题可能是您没有将所需的 DM[] 参数传递给 ScreenManager.java 类。
我假设错误与您的 public void setFullScreen(DisplayMode dm) 方法有关。在这种情况下,此方法的完整语法是:
注意这是发布后的温和死灵帖子。啊啊啊……
Add this code to your Core.java (or GameClient.java) class. The issue may be that you are not passing the required DM[] args to your ScreenManager.java class.
I'm assuming that the error is with your public void setFullScreen(DisplayMode dm) method. In that case, the full syntax for this method is:
Noticed this was a mild necro-post after posting. Aaahh...