Package org.jbox2d.testbed.tests
Class Car
- java.lang.Object
-
- org.jbox2d.testbed.framework.TestbedTest
-
- org.jbox2d.testbed.tests.Car
-
- All Implemented Interfaces:
ContactListener
,JbDeserializer.ObjectListener
,JbSerializer.ObjectSigner
,UnsupportedListener
public class Car extends TestbedTest
-
-
Field Summary
Fields Modifier and Type Field Description private static long
CAR_TAG
private Body
m_car
private float
m_hz
private float
m_speed
private WheelJoint
m_spring1
private WheelJoint
m_spring2
private Body
m_wheel1
private Body
m_wheel2
private float
m_zeta
private static long
SPRING1_TAG
private static long
SPRING2_TAG
private static long
WHEEL1_TAG
private static long
WHEEL2_TAG
-
Fields inherited from class org.jbox2d.testbed.framework.TestbedTest
BOMB_TAG, destructionListener, GROUND_BODY_TAG, groundBody, m_textLine, m_world, MAX_CONTACT_POINTS, MOUSE_JOINT_TAG, points
-
-
Constructor Summary
Constructors Constructor Description Car()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description float
getDefaultCameraScale()
Override for a different default camera scalejava.lang.Long
getTag(Body body)
java.lang.Long
getTag(Joint joint)
java.lang.String
getTestName()
The name of the testvoid
initTest(boolean deserialized)
Initializes the current testboolean
isSaveLoadEnabled()
Override to enable saving and loading.void
keyPressed(char argKeyChar, int argKeyCode)
void
keyReleased(char argKeyChar, int argKeyCode)
void
processBody(Body body, java.lang.Long tag)
void
processJoint(Joint joint, java.lang.Long tag)
void
step(TestbedSettings settings)
-
Methods inherited from class org.jbox2d.testbed.framework.TestbedTest
_load, _reset, _save, addTextLine, beginContact, completeBombSpawn, endContact, exit, getBomb, getCachedCameraPos, getCachedCameraScale, getContactPoints, getDebugDraw, getDefaultCameraPos, getFilename, getGroundBody, getModel, getPointCount, getStepCount, getTag, getTag, getTag, getWorld, getWorldMouse, init, init, isDialogOnSaveLoadErrors, isHasCachedCamera, isUnsupported, jointDestroyed, lanchBomb, launchBomb, load, mouseDown, mouseMove, mouseUp, postSolve, preSolve, processFixture, processShape, processWorld, queueKeyPressed, queueKeyReleased, queueMouseDown, queueMouseMove, queueMouseUp, queueShiftMouseDown, reset, save, setCachedCameraPos, setCachedCameraScale, setCamera, setCamera, setDialogOnSaveLoadErrors, setHasCachedCamera, setTitle, shiftMouseDown, spawnBomb, update
-
-
-
-
Field Detail
-
CAR_TAG
private static final long CAR_TAG
- See Also:
- Constant Field Values
-
WHEEL1_TAG
private static final long WHEEL1_TAG
- See Also:
- Constant Field Values
-
WHEEL2_TAG
private static final long WHEEL2_TAG
- See Also:
- Constant Field Values
-
SPRING1_TAG
private static final long SPRING1_TAG
- See Also:
- Constant Field Values
-
SPRING2_TAG
private static final long SPRING2_TAG
- See Also:
- Constant Field Values
-
m_car
private Body m_car
-
m_wheel1
private Body m_wheel1
-
m_wheel2
private Body m_wheel2
-
m_hz
private float m_hz
-
m_zeta
private float m_zeta
-
m_speed
private float m_speed
-
m_spring1
private WheelJoint m_spring1
-
m_spring2
private WheelJoint m_spring2
-
-
Method Detail
-
getTag
public java.lang.Long getTag(Body body)
- Specified by:
getTag
in interfaceJbSerializer.ObjectSigner
- Overrides:
getTag
in classTestbedTest
- Returns:
- the tag for the body. can be null.
-
getTag
public java.lang.Long getTag(Joint joint)
- Specified by:
getTag
in interfaceJbSerializer.ObjectSigner
- Overrides:
getTag
in classTestbedTest
- Returns:
- the tag for the joint. can be null.
-
processBody
public void processBody(Body body, java.lang.Long tag)
- Specified by:
processBody
in interfaceJbDeserializer.ObjectListener
- Overrides:
processBody
in classTestbedTest
-
processJoint
public void processJoint(Joint joint, java.lang.Long tag)
- Specified by:
processJoint
in interfaceJbDeserializer.ObjectListener
- Overrides:
processJoint
in classTestbedTest
-
isSaveLoadEnabled
public boolean isSaveLoadEnabled()
Description copied from class:TestbedTest
Override to enable saving and loading. Remember to also override theJbDeserializer.ObjectListener
andJbSerializer.ObjectSigner
methods if you need to- Overrides:
isSaveLoadEnabled
in classTestbedTest
- Returns:
-
getTestName
public java.lang.String getTestName()
Description copied from class:TestbedTest
The name of the test- Specified by:
getTestName
in classTestbedTest
- Returns:
-
initTest
public void initTest(boolean deserialized)
Description copied from class:TestbedTest
Initializes the current test- Specified by:
initTest
in classTestbedTest
-
keyPressed
public void keyPressed(char argKeyChar, int argKeyCode)
- Overrides:
keyPressed
in classTestbedTest
-
keyReleased
public void keyReleased(char argKeyChar, int argKeyCode)
- Overrides:
keyReleased
in classTestbedTest
-
getDefaultCameraScale
public float getDefaultCameraScale()
Description copied from class:TestbedTest
Override for a different default camera scale- Overrides:
getDefaultCameraScale
in classTestbedTest
- Returns:
-
step
public void step(TestbedSettings settings)
- Overrides:
step
in classTestbedTest
-
-