I want to make a 'Pong' game using lwjgl. For now, I made 2 classes: GameLoop and Inizializza. I have those 4 lines of code marked below that are giving me compile errors. I copied that part from LJWGL wiki.
GameLoop-
package game.engine;
public class GameLoop
{
//Main
public static void main(String[] argv)
{
Inizializza finestraGioco = new Inizializza();
finestraGioco.start();
}
}
Inizializza-
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();
}
}
}
Yeah, you've just dropped those lines in the class body; they should be in a method (somewhere in your start method?).
:)