Пример #1
0
void	CliDisplay::refresh()
{
    int	k;

    k = getch();
    if (k == KEY_ESC) {
        endwin();
        exit(0);
    }	else if (k == KEY_RESIZE) {
        resizeHandler(0);
    }

    clear();
    _refreshHostData();
    mvhline(10, 0, 0, 1042);
    _refreshCpuData();
    mvhline(27, 0, 0, 1042);
    _refreshRamData();
    mvhline(35, 0, 0, 1042);
    _refreshNetworkData();
    //mvhline(38, 0, 0, 1042);
    _refreshPonyData();

    border('|', '|', '-', '-', '+', '+', '+', '+');
    wrefresh(stdscr);
}
Пример #2
0
void LoadStage(char which)
{
    ClearSpawnQueue();
    
    mvhline(29,25,'-',60);
    mvprintw(30,25, "|                                                          |");
    mvhline(31,25,'-',60);
    
    attron(A_BOLD);
    if (which == 'w')
    {
        mvprintw(29,50,"Now loading");
    }
    else
    {
        mvprintw(29,44,"Now refreshing stage");    
    }
    attroff(A_BOLD);
    
    attron(COLOR_PAIR(10));
    curs_set(0);
    for (int i = 0; i < 58; ++i)
    {
        usleep(35000);
        mvaddch(30,26+i,' ');
        refresh();
    }
    attroff(COLOR_PAIR(10));
}
Пример #3
0
void ClearPrompts(void)
{
    mvhline(47,60,' ',40);
    mvhline(48,60,' ',40);
    mvhline(49,60,' ',40);
    Home();
}
Пример #4
0
void create_map(MAP *p_map, bool flag)
{	int i, j;
	int x, y, w, h;

	x = p_map->startx;
	y = p_map->starty;
	w = p_map->width;
	h = p_map->height;

	if(flag == TRUE)
	{	mvaddch(y, x, p_map->border.tl); // augša kreisā
		mvaddch(y, x + w, p_map->border.tr); // augša labā
		mvaddch(y + h, x, p_map->border.bl); // kreisā apakša
		mvaddch(y + h, x + w, p_map->border.br); // labā apakša
		mvhline(y, x + 1, p_map->border.ts, w - 1); // augša
		mvhline(y + h, x + 1, p_map->border.bs, w - 1); // apakša
		mvvline(y + 1, x, p_map->border.ls, h - 1); // kreisā puse
		mvvline(y + 1, x + w, p_map->border.rs, h - 1); // labā puse

	}
	else
		for(j = y; j <= y + h; ++j)
			for(i = x; i <= x + w; ++i)
				mvaddch(j, i, ' ');
				
	refresh();

}
Пример #5
0
void create_tank_down(TANK *p_tank, bool flag)
{	int i, j;
	int x, y, w, h;

	x = p_tank->startx;
	y = p_tank->starty;
	w = p_tank->width;
	h = p_tank->height;

	if(flag == TRUE)
	{	mvaddch(y, x, p_tank->border.tl); // augša kreisā
		mvaddch(y, x + w, p_tank->border.tr); // augša labā
		mvaddch(y + h, x, p_tank->border.bl); // kreisā apakša
		mvaddch(y + h, x + w, p_tank->border.br); // labā apakša
		mvhline(y, x + 1, p_tank->border.ts, w - 1); // augša
		mvhline(y + h, x + 1, p_tank->border.bs, w - 1); // apakša
		mvvline(y + 1, x, p_tank->border.ls, h - 1); // kreisā puse
		mvvline(y + 1, x + w, p_tank->border.rs, h - 1); // labā puse

		mvaddch(y+h, x + w/2, p_tank->border.gt); //stobra gals
		mvaddch(y+h-1, x + w/2, p_tank->border.gm); // stobra vidus
		mvaddch(y+2, x + w/2, p_tank->border.gb); // stobra apakša
	}
	else
		for(j = y; j <= y + h; ++j)
			for(i = x; i <= x + w; ++i)
				mvaddch(j, i, ' ');
				
	refresh();

}
Пример #6
0
void create_box(WIN *p_win, bool flag)
{	int i, j;
	int x, y, w, h;

	x = p_win->startx;
	y = p_win->starty;
	w = p_win->width;
	h = p_win->height;

	if(flag == TRUE)
	{	mvaddch(y, x, p_win->border.tl);
		mvaddch(y, x + w, p_win->border.tr);
		mvaddch(y + h, x, p_win->border.bl);
		mvaddch(y + h, x + w, p_win->border.br);
		mvhline(y, x + 1, p_win->border.ts, w - 1);
		mvhline(y + h, x + 1, p_win->border.bs, w - 1);
		mvvline(y + 1, x, p_win->border.ls, h - 1);
		mvvline(y + 1, x + w, p_win->border.rs, h - 1);

	}
	else
		for(j = y; j <= y + h; ++j)
			for(i = x; i <= x + w; ++i)
				mvaddch(j, i, ' ');
				
	refresh();

}
Пример #7
0
void create_box( WIN *p_win ) {
  int x = p_win->startx, 
      y = p_win->starty, 
      w = p_win->width, 
      h = p_win->height;

  WIN_BORDER b = p_win->border;

  // Draw the 4 corners
  mvaddch( y, x, b.tl );
  mvaddch( y, (x + w), b.tr );
  mvaddch( (y + h), x, b.bl );
  mvaddch( (y + h), (x + w), b.br );

  // Draw the top side and bottom side
  mvhline( y, (x + 1), b.ts, (w - 1) );
  mvhline( (y + h), (x + 1), b.bs, (w - 1) );

  // Draw the left side and right side
  mvvline( (y + 1), x, b.ls, (h - 1) );
  mvvline( (y + 1), (x + w), b.rs, (h - 1) );

  // Push to the screen
  refresh( );
}
Пример #8
0
void browse_draw() {
  struct dir *t;
  char fmtsize[9], *tmp;
  int selected, i;

  erase();
  t = dirlist_get(0);

  /* top line - basic info */
  attron(A_REVERSE);
  mvhline(0, 0, ' ', wincols);
  mvhline(winrows-1, 0, ' ', wincols);
  mvprintw(0,0,"%s %s ~ Use the arrow keys to navigate, press ? for help", PACKAGE_NAME, PACKAGE_VERSION);
  if(read_only)
    mvaddstr(0, wincols-11, "[read-only]");
  attroff(A_REVERSE);

  /* second line - the path */
  mvhline(1, 0, '-', wincols);
  if(t) {
    mvaddch(1, 3, ' ');
    tmp = getpath(t->parent);
    mvaddstr(1, 4, cropstr(tmp, wincols-8));
    mvaddch(1, 4+((int)strlen(tmp) > wincols-8 ? wincols-8 : (int)strlen(tmp)), ' ');
  }

  /* bottom line - stats */
  attron(A_REVERSE);
  if(t) {
    strcpy(fmtsize, formatsize(t->parent->size));
    mvprintw(winrows-1, 0, " Total disk usage: %s  Apparent size: %s  Items: %d",
      fmtsize, formatsize(t->parent->asize), t->parent->items);
  } else
    mvaddstr(winrows-1, 0, " No items to display.");
  attroff(A_REVERSE);

  /* nothing to display? stop here. */
  if(!t)
    return;

  /* get start position */
  t = dirlist_top(0);

  /* print the list to the screen */
  for(i=0; t && i<winrows-3; t=dirlist_next(t),i++) {
    browse_draw_item(t, 2+i);
    /* save the selected row number for later */
    if(t->flags & FF_BSEL)
      selected = i;
  }

  /* draw information window */
  t = dirlist_get(0);
  if(info_show && t != dirlist_parent)
    browse_draw_info(t);

  /* move cursor to selected row for accessibility */
  move(selected+2, 0);
}
Пример #9
0
Файл: vga.c Проект: kkaneda/vm
static void
print_menu ( void )
{
	mvprintw ( 0, 24, "V I R T U A L  M A C H I N E " );
	mvhline ( 1, 0, ACS_HLINE, WINDOW_WIDTH );
	mvhline ( 23, 0, ACS_HLINE, WINDOW_WIDTH );
	Refresh ( ) ;
}
Пример #10
0
void WindowManager::drawFrame(uint top, uint left, uint bottom, uint right)
{
	mvaddch(top,left,ACS_ULCORNER); mvaddch(top,right,ACS_URCORNER);
	mvhline(top,left+1,ACS_HLINE,right - left - 1);
	mvvline(top+1,left,ACS_VLINE,bottom - top - 1);
	mvvline(top+1,right,ACS_VLINE,bottom - top - 1);
	mvhline(bottom,left+1,ACS_HLINE,right - left - 1);
	mvaddch(bottom,left,ACS_LLCORNER); mvaddch(bottom,right,ACS_LRCORNER);
}
Пример #11
0
static void		print_victory(void)
{
	clear();
	mvprintw(LINES / 2, COLS / 2 - 4, "YOU WIN!");
	mvhline(LINES / 2 - 2, COLS / 2 - 10, 0, 21);
	mvvline(LINES / 2 - 1, COLS / 2 - 10, 0, 4);
	mvvline(LINES / 2 - 1, COLS / 2 + 10, 0, 4);
	mvhline(LINES / 2 + 2, COLS / 2 - 10, 0, 21);
	refresh();
	sleep(3);
}
Пример #12
0
void StatFormBase::LoadEmptyMenu()
{
	mvhline(4,0,' ',COLS_LENS);//清标题
	for(int i=6;i<LINE_SIZE+6;i++)
	{
		mvhline(i,0,' ',COLS_LENS);	
	}
	//mvhline(5 + LINE_SIZE + 3,0,' ',COLS_LENS);
	mvaddstr(5 + LINE_SIZE + 3,18,(char *)"Up Arrow = 向上   Down Arrow = 向下   Left Arrow = 前页   Right Arrow = 后页   ESC = 退出"); 
	return;	
}
Пример #13
0
void rectangle(int y1, int x1, int y2, int x2)
{
	attron(A_BOLD);
	mvhline(y1, x1+1, 0, x2-x1);
	mvhline(y2, x1+1, 0, x2-x1);
	mvvline(y1+1, x1, 0, y2-y1);
	mvvline(y1+1, x2, 0, y2-y1);
	mvaddch(y1, x1, ACS_ULCORNER);
	mvaddch(y1, x2, ACS_URCORNER);
	mvaddch(y2, x1, ACS_LLCORNER);
	mvaddch(y2, x2, ACS_LRCORNER);
	attroff(A_BOLD);
}
Пример #14
0
int draw_box(int x, int y, int hight, int width)
{
  mvhline(y, x+1, ACS_HLINE, width-1);
  mvhline(y+hight, x+1, ACS_HLINE, width-1);
  mvvline(y+1, x, ACS_VLINE, hight-1);
  mvvline(y+1, x+width, ACS_VLINE, hight-1);
  mvaddch(y, x, ACS_ULCORNER);
  mvaddch(y, x+width, ACS_URCORNER);
  mvaddch(y+hight, x, ACS_LLCORNER);
  mvaddch(y+hight, x+width, ACS_LRCORNER);

  refresh();
}
Пример #15
0
void Credits(void)
{
    clear();
    PrintOutline();
    ClearWindows();
    char *name[] = {"Tamara Charchoghlyan", 
                    "Alexander Fong", 
                    "Ethan Gagne", 
                    "Courtney Kolthof", 
                    "Alliyya Mo", 
                    "Vivian Ng",
                    "Ajeesh S", 
                    "Julian Tang",
                    "Jake Uskoski"};
    ClearWindows();
    curs_set(0);
    attron(A_BOLD);
    
    mvprintw(7,18,"                                                                        __ ");
    mvprintw(8,18,"                                                                       |  |");
    mvprintw(9,18," _____ _           _          ___                _         _           |  |");
    mvprintw(10,18,"|_   _| |_ ___ ___| |_ ___   |  _|___ ___    ___| |___ _ _|_|___ ___   |__|");
    mvprintw(11,18,"  | | |   | .'|   | '_|_ -|  |  _| . |  _|  | . | | .'| | | |   | . |   __ ");
    mvprintw(12,18,"  |_| |_|_|__,|_|_|_,_|___|  |_| |___|_|    |  _|_|__,|_  |_|_|_|_  |  |__|");
    mvprintw(13,18,"                                            |_|       |___|     |___|      ");
    
    for (int j = 0; j < 19; ++j)
    {
        for (int i = 0; i < 9; ++i)
        {
            if (j!=0)
            {
                mvhline(35+i-j,22,' ',80);
                mvhline(33+i-j+1,22,' ',80);
                mvhline(35+i-j+1,22,' ',80);
            }
        }

        mvprintw(33-j,45,"Developers & Designers");
        mvprintw(35-j,22,"%s\t%s\t\t%s",name[0],name[1],name[2]);
        mvprintw(36-j,22,"%s\t\t%s\t\t%s",name[3],name[4],name[5]);
        mvprintw(37-j,22,"%s\t\t\t%s\t\t%s",name[6],name[7],name[8]);
        mvprintw(40-j,22,"Special Thanks to Dave McCaughan and his many life lessons");
        mvprintw(43-j,22,"\t\t\"We drink because of group work.\" - Dave");
        usleep(250000);
        refresh();
    }
    attroff(A_BOLD);
    usleep(950000);
    // getchar();
}
Пример #16
0
/*Function to print the desired box at a desired location*/
void printbox(int ux, int uy, boxx b){
	mvvline(uy, ux, 0, b.length);
	mvvline(uy, ux+b.length, 0, b.length);
	mvhline(uy, ux, 0, b.length);
	mvhline(uy+b.length, ux, 0, b.length);
	mvaddch(uy, ux, ACS_ULCORNER);
	mvaddch(uy, ux+b.length, ACS_URCORNER);
	mvaddch(uy+b.length, ux, ACS_LLCORNER);
	mvaddch(uy+b.length, ux+b.length, ACS_LRCORNER);
	if(b.value == ' ')
		mvaddch(uy+b.length/2, ux+b.length/2, b.value);
	else
		mvprintw(uy+b.length/2, ux+b.length/2, "%d", b.value);
}
Пример #17
0
/* Helper functions */
static void message(FILE *output_fd, const char *prefix, const char *fmt, va_list ap)
{
	va_list tmp;

	/* Log to standard out */
	if (output_fd) {
		va_copy(tmp, ap);
		fprintf(output_fd, "%s: ", prefix);
		vfprintf(output_fd, fmt, tmp);
		fprintf(output_fd, "\n");
	}

	/* Log to debug file */
	if (debug_fd) {
		va_copy(tmp, ap);
		fprintf(debug_fd, "%s: ", prefix);
		vfprintf(debug_fd, fmt, tmp);
		fprintf(debug_fd, "\n");
	}

	/* Log to status bar */
	if (&COMPACT && stdscr) {
		int rev = COMPACT ? A_BOLD : 0;
		va_copy(tmp, ap);
		if (!COMPACT)
			mvhline(LINES-2, 0, ACS_HLINE, COLS);
		move(LINES-1, 0);
		attron(COLOR_PAIR(COLOR_ERROR) | rev);
		vwprintw(stdscr, fmt, tmp);
		attroff(COLOR_PAIR(COLOR_ERROR) | rev);
		if (!COMPACT)
			clrtoeol();
	}
}
Пример #18
0
void
list_headerline()
{
	struct index_elem *e;
	int x_pos = 1, width;
	char *str = NULL;

#if defined(A_BOLD) && defined(A_NORMAL)
	attrset(A_BOLD);
#endif
	attrset(COLOR_PAIR(CP_LIST_HEADER));
	mvhline(2, 0, ' ', COLS);

	for(e = index_elements; e; e = e->next)
		if(e->type == INDEX_TEXT)
			x_pos += strwidth(e->d.text);
		else if(e->type == INDEX_FIELD) {
			get_field_info(e->d.field.id, NULL, &str, NULL);
			width = e->d.field.len ?
				abs(e->d.field.len) : strwidth(str);
			if(width + x_pos > COLS)
				width = bytes2width(str, COLS - x_pos);
			mvaddnstr(2, x_pos, str, width);
			x_pos += width;
		} else
			assert(0);

#if defined(A_BOLD) && defined(A_NORMAL)
	attrset(A_NORMAL);
#endif
}
void draw(char game_grid[16][16]) {
	mvvline(1, 1, '|', 18);
	mvvline(1, 18, '|', 18);
	mvhline(1, 1, '-', 18);
	mvhline(18, 1, '-', 18);
  int r, c;
	for(r = 0; r < 16; r++) {
		for(c = 0; c < 16; c++) {
			mvaddch(r+2, c+2, game_grid[r][c]);
		}
	}
	mvaddstr(20, 1, "*WASD to play, Q to quit*");
	mvaddstr(21, 5, "**EARLY ALPHA**");
	mvaddstr(22, 6, "***HAS BUGS***");
	refresh();
}
Пример #20
0
void nccreate(int height, int width, const char *title) {
  int i;

  subwinr = winrows/2-height/2;
  subwinc = wincols/2-width/2;

  /* clear window */
  for(i=0; i<height; i++)
    mvhline(subwinr+i, subwinc, ' ', width);

  /* box() only works around curses windows, so create our own */
  move(subwinr, subwinc);
  addch(ACS_ULCORNER);
  for(i=0; i<width-2; i++)
    addch(ACS_HLINE);
  addch(ACS_URCORNER);

  move(subwinr+height-1, subwinc);
  addch(ACS_LLCORNER);
  for(i=0; i<width-2; i++)
    addch(ACS_HLINE);
  addch(ACS_LRCORNER);

  mvvline(subwinr+1, subwinc, ACS_VLINE, height-2);
  mvvline(subwinr+1, subwinc+width-1, ACS_VLINE, height-2);

  /* title */
  attron(A_BOLD);
  mvaddstr(subwinr, subwinc+4, title);
  attroff(A_BOLD);
}
Пример #21
0
void ClearUserSelection(void)
{
    for (int i = 0; i < 9; ++i)
    {
        mvhline(46+i,6,' ',95);
    }
}
Пример #22
0
int main()
{   
	initscr();   //初始化全屏幕,全局的WINDOW* stdscr代表整个屏幕
	printw("hello world.");
	mvprintw(5,6,"hello world.");
	//画出一行的一部分
	mvhline(LINES/2,5,'=',COLS-10);
	//画出一列的一部分
	mvvline(2,4,'|',LINES-4);
	
	//LINES,COLS系统初始化的代表屏幕的行和列,编号从零开始
	mvprintw(LINES/2-1,(COLS-strlen("hello world."))/2-1,"hello world");

        //画出一个框
	box(stdscr,0,0);
	//隐藏光标
	curs_set(0);
	
	refresh();
	//scanw()
	getch();
	endwin();
	
	return 0;
}
Пример #23
0
void updategui(dcpu16 *cpu) {
    mvprintw(0, 0, "dcpu16emu");
    mvhline(1, 0, ACS_BULLET, 10);


    updatescreen(cpu);
    updatestatus(cpu);
}
Пример #24
0
void RedrawResources(Level * lvl)
{
    mvhline(5,92,' ',6);
    attron(A_BOLD);
    mvprintw(5,92,"$%d",lvl->resources);
    attroff(A_BOLD);
    Home();
}
Пример #25
0
void RedrawHP(Level * lvl)
{
    mvhline(5,61,' ',5);
    attron(A_BOLD);
    mvprintw(5,60,"%d",lvl->health);
    attroff(A_BOLD);
    Home();
}
Пример #26
0
static void OpenFilesScreen_draw(OpenFilesScreen* htop_this, IncSet* inc) {
     attrset(CRT_colors[METER_TEXT]);
     mvhline(0, 0, ' ', COLS);
     mvprintw(0, 0, "Snapshot of files open in process %d - %s", htop_this->pid, htop_this->process->comm);
     attrset(CRT_colors[DEFAULT_COLOR]);
     Panel_draw(htop_this->display, true);
     IncSet_drawBar(inc);
}
Пример #27
0
static void draw_looking_for(unsigned int pgno, unsigned int subno)
{
    char subnos[3] = "*";
    if (subno != VBI_ANY_SUBNO)
        sprintf(subnos, "%02x", subno);
    mvhline(2, 43, ' ', COLS - 43);
    mvprintw(2, 43, "Looking for %03X.%s", pgno, subnos);
}
Пример #28
0
/* TODO: seek_indirect() and seek_tag_table() are almost identical: remove duplicate code */
int
seek_indirect(FILE * id)
{
	int finito = 0;
	long seek_pos;
	int input;
	char *type = xmalloc(1024);
	fseek(id, 0, SEEK_SET);
	while (!finito)		/*
						 * scan through the file, searching for "indirect:"
						 * string in the type(header) line of node.
						 */
	{
		while ((input = fgetc(id)) != INFO_TAG)
			if (input == EOF)
			{
				if (type)
				{
					xfree(type);
					type = 0;
				}
				return 0;
			}
		seek_pos = ftell(id) - 2;
		fgetc(id);
		if (fgets(type, 1024, id)==0)
		{
			/* we're at the end of the file and haven't found any indirect refs. so bail out */
			if (type)
			{
				xfree(type);
				type = 0;
			}
			return 0;
		}
		if (strncasecmp("Indirect:", type, strlen("Indirect:")) == 0)
		{
			finito = 1;
		}
	}
	xfree(type);
	type = 0;
	if (!curses_open)
	{
		printf(_("Searching for indirect done"));
		printf("\n");
	}
	else
	{
		attrset(bottomline);
		mvhline(maxy - 1, 0, ' ', maxx);
		mvaddstr(maxy - 1, 0, _("Searching for indirect done"));
		attrset(normal);
	}
	fseek(id, seek_pos, SEEK_SET);
	return 1;
}
Пример #29
0
void interactiveInit() {
    if (!Modes.interactive)
        return;

    initscr();
    clear();
    refresh();

    mvprintw(0, 0, " Hex    Mode  Sqwk  Flight   Alt    Spd  Hdg    Lat      Long   RSSI  Msgs  Ti");
    mvhline(1, 0, ACS_HLINE, 80);
}
Пример #30
0
static void percentage(const unsigned int y, const unsigned int w, const float p) {

	const unsigned int x = (w/2) + 2;
	unsigned int len = w - x - 1;

	len = len * (p / 100.0);

	attron(A_REVERSE);
	mvhline(y, x, ' ', len);
	attroff(A_REVERSE);
}