|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
com.threerings.opengl.DisplayCanvas
public class DisplayCanvas
A canvas that uses Display.
| Nested Class Summary | |
|---|---|
protected class |
DisplayCanvas.ButtonRecord
Contains the state of a single mouse button. |
| Nested classes/interfaces inherited from class javax.swing.JPanel |
|---|
JPanel.AccessibleJPanel |
| Nested classes/interfaces inherited from class javax.swing.JComponent |
|---|
JComponent.AccessibleJComponent |
| Nested classes/interfaces inherited from class java.awt.Container |
|---|
Container.AccessibleAWTContainer |
| Nested classes/interfaces inherited from class java.awt.Component |
|---|
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy |
| Field Summary | |
|---|---|
protected DisplayCanvas.ButtonRecord[] |
_buttons
The states of the mouse buttons. |
protected Canvas |
_canvas
The contained canvas. |
protected boolean |
_entered
Whether or not the mouse is over the component. |
protected boolean |
_initialized
Set on initialization. |
protected int |
_lclicks
The number of wheel clicks recorded. |
protected int |
_lx
The last position we reported. |
protected int |
_ly
The last position we reported. |
protected int |
_modifiers
The current set of modifiers. |
protected HashIntSet |
_pressedKeys
The set of currently pressed keys. |
protected Runnable |
_updater
The runnable that updates the frame. |
protected static int |
ANY_BUTTONS_DOWN_MASK
A mask for checking whether any mouse buttons are down. |
protected static long |
CLICK_CHAIN_INTERVAL
Clicks this close to one another are chained together for counting purposes. |
protected static long |
CLICK_INTERVAL
Mouse buttons released within this interval after being pressed are counted as clicks. |
| Fields inherited from class javax.swing.JComponent |
|---|
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
| 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 | |
|---|---|
DisplayCanvas()
Creates a new canvas. |
|
| Method Summary | |
|---|---|
void |
addNotify()
|
protected boolean |
anyButtonsDown()
Determines whether the current set of modifiers contains any pressed buttons. |
protected void |
checkButtonState(long now,
int x,
int y,
int button,
boolean pressed)
Checks for button press/release. |
protected void |
checkEntered(long now,
int x,
int y)
Determines whether the mouse has entered the component, dispatching an event if so. |
protected void |
checkExited(long now,
int x,
int y)
Determines whether the mouse has exited the component, dispatching an event if so. |
protected void |
checkMoved(long now,
int x,
int y)
Determines whether the mouse has moved, dispatching an event if so. |
protected void |
didInit()
Override to perform custom initialization. |
boolean |
dispatchKeyEvent(KeyEvent event)
|
protected void |
generateEvents()
Generates AWT input events from the LWJGL devices. |
protected static int |
getAWTButton(int button)
Returns the AWT button corresponding to the specified LWJGL button. |
protected static int |
getAWTCode(int key)
Returns the AWT key code corresponding to the specified key. |
protected static int |
getAWTLocation(int key)
Returns the AWT location corresponding to the specified key. |
Drawable |
getDrawable()
Returns the canvas drawable. |
protected static int |
getLWJGLButton(int button)
Returns the LWJGL button corresponding to the specified AWT button. |
Point |
getMousePosition()
|
protected Point |
getRelativeMouseLocation()
Returns the location of the mouse pointer relative to this component, regardless of whether or not it's actually hovering over the component. |
protected void |
init(PixelFormat pformat)
Attempts to create the display with this canvas as its parent. |
void |
makeCurrent()
Makes the canvas context current. |
void |
removeNotify()
|
protected void |
renderView()
Override to render the contents of the canvas. |
void |
setVSyncEnabled(boolean vsync)
Enables or disables vsync. |
void |
shutdown()
Shuts down the canvas. |
protected void |
startUpdating()
Starts calling updateFrame() regularly. |
protected void |
stopUpdating()
Stops calling updateFrame(). |
protected void |
updateButtonModifier(int button,
boolean pressed)
Updates the modifier for the specified button. |
protected void |
updateFrame()
Updates and, if the canvas is showing, renders the scene and swaps the buffers. |
protected void |
updateView()
Override to perform any updates that are required even if not rendering. |
protected boolean |
windowIsFocused()
Checks whether the window that contains this canvas (if any) is focused. |
| Methods inherited from class javax.swing.JPanel |
|---|
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected Canvas _canvas
protected boolean _initialized
protected Runnable _updater
protected boolean _entered
protected int _lx
protected int _ly
protected DisplayCanvas.ButtonRecord[] _buttons
protected int _lclicks
protected int _modifiers
protected HashIntSet _pressedKeys
protected static final int ANY_BUTTONS_DOWN_MASK
protected static final long CLICK_INTERVAL
protected static final long CLICK_CHAIN_INTERVAL
| Constructor Detail |
|---|
public DisplayCanvas()
| Method Detail |
|---|
public Drawable getDrawable()
GlCanvas
getDrawable in interface GlCanvaspublic void setVSyncEnabled(boolean vsync)
GlCanvas
setVSyncEnabled in interface GlCanvaspublic void makeCurrent()
GlCanvas
makeCurrent in interface GlCanvaspublic void shutdown()
GlCanvas
shutdown in interface GlCanvaspublic boolean dispatchKeyEvent(KeyEvent event)
dispatchKeyEvent in interface KeyEventDispatcherpublic void addNotify()
addNotify in class JComponentpublic void removeNotify()
removeNotify in class JComponentpublic Point getMousePosition()
getMousePosition in class Component
protected void init(PixelFormat pformat)
throws LWJGLException
LWJGLExceptionprotected void didInit()
protected void startUpdating()
updateFrame() regularly.
protected void stopUpdating()
updateFrame().
protected void updateFrame()
protected void generateEvents()
protected void checkEntered(long now,
int x,
int y)
protected void checkExited(long now,
int x,
int y)
protected boolean windowIsFocused()
protected void checkMoved(long now,
int x,
int y)
protected void checkButtonState(long now,
int x,
int y,
int button,
boolean pressed)
protected void updateButtonModifier(int button,
boolean pressed)
protected void updateView()
protected void renderView()
protected Point getRelativeMouseLocation()
protected boolean anyButtonsDown()
protected static int getAWTCode(int key)
protected static int getAWTLocation(int key)
protected static int getAWTButton(int button)
protected static int getLWJGLButton(int button)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||