本文整理汇总了C++中Term_gotoxy函数的典型用法代码示例。如果您正苦于以下问题:C++ Term_gotoxy函数的具体用法?C++ Term_gotoxy怎么用?C++ Term_gotoxy使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Term_gotoxy函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: place_visual_list_cursor
/*
* Place the cursor at the collect position for visual mode
*/
static void place_visual_list_cursor(int col, int row, byte a, byte c,
byte attr_top, byte char_left)
{
int i = a - attr_top;
int j = c - char_left;
int x = col + actual_width(j);
int y = row + actual_height(i);
/* Place the cursor */
Term_gotoxy(x, y);
}
示例2: item_menu_browser
/**
* Show quiver missiles in full inventory
*/
static void item_menu_browser(int oid, void *data, const region *local_area)
{
char tmp_val[80];
int count, j, i = num_obj;
int quiver_slots = (player->upkeep->quiver_cnt + z_info->quiver_slot_size - 1)
/ z_info->quiver_slot_size;
/* Set up to output below the menu */
text_out_hook = text_out_to_screen;
text_out_wrap = 0;
text_out_indent = local_area->col - 1;
text_out_pad = 1;
prt("", local_area->row + local_area->page_rows, MAX(0, local_area->col - 1));
Term_gotoxy(local_area->col, local_area->row + local_area->page_rows);
/* If we're printing pack slots the quiver takes up */
if (olist_mode & OLIST_QUIVER && player->upkeep->command_wrk == USE_INVEN) {
/* Quiver may take multiple lines */
for (j = 0; j < quiver_slots; j++, i++) {
const char *fmt = "in Quiver: %d missile%s\n";
char letter = I2A(i);
/* Number of missiles in this "slot" */
if (j == quiver_slots - 1)
count = player->upkeep->quiver_cnt - (z_info->quiver_slot_size *
(quiver_slots - 1));
else
count = z_info->quiver_slot_size;
/* Print the (disabled) label */
strnfmt(tmp_val, sizeof(tmp_val), "%c) ", letter);
text_out_c(COLOUR_SLATE, tmp_val, local_area->row + i, local_area->col);
/* Print the count */
strnfmt(tmp_val, sizeof(tmp_val), fmt, count,
count == 1 ? "" : "s");
text_out_c(COLOUR_L_UMBER, tmp_val, local_area->row + i, local_area->col + 3);
}
}
/* Always print a blank line */
prt("", local_area->row + i, MAX(0, local_area->col - 1));
/* Blank out whole tiles */
while ((tile_height > 1) && ((local_area->row + i) % tile_height != 0)) {
i++;
prt("", local_area->row + i, MAX(0, local_area->col - 1));
}
text_out_pad = 0;
text_out_indent = 0;
}
示例3: Term_putch
/*
* Move to a location and, using an attr, add a char
*/
errr Term_putch(int x, int y, byte a, char c)
{
errr res;
/* Move first */
if ((res = Term_gotoxy(x, y)) != 0) return (res);
/* Then add the char */
if ((res = Term_addch(a, c)) != 0) return (res);
/* Success */
return (0);
}
示例4: Term_putstr
/*
* Move to a location and, using an attr, add a string
*/
errr Term_putstr(int x, int y, int n, byte a, cptr s)
{
errr res;
/* Move first */
if ((res = Term_gotoxy(x, y)) != 0) return (res);
/* Then add the string */
if ((res = Term_addstr(n, a, s)) != 0) return (res);
/* Success */
return (0);
}
示例5: point_based_command
static enum birth_stage point_based_command(void)
{
static int stat = 0;
struct keypress ch;
enum birth_stage next = BIRTH_POINTBASED;
/* Place cursor just after cost of current stat */
Term_gotoxy(COSTS_COL + 4, COSTS_ROW + stat);
/* Get key */
ch = inkey();
if (ch.code == KTRL('X')) {
quit(NULL);
} else if (ch.code == ESCAPE) {
/* Go back a step, or back to the start of this step */
next = BIRTH_BACK;
} else if (ch.code == 'r' || ch.code == 'R') {
cmdq_push(CMD_RESET_STATS);
cmd_set_arg_choice(cmdq_peek(), "choice", FALSE);
} else if (ch.code == KC_ENTER) {
/* Done */
next = BIRTH_NAME_CHOICE;
} else {
int dir = target_dir(ch);
/* Prev stat, looping round to the bottom when going off the top */
if (dir == 8)
stat = (stat + STAT_MAX - 1) % STAT_MAX;
/* Next stat, looping round to the top when going off the bottom */
if (dir == 2)
stat = (stat + 1) % STAT_MAX;
/* Decrease stat (if possible) */
if (dir == 4) {
cmdq_push(CMD_SELL_STAT);
cmd_set_arg_choice(cmdq_peek(), "choice", stat);
}
/* Increase stat (if possible) */
if (dir == 6) {
cmdq_push(CMD_BUY_STAT);
cmd_set_arg_choice(cmdq_peek(), "choice", stat);
}
}
return next;
}
示例6: do_cmd_view_map
/*
* Display a "small-scale" map of the dungeon.
*
* Note that the "player" is always displayed on the map.
*/
void do_cmd_view_map(void)
{
int cy, cx;
byte w, h;
const char *prompt = "Hit any key to continue";
if (Term->view_map_hook) {
(*(Term->view_map_hook))(Term);
return;
}
/* Save screen */
screen_save();
/* Note */
prt("Please wait...", 0, 0);
/* Flush */
Term_fresh();
/* Clear the screen */
Term_clear();
/* store the tile multipliers */
w = tile_width;
h = tile_height;
tile_width = 1;
tile_height = 1;
/* Display the map */
display_map(&cy, &cx);
/* Show the prompt */
put_str(prompt, Term->hgt - 1, Term->wid / 2 - strlen(prompt) / 2);
/* Highlight the player */
Term_gotoxy(cx, cy);
/* Get any key */
(void)anykey();
/* Restore the tile multipliers */
tile_width = w;
tile_height = h;
/* Load screen */
screen_load();
}
示例7: curse_menu_browser
/**
* Show spell long description when browsing
*/
static void curse_menu_browser(int oid, void *data, const region *loc)
{
int *choice = data;
/* Redirect output to the screen */
text_out_hook = text_out_to_screen;
text_out_wrap = 0;
text_out_indent = loc->col - 1;
text_out_pad = 1;
Term_gotoxy(loc->col, loc->row + loc->page_rows);
text_out("\n%s\n", curses[choice[oid]].desc);
/* XXX */
text_out_pad = 0;
text_out_indent = 0;
}
示例8: print_menu_instructions
/* Show the birth instructions on an otherwise blank screen */
static void print_menu_instructions(void)
{
/* Clear screen */
Term_clear();
/* Output to the screen */
text_out_hook = text_out_to_screen;
/* Indent output */
text_out_indent = QUESTION_COL;
Term_gotoxy(QUESTION_COL, HEADER_ROW);
/* Display some helpful information */
text_out_e(BIRTH_MENU_HELPTEXT);
/* Reset text_out() indentation */
text_out_indent = 0;
}
示例9: roff_top
/*
* Hack -- Display the "name" and "attr/chars" of a monster race
*/
static void roff_top(int r_idx)
{
monster_race *r_ptr = &r_info[r_idx];
byte a1, a2;
char c1, c2;
/* Get the chars */
c1 = r_ptr->d_char;
c2 = r_ptr->x_char;
/* Get the attrs */
a1 = r_ptr->d_attr;
a2 = r_ptr->x_attr;
/* Clear the top line */
Term_erase(0, 0, 255);
/* Reset the cursor */
Term_gotoxy(0, 0);
/* A title (use "The" for non-uniques) */
if (!(r_ptr->flags1 & RF1_UNIQUE))
{
Term_addstr(-1, TERM_WHITE, "The ");
}
/* Dump the name */
Term_addstr(-1, TERM_WHITE, (r_name + r_ptr->name));
/* Append the "standard" attr/char info */
Term_addstr(-1, TERM_WHITE, " ('");
Term_addch(a1, c1);
Term_addstr(-1, TERM_WHITE, "')");
/* Append the "optional" attr/char info */
Term_addstr(-1, TERM_WHITE, "/('");
Term_addch(a2, c2);
if (use_bigtile && (a2 & 0x80)) Term_addch(255, -1);
Term_addstr(-1, TERM_WHITE, "'):");
}
示例10: display_glyphs
/*
* Display glyph and colours
*/
static void display_glyphs(int col, int row, int height, int width, byte a,
wchar_t c)
{
int i;
int x, y;
/* Clear the display lines */
for (i = 0; i < height; i++)
Term_erase(col, row + i, width);
/* Prompt */
prt("Choose colour:", row + height / 2, col);
Term_locate(&x, &y);
for (i = 0; i < MAX_COLORS; i++)
big_pad(x + i, y, i, c);
/* Place the cursor */
Term_gotoxy(x + a, y);
}
示例11: move_cursor_relative_map
/**
* Move the cursor to a given map location.
*/
static void move_cursor_relative_map(int y, int x)
{
int ky, kx;
term *old;
int j;
/* Scan windows */
for (j = 0; j < ANGBAND_TERM_MAX; j++) {
term *t = angband_term[j];
/* No window */
if (!t) continue;
/* No relevant flags */
if (!(window_flag[j] & (PW_MAPS))) continue;
/* Location relative to panel */
ky = y - t->offset_y;
if (tile_height > 1)
ky = tile_height * ky;
/* Verify location */
if ((ky < 0) || (ky >= t->hgt)) continue;
/* Location relative to panel */
kx = x - t->offset_x;
if (tile_width > 1)
kx = tile_width * kx;
/* Verify location */
if ((kx < 0) || (kx >= t->wid)) continue;
/* Go there */
old = Term;
Term_activate(t);
(void)Term_gotoxy(kx, ky);
Term_activate(old);
}
}
示例12: gain_spec_menu_browser
/**
* Show spell long description when browsing
*/
static void gain_spec_menu_browser(int oid, void *data, const region *loc)
{
struct spec_menu_data *d = data;
/* Redirect output to the screen */
text_out_hook = text_out_to_screen;
text_out_wrap = 0;
text_out_indent = loc->col - 1;
text_out_pad = 1;
clear_from(loc->row + loc->page_rows);
Term_gotoxy(loc->col, loc->row + loc->page_rows);
text_out_to_screen(TERM_DEEP_L_BLUE, (char *) abilities[d->specialties[oid]].desc);
/* XXX */
text_out_pad = 0;
text_out_indent = 0;
}
示例13: spell_menu_browser
/**
* Show spell long description when browsing
*/
static void spell_menu_browser(int oid, void *data, const region * loc)
{
struct spell_menu_data *d = data;
int spell = d->spells[oid];
const magic_type *s_ptr = &mp_ptr->info[spell];
/* Redirect output to the screen */
text_out_hook = text_out_to_screen;
text_out_wrap = 0;
text_out_indent = loc->col - 1;
text_out_pad = 1;
Term_gotoxy(loc->col, loc->row + loc->page_rows);
text_out_c(TERM_DEEP_L_BLUE,
format("\n%s\n", s_info[s_ptr->index].text));
/* XXX */
text_out_pad = 0;
text_out_indent = 0;
}
示例14: curse_menu_browser
/**
* Show spell long description when browsing
*/
static void curse_menu_browser(int oid, void *data, const region *loc)
{
struct curse_menu_data *choice = data;
char buf[80];
/* Redirect output to the screen */
text_out_hook = text_out_to_screen;
text_out_wrap = 0;
text_out_indent = loc->col - 1;
text_out_pad = 1;
Term_gotoxy(loc->col, loc->row + loc->page_rows);
my_strcpy(buf, curses[choice[oid].index].desc, sizeof(buf));
my_strcap(buf);
text_out(" %s.\n", buf);
/* XXX */
text_out_pad = 0;
text_out_indent = 0;
}
示例15: spell_menu_browser
/**
* Show spell long description when browsing
*/
static void spell_menu_browser(int oid, void *data, const region *loc)
{
struct spell_menu_data *d = data;
int spell_index = d->spells[oid];
if (d->show_description) {
/* Redirect output to the screen */
text_out_hook = text_out_to_screen;
text_out_wrap = 0;
text_out_indent = loc->col - 1;
text_out_pad = 1;
Term_gotoxy(loc->col, loc->row + loc->page_rows);
text_out("\n%s\n", spell_by_index(spell_index)->text);
/* XXX */
text_out_pad = 0;
text_out_indent = 0;
}
}