• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ display函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: XUnmapWindow

Menu::~Menu()
{
    XUnmapWindow(display(), m_window[screen()]);
}
开发者ID:bbidulock,项目名称:wmx,代码行数:4,代码来源:Menu.C


示例2: main

int main(int argc, char **argv)
{

    int i;
    for (i = 1; i < argc; ++i) {
        const char *arg = argv[i];

        if (arg[0] != '-') {
            break;
        }

        if (!strcmp(arg, "--")) {
            break;
        } else if (!strcmp(arg, "-b")) {
            benchmark = true;
            retrace::verbosity = -1;
        } else if (!strcmp(arg, "-c")) {
            compare_prefix = argv[++i];
            if (snapshot_frequency == FREQUENCY_NEVER) {
                snapshot_frequency = FREQUENCY_FRAME;
            }
        } else if (!strcmp(arg, "-D")) {
            dump_state = atoi(argv[++i]);
            retrace::verbosity = -2;
        } else if (!strcmp(arg, "-db")) {
            double_buffer = true;
        } else if (!strcmp(arg, "-sb")) {
            double_buffer = false;
        } else if (!strcmp(arg, "--help")) {
            usage();
            return 0;
        } else if (!strcmp(arg, "-s")) {
            snapshot_prefix = argv[++i];
            if (snapshot_frequency == FREQUENCY_NEVER) {
                snapshot_frequency = FREQUENCY_FRAME;
            }
        } else if (!strcmp(arg, "-S")) {
            arg = argv[++i];
            if (!strcmp(arg, "frame")) {
                snapshot_frequency = FREQUENCY_FRAME;
            } else if (!strcmp(arg, "framebuffer")) {
                snapshot_frequency = FREQUENCY_FRAMEBUFFER;
            } else if (!strcmp(arg, "draw")) {
                snapshot_frequency = FREQUENCY_DRAW;
            } else {
                std::cerr << "error: unknown frequency " << arg << "\n";
                usage();
                return 1;
            }
            if (snapshot_prefix == NULL) {
                snapshot_prefix = "";
            }
        } else if (!strcmp(arg, "-v")) {
            ++retrace::verbosity;
        } else if (!strcmp(arg, "-w")) {
            wait = true;
        } else {
            std::cerr << "error: unknown option " << arg << "\n";
            usage();
            return 1;
        }
    }

    ws = glws::createNativeWindowSystem();
    visual = ws->createVisual(double_buffer);

    for ( ; i < argc; ++i) {
        if (!parser.open(argv[i])) {
            std::cerr << "error: failed to open " << argv[i] << "\n";
            return 1;
        }

        display();

        parser.close();
    }

    return 0;
}
开发者ID:pzick,项目名称:apitrace,代码行数:79,代码来源:glretrace_main.cpp


示例3: display

//----------------------------------------------------------------------------------------------
void LoggerWidget::logSuccess (const QString & info)
{
    _logConsole->setTextColor (Qt::green);
    display (info);
}
开发者ID:cdonnat,项目名称:QSeriesHunter,代码行数:6,代码来源:loggerwidget.cpp


示例4: main


//.........这里部分代码省略.........
		case 'O':		/* PSQF_ORDER */
		case 'p':		/* PSQF_PATH */
		case 'r':		/* PSQF_RESULT */
		case 'R':		/* PSQF_PROGRAM */
		case 's':		/* PSQF_STAMP */
		case 'S':		/* PSQF_SEVERITY */
		case 't':		/* PSQF_FTYPE */
		case 'T':		/* PSQF_TEXT */
		case 'u':		/* PSQF_UID */
		case 'y':		/* PSQF_TYPE */
			new_trait = plog_trait(o, optarg);
			if (!new_trait) {
				bad_args = 1;
			}
			break;
		case 'h':
			usage(EXIT_SUCCESS);
			break;
		case '?':		/* FALLTHROUGH */
		default:
			fprintf(stderr, "unknown option '%c'\n", optopt);
			usage(EXIT_FAILURE);
			break;
		}
		if (new_trait) {
			if (current) {
				current->next = new_trait;
				current = current->next;
			} else {
				traits = new_trait;
				current = new_trait;
			}
			new_trait = 0;
		}
	}

	if (optind < argc) {
		pseudo_diag("Error: Extra arguments not associated with any option.\n");
		usage(EXIT_FAILURE);
	}

	if (query_only && opt_l) {
		pseudo_diag("Error: -l cannot be used with query-only options or flags.\n");
		bad_args = 1;
	}

	/* should be set only if we have already diagnosed the bad arguments. */
	if (bad_args)
		exit(EXIT_FAILURE);

	if (!pseudo_get_prefix(argv[0])) {
		pseudo_diag("Can't figure out prefix.  Set PSEUDO_PREFIX or invoke with full path.\n");
		exit(EXIT_FAILURE);
	}

	if (!pseudo_get_bindir()) {
		pseudo_diag("Can't figure out bindir.  Set PSEUDO_BINDIR.\n");
		exit(EXIT_FAILURE);
	}

	if (!pseudo_get_libdir()) {
		pseudo_diag("Can't figure out libdir.  Set PSEUDO_LIBDIR.\n");
		exit(EXIT_FAILURE);
	}

	if (!pseudo_get_localstatedir()) {
		pseudo_diag("Can't figure out localstatedir.  Set PSEUDO_LOCALSTATEDIR.\n");
		exit(EXIT_FAILURE);
	}

	if (opt_l) {
		pdb_log_traits(traits);
	} else {
		int fields;
		fields = format_scan(format);
		if (fields == -1) {
			pseudo_diag("couldn't parse format string (%s).\n", format);
			return EXIT_FAILURE;
		}
		if (opt_D) {
			if (pdb_delete(traits, fields)) {
				pseudo_diag("errors occurred trying to delete entries.\n");
			}
		} else {
			history = pdb_history(traits, fields, opt_U);
			if (history) {
				log_entry *e;
				while ((e = pdb_history_entry(history)) != NULL) {
					display(e, format);
					log_entry_free(e);
				}
				pdb_history_free(history);
			} else {
				pseudo_diag("could not retrieve history.\n");
				return EXIT_FAILURE;
			}
		}
	}
	return 0;
}
开发者ID:cgwalters,项目名称:pseudo,代码行数:101,代码来源:pseudolog.c


