use of spacegraph.space2d.SurfaceBase in project narchy by automenta.
the class AWTSurface method start.
@Override
public void start(@Nullable SurfaceBase parent) {
synchronized (this) {
super.start(parent);
AtomicBoolean busy = new AtomicBoolean(false);
ons = root().onUpdate(w -> {
if (!busy.compareAndSet(false, true))
return;
// if (component.getIgnoreRepaint() && !component.is)
SwingUtilities.invokeLater(() -> {
try {
buffer = AWTCamera.get(component, buffer);
tex.update(buffer);
} finally {
busy.set(false);
}
});
});
}
}
use of spacegraph.space2d.SurfaceBase 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();
}
}
}
Aggregations