当前位置: 首页>>代码示例>>C++>>正文


C++ c_put_str函数代码示例

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


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

示例1: prt_stat

/*
 * Print character stat in given row, column
 */
static void prt_stat(int stat, int row, int col)
{
	char tmp[32];

	/* Display "injured" stat */
	if (p_ptr->stat_cur[stat] < p_ptr->stat_max[stat])
	{
		put_str(stat_names_reduced[stat], row, col);
		cnv_stat(p_ptr->state.stat_use[stat], tmp, sizeof(tmp));
		c_put_str(TERM_YELLOW, tmp, row, col + 6);
	}

	/* Display "healthy" stat */
	else
	{
		put_str(stat_names[stat], row, col);
		cnv_stat(p_ptr->state.stat_use[stat], tmp, sizeof(tmp));
		c_put_str(TERM_L_GREEN, tmp, row, col + 6);
	}

	/* Indicate natural maximum */
	if (p_ptr->stat_max[stat] == 18+100)
	{
		put_str("!", row, col + 3);
	}
}
开发者ID:cinereaste,项目名称:angband,代码行数:29,代码来源:xtra3.c

示例2: prt_exp

/*
 * Display the experience
 */
static void prt_exp(int row, int col)
{
	char out_val[32];
	bool lev50 = (p_ptr->lev == 50);

	long xp = (long)p_ptr->exp;


	/* Calculate XP for next level */
	if (!lev50)
		xp = (long)(player_exp[p_ptr->lev - 1] * p_ptr->expfact / 100L) - p_ptr->exp;

	/* Format XP */
	strnfmt(out_val, sizeof(out_val), "%8ld", (long)xp);


	if (p_ptr->exp >= p_ptr->max_exp)
	{
		put_str((lev50 ? "EXP" : "NXT"), row, col);
		c_put_str(TERM_L_GREEN, out_val, row, col + 4);
	}
	else
	{
		put_str((lev50 ? "Exp" : "Nxt"), row, col);
		c_put_str(TERM_YELLOW, out_val, row, col + 4);
	}
}
开发者ID:cinereaste,项目名称:angband,代码行数:30,代码来源:xtra3.c

示例3: prt_field

/*
 * Print character info at given row, column in a 13 char field
 */
static void prt_field(cptr info, int row, int col)
{
	/* Dump 13 spaces to clear */
	c_put_str(TERM_WHITE, "             ", row, col);

	/* Dump the info itself */
	c_put_str(TERM_L_BLUE, info, row, col);
}
开发者ID:cinereaste,项目名称:angband,代码行数:11,代码来源:xtra3.c

示例4: prt_shape

/**
 * Prints current shape, if not normal.   -LM-
 */
static void prt_shape(int row, int col)
{
    char *shapedesc = "";

    switch (p_ptr->schange) {
    case SHAPE_MOUSE:
	shapedesc = "Mouse     ";
	break;
    case SHAPE_FERRET:
	shapedesc = "Ferret    ";
	break;
    case SHAPE_HOUND:
	shapedesc = "Hound     ";
	break;
    case SHAPE_GAZELLE:
	shapedesc = "Gazelle   ";
	break;
    case SHAPE_LION:
	shapedesc = "Lion      ";
	break;
    case SHAPE_ENT:
	shapedesc = "Ent       ";
	break;
    case SHAPE_BAT:
	shapedesc = "Bat       ";
	break;
    case SHAPE_WEREWOLF:
	shapedesc = "Werewolf  ";
	break;
    case SHAPE_VAMPIRE:
	shapedesc = "Vampire   ";
	break;
    case SHAPE_WYRM:
	shapedesc = "Dragon    ";
	break;
    case SHAPE_BEAR:
	shapedesc = "Bear      ";
	break;
    default:
	shapedesc = "          ";
	break;
    }

    /* Display (or write over) the shapechange with pretty colors. */
    if (mp_ptr->spell_book == TV_DRUID_BOOK)
	c_put_str(TERM_GREEN, shapedesc, row, col);
    else if (mp_ptr->spell_book == TV_NECRO_BOOK)
	c_put_str(TERM_VIOLET, shapedesc, row, col);
    else
	c_put_str(TERM_RED, shapedesc, row, col);

}
开发者ID:artes-liberales,项目名称:FAangband,代码行数:55,代码来源:xtra3.c

