Search in sources :

Example 1 with TerminalPosition

use of com.googlecode.lanterna.TerminalPosition 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();
        }
    }
}
Also used : TerminalScreen(com.googlecode.lanterna.screen.TerminalScreen) TerminalSize(com.googlecode.lanterna.TerminalSize) DefaultVirtualTerminal(com.googlecode.lanterna.terminal.virtual.DefaultVirtualTerminal) com.googlecode.lanterna.gui2(com.googlecode.lanterna.gui2) IOException(java.io.IOException) TextColor(com.googlecode.lanterna.TextColor) EOFException(java.io.EOFException) Nullable(org.jetbrains.annotations.Nullable) TerminalScreen(com.googlecode.lanterna.screen.TerminalScreen) List(java.util.List) SurfaceBase(spacegraph.space2d.SurfaceBase) SimpleTheme(com.googlecode.lanterna.graphics.SimpleTheme) On(jcog.event.On) TerminalPosition(com.googlecode.lanterna.TerminalPosition) Theme(com.googlecode.lanterna.graphics.Theme) TerminalPosition(com.googlecode.lanterna.TerminalPosition) TerminalSize(com.googlecode.lanterna.TerminalSize) IOException(java.io.IOException)

Aggregations

TerminalPosition (com.googlecode.lanterna.TerminalPosition)1 TerminalSize (com.googlecode.lanterna.TerminalSize)1 TextColor (com.googlecode.lanterna.TextColor)1 SimpleTheme (com.googlecode.lanterna.graphics.SimpleTheme)1 Theme (com.googlecode.lanterna.graphics.Theme)1 com.googlecode.lanterna.gui2 (com.googlecode.lanterna.gui2)1 TerminalScreen (com.googlecode.lanterna.screen.TerminalScreen)1 DefaultVirtualTerminal (com.googlecode.lanterna.terminal.virtual.DefaultVirtualTerminal)1 EOFException (java.io.EOFException)1 IOException (java.io.IOException)1 List (java.util.List)1 On (jcog.event.On)1 Nullable (org.jetbrains.annotations.Nullable)1 SurfaceBase (spacegraph.space2d.SurfaceBase)1