我想用 lwjgl 制作一个“乒乓”游戏。目前,我做了 2 个类:GameLoop 和 Inizializza。我有下面标记的那 4 行代码,它们给了我编译错误。我从 LJWGL wiki 复制了那部分。
游戏循环-
package game.engine;
public class GameLoop
{
//Main
public static void main(String[] argv)
{
Inizializza finestraGioco = new Inizializza();
finestraGioco.start();
}
}
初始化-
package game.engine;
import org.lwjgl.LWJGLException;
import org.lwjgl.opengl.Display;
import org.lwjgl.opengl.DisplayMode;
import org.lwjgl.opengl.GL11;
public class Inizializza
{
##This is where the code gives me errors##
GL11.glMatrixMode(GL11.GL_PROJECTION); >>Syntax error on token "glMatrixMode", identifier expected after this token
GL11.glLoadIdentity(); >>Syntax error on token "glLoadIdentity", Identifier expected after this toketn
GL11.glOrtho(0, width, height, 0, 1, -1); >>Syntax error on token "(",= expected
>>Syntax error(s) on tokens, misplaced construct(s)
GL11.glMatrixMode(GL11.GL_MODELVIEW); >>Syntax error on token "glMatrixMode", identifier expected after this token
>>Syntax error on tokent ".", ... expected
public void start()
{
try
{
Display.setDisplayMode(new DisplayMode(800,600));
Display.create();
} catch (LWJGLException e)
{
e.printStackTrace();
}
while(!Display.isCloseRequested())
{
Entità.pulisci();
Entità.colora();
Entità.disegna();
Display.update();
}
}
}