|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jbox2d.testbed.AbstractExample
public abstract class AbstractExample
Field Summary | |
---|---|
static javax.vecmath.Color3f |
black
|
static javax.vecmath.Color3f |
blue
|
protected boolean |
bombSpawning
True if a bomb has started spawning but has not been created yet. |
protected Vec2 |
bombSpawnPoint
The point at which we will place a bomb when completeBombSpawn() is called. |
float |
cachedCamScale
Saved camera variable so that camera stays put between reloads of example. |
float |
cachedCamX
Saved camera variable so that camera stays put between reloads of example. |
float |
cachedCamY
Saved camera variable so that camera stays put between reloads of example. |
static javax.vecmath.Color3f |
gray
|
static javax.vecmath.Color3f |
green
|
boolean |
hasCachedCamera
Have the cachedCam* variables been set for this example? |
static java.lang.String |
instructionString
General instructions that apply to all tests. |
boolean[] |
keyDown
Array of key states, by char value. |
protected Body |
m_bomb
The bomb body. |
protected BoundaryListener |
m_boundaryListener
Listener for world AABB violations. |
protected ContactListener |
m_contactListener
Listener for contact events. |
DebugDraw |
m_debugDraw
Used for drawing |
protected DestructionListener |
m_destructionListener
Listener for body and joint destructions. |
protected MouseJoint |
m_mouseJoint
Mouse joint. |
protected int |
m_pointCount
Number of active points in m_points array. |
protected org.jbox2d.testbed.AbstractExample.ContactPoint[] |
m_points
Array of contact points - use m_pointCount to get number of active elements. |
protected int |
m_textLine
Y-pixel value that marks bottom of text to be drawn. |
protected World |
m_world
The world object this example uses. |
protected AABB |
m_worldAABB
The bounding box for the world. |
float |
memFree
The exponentially smoothed amount of free memory available to the JVM. |
Vec2 |
mouseScreen
Screen coordinates of mouse |
Vec2 |
mouseWorld
World coordinates of mouse |
protected boolean |
needsReset
True if we should reset the demo for the next frame. |
boolean[] |
newKeyDown
Same as keyDown, but true only if the key was newly pressed this frame. |
TestbedMain |
parent
The controller that the AbstractExample runs in |
boolean |
pmousePressed
Was the mouse pressed last frame? True if either right or left button was down. |
Vec2 |
pmouseScreen
Screen coordinates of mouse on last frame |
static javax.vecmath.Color3f |
red
|
protected TestSettings |
settings
Settings for this example. |
static int |
textLineHeight
Height of font used to draw text. |
static javax.vecmath.Color3f |
white
|
Constructor Summary | |
---|---|
AbstractExample(TestbedMain _parent)
Instantiate the test. |
Method Summary | |
---|---|
void |
boundaryViolated(Body body)
Stub method for concrete examples to override if desired. |
void |
completeBombSpawn()
Creates and launches a bomb using the current bomb and mouse locations to "slingshot" it. |
abstract void |
create()
Create the world geometry for each test. |
void |
createWorld()
Overload this if you need to create a different world AABB or gravity vector |
java.lang.String |
getExampleInstructions()
Returns a string containing example instructions. |
abstract java.lang.String |
getName()
|
void |
initialize()
Should not usually be overloaded. |
void |
jointDestroyed(Joint joint)
Stub method for concrete examples to override if desired. |
void |
keyPressed(int key)
Set keyDown and newKeyDown arrays when we get a keypress. |
void |
keyReleased(int key)
Set keyDown array when we get a key release. |
void |
launchBomb()
Space launches a bomb from a random default position. |
void |
launchBomb(Vec2 position,
Vec2 velocity)
Launch bomb from a specific position with a given velocity. |
void |
mouseDown(Vec2 p)
Handle mouseDown events. |
void |
mouseMove(Vec2 p)
Handle mouseMove events (TestbedMain also sends mouseDragged events here) |
void |
mouseUp()
Handle mouseUp events. |
void |
postStep()
Stub for overloading in examples - called after physics step. |
void |
preStep()
Stub for overloading in examples - called before physics step. |
void |
printInstructions()
Prints default instructions + specific example instructions. |
void |
setCamera(float x,
float y,
float scale)
Sets the camera target and scale. |
void |
spawnBomb(Vec2 worldPt)
Begins spawning a bomb, spawn finishes and bomb is created upon calling completeBombSpawn(). |
void |
step()
Take a physics step. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public TestbedMain parent
public DebugDraw m_debugDraw
public boolean[] keyDown
public boolean[] newKeyDown
public static java.lang.String instructionString
public Vec2 mouseScreen
public Vec2 mouseWorld
public Vec2 pmouseScreen
public boolean pmousePressed
protected boolean needsReset
protected Vec2 bombSpawnPoint
protected boolean bombSpawning
protected int m_textLine
protected int m_pointCount
protected org.jbox2d.testbed.AbstractExample.ContactPoint[] m_points
protected World m_world
protected Body m_bomb
protected MouseJoint m_mouseJoint
protected TestSettings settings
protected AABB m_worldAABB
public float memFree
protected DestructionListener m_destructionListener
protected BoundaryListener m_boundaryListener
protected ContactListener m_contactListener
public static javax.vecmath.Color3f white
public static javax.vecmath.Color3f black
public static javax.vecmath.Color3f gray
public static javax.vecmath.Color3f red
public static javax.vecmath.Color3f green
public static javax.vecmath.Color3f blue
public float cachedCamX
public float cachedCamY
public float cachedCamScale
public boolean hasCachedCamera
public static int textLineHeight
Constructor Detail |
---|
public AbstractExample(TestbedMain _parent)
_parent
- The controller that this test is run from.Method Detail |
---|
public void printInstructions()
public java.lang.String getExampleInstructions()
public abstract java.lang.String getName()
public abstract void create()
public void createWorld()
public void initialize()
public void step()
public void preStep()
public void postStep()
public void launchBomb()
public void launchBomb(Vec2 position, Vec2 velocity)
position
- Position to launch bomb from.velocity
- Velocity to launch bomb with.public void spawnBomb(Vec2 worldPt)
public void completeBombSpawn()
public void keyPressed(int key)
key
- The key pressed.public void keyReleased(int key)
key
- The key released.public void mouseDown(Vec2 p)
p
- The screen location that the mouse is down at.public void mouseUp()
public void mouseMove(Vec2 p)
p
- The new mouse location (screen coordinates)public void setCamera(float x, float y, float scale)
x
- World x coordinate of camera focusy
- World y coordinate of camera focusscale
- Size in screen units (usually pixels) of one world unit (meter)public void jointDestroyed(Joint joint)
joint
- The implicitly destroyed jointpublic void boundaryViolated(Body body)
body
- The body that went out of bounds
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |