本文整理汇总了C++中c_put_str函数的典型用法代码示例。如果您正苦于以下问题:C++ c_put_str函数的具体用法?C++ c_put_str怎么用?C++ c_put_str使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了c_put_str函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: sval_display
/*
* Display an entry on the sval menu
*/
static void sval_display(menu_type *menu, int oid, bool cursor, int row, int col, int width)
{
char buf[80];
const squelch_choice *choice = menu_priv(menu);
int idx = choice[oid].idx;
byte attr = (cursor ? TERM_L_BLUE : TERM_WHITE);
/* Acquire the "name" of object "i" */
object_kind_name(buf, sizeof(buf), idx, choice[oid].aware);
/* Print it */
c_put_str(attr, format("[ ] %s", buf), row, col);
if ((choice[oid].aware && (k_info[idx].squelch & SQUELCH_IF_AWARE)) ||
((!choice[oid].aware) && (k_info[idx].squelch & SQUELCH_IF_UNAWARE)))
c_put_str(TERM_L_RED, "*", row, col + 1);
}
开发者ID:cinereaste,项目名称:angband,代码行数:21,代码来源:squelch.c
示例17: prt_sp
/*
* Prints players max/cur spell points
*/
static void prt_sp(int row, int col)
{
char cur_sp[32], max_sp[32];
byte color = player_sp_attr();
/* Do not show mana unless we have some */
if (!p_ptr->msp) return;
put_str("SP ", row, col);
strnfmt(max_sp, sizeof(max_sp), "%4d", p_ptr->msp);
strnfmt(cur_sp, sizeof(cur_sp), "%4d", p_ptr->csp);
/* Show mana */
c_put_str(color, cur_sp, row, col + 3);
c_put_str(TERM_WHITE, "/", row, col + 7);
c_put_str(TERM_L_GREEN, max_sp, row, col + 8);
}
开发者ID:cinereaste,项目名称:angband,代码行数:21,代码来源:xtra3.c
示例18: prt_recall
/*
* Print recall status.
*/
static size_t prt_recall(int row, int col)
{
if (p_ptr->word_recall) {
c_put_str(TERM_WHITE, "Recall", row, col);
return sizeof "Recall";
}
return 0;
}
开发者ID:artes-liberales,项目名称:FAangband,代码行数:12,代码来源:xtra3.c
示例19: display_object
/*
* Display the objects in a group.
*/
static void display_object(int col, int row, bool cursor, int oid)
{
object_kind *kind = &k_info[oid];
const char *inscrip = get_autoinscription(kind);
char o_name[80];
/* Choose a color */
bool aware = (!kind->flavor || kind->aware);
byte attr = curs_attrs[(int)aware][(int)cursor];
/* Find graphics bits -- versions of the object_char and object_attr defines */
bool use_flavour = (kind->flavor) && !(aware && kind->tval == TV_SCROLL);
byte a = use_flavour ? kind->flavor->x_attr : kind->x_attr;
byte c = use_flavour ? kind->flavor->x_char : kind->x_char;
/* Display known artifacts differently */
if (of_has(kind->flags, OF_INSTA_ART) && artifact_is_known(get_artifact_from_kind(kind)))
get_artifact_display_name(o_name, sizeof(o_name), get_artifact_from_kind(kind));
else
object_kind_name(o_name, sizeof(o_name), kind, OPT(cheat_know));
/* If the type is "tried", display that */
if (kind->tried && !aware)
my_strcat(o_name, " {tried}", sizeof(o_name));
/* Display the name */
c_prt(attr, o_name, row, col);
/* Show squelch status */
if ((aware && kind_is_squelched_aware(kind)) ||
(!aware && kind_is_squelched_unaware(kind)))
c_put_str(attr, "Yes", row, 46);
/* Show autoinscription if around */
if (aware && inscrip)
c_put_str(TERM_YELLOW, inscrip, row, 55);
if (tile_height == 1) {
big_pad(76, row, a, c);
}
}
开发者ID:coapp-packages,项目名称:angband,代码行数:47,代码来源:ui-knowledge.c
示例20: get_curse_display
/**
* Display an entry on the item menu
*/
void get_curse_display(struct menu *menu, int oid, bool cursor, int row,
int col, int width)
{
struct curse **choice = menu_priv(menu);
int attr = cursor ? COLOUR_L_BLUE : COLOUR_WHITE;
char buf[80];
int power = choice[oid]->power;
strnfmt(buf, sizeof(buf), "%s (power %d)", choice[oid]->name, power);
c_put_str(attr, buf, row + oid, col);
}
开发者ID:fe051,项目名称:angband,代码行数:13,代码来源:ui-curse.c
注:本文中的c_put_str函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论