Package org.jbox2d.testbed.framework
Class TestbedController
- java.lang.Object
-
- org.jbox2d.testbed.framework.TestbedController
-
- All Implemented Interfaces:
java.lang.Runnable
public class TestbedController extends java.lang.Object implements java.lang.RunnableThis 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.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classTestbedController.UpdateBehavior
-
Field Summary
Fields Modifier and Type Field Description private booleananimatingprivate java.lang.Threadanimatorprivate TestbedTestcurrTeststatic intDEFAULT_FPSprivate longframeCountprivate floatframeRateprivate static org.slf4j.Loggerlogprivate TestbedModelmodelprivate TestbedTestnextTestprivate TestbedPanelpanelprivate longstartTimeprivate inttargetFrameRateprivate TestbedController.UpdateBehaviorupdateBehavior
-
Constructor Summary
Constructors Constructor Description TestbedController(TestbedModel argModel, TestbedPanel argPanel, TestbedController.UpdateBehavior behavior)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidaddListeners()floatgetCalculatedFrameRate()longgetFrameCount()intgetFrameRate()longgetStartTime()booleanisAnimating()voidlastTest()voidloadTest()protected voidloopInit()voidnextTest()voidplayTest(int argIndex)voidresetTest()voidrun()voidsaveTest()voidsetFrameRate(int fps)voidstart()voidstop()protected voidupdate()
-
-
-
Field Detail
-
log
private static final org.slf4j.Logger log
-
DEFAULT_FPS
public static final int DEFAULT_FPS
- See Also:
- Constant Field Values
-
currTest
private TestbedTest currTest
-
nextTest
private TestbedTest nextTest
-
startTime
private long startTime
-
frameCount
private long frameCount
-
targetFrameRate
private int targetFrameRate
-
frameRate
private float frameRate
-
animating
private boolean animating
-
animator
private java.lang.Thread animator
-
model
private final TestbedModel model
-
panel
private final TestbedPanel panel
-
updateBehavior
private TestbedController.UpdateBehavior updateBehavior
-
-
Constructor Detail
-
TestbedController
public TestbedController(TestbedModel argModel, TestbedPanel argPanel, TestbedController.UpdateBehavior behavior)
-
-
Method Detail
-
addListeners
private void addListeners()
-
loopInit
protected void loopInit()
-
update
protected void update()
-
nextTest
public void nextTest()
-
resetTest
public void resetTest()
-
saveTest
public void saveTest()
-
loadTest
public void loadTest()
-
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()
-
run
public void run()
- Specified by:
runin interfacejava.lang.Runnable
-
-