use of com.googlecode.lanterna.TerminalSize in project narchy by automenta.
the class TextUI method session.
public DefaultVirtualTerminal session(float fps) {
DefaultVirtualTerminal vt = new DefaultVirtualTerminal(new TerminalSize(80, 25));
TextGUI session = new TextGUI(nar, vt, fps);
sessions.add(session);
return vt;
}
use of com.googlecode.lanterna.TerminalSize in project narchy by automenta.
the class ConsoleGUI method resize.
@Override
public void resize(int cols, int rows) {
cols = Math.min(cols, MAX_COLS);
rows = Math.min(rows, MAX_ROWS);
super.resize(cols, rows);
if (screen != null) {
screen.doResizeIfNecessary();
if (gui != null) {
Window win = gui.getActiveWindow();
if (win != null) {
win.setSize(new TerminalSize(cols, rows));
}
}
}
}
use of com.googlecode.lanterna.TerminalSize in project narchy by automenta.
the class ConsoleGUI method start.
@Override
public void start(@Nullable SurfaceBase parent) {
synchronized (this) {
super.start(parent);
// thr.start();
try {
screen = new TerminalScreen(term);
screen.startScreen();
gui = new MultiWindowTextGUI(MyStupidGUIThread::new, screen);
// TODO try to avoid wrapping it in Window
window = new BasicWindow();
window.setPosition(new TerminalPosition(0, 0));
TerminalSize size = term.getTerminalSize();
window.setSize(new TerminalSize(size.getColumns(), size.getRows()));
window.setHints(List.of(Window.Hint.FULL_SCREEN, Window.Hint.NO_DECORATIONS));
window.setTheme(DARK);
window.setEnableDirectionBasedMovements(true);
gui.addWindow(window);
gui.setActiveWindow(window);
gui.setEOFWhenNoWindows(true);
init(window);
TextGUIThread guiThread = gui.getGUIThread();
updates = root().onUpdate((s) -> {
try {
guiThread.processEventsAndUpdate();
} catch (IOException e) {
e.printStackTrace();
}
});
} catch (IOException e) {
e.printStackTrace();
}
}
}
use of com.googlecode.lanterna.TerminalSize in project narchy by automenta.
the class ConsoleTerminal method resize.
public void resize(int cols, int rows) {
term.setTerminalSize(new TerminalSize(cols, rows));
text.resize(cols, rows);
layout();
}
Aggregations