use tui;
use tui::layout;
use tui::widget;
use tui::widget::text;
use io;
use fmt;
use time;

export fn main() void = {
	const state = tui::init()!;
	defer tui::finish(&state);
	let txt = text::newtext(&state, "hello world", (50, 20), &text::DEFAULTSTYLE);
	let l = layout::newvlayout(&txt);
	l.layout.print(&l);

	//tui::clear(&state);

	time::sleep(1 * time::SECOND);
	let st = txt.style;
	st.normal = widget::color::GREENFG;
	text::settext(&txt, "bye world");
	l.layout.print(&l);

	//tui::clear(&state);

	time::sleep(1 * time::SECOND);
	st.normal = widget::color::BROWNFG;
	l.layout.print(&l);

	//tui::clear(&state);

	time::sleep(1 * time::SECOND);
	st.normal = widget::color::BLUEFG;
	l.layout.print(&l);

	//tui::clear(&state);

	time::sleep(1 * time::SECOND);
	st.normal = widget::color::MAGENTAFG;
	l.layout.print(&l);

	//tui::clear(&state);

	time::sleep(1 * time::SECOND);
	st.normal = widget::color::CYANFG;
	l.layout.print(&l);

	//tui::clear(&state);

	time::sleep(1 * time::SECOND);
	st.normal = widget::color::WHITEFG;
	l.layout.print(&l);

	//tui::clear(&state);

	time::sleep(1 * time::SECOND);
	st.normal = widget::color::DEFAULTFG;
	l.layout.print(&l);
};
