• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ c_prt函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中c_prt函数的典型用法代码示例。如果您正苦于以下问题:C++ c_prt函数的具体用法?C++ c_prt怎么用?C++ c_prt使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了c_prt函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: mon_summary

static void mon_summary(int gid, const int *object_list, int n, int top,
						int row, int col)
{
	int i;
	int kills = 0;

	/* Access the race */
	for (i = 0; i < n; i++) {
		int oid = default_join[object_list[i + top]].oid;
		kills += l_list[oid].pkills;
	}

	/* Different display for the first item if we've got uniques to show */
	if (gid == 0
		&& (rf_has((&r_info[default_join[object_list[0]].oid])->flags,
				   RF_UNIQUE))) {
		c_prt(TERM_L_BLUE, format("%d known uniques, %d slain.", n, kills),
			  row, col);
	} else {
		int tkills = 0;

		for (i = 0; i < z_info->r_max; i++)
			tkills += l_list[i].pkills;

		c_prt(TERM_L_BLUE,
			  format("Creatures slain: %d/%d (in group/in total)", kills,
					 tkills), row, col);
	}
}
开发者ID:NickMcConnell,项目名称:FAangband,代码行数:29,代码来源:ui-knowledge.c


示例2: print_abilities

/*
 * Draw the abilities list
 */
void print_abilities(s32b table[], s32b max, s32b sel, s32b start)
{
	s32b i, j;
	s32b wid, hgt;
	cptr keys;

	Term_clear();
	Term_get_size(&wid, &hgt);

	c_prt(TERM_WHITE, format("%s Abilities Screen", game_module), 0, 28);
	keys = format("#Bup#W/#Bdown#W to move, #Bright#W to buy, #B?#W for help");
	display_message(0, 1, strlen(keys), TERM_WHITE, keys);
	c_prt((p_ptr->skill_points) ? TERM_L_BLUE : TERM_L_RED,
	      format("Skill points left: %d", p_ptr->skill_points), 2, 0);

	print_desc_aux(ab_info[table[sel]].desc, 3, 0);

	for (j = start; j < start + (hgt - 7); j++)
	{
		byte color = TERM_WHITE;
		char deb = ' ', end = ' ';

		if (j >= max) break;

		i = table[j];

		if (ab_info[i].acquired)
			color = TERM_L_BLUE;
		else if (can_learn_ability(i))
			color = TERM_WHITE;
		else
			color = TERM_L_DARK;


		if (j == sel)
		{
			color = TERM_L_GREEN;
			deb = '[';
			end = ']';
		}

		c_prt(color, format("%c.%c%s", deb, end, ab_info[i].name),
		      j + 7 - start, 0);

		if (!ab_info[i].acquired)
		{
			c_prt(color, format("%d", ab_info[i].cost), j + 7 - start, 60);
		}
		else
		{
			c_prt(color, "Known", j + 7 - start, 60);
		}
	}
}
开发者ID:jcubic,项目名称:ToME,代码行数:57,代码来源:skills.c


示例3: display_monster

/*
 * Display a monster
 */
static void display_monster(int col, int row, bool cursor, int oid)
{
    /* HACK Get the race index. (Should be a wrapper function) */
    int r_idx = default_join[oid].oid;

    /* Access the race */
    monster_race *r_ptr = &r_info[r_idx];
    monster_lore *l_ptr = &l_list[r_idx];

    /* Choose colors */
    byte attr = curs_attrs[CURS_KNOWN][(int) cursor];
    byte a = r_ptr->x_attr;
    byte c = r_ptr->x_char;

    /* Display the name */
    c_prt(attr, r_ptr->name, row, col);

    if ((tile_width > 1) || (tile_height > 1))
	return;

    /* Display symbol */
    big_pad(66, row, a, c);

    /* Display kills */
    if (rf_has(r_ptr->flags, RF_UNIQUE))
	put_str(format("%s", (r_ptr->max_num == 0) ? " dead" : "alive"), row,
		70);
    else
	put_str(format("%5d", l_ptr->pkills), row, 70);
}
开发者ID:artes-liberales,项目名称:FAangband,代码行数:33,代码来源:ui-knowledge.c


示例4: display_feature

/*
 * Display the features in a group.
 */