示例5: prt_level

/*
 * Prints level
 */
static void prt_level(int row, int col)
{
    char tmp[32];

    strnfmt(tmp, sizeof(tmp), "%6d", p_ptr->lev);

    if (p_ptr->lev >= p_ptr->max_lev) {
	put_str("LEVEL ", row, col);
	c_put_str(TERM_L_GREEN, tmp, row, col + 6);
    } else {
	put_str("Level ", row, col);
	c_put_str(TERM_YELLOW, tmp, row, col + 6);
    }
}
开发者ID:artes-liberales,项目名称:FAangband,代码行数:17,代码来源:xtra3.c

示例6: prt_hp

/*
 * Prints Cur hit points
 */
static void prt_hp(int row, int col)
{
	char cur_hp[32], max_hp[32];
	byte color = player_hp_attr();

	put_str("HP ", row, col);

	strnfmt(max_hp, sizeof(max_hp), "%4d", p_ptr->mhp);
	strnfmt(cur_hp, sizeof(cur_hp), "%4d", p_ptr->chp);
	
	c_put_str(color, cur_hp, row, col + 3);
	c_put_str(TERM_WHITE, "/", row, col + 7);
	c_put_str(TERM_L_GREEN, max_hp, row, col + 8);
}
开发者ID:cinereaste,项目名称:angband,代码行数:17,代码来源:xtra3.c

示例7: print_history_header

static void print_history_header(void)
{
    char buf[80];

    /* Print the header (character name and title) */
    strnfmt(buf, sizeof(buf), "%s the %s %s", op_ptr->full_name,
	    rp_ptr->name, cp_ptr->name);

    c_put_str(TERM_WHITE, buf, 0, 0);
    c_put_str(TERM_WHITE, "============================================================", 1, 0);
    c_put_str(TERM_WHITE, "CHAR.", 2, 34);
    c_put_str(TERM_WHITE, "|   TURN  |      LOCATION        |LEVEL| EVENT",
	      3, 0);
    c_put_str(TERM_WHITE, "============================================================", 4, 0);
}
开发者ID:LostTemplar,项目名称:Beleriand,代码行数:15,代码来源:history.c

示例8: prt_speed

/*
 * Prints the speed of a character.
 */
static void prt_speed(int row, int col)
{
	int i = p_ptr->state.speed;

	byte attr = TERM_WHITE;
	const char *type = NULL;
	char buf[32] = "";

	/* Hack -- Visually "undo" the Search Mode Slowdown */
	if (p_ptr->searching) i += 10;

	/* Fast */
	if (i > 110)
	{
		attr = TERM_L_GREEN;
		type = "Fast";
	}

	/* Slow */
	else if (i < 110)
	{
		attr = TERM_L_UMBER;
		type = "Slow";
	}

	if (type)
		strnfmt(buf, sizeof(buf), "%s (%+d)", type, (i - 110));

	/* Display the speed */
	c_put_str(attr, format("%-10s", buf), row, col);
}
开发者ID:cinereaste,项目名称:angband,代码行数:34,代码来源:xtra3.c

示例9: quality_subdisplay

/*
 * Display the quality squelch subtypes.
 */
static void quality_subdisplay(menu_type *menu, int oid, bool cursor, int row, int col, int width)
{
	const char *name = quality_values[oid].name;
	byte attr = (cursor ? TERM_L_BLUE : TERM_WHITE);

	c_put_str(attr, name, row, col);
}
开发者ID:jobjingjo,项目名称:csangband,代码行数:10,代码来源:ui-options.c

示例10: quest_wolves_finish_hook

bool quest_wolves_finish_hook(char *fmt)
{
	s32b q_idx;

	q_idx = get_next_arg(fmt);

	if (q_idx != QUEST_WOLVES) return FALSE;

	c_put_str(TERM_YELLOW, "Thank you for killing the pack of wolves!", 8, 0);
	c_put_str(TERM_YELLOW, "You can use the hut as your house as a reward.", 9, 0);

	/* Continue the plot */
	*(quest[q_idx].plot) = QUEST_SPIDER;

	return TRUE;
}
开发者ID:AmyBSOD,项目名称:ToME-SX,代码行数:16,代码来源:q_wolves.c