示例5: processUdpPacket

void processUdpPacket( struct trafficRecord *tr, const u_char *packet ) {
  const struct udphdr *udp_ptr;
  const char *payload;
  const char *tmp_ptr;
  const int size_udp = sizeof( struct udphdr );

  PRIVATE int bytes_sent;
  PRIVATE u_int ip_hlen, ip_ver, ip_off, ip_offidx;
  PRIVATE int ip_len;
  PRIVATE char s_ip_addr_str[MAX_IP_ADDR_LEN+1];
  PRIVATE char d_ip_addr_str[MAX_IP_ADDR_LEN+1];
  PRIVATE struct in_addr addr;
  PRIVATE struct tm pkt_time;
  PRIVATE int payload_size;
  /* pre-allocated traffic record */
  PRIVATE struct trafficRecord *tr_tmp, *tmpTrPtr;
  PRIVATE struct tcpFlow *tf_ptr;
  time_t currentTime = time( NULL );

  /* process packet */

  /*
   * udp decode
   */

#ifdef DEBUG
  if ( config->debug >= 5 ) {
    display( LOG_DEBUG, "UDP packet" );
  }
#endif

  /* pointers are fun */
  udp_ptr = (struct udphdr*)( packet );

#ifdef BSD_DERIVED
  tr->sPort = ntohs( udp_ptr->uh_sport );
  tr->dPort = ntohs( udp_ptr->uh_dport );
#else
  tr->sPort = ntohs( udp_ptr->source );
  tr->dPort = ntohs( udp_ptr->dest );
#endif

#ifdef DEBUG
  if ( config->debug >= 3 ) {
    display( LOG_INFO, "UDP: S: %d D: %d", ntohs( tr->sPort ), ntohs( tr->dPort ) );
  }
#endif

  /*
   * write to log
   */
    
  XSTRNCPY( s_ip_addr_str, inet_ntoa( tr->sIp ), MAX_IP_ADDR_LEN );
  XSTRNCPY( d_ip_addr_str, inet_ntoa( tr->dIp ), MAX_IP_ADDR_LEN );
  fprintf( config->log_st, "[%04d/%02d/%02d %02d:%02d:%02d] %16s:%-5u -> %16s:%-5u UDP\n",
	   tr->wireTime.tm_year+1900,
	   tr->wireTime.tm_mon+1,
	   tr->wireTime.tm_mday,
	   tr->wireTime.tm_hour,
	   tr->wireTime.tm_min,
	   tr->wireTime.tm_sec,
	   s_ip_addr_str,
	   tr->sPort,
	   d_ip_addr_str,
	   tr->dPort
	   );

  /*
   * done with packet, fall through
   */
  
  /* cleanup, we will do nothing with this packet */
  return;
}
开发者ID:rondilley,项目名称:wirespy,代码行数:74,代码来源:process_udp.c


示例6: display

void InterfaceTree::interfaceListChanged()
{
#ifdef HAVE_LIBPCAP
    display();
#endif
}
开发者ID:pstavirs,项目名称:wireshark,代码行数:6,代码来源:interface_tree.cpp


示例7: delayMicroseconds

void rgb_lcd::begin(uint8_t cols, uint8_t lines, uint8_t dotsize) 
{

    Wire.begin();
    
    if (lines > 1) {
        _displayfunction |= LCD_2LINE;
    }
    _numlines = lines;
    _currline = 0;

    // for some 1 line displays you can select a 10 pixel high font
    if ((dotsize != 0) && (lines == 1)) {
        _displayfunction |= LCD_5x10DOTS;
    }

    // SEE PAGE 45/46 FOR INITIALIZATION SPECIFICATION!
    // according to datasheet, we need at least 40ms after power rises above 2.7V
    // before sending commands. Arduino can turn on way befer 4.5V so we'll wait 50
    delayMicroseconds(50000);


    // this is according to the hitachi HD44780 datasheet
    // page 45 figure 23

    // Send function set command sequence
    command(LCD_FUNCTIONSET | _displayfunction);
    delayMicroseconds(4500);  // wait more than 4.1ms

    // second try
    command(LCD_FUNCTIONSET | _displayfunction);
    delayMicroseconds(150);

    // third go
    command(LCD_FUNCTIONSET | _displayfunction);


    // finally, set # lines, font size, etc.
    command(LCD_FUNCTIONSET | _displayfunction);

    // turn the display on with no cursor or blinking default
    _displaycontrol = LCD_DISPLAYON | LCD_CURSOROFF | LCD_BLINKOFF;
    display();

    // clear it off
    clear();

    // Initialize to default text direction (for romance languages)
    _displaymode = LCD_ENTRYLEFT | LCD_ENTRYSHIFTDECREMENT;
    // set the entry mode
    command(LCD_ENTRYMODESET | _displaymode);
    
    
    // backlight init
    setReg(0, 0);
    setReg(1, 0);
    setReg(0x08, 0xAA);     // all led control by pwm
    
    setColorWhite();

}
开发者ID:gchai,项目名称:KTNE-Arduino,代码行数:61,代码来源:rgb_lcd.cpp


