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); }
static int lua_tb_clear( lua_State *L ) { if ( lua_gettop( L ) >= 2) { uint16_t fg = luaL_checkint( L, 1 ); uint16_t bg = luaL_checkint( L, 2 ); tb_set_clear_attributes( fg, bg ); } tb_clear(); return 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(); }
static thing_th *read_expressions(FILE *src, text_buffer *tb) { int inputChar; tb_clear(tb); while(is_whitespace(inputChar=get_character(src))); if(inputChar==EOF || is_closer(inputChar)) return NULL; if(character_is_break_out_token(inputChar)) return read_subcons(breakout_character(inputChar), src, tb); if(is_quotation(inputChar)) return read_string(inputChar, src, tb); if(is_opener(inputChar)) return read_subcons(open_sub_cons(src, tb, inputChar), src, tb); return read_literals(src, tb, inputChar); }
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; }
static void parse_go(char string[]) { const char * ptr; bool infinite, ponder; int depth, mate, movestogo; sint64 nodes; double binc, btime, movetime, winc, wtime; double time, inc; // init infinite = false; ponder = false; depth = -1; mate = -1; movestogo = -1; nodes = -1; binc = -1.0; btime = -1.0; movetime = -1.0; winc = -1.0; wtime = -1.0; // parse ptr = strtok(string," "); // skip "go" for (ptr = strtok(NULL," "); ptr != NULL; ptr = strtok(NULL," ")) { if (false) { } else if (string_equal(ptr,"binc")) { ptr = strtok(NULL," "); if (ptr == NULL) my_fatal("parse_go(): missing argument\n"); binc = double(atoi(ptr)) / 1000.0; ASSERT(binc>=0.0); } else if (string_equal(ptr,"btime")) { ptr = strtok(NULL," "); if (ptr == NULL) my_fatal("parse_go(): missing argument\n"); btime = double(atoi(ptr)) / 1000.0; ASSERT(btime>=0.0); } else if (string_equal(ptr,"depth")) { ptr = strtok(NULL," "); if (ptr == NULL) my_fatal("parse_go(): missing argument\n"); depth = atoi(ptr); ASSERT(depth>=0); } else if (string_equal(ptr,"infinite")) { infinite = true; } else if (string_equal(ptr,"mate")) { ptr = strtok(NULL," "); if (ptr == NULL) my_fatal("parse_go(): missing argument\n"); mate = atoi(ptr); ASSERT(mate>=0); } else if (string_equal(ptr,"movestogo")) { ptr = strtok(NULL," "); if (ptr == NULL) my_fatal("parse_go(): missing argument\n"); movestogo = atoi(ptr); ASSERT(movestogo>=0); } else if (string_equal(ptr,"movetime")) { ptr = strtok(NULL," "); if (ptr == NULL) my_fatal("parse_go(): missing argument\n"); movetime = double(atoi(ptr)) / 1000.0; ASSERT(movetime>=0.0); } else if (string_equal(ptr,"nodes")) { ptr = strtok(NULL," "); if (ptr == NULL) my_fatal("parse_go(): missing argument\n"); nodes = my_atoll(ptr); ASSERT(nodes>=0); } else if (string_equal(ptr,"ponder")) { ponder = true; } else if (string_equal(ptr,"searchmoves")) { // dummy } else if (string_equal(ptr,"winc")) { ptr = strtok(NULL," "); if (ptr == NULL) my_fatal("parse_go(): missing argument\n"); winc = double(atoi(ptr)) / 1000.0; ASSERT(winc>=0.0); } else if (string_equal(ptr,"wtime")) { ptr = strtok(NULL," "); if (ptr == NULL) my_fatal("parse_go(): missing argument\n"); wtime = double(atoi(ptr)) / 1000.0; ASSERT(wtime>=0.0); } } // init search_clear(); tb_clear(); egbb_clear(); eval_init_options(); // depth limit if (depth >= 0) { SearchInput->depth_is_limited = true; SearchInput->depth_limit = depth; } else if (mate >= 0) { SearchInput->depth_is_limited = true; SearchInput->depth_limit = mate * 2 - 1; // HACK: move -> ply } // nodes limit if (nodes > 0) { if (nodes < 1000) nodes = 1000; SearchInput->nodes_is_limited = true; SearchInput->nodes = nodes; } // time limit if (COLOUR_IS_WHITE(SearchInput->board->turn)) { time = wtime; inc = winc; } else { time = btime; inc = binc; } if (movestogo <= 0 || movestogo > 30) movestogo = 30; // HACK if (inc < 0.0) inc = 0.0; if (movetime >= 0.0) { // fixed time SearchInput->time_is_limited = true; SearchInput->time_limit_1 = movetime * 5.0; // HACK to avoid early exit SearchInput->time_limit_2 = movetime; } else if (time >= 0.0) { SearchInput->time_is_limited = true; time_allocation(time,inc,movestogo); } if (infinite || ponder) SearchInput->infinite = true; // search ASSERT(!Searching); ASSERT(!Delay); Searching = true; Infinite = infinite || ponder; Delay = false; search(); search_update_current(); ASSERT(Searching); ASSERT(!Delay); Searching = false; Delay = Infinite; if (!Delay) send_best_move(); }
static void draw() { tb_clear(); tb_change_cell(0, 0, 'A', 0, 1); tb_present(); }
/*! \brief Clears the internal back buffer. Use present() to flush cleared buffer. */ void clearScreen(){ Q_ASSERT_X(QTermboxCorePrivate::wasInitialized(), "clearScreen", "Termbox was not initialized."); tb_clear(); }