【发布时间】:2015-02-27 14:32:01
【问题描述】:
为什么这段代码有效(窗口在退出按钮时关闭)?
看来我的帖子主要是代码,我不知道要添加什么细节。看来我的帖子主要是代码,我不知道要添加什么细节。
public class Main
{
public static void main (String[] args)
{
start(); //Create a window
render(); //Run the game
close(); //End the game
}
private static void start()
{
Window SD = new Window();
SD.Launch();
}
private static void render()
{
while(!Display.isCloseRequested() && !Keyboard.isKeyDown(Keyboard.KEY_ESCAPE))
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
Display.update();
}
}
private static void close()
{
Display.destroy();
}
}
但是这段代码没有:
//
while(!Display.isCloseRequested() && !Input.ESC)
//
public class Input
{
public static boolean ESC = Keyboard.isKeyDown(Keyboard.KEY_ESCAPE);
}
【问题讨论】:
标签: java while-loop conditional-statements lwjgl