Luna/terminal/main.cpp
apio 5892a6bf09
All checks were successful
continuous-integration/drone/push Build is passing
libos+libui: Add event loops
2023-10-06 22:06:34 +02:00

33 lines
684 B
C++

#include "TerminalWidget.h"
#include <os/ArgumentParser.h>
#include <ui/App.h>
#include <unistd.h>
Result<int> luna_main(int argc, char** argv)
{
ui::App app;
TRY(app.init(argc, argv));
auto* window = TRY(ui::Window::create(ui::Rect { 150, 150, 640, 400 }));
app.set_main_window(window);
window->set_title("Terminal");
TerminalWidget terminal;
window->set_main_widget(terminal);
char* args[] = { "/bin/sh", nullptr };
TRY(terminal.init(args));
window->draw();
while (app.process_events())
{
bool should_sleep = TRY(terminal.process());
if (should_sleep) usleep(10000);
}
terminal.quit();
return 0;
}