示例8: player2

    void player2()
     {
       do
	{
	  cout<<endl;
	  textcolor(RED);
	  clreol();
	  cout<<"  PLAYER 2's MOVE"<<endl<<endl;
	  cout<<"  ENTER THE COORDINATES WHERE YOU WANT TO PUT YOUR 'O' "<<endl;
	  cout<<"  x=";
	  cin>>x;
	  if(x==-1)
	     menu();
	  cout<<endl;
	  cout<<"  y=";
	  cin>>y;
	  if((x<0)||(x>2)||(y<0)||(y>2))            //check for valid coordinates
	    {
	     cout<<endl;
	     textcolor(BLUE);
	     clreol();
	     cout<<" *.ENTER THE CORRECT COORDINATES!!!!"<<endl<<endl;
	    }
	}while((x<0)||(x>2)||(y<0)||(y>2));

       if(tic[x][y]==' ')                        //check for vacant space at entered coordinates
	   {
	     tic[x][y]='O';
	     cout<<endl<<endl;
	     ++sum;
	     textbackground(GREEN);
	     textcolor(WHITE);
	     clrscr();
	     display();                     //calling function display
	   }
       else
	   {
	     textcolor(BLUE);
	     clreol();
	     cout<<"\t\tTHIS POSITION IS ALREADY FILLED."<<endl;
	     textcolor(BLUE);
	     clreol();
	     cout<<"\t\tCHOOSE SOME OTHER COORDINATES"<<endl;
	     player2();                              //user function call
	   }

     d=check();                                  //check function call
     if(d==0)
       {
	 if(sum==9)
	    draw();
	 else
	    user();	                        //user function call
       }
     else
       {
	 cout<<endl;
	 player2win();

       }
   }
开发者ID:vipulk10,项目名称:Tic-Tac-Toe,代码行数:61,代码来源:tictactoe.cpp


示例9: selectionsort

void selectionsort(struct node **start)
{	struct node *ptr1,*ptr2,*ptr3,*ptr4,*ptr5;
	ptr1=*start;
    while(ptr1->next!=NULL)
	{
		ptr2=ptr1->next;
	    while(ptr2!=NULL)
		{
			if(ptr1->data>ptr2->data)
			{
			 	if(ptr1==*start)
				{
					if(ptr2==ptr1->next)
					{
						ptr1->next=ptr2->next;
						ptr2->next=ptr1;
						*start=ptr2;
						ptr3=ptr1;
						ptr1=ptr2;
						ptr2=ptr3;
						}
					else
					{
						ptr3=ptr1->next;
						ptr1->next=ptr2->next;
						ptr4->next=ptr1;
						ptr2->next=ptr3;
						*start=ptr2;
						ptr3=ptr1;
						ptr1=ptr2;
						ptr2=ptr3;	
					}
				}
				else
				{
					if(ptr2==ptr1->next)
					{
					ptr1->next=ptr2->next;
					ptr2->next=ptr1;
					ptr5->next=ptr2;
					ptr3=ptr1;
					ptr1=ptr2;
					ptr2=ptr3;
					}
		   			else
		   		{
				    ptr3=ptr1->next;
		   		    ptr1->next=ptr2->next;
		   		    ptr4->next=ptr1;
		   		    ptr2->next=ptr3;
		   		    ptr5->next=ptr2;
		   		    ptr3=ptr1;
		   		    ptr1=ptr2;
					ptr2=ptr3;
	            }
		   	 }
	     	
	    }
	       ptr4=ptr2;
	        ptr2=ptr2->next;
			
	}
	display(&*start);
      		 printf("\n");
      		 ptr5=ptr1;
	   		ptr1=ptr1->next;
}
}
开发者ID:sanjeev2210,项目名称:Codeskils,代码行数:68,代码来源:selectionll.c


示例10: arguemnts

