本文整理汇总了C++中draw_border函数的典型用法代码示例。如果您正苦于以下问题:C++ draw_border函数的具体用法?C++ draw_border怎么用?C++ draw_border使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了draw_border函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: newwin
void input_context::display_help()
{
// Shamelessly stolen from help.cpp
WINDOW *w_help = newwin(FULL_SCREEN_HEIGHT - 2, FULL_SCREEN_WIDTH - 2,
1 + (int)((TERMY > FULL_SCREEN_HEIGHT) ? (TERMY - FULL_SCREEN_HEIGHT) / 2 : 0),
1 + (int)((TERMX > FULL_SCREEN_WIDTH) ? (TERMX - FULL_SCREEN_WIDTH) / 2 : 0));
werase(w_help);
// Draw win header and borders
draw_border(w_help, c_white);
mvwprintz(w_help, 0, (FULL_SCREEN_WIDTH - utf8_width(_("Keybindings"))) / 2 - 1,
c_ltred, " %s ", _("Keybindings"));
mvwprintz(w_help, 1, 51, c_ltred, _("Unbound keys"));
mvwprintz(w_help, 2, 51, c_ltgreen, _("Keybinding active only"));
mvwprintz(w_help, 3, 51, c_ltgreen, _("on this screen"));
mvwprintz(w_help, 4, 51, c_ltgray, _("Keybinding active globally"));
// Clear the lines. Don't touch borders
for (int i = 1; i < FULL_SCREEN_HEIGHT - 3; i++) {
mvwprintz(w_help, i, 1, c_black, " ");
}
for (int i = 0; i < registered_actions.size(); i++) {
const std::string &action_id = registered_actions[i];
if(action_id == "ANY_INPUT") {
continue;
}
bool overwrite_default;
const std::vector<input_event> &input_events = inp_mngr.get_input_for_action(action_id, category,
&overwrite_default);
nc_color col = input_events.size() ? c_white : c_ltred;
mvwprintz(w_help, i, 3, col, "%s: ", inp_mngr.get_action_name(action_id).c_str());
if (!input_events.size()) {
mvwprintz(w_help, i, 30, c_ltred, _("Unbound!"));
} else {
// The color depends on whether this input draws from context-local or from
// default settings. Default will be ltgray, overwrite will be ltgreen.
col = overwrite_default ? c_ltgreen : c_ltgray;
mvwprintz(w_help, i, 30, col, "%s", get_desc(action_id).c_str());
}
}
wrefresh(w_help);
refresh();
long ch = getch();
while (ch != 'q' && ch != 'Q' && ch != KEY_ESCAPE) {
ch = getch();
};
werase(w_help);
wrefresh(w_help);
delwin(w_help);
}
示例2: play_game
int play_game(){
draw_border();
update_position();
draw_snake();
usleep(get_speed());
return 1;
}
示例3: run_arrange_hook
void run_arrange_hook(void)
{
SCM arrange_hook_sym = scm_from_locale_symbol("arrange-hook");
if (scm_defined_p(arrange_hook_sym, SCM_UNDEFINED) == SCM_BOOL_T) {
scm_c_eval_string("(arrange-hook)");
}
else {
fallback_arrange();
}
client_t *focus_client = get_focus_client();
if (focus_client) {
draw_border(focus_client);
}
else if (client_list) {
set_focus_client(client_list);
draw_border(client_list);
}
}
示例4: splash_screen
//-----------Splash screens------------//
void splash_screen (int screen_type)
{
switch (screen_type)
{
case 1 :
draw_border(26,3,53,7,1);
gotoxy(31,5);
textcolor(12);
cprintf("Welcome ");
textcolor(7);
cout<<adm[1].adm_name.first_name;
break;
case 2 :
draw_border(26,3,53,7,1);
gotoxy(31,5);
textcolor(12);
cprintf("Welcome ");
textcolor(7);
cout<<apt[acc_no].apt_name.first_name;
break;
case 3 :
draw_border(26,3,53,7,1);
gotoxy(31,5);
textcolor(12);
cprintf("Welcome ");
textcolor(7);
cout<<emp[acc_no].emp_name.first_name;
break;
case 4 : {
clrscr();
draw_border(16,7,63,16,1);
gotoxy(19,10);
textcolor(12);
cprintf("Thank you for using Intellisoft Job Portal");
gotoxy(24,12);
textcolor(7);
cprintf("Developed by Aniruddha Mysore");
gotoxy(26,13);
cprintf("Class 11-B | Roll No. 28");
delay(2000);
exit(0);
}
}
}
示例5: hide
void live_view::show(const int x, const int y)
{
if (!enabled || w_live_view == NULL) {
return;
}
bool did_hide = hide(false); // Clear window if it's visible
if (!g->u.sees(x, y)) {
if (did_hide) {
wrefresh(w_live_view);
}
return;
}
map &m = g->m;
mvwprintz(w_live_view, 0, START_COLUMN, c_white, "< ");
wprintz(w_live_view, c_green, _("Mouse View"));
wprintz(w_live_view, c_white, " >");
int line = START_LINE;
g->print_all_tile_info(x, y, w_live_view, START_COLUMN, line, true);
if (m.can_put_items(x, y) && m.sees_some_items(x, y, g->u)) {
if(g->u.has_effect("blind")) {
mvwprintz(w_live_view, line++, START_COLUMN, c_yellow,
_("There's something here, but you can't see what it is."));
} else {
print_items(m.i_at(x, y), line);
}
}
#if (defined TILES || defined SDLTILES || defined _WIN32 || defined WINDOWS)
// Because of the way the status UI is done, the live view window must
// be tall enough to clear the entire height of the viewport below the
// status bar. This hack allows the border around the live view box to
// be drawn only as big as it needs to be, while still leaving the
// window tall enough. Won't work for ncurses in Linux, but that doesn't
// currently support the mouse. If and when it does, there'll need to
// be a different code path here that works for ncurses.
int full_height = w_live_view->height;
if (line < w_live_view->height - 1) {
w_live_view->height = (line > 11) ? line : 11;
}
last_height = w_live_view->height;
#endif
draw_border(w_live_view);
#if (defined TILES || defined SDLTILES || defined _WIN32 || defined WINDOWS)
w_live_view->height = full_height;
#endif
inuse = true;
wrefresh(w_live_view);
}
示例6: draw_border
void snake_game::print_header(WINDOW *w_snake, bool show_shortcut)
{
draw_border(w_snake);
if (show_shortcut) {
std::string shortcut = _("<q>uit");
shortcut_print(w_snake, 0, FULL_SCREEN_WIDTH - utf8_width(shortcut.c_str()) - 2,
c_white, c_ltgreen, shortcut);
}
center_print(w_snake, 0, c_white, _("S N A K E"));
}
示例7: draw_border
//---------------------------------------------------------------------------------------
void GmoBox::on_draw(Drawer* pDrawer, RenderOptions& opt)
{
draw_border(pDrawer, opt);
draw_shapes(pDrawer, opt);
//draw contained boxes
std::vector<GmoBox*>::iterator it;
for (it=m_childBoxes.begin(); it != m_childBoxes.end(); ++it)
(*it)->on_draw(pDrawer, opt);
}
示例8: update_frame
void
update_frame(const GameState *game)
{
init_video_buffer();
// Draw puzzle
int nr_block = game->nr_block_h * game->nr_block_v;
for (int i = 0; i < nr_block; i++) {
int block_index = game->block[i];
// Draw a block
int scr_x = (i % game->nr_block_h) * game->block_w;
int scr_y = (i / game->nr_block_h) * game->block_h;
int pic_x = (block_index % game->nr_block_h) * game->block_w;
int pic_y = (block_index / game->nr_block_h) * game->block_h;
for (int off_y = 0; off_y < game->block_h; off_y++) {
for (int off_x = 0; off_x < game->block_w; off_x++) {
draw_pixel(scr_x + off_x, scr_y + off_y,
get_color(game->image, pic_x + off_x, pic_y + off_y, game->image_w, game->image_h));
}
}
}
// Draw frame
for (int i = 0; i < game->nr_block_h + 1; i++) {
int scr_x = i * game->block_w;
draw_column(scr_x, 0, 6, get_scr_h(), 0);
}
for (int i = 0; i < game->nr_block_v + 1; i++) {
int scr_y = i * game->block_h;
draw_row(0, scr_y, 6, get_scr_w(), 0);
}
draw_border(game->block_x * game->block_w, game->block_y * game->block_h,
game->block_w, game->block_h, 3, 0x000000ff);
if (game->select == 1) {
draw_border(game->select_block_x * game->block_w, game->select_block_y * game->block_h,
game->block_w, game->block_h, 3, 0x00ff0000);
}
update_screen();
}
示例9: string_input_popup
std::string string_input_popup(std::string title, int width, std::string input, std::string desc,
std::string identifier, int max_length, bool only_digits )
{
nc_color title_color = c_ltred;
nc_color desc_color = c_green;
std::vector<std::string> descformatted;
int titlesize = utf8_width(title.c_str());
int startx = titlesize + 2;
if ( max_length == 0 ) {
max_length = width;
}
int w_height = 3;
int iPopupWidth = (width == 0) ? FULL_SCREEN_WIDTH : width + titlesize + 4;
if (iPopupWidth > FULL_SCREEN_WIDTH) {
iPopupWidth = FULL_SCREEN_WIDTH;
}
if ( desc.size() > 0 ) {
int twidth = utf8_width(desc.c_str());
if ( twidth > iPopupWidth - 4 ) {
twidth = iPopupWidth - 4;
}
descformatted = foldstring(desc, twidth);
w_height += descformatted.size();
}
int starty = 1 + descformatted.size();
if ( max_length == 0 ) {
max_length = 1024;
}
int w_y = (TERMY - w_height) / 2;
int w_x = ((TERMX > iPopupWidth) ? (TERMX - iPopupWidth) / 2 : 0);
WINDOW *w = newwin(w_height, iPopupWidth, w_y,
((TERMX > iPopupWidth) ? (TERMX - iPopupWidth) / 2 : 0));
draw_border(w);
int endx = iPopupWidth - 3;
for( size_t i = 0; i < descformatted.size(); ++i ) {
mvwprintz(w, 1 + i, 1, desc_color, "%s", descformatted[i].c_str() );
}
mvwprintz(w, starty, 1, title_color, "%s", title.c_str() );
long key = 0;
int pos = -1;
std::string ret = string_input_win(w, input, max_length, startx, starty, endx, true, key, pos,
identifier, w_x, w_y, true, only_digits);
werase(w);
wrefresh(w);
delwin(w);
refresh();
return ret;
}
示例10: popup
long popup(const std::string &text, PopupFlags flags)
{
int width = 0;
int height = 2;
std::vector<std::string> folded = foldstring(text, FULL_SCREEN_WIDTH - 2);
height += folded.size();
for( size_t i = 0; i < folded.size(); ++i ) {
int cw = utf8_width(folded[i].c_str());
if(cw > width) {
width = cw;
}
}
width += 2;
WINDOW *w;
if ((flags & PF_FULLSCREEN) != 0) {
w = newwin(FULL_SCREEN_HEIGHT, FULL_SCREEN_WIDTH,
(TERMY > FULL_SCREEN_HEIGHT) ? (TERMY - FULL_SCREEN_HEIGHT) / 2 : 0,
(TERMX > FULL_SCREEN_WIDTH) ? (TERMX - FULL_SCREEN_WIDTH) / 2 : 0);
} else if ((flags & PF_ON_TOP) == 0) {
if (height > FULL_SCREEN_HEIGHT) {
height = FULL_SCREEN_HEIGHT;
}
w = newwin(height, width, (TERMY - (height + 1)) / 2,
(TERMX > width) ? (TERMX - width) / 2 : 0);
} else {
w = newwin(height, width, 0, (TERMX > width) ? (TERMX - width) / 2 : 0);
}
draw_border(w);
for( size_t i = 0; i < folded.size(); ++i ) {
mvwprintz(w, i + 1, 1, c_white, "%s", folded[i].c_str());
}
long ch = 0;
// Don't wait if not required.
while((flags & PF_NO_WAIT) == 0) {
wrefresh(w);
ch = getch();
if ((flags & PF_GET_KEY) != 0) {
// return the first key that got pressed.
werase(w);
break;
}
if (ch == ' ' || ch == '\n' || ch == KEY_ESCAPE) {
// The usuall "escape menu/window" keys.
werase(w);
break;
}
}
wrefresh(w);
delwin(w);
refresh();
return ch;
}
示例11: edit_apl_profile
//---------Edit Applicant Profile----------//
void edit_apl_profile()
{
int i = acc_no;
char choice;
clrscr;
gotoxy(28,10);
textcolor(12);
cprintf("What would you like to edit? ");
textcolor(7);
cout<<"\n\t\t\t\t[1] Name\n\t\t\t\t[2] Industry\n\t\t\t\t[3] Username";
draw_border(25,8,59,16,0);
gotoxy(28,15);
cin>>choice;
clrscr();
switch (choice)
{
case '1' : {
gotoxy(24,11);
cout<<"Please enter your first name : ";
cin>>apt[i].apt_name.first_name;
cin.ignore();
gotoxy(24,12);
cout<<"Please enter your last name : ";
cin>>apt[i].apt_name.last_name;
cin.ignore();
break;
}
case '2' : {
gotoxy(27,11);
cout<<"Industry 1 : ";
cin>>apt[i].industry[1];
cin.ignore();
gotoxy(27,12);
cout<<"Industry 2 : ";
cin>>apt[i].industry[2];
gotoxy(27,13);
cin.ignore();
cout<<"Industry 3 : ";
cin>>apt[i].industry[3];
cin.ignore();
break;
}
case '3' : {
gotoxy(28,12);
cout<<"Username : ";
cin>>apt[i].username;
cin.ignore();
break;
}
default :
error(1);
}
}
示例12: start_graph
void start_graph(void)
{
initscr();
raw();
color_init();
curs_set(0);
cbreak();
noecho();
nodelay(stdscr, TRUE);
scrollok(stdscr, TRUE);
draw_border();
}
示例13: wclear
void Ncurses::display(std::list<t_snake> snake, const t_food food)
{
wclear(_game);
draw_border();
for_each(snake.begin(), snake.end(), bind1st(std::mem_fun(&Ncurses::snake_body), this));
snake_head(snake.begin()->x, snake.begin()->y);
wattron(_game, COLOR_PAIR(1));
mvwprintw(_game, food.y + 1, food.x + 1, "@");
wattroff(_game, COLOR_PAIR(1));
speedup(snake.begin()->x, snake.begin()->y, food.x, food.y);
wrefresh(_game);
}
示例14: credential_input
//---------Password Check----------//
int credential_input (int acc)
{
int i,j;
char u[20],p[20];
draw_border(23,8,59,14,0);
gotoxy(26,10);
cout<<"Enter username : ";
textcolor(7);
gotoxy(45,10);
cin>>u;
cin.ignore();
gotoxy(26,12);
textcolor(8);
cout<<"Enter password : ";
textcolor(7);
for(j=0; p[j-1]!='\r'&&j!=18; j++)
{
p[j]=getch();
cout<<"*";
}
p[j-1]='\0';
if (acc ==1)
for(i=0; i<5; i++)
{
if(strcmp(u,adm[0].username)==0 && strcmp(p,adm[0].password)==0)
{
clrscr();
return 1;
}
}
else if (acc==2)
for(i=0; i<20 ; i++)
{
if(strcmp(u,apt[i].username)==0 && strcmp(p,apt[i].password)==0)
{
clrscr();
acc_no=i;
return 2;
}
}
else if (acc==3)
for(i=0; i<10 ; i++)
{
if(strcmp(u,emp[i].username)==0 && strcmp(p,emp[i].password)==0)
{
clrscr();
acc_no=i;
return 3;
}
}
return 0;
}
示例15: lem_redraw
static void lem_redraw(dcpu *dcpu) {
draw_border();
if (term.vram) {
// don't perform the indirection outside the loop. vid ram can be mapped
// toward the high end of the range, in which case we need to be careful
// that it wraps around to the start.
u16 addr = term.vram;
for (u16 i = 0; i < SCR_HEIGHT; i++)
for (u16 j = 0; j < SCR_WIDTH; j++)
draw(dcpu->ram[addr++], i, j);
}
wrefresh(term.vidwin);
}