所以,我在Java中创建了一个二维数组映射,并且它编写了整个映射。这显然是非常滞后的
public static final int WIDTH = 1000;
public static final int HEIGHT = 1000;
public static String[][] map = new String[HEIGHT][WIDTH];
如何阻止它将所有内容写入终端,而是将其打印出来以进行优化? 这是我的其余代码:
static int x = 0, y = 5;
public static void main(String[] args) {
myScreen = new MyScreen(TerminalFacade.createTerminal());
myScreen.startScreen();
myScreen.drawText("Dungeon Tredge", 0, 0, Color.RED);
myScreen.drawText("(C) 3 on a Java course", 0, 1, Color.YELLOW);
myScreen.drawText("TO DO: displayMap, addTree, addRock, addRoom", 0, 2,
Color.YELLOW);
myScreen.displayMap(0, y);
myScreen.refresh();
while (true) {
Key key = myScreen.readInput();
if (key != null)
handleInput(key.getCharacter());
if (myScreen.resizePending()) {
myScreen.displayMap(0, y);
myScreen.refresh();
}