com.jmex.swt.lwjgl
Class LWJGLSWTCanvas

java.lang.Object
  extended by org.eclipse.swt.widgets.Widget
      extended by org.eclipse.swt.widgets.Control
          extended by org.eclipse.swt.widgets.Scrollable
              extended by org.eclipse.swt.widgets.Composite
                  extended by org.eclipse.swt.widgets.Canvas
                      extended by org.eclipse.swt.opengl.GLCanvas
                          extended by com.jmex.swt.lwjgl.LWJGLSWTCanvas
All Implemented Interfaces:
JMECanvas, org.eclipse.swt.graphics.Drawable

public class LWJGLSWTCanvas
extends org.eclipse.swt.opengl.GLCanvas
implements JMECanvas

LWJGLCanvas

Author:
Joshua Slack

Field Summary
 
Fields inherited from class org.eclipse.swt.widgets.Control
view
 
Constructor Summary
LWJGLSWTCanvas(org.eclipse.swt.widgets.Composite parent, int style, org.eclipse.swt.opengl.GLData data)
           
 
Method Summary
 void dispose()
           
 int getTargetSyncRate()
           
 void init()
           
 boolean isDirty()
           
 boolean isDoUpdateOnly()
           
 boolean isDrawWhenDirty()
           
 boolean isUpdateInput()
           
 void killGfxContext()
          Destroy GFX context
 void makeDirty()
          Force this canvas to be flagged as dirty.
 void render()
           
 void setAutoKillGfxContext(boolean shouldAutoKillGfxContext)
           
 void setDoUpdateOnly(boolean doUpdateOnly)
          Use this to bypass the game task queue and other workings of canvas
 void setDrawWhenDirty(boolean whenDirty)
           
 void setImplementor(JMECanvasImplementor impl)
          Sets the logic/gameplay implementation for this JMECanvas
 void setTargetRate(int fps)
          Set the desired update/redraw frequency of this canvas.
 void setUpdateInput(boolean doUpdate)
           
 boolean shouldAutoKillGfxContext()
           
 
Methods inherited from class org.eclipse.swt.opengl.GLCanvas
getGLData, isCurrent, setCurrent, swapBuffers
 
Methods inherited from class org.eclipse.swt.widgets.Canvas
drawBackground, getCaret, getIME, scroll, setCaret, setFont, setIME
 
Methods inherited from class org.eclipse.swt.widgets.Composite
changed, checkSubclass, computeSize, getBackgroundMode, getChildren, getLayout, getLayoutDeferred, getTabList, isLayoutDeferred, layout, layout, layout, layout, setBackgroundMode, setFocus, setLayout, setLayoutDeferred, setTabList
 
Methods inherited from class org.eclipse.swt.widgets.Scrollable
computeTrim, getClientArea, getHorizontalBar, getVerticalBar
 
Methods inherited from class org.eclipse.swt.widgets.Control
addControlListener, addDragDetectListener, addFocusListener, addHelpListener, addKeyListener, addMenuDetectListener, addMouseListener, addMouseMoveListener, addMouseTrackListener, addMouseWheelListener, addPaintListener, addTraverseListener, computeSize, dragDetect, dragDetect, forceFocus, getAccessible, getBackground, getBackgroundImage, getBorderWidth, getBounds, getCursor, getDragDetect, getEnabled, getFont, getForeground, getLayoutData, getLocation, getMenu, getMonitor, getParent, getRegion, getShell, getSize, getToolTipText, getVisible, internal_dispose_GC, internal_new_GC, isEnabled, isFocusControl, isReparentable, isVisible, moveAbove, moveBelow, pack, pack, print, redraw, redraw, removeControlListener, removeDragDetectListener, removeFocusListener, removeHelpListener, removeKeyListener, removeMenuDetectListener, removeMouseListener, removeMouseMoveListener, removeMouseTrackListener, removeMouseWheelListener, removePaintListener, removeTraverseListener, setBackground, setBackgroundImage, setBounds, setBounds, setCapture, setCursor, setDragDetect, setEnabled, setForeground, setLayoutData, setLocation, setLocation, setMenu, setParent, setRedraw, setRegion, setSize, setSize, setToolTipText, setVisible, toControl, toControl, toDisplay, toDisplay, traverse, update
 
