use fmt; use tb = termbox2; export fn main() void = { let e = tb::init(); if (e is tb::err) fmt::fatalf(tb::strerror(e as tb::err)); defer tb::shutdown()!; let w = tb::width()!; let h = tb::height()!; tb::print(0, 0, tb::COLOR.GREEN, tb::COLOR.BLACK, "Terminal width: {}", w)!; tb::print(0, 1, tb::COLOR.GREEN, tb::COLOR.BLACK, "Terminal height: {}", h)!; tb::print(0, 2, tb::COLOR.WHITE, tb::COLOR.BLACK, "Press any key to exit")!; for (true) { let e = tb::present(); if (e is tb::err) fmt::fatalf(tb::strerror(e as tb::err)); match (tb::poll_event()) { case let e: tb::err => { if (e == tb::ERR.NO_EVENT) continue else tb::print(0, 4, tb::COLOR.WHITE, tb::COLOR.BLACK, "Unexpected error {}!", tb::strerror(e))!; }; case tb::key_event => break; case (tb::mouse_event | tb::resize_event) => continue; }; }; return; };