|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.Component
java.awt.Container
java.awt.Panel
java.applet.Applet
com.jmex.awt.applet.StandardApplet
public abstract class StandardApplet
LWJGL2 Applet imlpementation similar to StandardGame
Nested Class Summary | |
---|---|
static class |
StandardApplet.GameType
|
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 DisplaySystem |
display
The DisplaySystem for this applet |
protected java.awt.Canvas |
displayParent
The awt canvas to draw to |
protected boolean |
finished
|
protected java.lang.Thread |
gameThread
The thread with the game logic: initialization, updating, rendering |
protected ThrowableHandler |
throwableHandler
If there is an exception during the game loop this is used to handle it |
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 | |
---|---|
StandardApplet()
|
Method Summary | ||
---|---|---|
protected void |
assertDisplayCreated()
assertDisplayCreated determines if the display system was
successfully created before use. |
|
protected void |
cleanup()
|
|
void |
delayForUpdate()
Causes the current thread to wait for an update to occur in the OpenGL thread. |
|
void |
destroy()
|
|
|
executeInGL(java.util.concurrent.Callable<T> callable)
Convenience method that will make sure callable is executed in the
OpenGL thread. |
|
void |
finish()
Halts execution (cleanup methods are called afterwards) |
|
void |
gameLoop()
|
|
int |
getAlphaBits()
|
|
Camera |
getCamera()
The internally used Camera for this instance of
StandardApplet . |
|
java.awt.Canvas |
getCanvas()
|
|
int |
getDepthBits()
|
|
DisplaySystem |
getDisplay()
The internally used DisplaySystem for this instance
of StandardApplet |
|
int |
getFramerate()
|
|
java.lang.String |
getGameName()
|
|
int |
getSamples()
|
|
int |
getStencilBits()
|
|
protected ThrowableHandler |
getThrowableHandler()
Get the exception handler if one hs been set. |
|
StandardApplet.GameType |
getType()
|
|
java.lang.String |
getVersion()
|
|
boolean |
getVSyncEnabled()
|
|
boolean |
inGLThread()
Convenience method to let you know if the thread you're in is the OpenGL thread |
|
void |
init()
Initializes the awt canvas to later render the jme scene to via Display.setParent() |
|
protected void |
initGame()
|
|
protected void |
initSound()
|
|
protected void |
initSystem()
|
|
boolean |
isStarted()
Will return true if within the main game loop. |
|
void |
lock()
Will wait for a lock at the beginning of the OpenGL update method. |
|
protected void |
quit()
|
|
protected void |
render(float interpolation)
|
|
void |
resetCamera()
|
|
void |
setAlphaBits(int alphaBits)
|
|
void |
setBackgroundColor(ColorRGBA backgroundColor)
|
|
void |
setDepthBits(int depthBits)
|
|
void |
setFramerate(int preferredFPS)
|
|
void |
setGameName(java.lang.String gameName)
|
|
void |
setIcons(Image[] icons)
|
|
void |
setSamples(int samples)
|
|
void |
setStencilBits(int stencilBits)
|
|
protected void |
setThrowableHandler(ThrowableHandler throwableHandler)
|
|
void |
setType(StandardApplet.GameType type)
|
|
void |
setVSyncEnabled(boolean vSyncEnabled)
|
|
void |
shutdown()
Gracefully shutdown the main game loop thread. |
|
void |
start()
Creates the game thread, which first initializes the display, then runs the game updates and renders. |
|
void |
toggleFullscreen()
|
|
void |
unlock()
Used in conjunction with lock() in order to release a previously assigned lock on the OpenGL thread. |
|
protected 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 |
---|
protected java.awt.Canvas displayParent
protected java.lang.Thread gameThread
protected boolean finished
protected DisplaySystem display
protected ThrowableHandler throwableHandler
Constructor Detail |
---|
public StandardApplet()
Method Detail |
---|
public java.lang.String getVersion()
public void setGameName(java.lang.String gameName)
public java.lang.String getGameName()
public void setType(StandardApplet.GameType type)
public StandardApplet.GameType getType()
public void setFramerate(int preferredFPS)
public int getFramerate()
public void setVSyncEnabled(boolean vSyncEnabled)
public boolean getVSyncEnabled()
public void setIcons(Image[] icons)
public void setBackgroundColor(ColorRGBA backgroundColor)
public int getAlphaBits()
public void setAlphaBits(int alphaBits)
public int getDepthBits()
public void setDepthBits(int depthBits)
public int getStencilBits()
public void setStencilBits(int stencilBits)
public int getSamples()
public void setSamples(int samples)
public void toggleFullscreen()
public DisplaySystem getDisplay()
DisplaySystem
for this instance
of StandardApplet
DisplaySystem
public Camera getCamera()
Camera
for this instance of
StandardApplet
.
Camera
public java.awt.Canvas getCanvas()
public void init()
init
in class java.applet.Applet
public void start()
start
in class java.applet.Applet
public void destroy()
destroy
in class java.applet.Applet
public void gameLoop()
protected ThrowableHandler getThrowableHandler()
null
if not set.protected void setThrowableHandler(ThrowableHandler throwableHandler)
throwableHandler
- protected void assertDisplayCreated() throws JmeException
assertDisplayCreated
determines if the display system was
successfully created before use.
JmeException
- if the display system was not successfully createdprotected void initSystem()
protected void initSound()
public void resetCamera()
protected void initGame()
protected void update(float interpolation)
interpolationc
- is the number of seconds since the last frameprotected void render(float interpolation)
interpolation
- is the number of seconds since the last frameprotected void cleanup()
protected void quit()
public void finish()
public void shutdown()
finish()
public boolean isStarted()
public void delayForUpdate() throws java.lang.InterruptedException, java.util.concurrent.ExecutionException
java.lang.InterruptedException
java.util.concurrent.ExecutionException
public boolean inGLThread()
public <T> T executeInGL(java.util.concurrent.Callable<T> callable) throws java.lang.Exception
callable
is executed in the
OpenGL thread. If it is already in the OpenGL thread when this method is invoked
it will be executed and returned immediately. Otherwise, it will be put into the
GameTaskQueue and executed in the next update. This is a blocking method and will
wait for the successful return of callable
before returning.
T
- callable
-
java.lang.Exception
public void lock()
public void unlock()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |