/** * Show some text centred at the given position in the world. The text will be displayed in front * of any actors. Any previous text shown at the same location will first be removed. * * @param text The text to display; can be null to show no text * @param x X-coordinate of the text * @param y Y-coordinate of the text */ public void showText(String text, int x, int y) { for (Iterator<TextLabel> i = textLabels.iterator(); i.hasNext(); ) { TextLabel label = i.next(); if (label.getX() == x && label.getY() == y) { if (label.getText().equals(text)) { // Already have that text at that location return; } // Have different text at that location i.remove(); break; } } if (text != null && text.length() != 0) { textLabels.add(new TextLabel(text, x, y)); } }