本文介绍了如何使 slick2d 可调整大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嘿伙计们,我想知道是否有办法让用户可以调整 slick2d 的大小.(我已经研究过这个并且只发现了如何在程序中调整程序大小)
Hey guys I was wondering if there was a way to make slick2d resizable by the user.(I have researched this and only found out how to make the program resizable within the program)
这是我的代码,提前致谢.
Here is my code and thanks in advance.
package Main; import States.Menu; import States.Play; import org.newdawn.slick.*; import org.newdawn.slick.state.*; /** * * @author Kyle */ public class Lawu extends StateBasedGame{ public static final String gamename = "Lawu"; public static final int menu = 0; public static final int play = 1; public static int height=600,width=760; public Lawu(String gamename) { super(gamename); this.addState(new Menu(menu)); this.addState(new Play(play)); } public static void main(String[] args) { AppGameContainer appgc; try{ appgc = new AppGameContainer(new Lawu(gamename),width, height, false); appgc.start(); } catch(SlickException e) { e.printStackTrace(); } } public void initStatesList(GameContainer gc) throws SlickException { this.getState(menu).init(gc, this); this.getState(play).init(gc, this); gc.setIcon("res/Monster.png"); this.enterState(menu); } } 推荐答案把这个放在 appgc.start() 之前:
appgc.setResizable(true);更多推荐
如何使 slick2d 可调整大小
发布评论