Class AbstractTestbedController
java.lang.Object
de.pirckheimer_gymnasium.jbox2d.testbed.framework.AbstractTestbedController
- Direct Known Subclasses:
TestbedController
This class contains most control logic for the testbed and the update loop.
It also watches the model to switch tests and populates the model with some
loop statistics.
- Author:
- Daniel Murphy
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumstatic enum -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected longprotected longstatic final intprotected longprotected longprotected longprotected longprotected long -
Constructor Summary
ConstructorsConstructorDescriptionAbstractTestbedController(TestbedModel argModel, AbstractTestbedController.UpdateBehavior behavior, AbstractTestbedController.MouseBehavior mouseBehavior, TestbedErrorHandler errorHandler) -
Method Summary
Modifier and TypeMethodDescriptionfloatlongintlongbooleanvoidlastTest()voidload()protected voidloopInit()voidnextTest()voidplayTest(int argIndex) voidqueueKeyPressed(char c, int code) voidqueueKeyReleased(char c, int code) voidvoidqueueMouseDown(Vec2 screenPos, int button) voidqueueMouseDrag(Vec2 screenPos, int button) voidqueueMouseMove(Vec2 screenPos) voidqueueMouseUp(Vec2 screenPos, int button) voidprotected voidrender(TestbedPanel panel) voidreset()voidsave()voidsetFrameRate(int fps) voidstart()voidprotected voidvoidstop()voidvoidupdateExtents(float halfWidth, float halfHeight) voidCalled by the main run loop.
-
Field Details
-
DEFAULT_FPS
public static final int DEFAULT_FPS- See Also:
-
startTime
protected long startTime -
beforeTime
protected long beforeTime -
afterTime
protected long afterTime -
updateTime
protected long updateTime -
timeDiff
protected long timeDiff -
sleepTime
protected long sleepTime -
timeSpent
protected long timeSpent
-
-
Constructor Details
-
AbstractTestbedController
public AbstractTestbedController(TestbedModel argModel, AbstractTestbedController.UpdateBehavior behavior, AbstractTestbedController.MouseBehavior mouseBehavior, TestbedErrorHandler errorHandler)
-
-
Method Details
-
load
public void load() -
save
public void save() -
reset
public void reset() -
queueLaunchBomb
public void queueLaunchBomb() -
queuePause
public void queuePause() -
queueMouseUp
-
queueMouseDown
-
queueMouseMove
-
queueMouseDrag
-
queueKeyPressed
public void queueKeyPressed(char c, int code) -
queueKeyReleased
public void queueKeyReleased(char c, int code) -
updateExtents
public void updateExtents(float halfWidth, float halfHeight) -
loopInit
protected void loopInit() -
updateTest
public void updateTest()Called by the main run loop. If the update behavior is set toAbstractTestbedController.UpdateBehavior.UPDATE_IGNORED, then this needs to be called manually to update the input and test. -
nextTest
public void nextTest() -
lastTest
public void lastTest() -
playTest
public void playTest(int argIndex) -
setFrameRate
public void setFrameRate(int fps) -
getFrameRate
public int getFrameRate() -
getCalculatedFrameRate
public float getCalculatedFrameRate() -
getStartTime
public long getStartTime() -
getFrameCount
public long getFrameCount() -
isAnimating
public boolean isAnimating() -
start
public void start() -
stop
public void stop() -
startAnimator
public void startAnimator() -
stopAnimator
public void stopAnimator() -
stepAndRender
protected void stepAndRender() -
render
-