Minimizing the Display in LWJGL

2019-06-26 08:57发布

I am working on a game that uses LWJGL, and I need a way to minimize the Display with a method. Is there a way to do this?

1条回答
冷血范
2楼-- · 2019-06-26 09:51

The easiest way to do this is to embed the LWJGL into a JPanel, Canvas, or something of the like. Doing this will allow you full control of the way your OpenGL layer is resized, etc. You can even have your own little "OpenGL controls" if you want to start getting fancy with it. here and here are two good examples. The vital part of it is quite simply:

Display.setParent(myAwtOrSwingControl);

After this you can set:

myFrame.setState ( Frame.ICONIFIED );

To achieve the minimization that you're looking for.

查看更多
登录 后发表回答