|
20 | 20 | * <p> |
21 | 21 | * The GraphicEntityModule takes care of displaying and animating graphical entities on the replay of the game. |
22 | 22 | * </p> |
23 | | - * Use it by creating shapes, sprites, texts etc, then commiting their states to a certain moment of the frame. By default, the states are commited |
| 23 | + * Use it by creating shapes, sprites, texts etc, then committing their states to a certain moment of the frame. By default, the states are commited |
24 | 24 | * automatically at the end of the frame. |
25 | 25 | */ |
26 | 26 | @Singleton |
27 | 27 | public class GraphicEntityModule implements Module { |
28 | 28 |
|
29 | | - //TODO: extra properties for Texts (text wrapping, alignement, ...) |
| 29 | + //TODO: extra properties for Texts (text wrapping, alignment, ...) |
30 | 30 |
|
31 | 31 | static int ENTITY_COUNT = 0; |
32 | 32 |
|
@@ -103,8 +103,16 @@ public SpriteSheetSplitter createSpriteSheetSplitter() { |
103 | 103 | } |
104 | 104 |
|
105 | 105 | /** |
106 | | - * Every entity's graphical counterpart, at instant t of the frame being computed, will have the same properties as the java object as they are |
107 | | - * now. |
| 106 | + * <p> |
| 107 | + * Creates a commit for each entity that has had some of its properties modified since a previous commit or the previous frame. |
| 108 | + * </p> |
| 109 | + * <p> |
| 110 | + * This means that each one of those entities' graphical counterparts, at instant t of the frame being computed, will have the same properties as |
| 111 | + * the java object as they are now. |
| 112 | + * </p> |
| 113 | + * <p> |
| 114 | + * To force an entity to keep its current state instead of interpolating to the values of next frame, use <code>commitEntityState</code> instead. |
| 115 | + * </p> |
108 | 116 | * <p> |
109 | 117 | * Only the most recent commits are kept for a given t. |
110 | 118 | * </p> |
@@ -188,13 +196,9 @@ private void sendFrameData() { |
188 | 196 | .map(Entry::getValue) |
189 | 197 | .collect(Collectors.toList()); |
190 | 198 |
|
191 | | - List<String> worldCommitsBuilder = new ArrayList<>(); |
192 | 199 | List<WorldState> updateBuilder = new ArrayList<>(); |
193 | 200 |
|
194 | 201 | for (WorldState nextWorldState : orderedStates) { |
195 | | - if (nextWorldState.isWorldCommit()) { |
196 | | - worldCommitsBuilder.add(nextWorldState.getFrameTime()); |
197 | | - } |
198 | 202 | WorldState worldStateDiff = nextWorldState.diffFromOtherWorldState(currentWorldState); |
199 | 203 | updateBuilder.add(worldStateDiff); |
200 | 204 | currentWorldState.updateAllEntities(nextWorldState); |
|
0 commit comments