Skip to content

Commit

Permalink
Merge pull request #190 from brentdewe/intervalsystem
Browse files Browse the repository at this point in the history
Expose the interval in IntervalSystem
  • Loading branch information
dsaltares committed Nov 15, 2015
2 parents b4647a8 + 0fc1a06 commit 5277cbe
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
10 changes: 7 additions & 3 deletions ashley/src/com/badlogic/ashley/systems/IntervalSystem.java
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
/*******************************************************************************
* Copyright 2014 See AUTHORS file.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Expand Down Expand Up @@ -44,6 +44,10 @@ public IntervalSystem (float interval, int priority) {
this.accumulator = 0;
}

public float getInterval() {
return interval;
}

@Override
public final void update (float deltaTime) {
accumulator += deltaTime;
Expand Down
12 changes: 9 additions & 3 deletions ashley/tests/com/badlogic/ashley/systems/IntervalSystemTest.java
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
/*******************************************************************************
* Copyright 2014 See AUTHORS file.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Expand Down Expand Up @@ -50,4 +50,10 @@ public void intervalSystem () {
assertEquals(i / 2, intervalSystemSpy.numUpdates);
}
}

@Test
public void testGetInterval () {
IntervalSystemSpy intervalSystemSpy = new IntervalSystemSpy();
assertEquals(intervalSystemSpy.getInterval(), deltaTime * 2.0f, 0);
}
}

0 comments on commit 5277cbe

Please sign in to comment.