如何使 slick2d 可调整大小

编程入门 行业动态 更新时间:2024-10-28 18:36:34
本文介绍了如何使 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 可调整大小

本文发布于:2023-11-11 13:36:29,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1578591.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:可调整   大小   slick2d

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!