|
|
@ -2,9 +2,13 @@ package mightypork.rogue.screens.game; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import java.util.Collection; |
|
|
|
import java.util.Collection; |
|
|
|
|
|
|
|
import java.util.ConcurrentModificationException; |
|
|
|
|
|
|
|
import java.util.LinkedList; |
|
|
|
|
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
|
|
|
|
import mightypork.gamecore.gui.AlignX; |
|
|
|
import mightypork.gamecore.gui.AlignX; |
|
|
|
import mightypork.gamecore.gui.components.BaseComponent; |
|
|
|
import mightypork.gamecore.gui.components.BaseComponent; |
|
|
|
|
|
|
|
import mightypork.gamecore.logging.Log; |
|
|
|
import mightypork.gamecore.resources.fonts.FontRenderer; |
|
|
|
import mightypork.gamecore.resources.fonts.FontRenderer; |
|
|
|
import mightypork.gamecore.util.math.color.Color; |
|
|
|
import mightypork.gamecore.util.math.color.Color; |
|
|
|
import mightypork.gamecore.util.math.color.pal.RGB; |
|
|
|
import mightypork.gamecore.util.math.color.pal.RGB; |
|
|
@ -23,7 +27,8 @@ public class WorldConsoleRenderer extends BaseComponent { |
|
|
|
private final FontRenderer fr; |
|
|
|
private final FontRenderer fr; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public WorldConsoleRenderer(Num rowHeight) { |
|
|
|
public WorldConsoleRenderer(Num rowHeight) |
|
|
|
|
|
|
|
{ |
|
|
|
this.rowHeight = rowHeight; |
|
|
|
this.rowHeight = rowHeight; |
|
|
|
this.fr = new FontRenderer(Res.getFont("tiny")); |
|
|
|
this.fr = new FontRenderer(Res.getFont("tiny")); |
|
|
|
} |
|
|
|
} |
|
|
@ -36,23 +41,30 @@ public class WorldConsoleRenderer extends BaseComponent { |
|
|
|
|
|
|
|
|
|
|
|
Rect lowRow = bottomEdge().growUp(rowHeight); |
|
|
|
Rect lowRow = bottomEdge().growUp(rowHeight); |
|
|
|
|
|
|
|
|
|
|
|
Collection<Entry> entries = WorldProvider.get().getWorld().getConsole().getEntries(); |
|
|
|
Collection<WorldConsole.Entry> entries = WorldProvider.get().getWorld().getConsole().getEntries(); |
|
|
|
|
|
|
|
|
|
|
|
int cnt = 0; |
|
|
|
int cnt = 0; |
|
|
|
|
|
|
|
|
|
|
|
NumVar alph = Num.makeVar(); |
|
|
|
NumVar alph = Num.makeVar(); |
|
|
|
|
|
|
|
|
|
|
|
Color.pushAlpha(alph); |
|
|
|
Color.pushAlpha(alph); |
|
|
|
|
|
|
|
|
|
|
|
for (WorldConsole.Entry entry : entries) { |
|
|
|
try { |
|
|
|
|
|
|
|
|
|
|
|
alph.setTo(entry.getAlpha()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Rect rrr = lowRow.moveY(-rh * cnt); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fr.draw(entry.getMessage(), rrr.move(rh / 12, rh / 12), AlignX.LEFT, RGB.BLACK_60); |
|
|
|
for (WorldConsole.Entry entry : entries) { |
|
|
|
fr.draw(entry.getMessage(), rrr, AlignX.LEFT, RGB.WHITE); |
|
|
|
|
|
|
|
|
|
|
|
alph.setTo(entry.getAlpha()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Rect rrr = lowRow.moveY(-rh * cnt); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fr.draw(entry.getMessage(), rrr.move(rh / 12, rh / 12), AlignX.LEFT, RGB.BLACK_60); |
|
|
|
|
|
|
|
fr.draw(entry.getMessage(), rrr, AlignX.LEFT, RGB.WHITE); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cnt++; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
cnt++; |
|
|
|
} catch (ConcurrentModificationException e) { |
|
|
|
|
|
|
|
Log.e(e); // this should not happen anymore
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Color.popAlpha(); |
|
|
|
Color.popAlpha(); |
|
|
|