static void display_feature(int col, int row, bool cursor, int oid)
{
	/* Get the feature index */
	int f_idx = oid;

	/* Access the feature */
	feature_type *f_ptr = &f_info[f_idx];

	/* Choose a color */
	byte attr = curs_attrs[CURS_KNOWN][(int) cursor];

	/* Display the name */
	c_prt(attr, f_ptr->name, row, col);

	if (tile_height == 1) {
		/* Display symbols */
		col = 65;
		col += big_pad(col, row, f_ptr->x_attr[FEAT_LIGHTING_DARK],
					   f_ptr->x_char[FEAT_LIGHTING_DARK]);
		col += big_pad(col, row, f_ptr->x_attr[FEAT_LIGHTING_LIT],
					   f_ptr->x_char[FEAT_LIGHTING_LIT]);
		col += big_pad(col, row, f_ptr->x_attr[FEAT_LIGHTING_TORCH],
				f_ptr->x_char[FEAT_LIGHTING_TORCH]);
		col += big_pad(col, row, f_ptr->x_attr[FEAT_LIGHTING_LOS],
				f_ptr->x_char[FEAT_LIGHTING_LOS]);
	}

}
开发者ID:NickMcConnell,项目名称:FAangband,代码行数:31,代码来源:ui-knowledge.c


示例5: textui_textblock_place

void textui_textblock_place(textblock *tb, region orig_area, const char *header)
{
	const char *text = textblock_text(tb);
	const byte *attrs = textblock_attrs(tb);

	/* xxx on resize this should be recalculated */
	region area = region_calculate(orig_area);

	size_t *line_starts = NULL, *line_lengths = NULL;
	size_t n_lines;

	n_lines = textblock_calculate_lines(tb,
			&line_starts, &line_lengths, area.width);

	area.page_rows--;

	if (n_lines > (size_t) area.page_rows)
		n_lines = area.page_rows;

	c_prt(TERM_L_BLUE, header, area.row, area.col);
	area.row++;

	display_area(text, attrs, line_starts, line_lengths, n_lines, area, 0);

	mem_free(line_starts);
	mem_free(line_lengths);
}
开发者ID:BlackDragonB,项目名称:angband,代码行数:27,代码来源:ui.c


示例6: wiz_create_item_display

static void wiz_create_item_display(menu_type *m, int oid, bool cursor,
		int row, int col, int width)
{
	char buf[80];
	object_base_name(buf, sizeof buf, oid, TRUE);
	c_prt(curs_attrs[CURS_KNOWN][0 != cursor], buf, row, col);
}
开发者ID:mtadd,项目名称:angband,代码行数:7,代码来源:wizard.c


示例7: spoil_spells_by_realm

static void spoil_spells_by_realm(void)
{
    int i, row, col, realm_idx;
    while (1)
    {
        Term_clear();

        prt("Realm Spoilers", 2, 0);

        /* Realms */
        row = 4;
        col = 2;
        c_prt(TERM_RED, "Realms", row++, col - 2);

        for (realm_idx = REALM_LIFE; realm_idx <= MAX_MAGIC; realm_idx++)
        {
            prt(format("(%c) %s", 'a' + realm_idx - 1, realm_names[realm_idx]), row++, col);
        }

        i = inkey();
        if (i == ESCAPE) break;
        realm_idx = i - 'a' + 1;

        if (REALM_LIFE <= realm_idx && realm_idx <= MAX_MAGIC)
            _spoil_spells_by_realm_aux1(realm_idx);
     }
}
开发者ID:Alkalinear,项目名称:poschengband,代码行数:27,代码来源:wizard1.c


示例8: _spoil_spells_by_realm_aux2

static void _spoil_spells_by_realm_aux2(int realm_idx, int class1_idx)
{
    int i, row, col, class_idx, choice;
    vec_ptr vec = vec_alloc(NULL);

    for (class_idx = 0; class_idx < MAX_CLASS; class_idx++)
    {
        if (_check_realm(class_idx, realm_idx))
            vec_add_int(vec, class_idx);
    }

    vec_sort(vec, (vec_cmp_f)_cmp_class_name);

    while (1)
    {
        Term_clear();

        c_prt(TERM_L_BLUE, format("%s", realm_names[realm_idx]), 2, 0);
        c_prt(TERM_L_BLUE, format("First Class: %s", get_class_aux(class1_idx, 0)->name), 3, 0);

        /* Classes */
        row = 4;
        col = 2;
        c_prt(TERM_RED, "Second Class", row++, col - 2);

        for (i = 0; i < vec_length(vec); i++)
        {
            int      class_idx = vec_get_int(vec, i);
            class_t *class_ptr = get_class_aux(class_idx, 0);

            prt(format("(%c) %s", 'a' + i, class_ptr->name), row++, col);
        }

        i = inkey();
        if (i == ESCAPE) break;
        choice = i - 'a';

        if (0 <= choice && choice < vec_length(vec))
        {
            class_idx = vec_get_int(vec, choice);
            _spoil_spells_by_realm_aux3(realm_idx, class1_idx, class_idx);
        }
     }

    vec_free(vec);
}
开发者ID:Alkalinear,项目名称:poschengband,代码行数:46,代码来源:wizard1.c


