Search in sources :

Example 1 with ReverseListIterator

use of org.apache.commons.collections.iterators.ReverseListIterator in project ultimate-java by pantinor.

the class CodexLogDisplay method render.

public void render(Batch batch) {
    batch.draw(logbkgrnd, 200, 500);
    int h = 20;
    float y = 500 + 10;
    synchronized (logs) {
        ReverseListIterator iter = new ReverseListIterator(logs);
        while (iter.hasNext()) {
            String next = (String) iter.next();
            GlyphLayout layout = new GlyphLayout(font, next, Color.WHITE, width - 20, Align.left, true);
            y = y + layout.height + 4;
            h += layout.height + 4;
            if (h > height + 20) {
                break;
            }
            font.draw(batch, layout, 220, y);
        }
    }
}
Also used : GlyphLayout(com.badlogic.gdx.graphics.g2d.GlyphLayout) ReverseListIterator(org.apache.commons.collections.iterators.ReverseListIterator)

Example 2 with ReverseListIterator

use of org.apache.commons.collections.iterators.ReverseListIterator in project ultimate-java by pantinor.

the class LogDisplay method render.

public void render(Batch batch, Party party) {
    int food = party.getSaveGame().food / 100;
    font.setColor(food < 5 ? Color.RED : Color.WHITE);
    font.draw(batch, "Food  " + food, LOG_X + 8, 438);
    font.setColor(Color.WHITE);
    if (party.getContext().getTransportContext() == TransportContext.SHIP) {
        font.draw(batch, "Hull  " + party.getSaveGame().shiphull, LOG_X + 8 + 120, 438);
    } else {
        font.draw(batch, "Gold  " + party.getSaveGame().gold, LOG_X + 8 + 140, 438);
    }
    float y = Ultima4.SCREEN_HEIGHT - 48;
    for (int i = 0; i < party.getMembers().size(); i++) {
        PartyMember pm = party.getMember(i);
        String s = (i + 1) + " - " + pm.getPlayer().name;
        String d = pm.getPlayer().hp + "" + pm.getPlayer().status.getValue();
        font.setColor(i == party.getActivePlayer() ? new Color(.35f, .93f, 0.91f, 1) : Color.WHITE);
        if (pm.getPlayer().status == StatusType.POISONED) {
            font.setColor(Color.GREEN);
        }
        if (pm.getPlayer().status == StatusType.SLEEPING) {
            font.setColor(Color.YELLOW);
        }
        if (pm.getPlayer().status == StatusType.DEAD) {
            font.setColor(Color.GRAY);
        }
        font.draw(batch, s, LOG_X + 8, y);
        font.draw(batch, d, LOG_X + 8 + 110, y);
        y = y - 24;
    }
    font.setColor(Color.WHITE);
    y = 32;
    synchronized (logs) {
        ReverseListIterator iter = new ReverseListIterator(logs);
        while (iter.hasNext()) {
            String next = (String) iter.next();
            GlyphLayout layout = new GlyphLayout(font, next, Color.WHITE, LOG_AREA_WIDTH - 8, Align.left, true);
            y += layout.height + 10;
            if (y > LOG_AREA_TOP) {
                break;
            }
            font.draw(batch, layout, LOG_X + 8, y);
        }
    }
}
Also used : PartyMember(objects.Party.PartyMember) Color(com.badlogic.gdx.graphics.Color) GlyphLayout(com.badlogic.gdx.graphics.g2d.GlyphLayout) ReverseListIterator(org.apache.commons.collections.iterators.ReverseListIterator)

Aggregations

GlyphLayout (com.badlogic.gdx.graphics.g2d.GlyphLayout)2 ReverseListIterator (org.apache.commons.collections.iterators.ReverseListIterator)2 Color (com.badlogic.gdx.graphics.Color)1 PartyMember (objects.Party.PartyMember)1