12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- package me.hammerle.supersnuvi.rendering;
- import java.util.LinkedList;
- public class TileUpdater
- {
- private static class Update
- {
- private final int l;
- private final int x;
- private final int y;
-
- public Update(int l, int x, int y)
- {
- this.l = l;
- this.x = x;
- this.y = y;
- }
- }
-
- private final LinkedList<Update> updates = new LinkedList<>();
- private boolean updateAll = false;
- public void add(int layer, int x, int y)
- {
- updates.add(new Update(layer, x, y));
- }
-
- public void forEach(UpdateConsumer uc)
- {
- updates.forEach((up) -> uc.accept(up.l, up.x, up.y));
- }
-
- public void updateAll()
- {
- updateAll = true;
- }
-
- public boolean shouldUpdateAll()
- {
- return updateAll;
- }
-
- public void clear()
- {
- updates.clear();
- updateAll = false;
- }
- }
|