Top Fields Constructors Methods
org.lwjgl.examples.spaceinvaders

public Class GameApplet

extends Applet
Class Inheritance
Imports
java.applet.Applet, java.awt.BorderLayout, .Canvas, org.lwjgl.LWJGLException, org.lwjgl.opengl.Display

Deprecated

as a consequence of Applet being deprecated. See corresponding docs for further information.

Field Summary

Modifier and TypeField and Description
pack-priv Canvas
display_parent

The Canvas where the LWJGL Display is added

pack-priv Game
game

The Game instance

pack-priv Thread
gameThread

Thread which runs the main game loop

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
destroy()

Overrides java.applet.Applet.destroy.

Applet Destroy method will remove the canvas, before canvas is destroyed it will notify stopLWJGL() to stop main game loop and to destroy the Display
public void
init()

Overrides java.applet.Applet.init.

initialise applet by adding a canvas to it, this canvas will start the LWJGL Display and game loop in another thread.
public void
start()

Overrides java.applet.Applet.start.

Called by the browser or applet viewer to inform this applet that it should start its execution.
public void
startLWJGL()

Once the Canvas is created its add notify method will call this method to start the LWJGL Display and game loop in another thread.

public void
stop()

Overrides java.applet.Applet.stop.

Called by the browser or applet viewer to inform this applet that it should stop its execution.
private void
stopLWJGL()

Tell game loop to stop running, after which the LWJGL Display will be destoryed.

Inherited from java.applet.Applet:
getAccessibleContextgetAppletContextgetAppletInfogetAudioClipgetAudioClipgetCodeBasegetDocumentBasegetImagegetImagegetLocalegetParametergetParameterInfoisActiveisValidateRootnewAudioClipplayplayresizeresizesetStubshowStatus

Field Detail

display_parentback to summary
pack-priv Canvas display_parent

The Canvas where the LWJGL Display is added

gameback to summary
pack-priv Game game

The Game instance

gameThreadback to summary
pack-priv Thread gameThread

Thread which runs the main game loop

Constructor Detail

GameAppletback to summary
public GameApplet()

Method Detail

destroyback to summary
public void destroy()

Overrides java.applet.Applet.destroy.

Applet Destroy method will remove the canvas, before canvas is destroyed it will notify stopLWJGL() to stop main game loop and to destroy the Display

initback to summary
public void init()

Overrides java.applet.Applet.init.

initialise applet by adding a canvas to it, this canvas will start the LWJGL Display and game loop in another thread. It will also stop the game loop and destroy the display on canvas removal when applet is destroyed.

startback to summary
public void start()

Overrides java.applet.Applet.start.

Doc from java.applet.Applet.start.

Called by the browser or applet viewer to inform this applet that it should start its execution. It is called after the init method and each time the applet is revisited in a Web page.

A subclass of Applet should override this method if it has any operation that it wants to perform each time the Web page containing it is visited. For example, an applet with animation might want to use the start method to resume animation, and the stop method to suspend the animation.

Note

some methods, such as getLocationOnScreen, can only provide meaningful results if the applet is showing. Because isShowing returns false when the applet's start is first called, methods requiring isShowing to return true should be called from a ComponentListener.

The implementation of this method provided by the Applet class does nothing.

startLWJGLback to summary
public void startLWJGL()

Once the Canvas is created its add notify method will call this method to start the LWJGL Display and game loop in another thread.

stopback to summary
public void stop()

Overrides java.applet.Applet.stop.

Doc from java.applet.Applet.stop.

Called by the browser or applet viewer to inform this applet that it should stop its execution. It is called when the Web page that contains this applet has been replaced by another page, and also just before the applet is to be destroyed.

A subclass of Applet should override this method if it has any operation that it wants to perform each time the Web page containing it is no longer visible. For example, an applet with animation might want to use the start method to resume animation, and the stop method to suspend the animation.

The implementation of this method provided by the Applet class does nothing.

stopLWJGLback to summary
private void stopLWJGL()

Tell game loop to stop running, after which the LWJGL Display will be destoryed. The main thread will wait for the Display.destroy() to complete