示例9: wiz_create_item_subdisplay

void wiz_create_item_subdisplay(menu_type * m, int oid, bool cursor,
								int row, int col, int width)
{
	int *choices = menu_priv(m);
	char buf[80];

	/* Artifacts */
	if (choose_artifact) {
		get_art_name(buf, choices[oid]);
		c_prt(curs_attrs[CURS_KNOWN][0 != cursor], buf, row, col);
	}
	/* Regular objects */
	else {
		object_kind_name(buf, sizeof buf, choices[oid], TRUE);
		c_prt(curs_attrs[CURS_KNOWN][0 != cursor], buf, row, col);
	}
}
开发者ID:NickMcConnell,项目名称:Beleriand,代码行数:17,代码来源:wizard2.c


示例10: wiz_create_item_subdisplay

/** Object kind selection */
void wiz_create_item_subdisplay(menu_type *m, int oid, bool cursor,
		int row, int col, int width)
{
	object_kind **choices = menu_priv(m);
	char buf[80];

	object_kind_name(buf, sizeof buf, choices[oid], TRUE);
	c_prt(curs_attrs[CURS_KNOWN][0 != cursor], buf, row, col);
}
开发者ID:mtadd,项目名称:angband,代码行数:10,代码来源:wizard.c


示例11: option_toggle_display

/**
 * Displays an option entry.
 */
static void option_toggle_display(struct menu *m, int oid, bool cursor,
		int row, int col, int width)
{
	byte attr = curs_attrs[CURS_KNOWN][cursor != 0];
	bool *options = menu_priv(m);

	c_prt(attr, format("%-45s: %s  (%s)", option_desc(oid),
			options[oid] ? "yes" : "no ", option_name(oid)), row, col);
}
开发者ID:CrypticGator,项目名称:angband,代码行数:12,代码来源:ui-options.c


示例12: display_artifact

/*
 * Display an artifact label
 */
static void display_artifact(int col, int row, bool cursor, int oid)
{
	byte attr = curs_attrs[CURS_KNOWN][(int) cursor];
	char o_name[80];

	get_artifact_display_name(o_name, sizeof o_name, oid);

	c_prt(attr, o_name, row, col);
}
开发者ID:NickMcConnell,项目名称:FAangband,代码行数:12,代码来源:ui-knowledge.c


示例13: jump_display

/**
 * Display an entry on the jump menu
 */
void jump_display(menu_type *menu, int oid, bool cursor, int row, int col,
                  int width)
{
    const u16b *choice = menu_priv(menu);

    byte attr = (cursor ? TERM_L_BLUE : TERM_WHITE);

    c_prt(attr, locality_name[stage_map[choice[oid]][LOCALITY]], row, col);

}
开发者ID:mjdrinen,项目名称:FAangband,代码行数:13,代码来源:wizard2.c


示例14: display_ego_item

static void display_ego_item(int col, int row, bool cursor, int oid)
{
	/* HACK: Access the object */
	ego_item_type *e_ptr = &e_info[default_join[oid].oid];

	/* Choose a color */
	byte attr = curs_attrs[0 != (int) e_ptr->everseen][0 != (int) cursor];

	/* Display the name */
	c_prt(attr, e_ptr->name, row, col);
}
开发者ID:NickMcConnell,项目名称:FAangband,代码行数:11,代码来源:ui-knowledge.c


示例15: display_options_item

