refactor(renderer): Replace 'add' method with 'put' in RendererWorkingSet interface and implementations
This commit is contained in:
@@ -104,8 +104,8 @@ public class G2DRenderer implements Renderer {
|
||||
EventQueue.invokeAndWait(() -> {
|
||||
// this invokeAndWait() call is also important to wait until applyVideoOptions() has been completed, which also puts events to AWT event queue
|
||||
LOGGER.debug("Viewport initialized");
|
||||
this.rendererData.getRendererWorkingSet().add(this.rendererModuleId, this.rendererData.getRenderingBoPool().acquire("G2DRenderer_background", G2DDrawBackground.class));
|
||||
this.rendererData.getRendererWorkingSet().add(this.rendererModuleId, this.rendererData.getRenderingBoPool().acquire("G2DRenderer_tooltip", G2DDrawControlTooltip.class));
|
||||
this.rendererData.getRendererWorkingSet().put(this.rendererModuleId, this.rendererData.getRenderingBoPool().acquire("G2DRenderer_background", G2DDrawBackground.class));
|
||||
this.rendererData.getRendererWorkingSet().put(this.rendererModuleId, this.rendererData.getRenderingBoPool().acquire("G2DRenderer_tooltip", G2DDrawControlTooltip.class));
|
||||
});
|
||||
}
|
||||
catch (InvocationTargetException | InterruptedException e) {
|
||||
@@ -255,14 +255,14 @@ public class G2DRenderer implements Renderer {
|
||||
.setColor(RgbaColor.WHITE)
|
||||
.setLayer(RenderingBoLayer.TOP)
|
||||
.withPositionAbsoluteAnchorTopRight(100, 35);
|
||||
this.rendererData.getRendererWorkingSet().add(this.rendererModuleId, drawFont);
|
||||
this.rendererData.getRendererWorkingSet().put(this.rendererModuleId, drawFont);
|
||||
|
||||
this.fpsHistory.add(Integer.valueOf((int) this.frameDur));
|
||||
final var drawFpsHistory = this.rendererData.getRenderingBoPool().acquire("g2DRenderer_fpsHistory", G2DDrawFpsHistory.class)
|
||||
.setHistory(this.fpsHistory)
|
||||
.setLayer(RenderingBoLayer.TOP)
|
||||
.withPositionAbsoluteAnchorTopRight(100, 50);
|
||||
this.rendererData.getRendererWorkingSet().add(this.rendererModuleId, drawFpsHistory);
|
||||
this.rendererData.getRendererWorkingSet().put(this.rendererModuleId, drawFpsHistory);
|
||||
}
|
||||
|
||||
private void frameCap() throws InterruptedException {
|
||||
|
||||
@@ -8,9 +8,9 @@ import de.extio.game_engine.renderer.model.RenderingBo;
|
||||
|
||||
public interface RendererWorkingSet {
|
||||
|
||||
void add(String producerId, RenderingBo work);
|
||||
void put(String producerId, RenderingBo work);
|
||||
|
||||
void add(String producerId, List<RenderingBo> work);
|
||||
void put(String producerId, List<RenderingBo> work);
|
||||
|
||||
RenderingBo get(String producerId, String id);
|
||||
|
||||
|
||||
@@ -30,14 +30,14 @@ public class RendererWorkingSetImpl implements RendererWorkingSet {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(final String producerId, final RenderingBo work) {
|
||||
public void put(final String producerId, final RenderingBo work) {
|
||||
this.getWorkingSetByProducer(producerId)
|
||||
.next()
|
||||
.put(work.getId(), work);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(final String producerId, final List<RenderingBo> work) {
|
||||
public void put(final String producerId, final List<RenderingBo> work) {
|
||||
final var nextMap = this.getWorkingSetByProducer(producerId).next();
|
||||
for (final RenderingBo bo : work) {
|
||||
nextMap.put(bo.getId(), bo);
|
||||
|
||||
Reference in New Issue
Block a user