Exemplo n.º 1
0
 /*
  * The ctor calls the init function to initialize the termbox library, which
  * returns
  * -1 if unsupported terminal,
  * -2 if failed to open tty,
  * -3 unix pipe error.
  */
 Window::Window() {
     // TODO: ignored ret code for now
     int ret = tb_init();
     // input = {};
     // tb_clear();
     tb_select_output_mode(TB_OUTPUT_NORMAL);
     tb_present();
 }
Exemplo n.º 2
0
Arquivo: ui.c Projeto: thmzlt/tic
void ui_draw(state_t *state) {
    tb_clear();

    ui_draw_input_line(state->input);
    ui_draw_status_line();
    ui_draw_output(&state->log);

    tb_present();
    usleep(50000);
}
Exemplo n.º 3
0
void updateAndRedrawAll(int mx, int my) {
	tb_clear();
	if (mx != -1 && my != -1) {
		backbuf[bbw*my+mx].ch = runes[curRune];
		backbuf[bbw*my+mx].fg = colors[curCol];
	}
	memcpy(tb_cell_buffer(), backbuf, sizeof(struct tb_cell)*bbw*bbh);
	int h = tb_height();
	updateAndDrawButtons(&curRune, 0, 0, mx, my, len(runes), runeAttrFunc);
	updateAndDrawButtons(&curCol, 0, h-3, mx, my, len(colors), colorAttrFunc);
	tb_present();
}
Exemplo n.º 4
0
 /*
  * Starting from (x,y) we print the string character by character.
  */
 void Window::print(int x, int y, const std::string& s, uint16_t fg,
                    uint16_t bg) {
     // We work with the underlying C string
     auto str = s.c_str();
     for(int i = 0; i < s.size(); ++i) {
         uint32_t uni;
         tb_utf8_char_to_unicode(&uni, &str[i]);
         tb_change_cell(x, y, uni, fg, bg);
         ++x;
     }
     tb_present();
 }
Exemplo n.º 5
0
int main(int argc, char const *argv[])
{
    tb_init();
    Player player;

    while (1) {
        g_input.update();

        if (g_input.getKey() == KeyEsc) {
            tb_shutdown();
            return 0;
        }

        player.update();

        tb_clear();
        player.render();
        tb_present();
    }

    tb_shutdown();
    return 0;
}
Exemplo n.º 6
0
	/**
	 * Render widgets to the screen.
	 */
	inline
	void render() {
		if (root) root->render();
		tb_present();
	}
Exemplo n.º 7
0
 void Window::print(int x, int y, char c, uint16_t fg, uint16_t bg) {
     uint32_t uni;
     tb_utf8_char_to_unicode(&uni, &c);
     tb_change_cell(x, y, uni, fg, bg);
     tb_present();
 }
Exemplo n.º 8
0
static int lua_tb_present( lua_State *L ) {
	tb_present();

	return 0;
}
Exemplo n.º 9
0
static void draw() {
    tb_clear();
    tb_change_cell(0, 0, 'A', 0, 1);
    tb_present();
}
Exemplo n.º 10
0
/*!
	\brief Synchronizes the internal back buffer with the terminal.
	*/
void present(){
	Q_ASSERT_X(QTermboxCorePrivate::wasInitialized(), "present", "Termbox was not initialized.");
	tb_present();
}