Methods inherited from class org.eclipse.swt.widgets.Widget
addDisposeListener, addListener, checkWidget, getData, getData, getDisplay, getListeners, getStyle, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, removeListener, setData, setData, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LWJGLSWTCanvas

public LWJGLSWTCanvas(org.eclipse.swt.widgets.Composite parent,
                      int style,
                      org.eclipse.swt.opengl.GLData data)
               throws LWJGLException
Throws:
LWJGLException
Method Detail

setImplementor

public void setImplementor(JMECanvasImplementor impl)
Description copied from interface: JMECanvas
Sets the logic/gameplay implementation for this JMECanvas

Specified by:
setImplementor in interface JMECanvas
Parameters:
impl - the implementor object that will provide rendering/update logic.

init

public void init()

render

public void render()

isDoUpdateOnly

public boolean isDoUpdateOnly()

setDoUpdateOnly

public void setDoUpdateOnly(boolean doUpdateOnly)
Use this to bypass the game task queue and other workings of canvas

Parameters:
doUpdateOnly -

isUpdateInput

public boolean isUpdateInput()
Specified by:
isUpdateInput in interface JMECanvas
Returns:
true if the logic loop of this canvas should ask jME's input system to "poll".

setUpdateInput

public void setUpdateInput(boolean doUpdate)
Specified by:
setUpdateInput in interface JMECanvas
Parameters:
doUpdate - true if the logic loop of this canvas should ask jME's input system to "poll".

setTargetRate

public void setTargetRate(int fps)
Description copied from interface: JMECanvas
Set the desired update/redraw frequency of this canvas. If setDrawWhenDirty was called with true, this frequency is just a cap to possible redraw rate.

Specified by:
setTargetRate in interface JMECanvas
Parameters:
fps - the desired target rate in frames per second

getTargetSyncRate

public int getTargetSyncRate()
Specified by:
getTargetSyncRate in interface JMECanvas
Returns:
the desired target rate in frames per second
See Also:
JMECanvas.setTargetRate(int)

setDrawWhenDirty

public void setDrawWhenDirty(boolean whenDirty)
Specified by:
setDrawWhenDirty in interface JMECanvas
Parameters:
whenDirty - true if we should only draw if the canvas is flagged as dirty. false if we should draw on every loop regardless of dirty state.

isDrawWhenDirty

public boolean isDrawWhenDirty()
Specified by:
isDrawWhenDirty in interface JMECanvas
Returns:
true if we should only draw if the canvas is flagged as dirty. false if we should draw on every loop regardless of dirty state.

makeDirty

public void makeDirty()
Description copied from interface: JMECanvas
Force this canvas to be flagged as dirty. See JMECanvas.setDrawWhenDirty(boolean).

Specified by:
makeDirty in interface JMECanvas

isDirty

public boolean isDirty()

dispose

public void dispose()
Overrides:
dispose in class org.eclipse.swt.widgets.Widget

setAutoKillGfxContext

public void setAutoKillGfxContext(boolean shouldAutoKillGfxContext)
Specified by:
setAutoKillGfxContext in interface JMECanvas
Parameters:
shouldAutoKillGfxContext - true(default) if the GFX Context should be destroyed as soon as the canvas is removed from it's parent container

shouldAutoKillGfxContext

public boolean shouldAutoKillGfxContext()
Specified by:
shouldAutoKillGfxContext in interface JMECanvas
Returns:
true(default) if the GFX Context should be destroyed as soon as the canvas is removed from it's parent container

killGfxContext

public void killGfxContext()
Description copied from interface: JMECanvas
Destroy GFX context

Specified by:
killGfxContext in interface JMECanvas