/*======== void parse_file () ==========
Inputs:   char * filename 
          struct matrix * transform, 
          struct matrix * pm,
          screen s
	  color c
Returns: 

Goes through the file named filename and performs all of the actions listed in that file.
The file follows the following format:
     Every command is a single character that takes up a line
     Any command that requires arguments must have those arguments in the second line.
     The commands are as follows:
         l: add a line to the edge matrix - 
	    takes 6 arguemnts (x0, y0, z0, x1, y1, z1)
	 i: set the transform matrix to the identity matrix - 
	 s: create a scale matrix, 
	    then multiply the transform matrix by the scale matrix - 
	    takes 3 arguments (sx, sy, sz)
	 t: create a translation matrix, 
	    then multiply the transform matrix by the translation matrix - 
	    takes 3 arguments (tx, ty, tz)
	 x: create an x-axis rotation matrix,
	    then multiply the transform matrix by the rotation matrix -
	    takes 1 argument (theta)
	 y: create an y-axis rotation matrix,
	    then multiply the transform matrix by the rotation matrix -
	    takes 1 argument (theta)
	 z: create an z-axis rotation matrix,
	    then multiply the transform matrix by the rotation matrix -
	    takes 1 argument (theta)
	 a: apply the current transformation matrix to the 
	    edge matrix
	 v: draw the lines of the edge matrix to the screen
	    display the screen
	 g: draw the lines of the edge matrix to the screen
	    save the screen to a file -
	    takes 1 argument (file name)
	 q: end parsing

See the file script for an example of the file format


IMPORTANT MATH NOTE:
the trig functions int math.h use radian mesure, but us normal
humans use degrees, so the file will contain degrees for rotations,
be sure to conver those degrees to radians (M_PI is the constant
for PI)

jdyrlandweaver
====================*/
void parse_file ( char * filename, 
                  struct matrix * transform, 
                  struct matrix * pm,
                  screen s ,
		  color c ) {
  FILE *file = fopen(filename,"r");
  char *line = (char *)malloc(MAX_LINE_SIZE);
  double *args = (double *)malloc(MAX_ARG_SIZE * sizeof(double));

  while(fgets(line,MAX_LINE_SIZE,file)) {
    switch (line[0]) {
    case 'l':
      read_args(file,args);
      add_edge(pm,args[0],args[1],args[2],args[3],args[4],args[5]);
      break;
    case 'i':
      ident(transform);
      break;
    case 's':
      read_args(file,args);
      struct matrix *scale = make_scale(args[0],args[1],args[2]);
      matrix_mult(scale,transform);
      free_matrix(scale);
      break;
    case 't':
      read_args(file,args);
      struct matrix *translate = make_translate(args[0],args[1],args[2]);
      matrix_mult(translate,transform);
      free_matrix(translate);
      break;
    case 'x':
      read_args(file,args);
      struct matrix *rotx = make_rotX(args[0]);
      matrix_mult(rotx,transform);
      free_matrix(rotx);
      break;
    case 'y':
      read_args(file,args);
      struct matrix *roty = make_rotY(args[0]);
      matrix_mult(roty,transform);
      free_matrix(roty);
      break;
    case 'z':
      read_args(file,args);
      struct matrix *rotz = make_rotZ(args[0]);
      matrix_mult(rotz,transform);
      free_matrix(rotz);
      break;
    case 'a':
//.........这里部分代码省略.........
开发者ID:stuydw,项目名称:transformations,代码行数:101,代码来源:parser.c


示例11: comp


//.........这里部分代码省略.........
      if(a==3)
	{
	 for(int x=0;x<3;++x)
	    {
	     if(tic[0][x]!=' '&& tic[0][x]== tic[1][x] && tic[2][x]==' ')
	      {
		 a=2;
		 b=x;
		 break;
	      }
	  else
	  if(tic[0][x]!=' '&& tic[0][x]== tic[2][x] && tic[1][x]==' ')
	      {
		 a=1;
		 b=x;
		 break;
	      }
	  else
	  if(tic[1][x]!=' '&& tic[1][x]== tic[2][x] && tic[0][x]==' ')
	      {
		 a=0;
		 b=x;
		 break;
	      }
	 }
	 }
      if(a==3)
	{
	  if(tic[0][0]!=' '&& tic[0][0]== tic[1][1] && tic[2][2]==' ')
	      {
		 a=2;
		 b=2;
	      }
	   else
	  if(tic[0][0]!=' '&& tic[0][0]== tic[2][2] && tic[1][1]==' ')
	      {
		 a=1;
		 b=1;
	      }
	  else
	  if(tic[1][1]!=' '&& tic[1][1]== tic[2][2] && tic[0][0]==' ')
	      {
		 a=0;
		 b=0;
	      }
	  else
	  if(tic[0][2]!=' '&& tic[0][2]== tic[1][1] && tic[2][0]==' ')
	      {
		 a=2;
		 b=0;

	      }
	  else
	  if(tic[0][2]!=' '&& tic[0][2]== tic[2][0] && tic[1][1]==' ')
	      {
		 a=1;
		 b=1;

	      }
	  else
	  if(tic[1][1]!=' '&& tic[1][1]== tic[2][0] && tic[0][2]==' ')
	      {
		 a=0;
		 b=2;

	      }
	   }
	  if(a==3)
	   {
	    for(int m=0;m<=2;++m)
	      for(int l=0;l<=2;++l)
		    {
		      if(tic[m][l]==' ')
			 {
			   a=m;
			   b=l;
			   break;
			 }
		    }
	  }

       tic[a][b]='O';
       ++sum;
       display();
       d=check();
       if(d==0)
	  if(sum==9)
	    draw();
	  else
	     user();
       else
	 {
	   cout<<endl;
	   getch();
	   pcwin();

	 }
	   getch();
	   menu();
     }
开发者ID:vipulk10,项目名称:Tic-Tac-Toe,代码行数:101,代码来源:tictactoe.cpp


示例12: main

int main()
{//intializing the chessboard
    /**********************************************************************/

     for(int i=0;i<8;i++)
    {
        for(int j=0;j<8;j++)
        {
            chessboard[i][j]=NULL;
        }
    }
    //initializing white horse
    whorse[0].setposition(0,1);
    chessboard[0][1]=&whorse[0];
    whorse[1].setposition(0,6);
    chessboard[0][6]=&whorse[1];
    //initializing black horse
    bhorse[0].setposition(7,1);
    chessboard[7][1]=&bhorse[0];
    bhorse[1].setposition(7,6);
    chessboard[7][6]=&bhorse[1];
    //initializing white uut
    wuut[0].setposition(0,2);
    chessboard[0][2]=&wuut[0];
    wuut[1].setposition(0,5);
    chessboard[0][5]=&wuut[1];
    //intializing white uut
    buut[0].setposition(7,2);
    chessboard[7][2]=&buut[0];
    buut[1].setposition(7,5);
    chessboard[7][5]=&buut[1];

    welephant[0].setposition(0,0);//initializing white elephant
    chessboard[0][0]=&welephant[0];

    welephant[1].setposition(0,7);
    chessboard[0][7]=&welephant[1];

 belephant[0].setposition(7,0);//initializing black elephant1
    chessboard[7][0]=&belephant[0];
    //chessboard[7][0]->setposition(7,0);

    belephant[1].setposition(7,7);//initializing black elephant1
    chessboard[7][7]=&belephant[1];
    //chessboard[7][7]->setposition(7,7);
    for(int j=0;j<8;j++)             //initializing blacksoldier
    {
        b[j].setposition(6,j);
        chessboard[6][j]=&b[j];

    }
          bk.setposition(7,3);
      chessboard[7][3]=&bk;//initializing black king

            wk.setposition(0,3);
      chessboard[0][3]=&wk;//initializing white king
    for(int j=0;j<8;j++)//initializing whitesoldier
    {
        w[j].setposition(1,j);
        chessboard[1][j]=&w[j];

    }
     bqueen.setposition(7,4);
    chessboard[7][4]=&bqueen;//initializing black queen

    wqueen.setposition(0,4);//initiliazing white queen
    chessboard[0][4]=&wqueen;
int blackcurposx,blackcurposy;
int whitecurposx,whitecurposy;
//getbothkingpos(wk,bk,blackcurposx,blackcurposy,whitecurposx,whitecurposy);
/*******************************************************************************/
string player1,player2;
int player1x,player1y;
int player2x,player2y;
int choice;
cout<<"player 1::white player\"WHITE BACKGROUND\"\n";
cout<<"player 2::black player\"BLACK BACKGROUND\"\n\n";
system("color 70");
cout<<"Player 1 name::";
cin>>player1;
system("color 07");
cout<<"Player 2 name::";
cin>>player2;
cout<<"\nlets start\n";
display();
while(2){
 cout<<player1<<"chance:\n";
while(2)
{
        system("color 70");
    cout<<"enter cordinates \n";
    while(2)
    {
        cin>>player1x;
        cin>>player1y;
        if(chessboard[player1x][player1y]==NULL)
        {
            cout<<"pls "<<player1<<",select players\n";
        }
        else if(chessboard[player1x][player1y]->givetypeofplayer()==0)
//.........这里部分代码省略.........
开发者ID:Ankit-jhunjhunwala22,项目名称:chess-using-c-,代码行数:101,代码来源:main.cpp


示例13: m_items

Menu::Menu(WindowManager *manager, XEvent *e)
    : m_items(0), m_nItems(0), m_nHidden(0),
      m_hasSubmenus(False),
      m_windowManager(manager),
      m_event(e)
{
    if (!m_initialised)
    {
	XGCValues *values;
	XSetWindowAttributes *attr;

        m_menuGC = (GC *) malloc(m_windowManager->screensTotal() * sizeof(GC));
        m_window = (Window *) malloc(m_windowManager->screensTotal() *
				     sizeof(Window));
#ifdef CONFIG_USE_XFT
	char *fi = strdup(CONFIG_MENU_FONT);
	char *ffi = fi, *tokstr = fi;
	while ((fi = strtok(tokstr, ","))) {
		
	    fprintf(stderr, "fi = \"%s\"\n", fi);
	    tokstr = 0;
	    
	    FcPattern *pattern = FcPatternCreate();
	    FcPatternAddString(pattern, FC_FAMILY, (FcChar8 *)fi);
	    FcPatternAddInteger(pattern, FC_SLANT, FC_SLANT_ROMAN);

#ifndef FC_WEIGHT_REGULAR
#define FC_WEIGHT_REGULAR FC_WEIGHT_MEDIUM
#endif
	    FcPatternAddInteger(pattern, FC_WEIGHT, FC_WEIGHT_REGULAR);
	    FcPatternAddInteger(pattern, FC_PIXEL_SIZE, CONFIG_MENU_FONT_SIZE);
	    FcConfigSubstitute(FcConfigGetCurrent(), pattern, FcMatchPattern);

	    FcResult result = FcResultMatch;
	    FcPattern *match = FcFontMatch(FcConfigGetCurrent(), pattern, &result);
	    FcPatternDestroy(pattern);

	    if (!match || result != FcResultMatch) {
		if (match) FcPatternDestroy(match);
		continue;
	    }

	    m_font = XftFontOpenPattern(display(), match);
	    if (m_font) break;
	    FcPatternDestroy(match);
	}
	free(ffi);
	if (!m_font) {
	    m_windowManager->fatal("couldn't load menu Xft font");
	}
	m_xftColour = (XftColor *) malloc(m_windowManager->screensTotal() *
					  sizeof(XftColor));
	m_xftDraw = (XftDraw **) malloc(m_windowManager->screensTotal() *
					sizeof(XftDraw *));
#else
	m_font = (XFontStruct **) malloc(m_windowManager->screensTotal() *
					 sizeof(XFontStruct *));
#endif
	values = (XGCValues *) malloc(m_windowManager->screensTotal() *
				      sizeof(XGCValues));
	attr = (XSetWindowAttributes *) malloc(m_windowManager->screensTotal() *
				      sizeof(XSetWindowAttributes));
	
        for (int i = 0; i < m_windowManager->screensTotal(); i++)
	{
	    m_foreground = m_windowManager->allocateColour
	      (i, CONFIG_MENU_FOREGROUND, "menu foreground");
	    m_background = m_windowManager->allocateColour
	      (i, CONFIG_MENU_BACKGROUND, "menu background");
	    m_border = m_windowManager->allocateColour
	      (i, CONFIG_MENU_BORDERS, "menu border");

#ifndef CONFIG_USE_XFT
	    char **ml;
	    int mc;
	    char *ds;
	    
	    m_fontset = XCreateFontSet(display(), CONFIG_NICE_MENU_FONT,
				       &ml, &mc, &ds);
	    if (!m_fontset)
	      m_fontset = XCreateFontSet(display(), CONFIG_NASTY_FONT,
					 &ml, &mc, &ds);
	    if (m_fontset) {
		XFontStruct **fs_list;
		XFontsOfFontSet(m_fontset, &fs_list, &ml);
		m_font[i] = fs_list[0];
	    } else {
		m_font[i] = NULL;
	    }
#define XDrawString(t,u,v,w,x,y,z) XmbDrawString(t,u,m_fontset,v,w,x,y,z)
	    if (!m_font[i]) m_windowManager->fatal("couldn't load menu font\n");
#endif
	    
	    values[i].background = m_background;
	    values[i].foreground = m_foreground ^ m_background;
	    values[i].function = GXxor;
	    values[i].line_width = 0;
	    values[i].subwindow_mode = IncludeInferiors;
#ifndef CONFIG_USE_XFT
	    values[i].font = m_font[i]->fid;
//.........这里部分代码省略.........
开发者ID:bbidulock,项目名称:wmx,代码行数:101,代码来源:Menu.C


示例14: getItems

int Menu::getSelection()
{
    m_items = getItems(&m_nItems, &m_nHidden);
    XButtonEvent *xbev = (XButtonEvent *)m_event; // KeyEvent is similar enough

    if (xbev->window == m_window[screen()] || m_nItems == 0) return -1;

    int width, maxWidth = 10;
    for (int i = 0; i < m_nItems; i++) {
	width = getTextWidth(m_items[i], STRLEN_MITEMS(i));
	if (width > maxWidth) maxWidth = width;
    }
    maxWidth += 32;

    Boolean isKeyboardMenu = isKeyboardMenuEvent(m_event);
    int selecting = isKeyboardMenu ? 0 : -1, prev = -1;
#ifdef CONFIG_USE_XFT
    int entryHeight = m_font->ascent + m_font->descent + 4;
#else
    int entryHeight = m_font[screen()]->ascent + m_font[screen()]->descent + 4;
#endif
    int totalHeight = entryHeight * m_nItems + 13;

    int mx = DisplayWidth (display(), screen()) - 1;
    int my = DisplayHeight(display(), screen()) - 1;

    int x, y;

    if (isKeyboardMenu) {
	x = mx / 2 - maxWidth / 2;
	y = my / 2 - totalHeight / 2;
    } else {

	x = xbev->x - maxWidth/2;
	y = xbev->y - 2;

	Boolean warp = False;

	if (x < 0) {
	    xbev->x -= x;
	    x = 0;
	    warp = True;
	} else if (x + maxWidth >= mx) {
	    xbev->x -= x + maxWidth - mx;
	    x = mx - maxWidth;
	    warp = True;
	}
    
	if (y < 0) {
	    xbev->y -= y;
	    y = 0;
	    warp = True;
	} else if (y + totalHeight >= my) {
	    xbev->y -= y + totalHeight - my;
	    y = my - totalHeight;
	    warp = True;
	}

	if (warp) XWarpPointer(display(), None, root(), None, None,
			       None, None, xbev->x, xbev->y);
    }

    XMoveResizeWindow(display(), m_window[screen()], x, y, maxWidth, totalHeight);
    XSelectInput(display(), m_window[screen()], MenuMask);
    XMapRaised(display(), m_window[screen()]);

    if (m_windowManager->attemptGrab(m_window[screen()], None,
				     MenuGrabMask, xbev->time)
	!= GrabSuccess) {
	XUnmapWindow(display(), m_window[screen()]);
	return -1;
    }
    
    if (isKeyboardMenu) {
	if (m_windowManager->attemptGrabKey(m_window[screen()], xbev->time)
	    != GrabSuccess) {
	    XUnmapWindow(display(), m_window[screen()]);
	    return -1;
	}
    }	    

    Boolean done = False;
    Boolean drawn = False;
    XEvent event;
    struct timeval sleepval;
    unsigned long tdiff = 0L;
    Boolean speculating = False;
    Boolean foundEvent;

    while (!done)
    {
	int i;
	foundEvent = False;

	if (CONFIG_FEEDBACK_DELAY >= 0 &&
	    tdiff > (unsigned long)CONFIG_FEEDBACK_DELAY &&
	    !isKeyboardMenu && // removeFeedback didn't seem to work for it
	    !speculating) {

	    if (selecting >= 0 && selecting < m_nItems) {
//.........这里部分代码省略.........
开发者ID:bbidulock,项目名称:wmx,代码行数:101,代码来源:Menu.C


示例15: delay

/*-----------------------------------------------------------------------------------------------
 * Function: begin
 * Description: Initialize lcd columns, rows and dot size
 * Ins: Integer value for col, row and dotsize.
 * Outs: none
 * ----------------------------------------------------------------------------------------------*/
void LCD::begin(uint8_t cols, uint8_t lines, uint8_t dotsize) {
	// SEE PAGE 45/46 FOR INITIALIZATION SPECIFICATION!
	// according to datasheet, we need at least 40ms after power rises above 2.7V
	// before sending commands. Arduino can turn on way befer 4.5V so we'll wait 50
	delay(50);

	Wire.begin();
	// first thing we do is get the GPIO expander's head working straight, 
  // with a boatload of junk data.
	Wire.beginTransmission(MCP23008_ADDRESS | lcd_i2cAddr);
#if ARDUINO >= 100
	Wire.write((byte)MCP23008_IODIR);
	Wire.write((byte)0xFF);
	Wire.write((byte)0x00);
	Wire.write((byte)0x00);
	Wire.write((byte)0x00);
	Wire.write((byte)0x00);
	Wire.write((byte)0x00);
	Wire.write((byte)0x00);
	Wire.write((byte)0x00);
	Wire.write((byte)0x00);
	Wire.write((byte)0x00);
#else
	Wire.send(MCP23008_IODIR);
	Wire.send(0xFF);
	Wire.send(0x00);
	Wire.send(0x00);
	Wire.send(0x00);
	Wire.send(0x00);
	Wire.send(0x00);
	Wire.send(0x00);
	Wire.send(0x00);
	Wire.send(0x00);
	Wire.send(0x00);
#endif
	Wire.endTransmission();

	// now we set the GPIO expander's I/O direction to output since it's soldered to an LCD output.
	Wire.beginTransmission(MCP23008_ADDRESS | lcd_i2cAddr);
#if ARDUINO >= 100
	Wire.write((byte)MCP23008_IODIR);
	Wire.write((byte)0x00); // all output: 00000000 for pins 1...8
#else
	Wire.send(MCP23008_IODIR);
	Wire.send(0x00); // all output: 00000000 for pins 1...8
#endif
	Wire.endTransmission();

	if (lines > 1) {
		_displayfunction |= LCD_2LINE;
	}
	_numlines = lines;
	_currline = 0;

	// for some 1 line displays you can select a 10 pixel high font
	if ((dotsize != 0) && (lines == 1)) {
		_displayfunction |= LCD_5x10DOTS;
	}

	//put the LCD into 4 bit mode
	// start with a non-standard command to make it realize we're speaking 4-bit here
	// per LCD datasheet, first command is a single 4-bit burst, 0011.
        //-----
        //  we cannot assume that the LCD panel is powered at the same time as
        //  the arduino, so we have to perform a software reset as per page 45
        //  of the HD44780 datasheet - (kch)
        //-----
        // bit pattern for the burstBits function is
        //
        //  7   6   5   4   3   2   1   0
        // LT  D7  D6  D5  D4  EN  RS  n/c
        //-----
        lcd_burstBits(B10011100); // send LITE D4 D5 high with enable
        lcd_burstBits(B10011000); // send LITE D4 D5 high with !enable
        lcd_burstBits(B10011100); //
        lcd_burstBits(B10011000); //
        lcd_burstBits(B10011100); // repeat twice more
        lcd_burstBits(B10011000); //
        lcd_burstBits(B10010100); // send D4 low and LITE D5 high with enable
        lcd_burstBits(B10010000); // send D4 low and LITE D5 high with !enable
	delay(5); // this shouldn't be necessary, but sometimes 16MHz is stupid-fast.
	
	command(LCD_FUNCTIONSET | _displayfunction); // then send 0010NF00 (N=lines, F=font)
	delay(5); // for safe keeping...
	command(LCD_FUNCTIONSET | _displayfunction); // ... twice.
	delay(5); // done!

	// turn on the LCD with our defaults. since these libs seem to use personal preference, 
  // I like a cursor.
	_displaycontrol = LCD_DISPLAYON;  
	display();
	// clear it off
	clear();

//.........这里部分代码省略.........
开发者ID:brooksware2000,项目名称:Hobbybotics-AD595-Breakout,代码行数:101,代码来源:LCD.cpp


示例16: timer

void timer(int = 0)
{
  game.tick();
  display();
  glutTimerFunc(300, timer, 0);
}
开发者ID:art-spasky,项目名称:snake,代码行数:6,代码来源:main.cpp


示例17: switch

BOOL CALLBACK ColumnEditorDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM)
{
	switch (message) 
	{
		case WM_INITDIALOG :
		{
			switchTo(activeText);
			::SendDlgItemMessage(_hSelf, IDC_COL_DEC_RADIO, BM_SETCHECK, TRUE, 0);
			goToCenter();

			NppParameters *pNppParam = NppParameters::getInstance();
			ETDTProc enableDlgTheme = (ETDTProc)pNppParam->getEnableThemeDlgTexture();
			if (enableDlgTheme)
			{
				enableDlgTheme(_hSelf, ETDT_ENABLETAB);
				redraw();
			}
			return TRUE;
		}
		case WM_COMMAND : 
		{
			switch (wParam)
			{
				case IDCANCEL : // Close
					display(false);
					return TRUE;

				case IDOK :
                {
					(*_ppEditView)->execute(SCI_BEGINUNDOACTION);
					
					const int stringSize = 1024;
					TCHAR str[stringSize];
					
					bool isTextMode = (BST_CHECKED == ::SendDlgItemMessage(_hSelf, IDC_COL_TEXT_RADIO, BM_GETCHECK, 0, 0));
					
					if (isTextMode)
					{
						::SendDlgItemMessage(_hSelf, IDC_COL_TEXT_EDIT, WM_GETTEXT, stringSize, (LPARAM)str);

						display(false);
						
						if ((*_ppEditView)->execute(SCI_SELECTIONISRECTANGLE) || (*_ppEditView)->execute(SCI_GETSELECTIONS) > 1)
						{
							ColumnModeInfos colInfos = (*_ppEditView)->getColumnModeSelectInfo();
							std::sort(colInfos.begin(), colInfos.end(), SortInPositionOrder());
							(*_ppEditView)->columnReplace(colInfos, str);
							std::sort(colInfos.begin(), colInfos.end(), SortInSelectOrder());
							(*_ppEditView)->setMultiSelections(colInfos);
						}
						else
						{
							int cursorPos = (*_ppEditView)->execute(SCI_GETCURRENTPOS);
							int cursorCol = (*_ppEditView)->execute(SCI_GETCOLUMN, cursorPos);
							int cursorLine = (*_ppEditView)->execute(SCI_LINEFROMPOSITION, cursorPos);
							int endPos = (*_ppEditView)->execute(SCI_GETLENGTH);
							int endLine = (*_ppEditView)->execute(SCI_LINEFROMPOSITION, endPos);

							int lineAllocatedLen = 1024;
							TCHAR *line = new TCHAR[lineAllocatedLen];

							for (int i = cursorLine ; i <= endLine ; i++)
							{
								int lineBegin = (*_ppEditView)->execute(SCI_POSITIONFROMLINE, i);
								int lineEnd = (*_ppEditView)->execute(SCI_GETLINEENDPOSITION, i);

								int lineEndCol = (*_ppEditView)->execute(SCI_GETCOLUMN, lineEnd);
								int lineLen = lineEnd - lineBegin + 1;

								if (lineLen > lineAllocatedLen)
								{
									delete [] line;
									line = new TCHAR[lineLen];
								}
								(*_ppEditView)->getGenericText(line, lineLen, lineBegin, lineEnd);
								generic_string s2r(line);

								if (lineEndCol < cursorCol)
								{
									generic_string s_space(cursorCol - lineEndCol, ' ');
									s2r.append(s_space);
									s2r.append(str);
								}
								else
								{
									int posAbs2Start = (*_ppEditView)->execute(SCI_FINDCOLUMN, i, cursorCol);
									int posRelative2Start = posAbs2Start - lineBegin;
									s2r.insert(posRelative2Start, str);
								}
								(*_ppEditView)->replaceTarget(s2r.c_str(), lineBegin, lineEnd);
							}
							delete [] line;
						}
					}
					else
					{
						int initialNumber = ::GetDlgItemInt(_hSelf, IDC_COL_INITNUM_EDIT, NULL, TRUE);
						int increaseNumber = ::GetDlgItemInt(_hSelf, IDC_COL_INCREASENUM_EDIT, NULL, TRUE);
						UCHAR format = getFormat();
						display(false);
//.........这里部分代码省略.........
开发者ID:herbertkb,项目名称:Swummary,代码行数:101,代码来源:columnEditor.cpp


示例18: input

//input values into element
void input(point *p)
{
	printf("enter values for x and y (e.g. 1 2): ");
	scanf("%d %d", &p->x, &p->y);
	display(p);
}
开发者ID:jamescoll,项目名称:c_portfolio,代码行数:7,代码来源:linkedlist.c


示例19: pacman_query

int pacman_query(alpm_list_t *targets)
{
	int ret = 0;
	int match = 0;
	alpm_list_t *i;
	alpm_pkg_t *pkg = NULL;
	alpm_db_t *db_local;

	/* First: operations that do not require targets */

	/* search for a package */
	if(config->op_q_search) {
		ret = query_search(targets);
		return ret;
	}

	/* looking for groups */
	if(config->group) {
		ret = query_group(targets);
		return ret;
	}

	if(config->op_q_foreign || config->op_q_upgrade) {
		if(check_syncdbs(1, 1)) {
			return 1;
		}
	}

	db_local = alpm_option_get_localdb(config->handle);

	/* operations on all packages in the local DB
	 * valid: no-op (plain -Q), list, info, check
	 * invalid: isfile, owns */
	if(targets == NULL) {
		if(config->op_q_isfile || config->op_q_owns) {
			pm_printf(ALPM_LOG_ERROR, _("no targets specified (use -h for help)\n"));
			return 1;
		}

		for(i = alpm_db_get_pkgcache(db_local); i; i = alpm_list_next(i)) {
			pkg = alpm_list_getdata(i);
			if(filter(pkg)) {
				int value = display(pkg);
				if(value != 0) {
					ret = 1;
				}
				match = 1;
			}
		}
		if(!match) {
			ret = 1;
		}
		return ret;
	}

	/* Second: operations that require target(s) */

	/* determine the owner of a file */
	if(config->op_q_owns) {
		ret = query_fileowner(targets);
		return ret;
	}

	/* operations on named packages in the local DB
	 * valid: no-op (plain -Q), list, info, check */
	for(i = targets; i; i = alpm_list_next(i)) {
		char *strname = alpm_list_getdata(i);

		if(config->op_q_isfile) {
			alpm_pkg_load(config->handle, strname, 1, 0, &pkg);
		} else {
			pkg = alpm_db_get_pkg(db_local, strname);
		}

		if(pkg == NULL) {
			switch(alpm_errno(config->handle)) {
				case ALPM_ERR_PKG_NOT_FOUND:
					pm_fprintf(stderr, ALPM_LOG_ERROR,
							_("package '%s' was not found\n"), strname);
					if(!config->op_q_isfile && access(strname, R_OK) == 0) {
						pm_fprintf(stderr, ALPM_LOG_WARNING,
								_("'%s' is a file, you might want to use %s.\n"),
								strname, "-p/--file");
					}
					break;
				default:
					pm_fprintf(stderr, ALPM_LOG_ERROR,
							_("could not load package '%s': %s\n"), strname,
							alpm_strerror(alpm_errno(config->handle)));
					break;
			}
			ret = 1;
			continue;
		}

		if(filter(pkg)) {
			int value = display(pkg);
			if(value != 0) {
				ret = 1;
			}
//.........这里部分代码省略.........
开发者ID:moben,项目名称:pacman,代码行数:101,代码来源:query.c


示例20: switch

void GLCanvas::keyboard(unsigned char key, int x, int y) {
  args->raytracing_animation = false;
  switch (key) {
    // RAYTRACING STUFF
  case 'r':  case 'R':
    // animate raytracing of the scene
    args->gather_indirect=false;
    args->raytracing_animation = !args->raytracing_animation;
    if (args->raytracing_animation) {
      raytracing_skip = my_max(args->width,args->height) / 10;
      if (raytracing_skip % 2 == 0) raytracing_skip++;
      assert (raytracing_skip >= 1);
      raytracing_x = raytracing_skip/2;
      raytracing_y = raytracing_skip/2;
      display(); // clear out any old rendering
      printf ("raytracing animation started, press 'R' to stop\n");
    } else
      printf ("raytracing animation stopped, press 'R' to start\n");    
    break;
  case 't':  case 'T': {
    // visualize the  

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ displayError函数代码示例发布时间:2022-05-31
下一篇:
C++ dispex_query_interface函数代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap