|
||||||||||
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
processing.core.PApplet
org.jbox2d.testbed.TestbedMain
public class TestbedMain
TestbedMain is the holder PApplet for the entire testbed.
It has first stab at input events, and delegates them out
to the appropriate handlers if necessary. It handles the
list of tests to run, and starts them as needed.
For applet safety, no variables are static, because
in the browser a page reload does not reset static
variables (even though the applet may get restarted otherwise).
From a design perspective this is not ideal, but hey - this
is just a demo, anyways, let's not get too bent out of
shape over it.
In the future, other classes should be checked to
make sure this odd static variable behavior is not causing
memory leaks in the browser.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class processing.core.PApplet |
---|
processing.core.PApplet.RegisteredMethods |
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.BltBufferStrategy, java.awt.Component.FlipBufferStrategy |
Field Summary | |
---|---|
protected AbstractExample |
currentTest
Currently running example |
protected int |
currentTestIndex
Index of current example in tests array. |
DebugDraw |
g
Drawing handler to use. |
protected boolean |
handleOptions
Is the options window open? |
TestbedOptions |
options
Our options handler - displays GUI and sets TestSettings for currentTest. |
boolean |
shiftKey
Is the shift key held? |
protected java.util.ArrayList<AbstractExample> |
tests
The list of registered examples |
Fields inherited from class processing.core.PApplet |
---|
args, ARGS_BGCOLOR, ARGS_DISPLAY, ARGS_EDITOR_LOCATION, ARGS_EXTERNAL, ARGS_HIDE_STOP, ARGS_LOCATION, ARGS_PRESENT, ARGS_SKETCH_FOLDER, ARGS_STOP_COLOR, DEFAULT_HEIGHT, DEFAULT_WIDTH, defaultSize, disposeMethods, dmouseX, dmouseY, drawMethods, emouseX, emouseY, exception, exit, EXTERNAL_MOVE, EXTERNAL_QUIT, EXTERNAL_STOP, finished, firstMouse, focused, frame, frameRate, frameRateLastDelayTime, frameRateLastMillis, frameRateTarget, height, javaVersion, javaVersionName, key, keyCode, keyEvent, keyEventMethods, keyPressed, LEECH_WAKEUP, leechErr, listenersAdded, loadImageFormats, looping, MIN_WINDOW_HEIGHT, MIN_WINDOW_WIDTH, mouseButton, mouseEvent, mouseEventMethods, mousePressed, mouseX, mouseY, online, pixels, platform, platformName, pmouseX, pmouseY, postMethods, preMethods, recorder, redraw, screen, sizeMethods, sketchPath, width |
Fields inherited from class java.awt.Component |
---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface processing.core.PConstants |
---|
ADD, ALPHA, ALPHA_MASK, ALT, AMBIENT, ARGB, ARROW, BACKSPACE, BASELINE, BEVEL, BLEND, BLUE_MASK, BLUR, BOTTOM, BURN, CENTER, CENTER_RADIUS, CHATTER, CLOSE, CODED, COMPLAINT, CONTROL, CORNER, CORNERS, CROSS, CUSTOM, DARKEST, DEG_TO_RAD, DELETE, DIFFERENCE, DILATE, DIRECTIONAL, DISABLE_DEPTH_TEST, DISABLE_ERROR_REPORT, DISABLE_TEXT_SMOOTH, DODGE, DOWN, DXF, ENABLE_ACCURATE_TEXTURES, ENABLE_DEPTH_SORT, ENABLE_NATIVE_FONTS, ENTER, EPSILON, ERODE, ESC, EXCLUSION, GIF, GRAY, GREEN_MASK, HALF_PI, HAND, HARD_LIGHT, HINT_COUNT, HSB, IMAGE, INVERT, JAVA2D, JPEG, LEFT, LIGHTEST, LINES, LINUX, MACOS9, MACOSX, MITER, MODEL, MOVE, MULTIPLY, NO_FLYING_POO, NORMALIZED, OPAQUE, OPEN, OPENGL, ORTHOGRAPHIC, OTHER, OVERLAY, P2D, P3D, PDF, PERSPECTIVE, PI, PIXEL_CENTER, POINT, POINTS, POLYGON, POSTERIZE, PROBLEM, PROJECT, QUAD_STRIP, QUADS, QUARTER_PI, RAD_TO_DEG, RADIUS, RED_MASK, REPLACE, RETURN, RGB, RIGHT, ROUND, SCREEN, SHAPE, SHIFT, SOFT_LIGHT, SPOT, SQUARE, SUBTRACT, TAB, TARGA, TEXT, THIRD_PI, THRESHOLD, TIFF, TOP, TRIANGLE_FAN, TRIANGLE_STRIP, TRIANGLES, TWO_PI, UP, WAIT, WHITESPACE, WINDOWS |
Fields inherited from interface java.awt.image.ImageObserver |
---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
---|---|
TestbedMain()
Constructor - real initialization happens in setup() function |
Method Summary | |
---|---|
void |
draw()
This is the main looping function, and is called targetFPS times per second. |
void |
handleCanvasDrag()
Allows the world to be dragged with a right-click. |
void |
keyPressed()
Apply keyboard shortcuts, do keypress handling, and then send the key event to the current test if appropriate. |
void |
keyReleased()
Handle keyReleased events and pass them on to currentTest. |
static void |
main(java.lang.String[] args)
Start PApplet as a Java program (can also be run as an applet). |
void |
mouseDragged()
Just report a mouseMoved event if mouseDragged. |
void |
mouseMoved()
Dispatch mouseMoved events to the current test. |
void |
mousePressed()
Dispatch mousePressed events to the current test. |
void |
mouseReleased()
Dispatch mouseReleased events to the current test. |
void |
registerExample(AbstractExample test)
Register an AbstractExample to the current list of examples. |
void |
setup()
Called once upon program initialization (by Processing). |
Methods inherited from class processing.core.PApplet |
---|
abs, abs, acos, addListeners, alpha, ambient, ambient, ambient, ambientLight, ambientLight, append, append, append, append, append, append, applyMatrix, applyMatrix, arc, arraycopy, arraycopy, arraycopy, asin, atan, atan2, background, background, background, background, background, background, background, beginCamera, beginRaw, beginRaw, beginRecord, beginRecord, beginShape, beginShape, bezier, bezier, bezierDetail, bezierPoint, bezierTangent, bezierVertex, bezierVertex, binary, binary, binary, binary, blend, blend, blendColor, blue, box, box, breakShape, brightness, camera, camera, ceil, checkKeyEvent, checkMouseEvent, color, color, color, color, color, color, color, color, colorMode, colorMode, colorMode, colorMode, concat, concat, concat, concat, concat, concat, concat, constrain, constrain, copy, copy, cos, createFont, createFont, createFont, createGraphics, createGraphics, createGraphics, createImage, createPath, createReader, createReader, createReader, createWriter, createWriter, createWriter, cursor, cursor, cursor, cursor, curve, curve, curveDetail, curvePoint, curveTangent, curveTightness, curveVertex, curveVertex, dataPath, day, degrees, delay, dequeueKeyEvents, dequeueMouseEvents, destroy, die, die, directionalLight, displayable, dist, dist, ellipse, ellipseMode, emissive, emissive, emissive, endCamera, endRaw, endRecord, endShape, endShape, enqueueKeyEvent, enqueueMouseEvent, exec, exit, exp, expand, expand, expand, expand, expand, expand, expand, expand, expand, expand, expand, expand, expand, expand, fill, fill, fill, fill, fill, fill, filter, filter, floor, focusGained, focusGained, focusLost, focusLost, frameRate, frustum, get, get, get, getPreferredSize, green, gzipInput, gzipOutput, handleDisplay, handleKeyEvent, handleMouseEvent, hex, hex, hex, hex, hint, hour, hue, image, image, image, imageMode, init, inputFile, inputFile, inputFile, inputFile, insertFrame, join, join, keyPressed, keyReleased, keyTyped, keyTyped, lerp, lerpColor, lerpColor, lightFalloff, lights, lightSpecular, line, line, link, link, loadBytes, loadBytes, loadFont, loadImage, loadImage, loadImageIO, loadImageSync, loadImageTGA, loadMatrix, loadPixels, loadStrings, loadStrings, loadStrings, log, loop, mag, mag, map, mask, mask, max, max, max, max, max, max, millis, min, min, min, min, min, min, minute, modelX, modelY, modelZ, month, mouseClicked, mouseClicked, mouseDragged, mouseEntered, mouseExited, mouseMoved, mousePressed, mouseReleased, nf, nf, nf, nf, nfc, nfc, nfc, nfc, nfp, nfp, nfp, nfp, nfs, nfs, nfs, nfs, noCursor, noFill, noHint, noise, noise, noise, noiseDetail, noiseDetail, noiseSeed, noLoop, norm, normal, noSmooth, noStroke, noTint, open, open, openStream, openStream, openStreamGZ, openStreamGZ, ortho, ortho, outputFile, outputFile, outputFile, outputFile, paint, param, parseBoolean, parseBoolean, parseBoolean, parseBoolean, parseBoolean, parseByte, parseByte, parseByte, parseByte, parseByte, parseByte, parseByte, parseByte, parseByte, parseChar, parseChar, parseChar, parseChar, parseFloat, parseFloat, parseFloat, parseFloat, parseFloat, parseFloat, parseInt, parseInt, parseInt, parseInt, parseInt, parseInt, parseInt, parseInt, parseInt, parseInt, parseInt, parseInt, perspective, perspective, point, point, pointLight, popMatrix, pow, print, print, print, print, print, print, print, printCamera, println, println, println, println, println, println, println, println, printMatrix, printProjection, pushMatrix, quad, radians, random, random, randomSeed, rect, rectMode, red, redraw, registerDispose, registerDraw, registerKeyEvent, registerMouseEvent, registerNoArgs, registerPost, registerPre, registerSize, registerWithArgs, resetMatrix, reverse, reverse, reverse, reverse, reverse, reverse, reverse, rotate, rotate, rotateX, rotateY, rotateZ, round, run, saturation, save, saveBytes, saveBytes, saveBytes, saveFrame, saveFrame, savePath, saveStream, saveStream, saveStrings, saveStrings, saveStrings, scale, scale, scale, screenX, screenX, screenY, screenY, screenZ, second, set, set, setupExternalMessages, setupFrameResizeListener, shininess, shorten, shorten, shorten, shorten, shorten, shorten, shorten, sin, size, size, size, sketchPath, smooth, sort_compare, sort_internal, sort_partition, sort_swap, sort, sort, sort, sort, sort, sort, sort, sort, sort, sort, sort, specular, specular, specular, specular, specular, sphere, sphereDetail, splice, splice, splice, splice, splice, splice, splice, splice, splice, splice, splice, splice, splice, split, split, splitTokens, splitTokens, spotLight, sq, sqrt, start, status, stop, str, str, str, str, str, str, str, str, str, str, stroke, stroke, stroke, stroke, stroke, stroke, strokeCap, strokeJoin, strokeWeight, subset, subset, subset, subset, subset, subset, subset, subset, subset, subset, subset, subset, subset, subset, tan, text, text, text, text, text, text, text, text, text, text, text, text, textAlign, textAlign, textAscent, textDescent, textFont, textFont, textLeading, textMode, textSize, texture, textureMode, textWidth, textWidth, tint, tint, tint, tint, tint, tint, translate, translate, triangle, trim, trim, unbinary, unhex, update, updatePixels, updatePixels, updateSize, vertex, vertex, vertex, vertex, year |
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 |
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, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, paramString, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, removeNotify, setComponentZOrder, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, setLayout, transferFocusBackward, transferFocusDownCycle, 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, 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.util.ArrayList<AbstractExample> tests
protected AbstractExample currentTest
protected int currentTestIndex
protected boolean handleOptions
public boolean shiftKey
public TestbedOptions options
public DebugDraw g
Constructor Detail |
---|
public TestbedMain()
Method Detail |
---|
public void setup()
setup
in class processing.core.PApplet
public void draw()
draw
in class processing.core.PApplet
public void handleCanvasDrag()
public void mousePressed()
mousePressed
in class processing.core.PApplet
public void mouseReleased()
mouseReleased
in class processing.core.PApplet
public void mouseMoved()
mouseMoved
in class processing.core.PApplet
public void mouseDragged()
mouseDragged
in class processing.core.PApplet
public void keyPressed()
keyPressed
in class processing.core.PApplet
public void keyReleased()
keyReleased
in class processing.core.PApplet
public void registerExample(AbstractExample test)
public static void main(java.lang.String[] args)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |