com.jmex.awt.applet
Class BaseApplet

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by java.awt.Panel
              extended by java.applet.Applet
                  extended by com.jmex.awt.applet.BaseApplet
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible
Direct Known Subclasses:
BaseSimpleApplet

public abstract class BaseApplet
extends java.applet.Applet

Base class for lwjgl2 kind if Applets, similar to BaseGame.
Display.setParent() is called in the applets start method.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class java.applet.Applet
java.applet.Applet.AccessibleApplet
 
Nested classes/interfaces inherited from class java.awt.Panel
java.awt.Panel.AccessibleAWTPanel
 
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
protected  int alphaBits
          Alpha bits to use for the renderer.
protected  int bpp
          bits per pixel.
protected  int depthBits
          Depth bits to use for the renderer.
protected  DisplaySystem display
           
protected  java.awt.Canvas displayParent
          The awt canvas to draw to
protected  boolean finished
          Flag for running the system.
protected  java.lang.Thread gameThread
          The thread with the game logic: initialization, updating, rendering
protected  int samples
          Number of samples to use for the multisample buffer.
protected  int stencilBits
          Stencil bits to use for the renderer.
protected  ThrowableHandler throwableHandler
           
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
BaseApplet()
           
 
Method Summary
protected  void assertDisplayCreated()
          assertDisplayCreated determines if the display system was successfully created before use.
protected abstract  void cleanup()
           
 void destroy()
           
 void finish()
          Halts execution (cleanup methods are called afterwards)
 void gameLoop()
           
protected  ThrowableHandler getThrowableHandler()
          Get the exception handler if one hs been set.
 java.lang.String getVersion()
           
 void init()
          Initializes the awt canvas to later render the jme scene to via Display.setParent()
protected abstract  void initGame()
           
protected abstract  void initSystem()
           
protected abstract  void reinit()
           
protected abstract  void render(float interpolation)
           
protected  void setThrowableHandler(ThrowableHandler throwableHandler)
           
 void start()
          Creates the game thread, which first initializes the display, then runs the game updates and renders.
protected  void togglefullscreen()
          switched between fullscreen and window mode by calling Display.setFullscreen(true/false) and adjusting the Cameras frustum.
protected abstract  void update(float interpolation)
           
 
Methods inherited from class java.applet.Applet
getAccessibleContext, getAppletContext, getAppletInfo, getAudioClip, getAudioClip, getCodeBase, getDocumentBase, getImage, getImage, getLocale, getParameter, getParameterInfo, isActive, newAudioClip, play, play, resize, resize, setStub, showStatus, stop
 
Methods inherited from class java.awt.Panel
addNotify
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getInsets, getLayout, getListeners, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, paramString, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, removeNotify, setComponentZOrder, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, setLayout, transferFocusBackward, transferFocusDownCycle, update, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

throwableHandler

protected ThrowableHandler throwableHandler

displayParent

protected java.awt.Canvas displayParent
The awt canvas to draw to


gameThread

protected java.lang.Thread gameThread
The thread with the game logic: initialization, updating, rendering


finished

protected boolean finished
Flag for running the system.


display

protected DisplaySystem display

alphaBits

protected int alphaBits
Alpha bits to use for the renderer. Any changes must be made prior to call of start().


depthBits

protected int depthBits
Depth bits to use for the renderer. Any changes must be made prior to call of start().


stencilBits

protected int stencilBits
Stencil bits to use for the renderer. Any changes must be made prior to call of start().


samples

protected int samples
Number of samples to use for the multisample buffer. Any changes must be made prior to call of start().


bpp

protected int bpp
bits per pixel. Any changes must be made prior to call of start().

Constructor Detail

BaseApplet

public BaseApplet()
Method Detail

getVersion

public java.lang.String getVersion()
See Also:
AbstractGame.getVersion()

finish

public void finish()
Halts execution (cleanup methods are called afterwards)


init

public void init()
Initializes the awt canvas to later render the jme scene to via Display.setParent()

Overrides:
init in class java.applet.Applet

start

public final void start()
Creates the game thread, which first initializes the display, then runs the game updates and renders.

Overrides:
start in class java.applet.Applet

destroy

public void destroy()
Overrides:
destroy in class java.applet.Applet

gameLoop

public void gameLoop()

togglefullscreen

protected void togglefullscreen()
switched between fullscreen and window mode by calling Display.setFullscreen(true/false) and adjusting the Cameras frustum.


getThrowableHandler

protected ThrowableHandler getThrowableHandler()
Get the exception handler if one hs been set.

Returns:
the exception handler, or null if not set.

setThrowableHandler

protected void setThrowableHandler(ThrowableHandler throwableHandler)
Parameters:
throwableHandler -

assertDisplayCreated

protected void assertDisplayCreated()
                             throws JmeException
assertDisplayCreated determines if the display system was successfully created before use.

Throws:
JmeException - if the display system was not successfully created

update

protected abstract void update(float interpolation)
Parameters:
interpolation - unused in this implementation
See Also:
AbstractGame.update(float interpolation)

render

protected abstract void render(float interpolation)
Parameters:
interpolation - unused in this implementation
See Also:
AbstractGame.render(float interpolation)

initSystem

protected abstract void initSystem()
See Also:
AbstractGame.initSystem()

initGame

protected abstract void initGame()
See Also:
AbstractGame.initGame()

reinit

protected abstract void reinit()
See Also:
AbstractGame.reinit()

cleanup

protected abstract void cleanup()
See Also:
AbstractGame.cleanup()