示例11: get_sex

/*
 * Get the Sex.
 */
static bool get_sex(void)
{
	char query2;
	int loopagain = TRUE;
	
	// Set the default sex info to female
	if (p_ptr->psex == SEX_UNDEFINED)
	{
		p_ptr->psex = SEX_FEMALE;
		sp_ptr = &sex_info[SEX_FEMALE];
	}
	
	while (loopagain == TRUE)
	{
		/* Display the player */
		display_player(0);

		// Highlight the relevant feature
		c_put_str(TERM_YELLOW, sp_ptr->title, 3, 8);
		
		/* Prompt */
		Term_putstr(QUESTION_COL, INSTRUCT_ROW + 1, -1, TERM_SLATE,
					"Enter accept sex");
		Term_putstr(QUESTION_COL, INSTRUCT_ROW + 2, -1, TERM_SLATE,
					"Space change sex");
		
		/* Hack - highlight the key names */
		Term_putstr(QUESTION_COL, INSTRUCT_ROW + 1, - 1, TERM_L_WHITE, "Enter");
		Term_putstr(QUESTION_COL, INSTRUCT_ROW + 2, - 1, TERM_L_WHITE, "Space");
		
		/* Move the cursor */
		Term_gotoxy(0, INSTRUCT_ROW + 1);
				
		/* Query */
		query2 = inkey();
		
		if ((query2 == '\r') || (query2 == '\n'))
		{
			/* got a sex*/
			loopagain = FALSE;
			
			p_ptr->redraw |= (PR_MISC);
		}
		
		else if (query2 == ESCAPE)  return (FALSE);
		
		else if (((query2 == 'Q') || (query2 == 'q')) && (turn == 0)) quit (NULL);

		else
		{
			if (p_ptr->psex == SEX_FEMALE)	p_ptr->psex = SEX_MALE;
			else							p_ptr->psex = SEX_FEMALE;
			
			sp_ptr = &sex_info[p_ptr->psex];
		}
	}
	
	return (TRUE);
}
开发者ID:halfsickofshadows,项目名称:Sil,代码行数:62,代码来源:birth.c

示例12: prt_ac

/*
 * Prints current AC
 */
static void prt_ac(int row, int col)
{
	char tmp[32];

	put_str("Cur AC ", row, col);
	strnfmt(tmp, sizeof(tmp), "%5d", p_ptr->state.dis_ac + p_ptr->state.dis_to_a);
	c_put_str(TERM_L_GREEN, tmp, row, col + 7);
}
开发者ID:cinereaste,项目名称:angband,代码行数:11,代码来源:xtra3.c

示例13: birthmenu_display

/* A custom "display" function for our menus that simply displays the
   text from our stored data in a different colour if it's currently
   selected. */
static void birthmenu_display(menu_type *menu, int oid, bool cursor,
			      int row, int col, int width)
{
	struct birthmenu_data *data = menu->menu_data;

	byte attr = curs_attrs[CURS_KNOWN][0 != cursor];
	c_put_str(attr, data->items[oid], row, col);
}
开发者ID:Chiinatso,项目名称:Anquestria,代码行数:11,代码来源:ui-birth.c

示例14: prt_gold

/*
 * Prints current gold
 */
static void prt_gold(int row, int col)
{
	char tmp[32];

	put_str("AU ", row, col);
	strnfmt(tmp, sizeof(tmp), "%9ld", (long)p_ptr->au);
	c_put_str(TERM_L_GREEN, tmp, row, col + 3);
}
开发者ID:cinereaste,项目名称:angband,代码行数:11,代码来源:xtra3.c

示例15: quality_subdisplay

/**
 * Display the quality ignore subtypes.
 */
static void quality_subdisplay(struct menu *menu, int oid, bool cursor, int row,
							   int col, int width)
{
	const char *name = quality_values[oid].name;
	byte attr = (cursor ? COLOUR_L_BLUE : COLOUR_WHITE);

	c_put_str(attr, name, row, col);
}
开发者ID:CrypticGator,项目名称:angband,代码行数:11,代码来源:ui-options.c


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