static void display_options_item(struct menu *menu, int oid, bool cursor,
								 int row, int col, int width)
{
	size_t line = (size_t) oid;

	/* Most of the menu is svals, with a small "extra options" section below */
	if (line < N_ELEMENTS(sval_dependent)) {
		bool known = seen_tval(sval_dependent[line].tval);
		byte attr = curs_attrs[known ? CURS_KNOWN: CURS_UNKNOWN][(int)cursor];

		c_prt(attr, sval_dependent[line].desc, row, col);
	} else {
		byte attr = curs_attrs[CURS_KNOWN][(int)cursor];

		line = line - N_ELEMENTS(sval_dependent) - 1;

		if (line < N_ELEMENTS(extra_item_options))
			c_prt(attr, extra_item_options[line].name, row, col);
	}
}
开发者ID:CrypticGator,项目名称:angband,代码行数:20,代码来源:ui-options.c


示例16: print_skills

/*
 * Draw the skill tree
 */
void print_skills(s32b **table, s32b max, s32b sel, s32b start)
{
	s32b i, j;
	s32b wid, hgt;
	cptr keys;

	Term_clear();
	Term_get_size(&wid, &hgt);

	c_prt(TERM_WHITE, format("%s Skills Screen", game_module), 0, 28);
	keys = format("#BEnter#W to develop a branch, #Bup#W/#Bdown#W to move, #Bright#W/#Bleft#W to modify, #B?#W for help");
	display_message(0, 1, strlen(keys), TERM_WHITE, keys);
	c_prt((p_ptr->skill_points) ? TERM_L_BLUE : TERM_L_RED,
	      format("Skill points left: %d", p_ptr->skill_points), 2, 0);
	print_desc_aux(s_info[table[sel][0]].desc, 3, 0);

	for (j = start; j < start + (hgt - 7); j++)
	{
		byte color = TERM_WHITE;
		char deb = ' ', end = ' ';

		if (j >= max) break;

		i = table[j][0];

		if (get_skill(i) == 0)
		{
			if (s_info[i].mod == 0) color = TERM_L_DARK;
			else color = TERM_ORANGE;
		}
		else if (get_skill_raw(i) == SKILL_MAX) color = TERM_L_BLUE;
		if (s_info[i].hidden) color = TERM_L_RED;
		if (j == sel)
		{
			color = TERM_L_GREEN;
			deb = '[';
			end = ']';
		}
		if (!has_child(i))
		{
			c_prt(color, format("%c.%c%s", deb, end, s_info[i].name),
			      j + 7 - start, table[j][1] * 4);
		}
		else if (s_info[i].dev)
		{
			c_prt(color, format("%c-%c%s", deb, end, s_info[i].name),
			      j + 7 - start, table[j][1] * 4);
		}
		else
		{
			c_prt(color, format("%c+%c%s", deb, end, s_info[i].name),
				j + 7 - start, table[j][1] * 4);
		}
		c_prt(color,
			format("%c%02ld.%03ld [%01d.%03d]", (get_skill_raw(i) < 0) ? '-' : ' ',
				abs(get_skill_raw(i)) / SKILL_STEP, abs(get_skill_raw(i)) % SKILL_STEP,
				s_info[i].mod / 1000, s_info[i].mod % 1000),
			j + 7 - start, 60);
	}
}
开发者ID:jcubic,项目名称:ToME,代码行数:63,代码来源:skills.c


示例17: _list

static void _list(menu_ptr menu, char *keys)
{
    char temp[255];
    int  i;
    int  y = 1;
    int  x = 13;

    Term_erase(x, y, 255);

    if (menu->heading)
        put_str(format("     %s", menu->heading), y++, x);

    for (i = 0; i < menu->count; i++)
    {
        byte attr = TERM_WHITE;
        variant key, text, color;

        var_init(&key);
        var_init(&text);
        var_init(&color);

        menu->fn(MENU_KEY, i, menu->cookie, &key);
        if (var_is_null(&key))
            keys[i] = I2A(i);
        else
            keys[i] = (char)var_get_int(&key);

        if (menu->count <= 26)
            keys[i] = tolower(keys[i]);

        menu->fn(MENU_TEXT, i, menu->cookie, &text);
        if (var_is_null(&text))
            var_set_string(&text, "");

        menu->fn(MENU_COLOR, i, menu->cookie, &color);
        if (!var_is_null(&color))
            attr = var_get_int(&color);

        if (attr == TERM_DARK)
            keys[i] = '\0';

        sprintf(temp, "  %c) %s", keys[i], var_get_string(&text));
        c_prt(attr, temp, y + i, x);

        var_clear(&key);
        var_clear(&text);
        var_clear(&color);
    }
    Term_erase(x, y + menu->count, 255);
}
开发者ID:Alkalinear,项目名称:poschengband,代码行数:50,代码来源:menu.c


