Top Fields Constructors Methods
org.lwjgl.test.applet

public Class GearsApplet

extends Applet
Class Inheritance
Imports
java.applet.Applet, java.awt.BorderLayout, .Canvas, java.nio.FloatBuffer, org.lwjgl.BufferUtils, .LWJGLException, .LWJGLUtil, .Sys, org.lwjgl.opengl.Display, .GLContext, org.lwjgl.input.Keyboard, .Mouse

Deprecated

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

Field Summary

Modifier and TypeField and Description
private float
pack-priv Canvas
display_parent

The Canvas where the LWJGL Display is added

pack-priv Thread
gameThread

Thread which runs the main game loop

private int
private int
private int
pack-priv boolean
private boolean
private int
private int
pack-priv boolean
running

is the game loop running

private float
view_rotx

variables used to rotate the view

private float
private float

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
public void
private void
gear(float
radius of hole at center
inner_radius
,
float
radius at center of teeth
outer_radius
,
float
width of gear
width
,
int
number of teeth
teeth
,
float
depth of tooth
tooth_depth
)

Draw a gear wheel.

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.
protected void
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

angleback to summary
private float angle
display_parentback to summary
pack-priv Canvas display_parent

The Canvas where the LWJGL Display is added

gameThreadback to summary
pack-priv Thread gameThread

Thread which runs the main game loop

gear1back to summary
private int gear1
gear2back to summary
private int gear2
gear3back to summary
private int gear3
keyDownback to summary
pack-priv boolean keyDown
mouseButtonDownback to summary
private boolean mouseButtonDown
prevMouseXback to summary
private int prevMouseX
prevMouseYback to summary
private int prevMouseY
runningback to summary
pack-priv boolean running

is the game loop running

view_rotxback to summary
private float view_rotx

variables used to rotate the view

view_rotyback to summary
private float view_roty
view_rotzback to summary
private float view_rotz

Constructor Detail

GearsAppletback to summary
public GearsApplet()

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

drawLoopback to summary
public void drawLoop()
gameLoopback to summary
public void gameLoop()
gearback to summary
private void gear(float inner_radius, float outer_radius, float width, int teeth, float tooth_depth)

Draw a gear wheel. You'll probably want to call this function when building a display list since we do a lot of trig here.

Parameters
inner_radius:float

radius of hole at center

outer_radius:float

radius at center of teeth

width:float

width of gear

teeth:int

number of teeth

tooth_depth:float

depth of tooth

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.

initGLback to summary
protected void initGL()
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