コード例 #1
0
ファイル: display.c プロジェクト: L-ios/ibus-fbterm
static void draw_lookup_table()
{
	set_im_window(LookupTableWin, lookup_table_win);
	if (!lookup_table_win.w) return;

	draw_margin(lookup_table_win, COLOR_BG);

	unsigned i, x = lookup_table_win.x + MARGIN, y = lookup_table_win.y + MARGIN;
	for (i = 0; ; i++) {
		IBusText *text = ibus_lookup_table_get_candidate(lookup_table, i);
		if (!text) break;

		char buf[8];
		snprintf(buf, sizeof(buf), "%d.", i + 1);
		draw_text(x, y, COLOR_FG, COLOR_BG, buf, strlen(buf));
		x += FW(2);

		draw_text(x, y, i == lookup_table->cursor_pos ? COLOR_ACTIVE_CANDIDATE : COLOR_FG, COLOR_BG, text->text, strlen(text->text));
		x += FW(text_width(text->text));

		char space = ' ';
		draw_text(x, y, COLOR_FG, COLOR_BG, &space, 1);
		x += FW(1);
	}

	unsigned endx = lookup_table_win.x + lookup_table_win.w - MARGIN;
	if (x < endx) {
		Rectangle rect = { x, y, endx - x, FH(1) };
		fill_rect(rect, COLOR_BG);
	}
}
コード例 #2
0
ファイル: trueskill.cpp プロジェクト: JesseBuesking/trueskill
Constants::Constants() {
    double INITIAL_MU = 25.0;
    double INITIAL_SIGMA = INITIAL_MU / 3.0;
    double TOTAL_PLAYERS = 2.0;

    this->BETA = INITIAL_SIGMA / 2.0;
    this->EPSILON = draw_margin(0.1, this->BETA, TOTAL_PLAYERS);
    this->GAMMA = INITIAL_SIGMA / 100.0;
}
コード例 #3
0
ファイル: display.c プロジェクト: L-ios/ibus-fbterm
static void draw_auxiliary_text()
{
	set_im_window(AuxiliaryTextWin, auxiliary_text_win);
	if (!auxiliary_text_win.w) return;

	draw_margin(auxiliary_text_win, COLOR_BG);

	unsigned x = auxiliary_text_win.x + MARGIN, y = auxiliary_text_win.y + MARGIN;
	draw_text(x, y, COLOR_FG, COLOR_BG, auxiliary_text->text, strlen(auxiliary_text->text));
}
コード例 #4
0
ファイル: display.c プロジェクト: L-ios/ibus-fbterm
static void draw_status_bar()
{
	set_im_window(StatusBarWin, status_bar_win);
	if (!status_bar_win.w) return;

	draw_margin(status_bar_win, COLOR_BG);

	unsigned i, x = status_bar_win.x + MARGIN, y = status_bar_win.y + MARGIN;
	for (i = 0; ; i++) {
		IBusProperty *prop = ibus_prop_list_get(property_list, i);
		if (!prop) break;

		draw_text(x, y, COLOR_FG, COLOR_BG, prop->label->text, strlen(prop->label->text));
		x += FW(text_width(prop->label->text));

		char space = ' ';
		draw_text(x, y, COLOR_FG, COLOR_BG, &space, 1);
		x += FW(1);
	}
}