示例18: display_options_item

static void display_options_item(menu_type *menu, int oid, bool cursor, int row, int col, int width)
{
	size_t line = (size_t) oid;

	/* First section of menu - the svals */
	if (line < N_ELEMENTS(sval_dependent))
	{
		bool known = seen_tval(sval_dependent[line].tval);
		byte attr = curs_attrs[known ? CURS_KNOWN: CURS_UNKNOWN][(int)cursor];

		c_prt(attr, sval_dependent[line].desc, row, col);
	}
	/* Second section - the "extra options" */
	else
	{
		byte attr = curs_attrs[CURS_KNOWN][(int)cursor];

		line = line - N_ELEMENTS(sval_dependent) - 1;

		if (line < N_ELEMENTS(extra_item_options))
			c_prt(attr, extra_item_options[line].name, row, col);
	}
}
开发者ID:jobjingjo,项目名称:csangband,代码行数:23,代码来源:ui-options.c


示例19: display_object

/*
 * Display the objects in a group.
 */
static void display_object(int col, int row, bool cursor, int oid)
{
    int k_idx = oid;

    object_kind *k_ptr = &k_info[k_idx];
    const char *inscrip = get_autoinscription(oid);

    char o_name[80];

    /* Choose a color */
    bool aware = (!k_ptr->flavor || k_ptr->aware);
    byte attr = curs_attrs[(int) aware][(int) cursor];

    /* Find graphics bits -- versions of the object_char and object_attr
     * defines */
    bool use_flavour = (k_ptr->flavor) && !(aware && k_ptr->tval == TV_SCROLL);

    byte a = use_flavour ? flavor_info[k_ptr->flavor].x_attr : k_ptr->x_attr;
    byte c = use_flavour ? flavor_info[k_ptr->flavor].x_char : k_ptr->x_char;

    /* Display known artifacts differently */
    if (kf_has(k_ptr->flags_kind, KF_INSTA_ART)
	&& artifact_is_known(get_artifact_from_kind(k_ptr))) {
	get_artifact_display_name(o_name, sizeof(o_name),
				  get_artifact_from_kind(k_ptr));
    } else {
	object_kind_name(o_name, sizeof(o_name), k_idx, OPT(cheat_know));
    }

    /* If the type is "tried", display that */
    if (k_ptr->tried && !aware)
	my_strcat(o_name, " {tried}", sizeof(o_name));

    /* Display the name */
    c_prt(attr, o_name, row, col);

    /* Show autoinscription if around */
    if (aware && inscrip)
	c_put_str(TERM_YELLOW, inscrip, row, 55);

    /* Hack - don't use if double tile */
    if ((tile_width > 1) || (tile_height > 1))
	return;

    /* Display symbol */
    big_pad(76, row, a, c);
}
开发者ID:artes-liberales,项目名称:FAangband,代码行数:50,代码来源:ui-knowledge.c


示例20: display_feature

/*
 * Display the features in a group.
 */
static void display_feature(int col, int row, bool cursor, int oid )
{
	feature_type *f_ptr = &f_info[oid];
	byte attr = curs_attrs[CURS_KNOWN][(int)cursor];

	c_prt(attr, f_ptr->name, row, col);

	if (tile_height == 1) {
		/* Display symbols */
		col = 66;
		col += big_pad(col, row, f_ptr->x_attr[FEAT_LIGHTING_DARK],
				f_ptr->x_char[FEAT_LIGHTING_DARK]);
		col += big_pad(col, row, f_ptr->x_attr[FEAT_LIGHTING_LIT],
				f_ptr->x_char[FEAT_LIGHTING_LIT]);
		col += big_pad(col, row, f_ptr->x_attr[FEAT_LIGHTING_BRIGHT],
				f_ptr->x_char[FEAT_LIGHTING_BRIGHT]);
	}
}
开发者ID:coapp-packages,项目名称:angband,代码行数:21,代码来源:ui-knowledge.c



注:本文中的c_prt函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ c_re函数代码示例发布时间:2022-05-30
下一篇:
C++ c_keep函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap