Last active
March 8, 2016 12:15
-
-
Save nanonull/b56b3d71779b6c62aa52 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Test | |
public void test_interval_delta_when_world_step_is_bigger_than_system_interval() { | |
IntervalSystem intervalSystem = new IntervalSystem(); | |
World world = new World(new WorldConfiguration() | |
.setSystem(intervalSystem)); | |
float worldTotalTime=0; | |
float intervalSystemTotalIntervalTime=0; | |
for (int i = 0; i < 4; i++) { | |
world.delta = 2f; | |
worldTotalTime+=2f; | |
world.process(); | |
// intervalSystem has 1 second interval | |
// so it will run processing round on each world step | |
intervalSystemTotalIntervalTime +=intervalSystem.getIntervalDelta(); | |
System.out.println(intervalSystem.getIntervalDelta()); | |
} | |
Assert.assertEquals(worldTotalTime, 2 * 4, ACC); | |
Assert.assertEquals(intervalSystemTotalIntervalTime, 2 * 4, ACC); | |
} | |
private static class IntervalSystem extends IntervalEntitySystem { | |
@SuppressWarnings("unchecked") | |
public IntervalSystem() { | |
super(Aspect.all(ComponentX.class), 1); | |
} | |
@Override | |
protected void processSystem() { | |
System.out.println("processSystem"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment