Class TestbedTest
java.lang.Object
de.pirckheimer_gymnasium.jbox2d.testbed.framework.TestbedTest
- All Implemented Interfaces:
ContactListener,JbDeserializer.ObjectListener,JbSerializer.ObjectSigner,UnsupportedListener
- Direct Known Subclasses:
ApplyForce,BlobTest4,BodyTypes,Breakable,BulletTest,Cantilever,Car,Chain,CharacterCollision,CircleStress,CollisionFiltering,CollisionProcessing,CompoundShapes,ConfinedTest,ContinuousTest,ConvexHull,ConveyorBelt,DamBreak,DistanceTest,DominoTest,DominoTower,DrawingParticles,DynamicTreeTest,EdgeShapes,EdgeTest,FixedPendulumTest,FreePendulumTest,Gears,LiquidTimer,MotorTest,OneSidedTest,Particles,ParticleTypes,PistonTest,PolyShapes,PrismaticTest,Pulleys,PyramidTest,RayCastTest,RevoluteTest,RopeTest,SensorTest,ShapeEditing,SliderCrankTest,SphereStack,TheoJansen,Tumbler,VaryingFrictionTest,VaryingRestitution,VerticalStack,WaveMachine,Web
public abstract class TestbedTest
extends Object
implements ContactListener, JbDeserializer.ObjectListener, JbSerializer.ObjectSigner, UnsupportedListener
- Author:
- Daniel Murphy
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intprotected static final longprotected DestructionListenerprotected static final longprotected Bodyprotected intprotected WorldOnly visible for compatibility.static final intstatic final intprotected static final longprotected booleanprotected ParticleDestructionListenerfinal ContactPoint[]static final intstatic final intstatic final float -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddTextLine(String line) Adds a text line to the reporting areavoidbeginContact(Contact contact) voidendContact(Contact contact) voidexit()called when the tests exitsvoidfixtureDestroyed(Fixture fixture) getBomb()Gets the 'bomb' body if it's presentGets the contact points for the current testGets the debug draw for the testbedOverride for a different default camera positionfloatOverride for a different default camera scaleprotected JbDeserializerGets the filename of the current test.Gets the ground body of the world, used for some jointsgetModel()Gets the testbed modelintThe number of contact points we're storingprotected JbSerializerintabstract StringThe name of the testgetWorld()Gets the current worldGets the world position of the mousevoidvoidinit(TestbedModel model) abstract voidinitTest(boolean deserialized) Initializes the current test.booleanbooleanOverride to enable saving and loading.booleanisUnsupported(UnsupportedObjectException exception) voidjointDestroyed(Joint joint) voidkeyPressed(char keyChar, int keyCode) voidkeyReleased(char keyChar, int keyCode) voidvoidvoidvoidvoidCalled for mouse-upvoidparticleDestroyed(int particle) voidvoidpostSolve(Contact contact, ContactImpulse impulse) voidvoidprocessBody(Body body, Long tag) voidprocessFixture(Fixture fixture, Long tag) voidprocessJoint(Joint joint, Long tag) voidprocessShape(Shape shape, Long tag) voidprocessWorld(World world, Long tag) voidDeprecated.voidDeprecated.usegetCamera()voidstep(TestbedSettings settings)
-
Field Details
-
MAX_CONTACT_POINTS
public static final int MAX_CONTACT_POINTS- See Also:
-
ZOOM_SCALE_DIFF
public static final float ZOOM_SCALE_DIFF- See Also:
-
TEXT_LINE_SPACE
public static final int TEXT_LINE_SPACE- See Also:
-
TEXT_SECTION_SPACE
public static final int TEXT_SECTION_SPACE- See Also:
-
MOUSE_JOINT_BUTTON
public static final int MOUSE_JOINT_BUTTON- See Also:
-
BOMB_SPAWN_BUTTON
public static final int BOMB_SPAWN_BUTTON- See Also:
-
GROUND_BODY_TAG
protected static final long GROUND_BODY_TAG- See Also:
-
BOMB_TAG
protected static final long BOMB_TAG- See Also:
-
MOUSE_JOINT_TAG
protected static final long MOUSE_JOINT_TAG- See Also:
-
points
-
m_world
Only visible for compatibility. Should usegetWorld()instead. -
groundBody
-
mouseTracing
protected boolean mouseTracing -
destructionListener
-
particleDestructionListener
-
m_textLine
protected int m_textLine
-
-
Constructor Details
-
TestbedTest
public TestbedTest()
-
-
Method Details
-
init
-
init
-
getSerializer
-
getDeserializer
-
getWorld
Gets the current world -
getModel
Gets the testbed model -
getContactPoints
Gets the contact points for the current test -
getGroundBody
Gets the ground body of the world, used for some joints -
getDebugDraw
Gets the debug draw for the testbed -
getWorldMouse
Gets the world position of the mouse -
getStepCount
public int getStepCount() -
getPointCount
public int getPointCount()The number of contact points we're storing -
getCamera
-
getBomb
Gets the 'bomb' body if it's present -
getDefaultCameraPos
Override for a different default camera position -
getDefaultCameraScale
public float getDefaultCameraScale()Override for a different default camera scale -
isMouseTracing
public boolean isMouseTracing() -
getMouseTracerPosition
-
getMouseTracerVelocity
-
getFilename
Gets the filename of the current test. Default implementation uses the test name with no spaces". -
setCamera
Deprecated.usegetCamera() -
setCamera
Deprecated.usegetCamera() -
initTest
public abstract void initTest(boolean deserialized) Initializes the current test.- Parameters:
deserialized- if the test was deserialized from a file. If so, all physics objects are already added.
-
getTestName
The name of the test -
addTextLine
Adds a text line to the reporting area -
exit
public void exit()called when the tests exits -
step
-
mouseUp
Called for mouse-up -
keyPressed
public void keyPressed(char keyChar, int keyCode) -
keyReleased
public void keyReleased(char keyChar, int keyCode) -
mouseDown
-
mouseMove
-
mouseDrag
-
lanchBomb
public void lanchBomb() -
isSaveLoadEnabled
public boolean isSaveLoadEnabled()Override to enable saving and loading. Remember to also override theJbDeserializer.ObjectListenerandJbSerializer.ObjectSignermethods if you need to -
getTag
- Specified by:
getTagin interfaceJbSerializer.ObjectSigner
-
getTag
- Specified by:
getTagin interfaceJbSerializer.ObjectSigner
-
getTag
- Specified by:
getTagin interfaceJbSerializer.ObjectSigner
-
getTag
- Specified by:
getTagin interfaceJbSerializer.ObjectSigner
-
getTag
- Specified by:
getTagin interfaceJbSerializer.ObjectSigner
-
processBody
- Specified by:
processBodyin interfaceJbDeserializer.ObjectListener
-
processFixture
- Specified by:
processFixturein interfaceJbDeserializer.ObjectListener
-
processJoint
- Specified by:
processJointin interfaceJbDeserializer.ObjectListener
-
processShape
- Specified by:
processShapein interfaceJbDeserializer.ObjectListener
-
processWorld
- Specified by:
processWorldin interfaceJbDeserializer.ObjectListener
-
isUnsupported
- Specified by:
isUnsupportedin interfaceUnsupportedListener
-
fixtureDestroyed
-
jointDestroyed
-
beginContact
- Specified by:
beginContactin interfaceContactListener
-
endContact
- Specified by:
endContactin interfaceContactListener
-
particleDestroyed
public void particleDestroyed(int particle) -
particleGroupDestroyed
-
postSolve
- Specified by:
postSolvein interfaceContactListener
-
preSolve
- Specified by:
preSolvein interfaceContactListener
-
getCamera()