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

C++ putimage函数代码示例

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

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



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

示例1: SureExit

int SureExit(){
		outtextxy(320,100,"Play Again?");
		outtextxy(240,300,"Yes");
		outtextxy(400,300,"No and Quit");
	do{
		if(leftPress() != 1){
			getMousePosition(&mx,&my);
			if(mousex != mx||mousey != my){
				putimage(mousex,mousey,imagep,XOR_PUT);
				mousex = mx; mousey = my;
				putimage(mousex,mousey,imagep,XOR_PUT);
			}
		}else if(mouseLeftFlag == 1){
			mouseLeftFlag = 0;
			getMousePosition(&mx,&my);
			if(mx < 280 && mx > 200 && my < 320 && my > 280){
				cleardevice();
				return 1;
			}
			else if(mx < 440 && mx  > 360 && my < 320 && my > 280){
				cleardevice();
				return 0;
			}
		}
	}while(1);
}
开发者ID:reAsOn2010,项目名称:libs,代码行数:26,代码来源:Gaming.c


示例2: PrintGreekChar

/*-------------------------------------------------------------------
 *  PrintGreekChar           10.17.90 MM
 *
 *  Print the given betaletter at X,Y.
 *-------------------------------------------------------------------
 */
int
PrintGreekChar( int cpX, int cpY, BETALETTER bchar)
{
        int i;

        if(bchar.dc_num != LCHAR )
        {
           putimage( cpX, cpY, (void far *)&Greek[bchar.charcode][0],
                     bchar.attrib );
           for(i=0;i<bchar.dc_num;i++)
           {
              if( bchar.dc_codes[i] == IOTASUBCODE )
              {
                putimage( cpX, cpY+1, (void far *) &Greek[bchar.dc_codes[i]][0],
                          XOR_PUT );
              }
              else
              {
                putimage( cpX, cpY-3, (void far *) &Greek[bchar.dc_codes[i]][0],
                          XOR_PUT );
              }
           }
        }
        else
                outtextxy(cpX,cpY,bchar.dc_codes);

        return( CHARWIDTH );
}/*
开发者ID:mikemull,项目名称:Chiron,代码行数:34,代码来源:greek.c


示例3: main

int main()
{
   int i,gd=DETECT,gm,size;
   void *buf;
   initgraph(&gd,&gm,"");
   setbkcolor(BLUE);
   cleardevice();
   setcolor(LIGHTRED);
   setlinestyle(0,0,1);
   setfillstyle(1,10);
   circle(100,200,30);
   floodfill(100,200,12);
   size=imagesize(69,169,131,231);
   buf=malloc(size);
   getimage(69,169,131,231,buf);
   putimage(500,269,buf,COPY_PUT);
   for(i=0;i<185;i++)
   {
      putimage(70+i,170,buf,COPY_PUT);
      putimage(500-i,170,buf,COPY_PUT);
   }
   for(i=0;i<185;i++)
   {
      putimage(255-i,170,buf,COPY_PUT);
      putimage(315+i,170,buf,COPY_PUT);
   }
   getch();
   closegraph();
}
开发者ID:Huericiz,项目名称:C_lg_small_examples,代码行数:29,代码来源:3-64.c


示例4: XCreatePixmap

void MCScreenDC::create_stipple()
{
	graystipple = XCreatePixmap(dpy, getroot(), 32, 32, 1);
	gc1 = XCreateGC(dpy, graystipple, 0, NULL);
	XSetGraphicsExposures(dpy, gc1, False);
	XSetForeground(dpy, gc1, 1);
	XSetBackground(dpy, gc1, 0);

	Boolean oldshm = MCshm;
	MCBitmap *im = createimage(1, 64, 64, False, 0x0, True, False);
	int2 i;
	uint4 *dptr = (uint4 *)im->data;
	for (i = 0 ; i < 16 ; i++)
	{

		*dptr++ = 0xAAAAAAAA;
		*dptr++ = 0xAAAAAAAA;
		*dptr++ = 0x55555555;
		*dptr++ = 0x55555555;
	}

	putimage(graystipple, im, 0, 0, 0, 0, 32, 32);
	XSync(dpy, False);
	if (oldshm != MCshm)
		putimage(graystipple, im, 0, 0, 0, 0, 32, 32);
	destroyimage(im);
}
开发者ID:bduck,项目名称:livecode,代码行数:27,代码来源:lnxdclnx.cpp


示例5: food

food()
{        row=col=0;
	setfillstyle(1,15);
	if(xc!=0 && yc!=0)
		putimage(xc,yc,f1,XOR_PUT);
     ram: col=random(1001);
	while(col>=40)
	{
		row=row+1;
		col-=40;
	}
	xc=(col*15)+25;
	yc=(row*15)+20;
	for(v=0;v<=i;v++)
	{
		if((x[v]==xc)&&(y[v]==yc))
			goto ram;
	}
	for(v=0;v<=j;v++)
	{
		if((x2[v]==xc)&&(y2[v]==yc))
			goto ram;
	}
	setfillstyle(1,15);
	if((xc<=610)&&(xc>=25)&&(yc<=380)&&(yc>=20))
	{
		putimage(xc,yc,f1,XOR_PUT);
		set=1;
	}
	else
		goto ram;
return 0;
}
开发者ID:ramkicse,项目名称:Snake-Game-in-C,代码行数:33,代码来源:snake.C


示例6: background

void background(void *img1, void *img2, int h, int scroll_speed){
	static int y1 = 0, y2 = 0;
	static int flag = 1;
	static clock_t cur = clock();
	const clock_t delay = 15;
	if(flag){
		y2 = -h;
		flag = 0;
	}
	if(y2 < 0){
		putimage(0,y2,img2,0);
		putimage(0,y1,img1,0);
	}else{
		putimage(0,y1,img1,0);
		putimage(0,y2,img2,0);
	}

	if(clock() - cur > delay){
	
		if(y1 >= getmaxy())
			y1 = -h;
		else
			y1 += scroll_speed;
		if(y2 >= getmaxy())
			y2 = -h;
		else
			y2 += scroll_speed;
		cur = clock();
	}	
	
}
开发者ID:ernie0218e,项目名称:Sora,代码行数:31,代码来源:utilize.cpp


示例7: updateexplosion

void updateexplosion(void){
    explosion *ptr = exhead, *dexplosion;
    int w,h;
    const clock_t delay = 40;
    while(ptr != NULL){
    	if(clock() - ptr -> time < delay && ptr -> frame < ptr -> tframe){
			w = ptr -> w;
			h = ptr -> h;	
			putimage(ptr -> x - w/2, ptr -> y - h/2, ptr -> img[2*(ptr -> frame) + 1], 3);
			putimage(ptr -> x - w/2, ptr -> y - h/2, ptr -> img[2*(ptr -> frame)], 2);
			ptr -> frame += 1;
			ptr -> time = clock();
			ptr = ptr -> next;
		}else if(ptr -> frame >= ptr -> tframe){
			dexplosion = ptr;
			ptr = ptr -> next;
			deleteexplosion(dexplosion);
		}else{
			w = ptr -> w;
			h = ptr -> h;	
			putimage(ptr -> x - w/2, ptr -> y - h/2, ptr -> img[2*(ptr -> frame) + 1], 3);
			putimage(ptr -> x - w/2, ptr -> y - h/2, ptr -> img[2*(ptr -> frame)], 2);
			ptr = ptr -> next;
		}
    }
}
开发者ID:ernie0218e,项目名称:Sora,代码行数:26,代码来源:utilize.cpp


示例8: main

int main(void)
{
clrscr();
   /* request autodetection */
   int gdriver = DETECT, gmode, errorcode;
   void *arrow;
   int x, y, maxx;
   unsigned int size;

   /* initialize graphics and local variables */
   initgraph(&gdriver, &gmode, "d:\\tc\\bgi");

   /* read result of initialization */
   errorcode = graphresult();
   if (errorcode != grOk)  /* an error occurred */
   {
      printf("Graphics error: %s\n", grapherrormsg(errorcode));
      printf("Press any key to halt:");
      getch();
      exit(1); /* terminate with an error code */
   }

   maxx = getmaxx();
   x = 0;
   y = getmaxy() / 2;

   /* draw the image to be grabbed */
   draw_arrow(x, y);

   /* calculate the size of the image */
   size = imagesize(x, y-ARROW_SIZE, x+(4*ARROW_SIZE), y+ARROW_SIZE);

   /* allocate memory to hold the image */
   arrow = malloc(size);

   /* grab the image */
   getimage(x, y-ARROW_SIZE, x+(4*ARROW_SIZE), y+ARROW_SIZE, arrow);

   /* repeat until a key is pressed */
   while (!kbhit())
   {
      /* erase old image */
      putimage(x, y-ARROW_SIZE, arrow, XOR_PUT);

      x += ARROW_SIZE;
      if (x >= maxx)
          x = 0;

      /* plot new image */
      putimage(x, y-ARROW_SIZE, arrow, XOR_PUT);
   }

   /* clean up */
   free(arrow);
   closegraph();
   return 0;
}
开发者ID:pjmodi,项目名称:projects,代码行数:57,代码来源:IMGSIZE.CPP


示例9: belowcloud

void belowcloud(cloud *cl, int len){
	int i;
	for(i = 0;i < len;i++){
		if((!cl[i].alt) && cl[i].active){
			putimage(cl[i].x - cl[i].w/2,cl[i].y-cl[i].h/2,cl[i].img[1],3);
			putimage(cl[i].x - cl[i].w/2,cl[i].y-cl[i].h/2,cl[i].img[0],2);
		}
	}
}
开发者ID:ernie0218e,项目名称:Sora,代码行数:9,代码来源:utilize.cpp


示例10: printImg

void printImg(imagem_type *imagem){
	int mode = COPY_PUT;
	
	if(imagem->mask){
	 	putimage(imagem->pos.x, imagem->pos.y, imagem->mask, AND_PUT);
	 	mode = OR_PUT;
	 }
	
	putimage(imagem->pos.x, imagem->pos.y, imagem->img, mode);	
}
开发者ID:whateverton,项目名称:tamagoshi,代码行数:10,代码来源:desenha.cpp


示例11: restore

void restore(int x1,int y1)
{
putimage(x1,y1,p1,OR_PUT);
putimage(midx+1,y1,p2,OR_PUT);
putimage(x1,midy+1,p3,OR_PUT);
putimage(midx+1,midy+1,p4,OR_PUT);


farfree(p1);
farfree(p2);
farfree(p3);
farfree(p4);
}
开发者ID:pjmodi,项目名称:projects,代码行数:13,代码来源:MOUSE2.CPP


示例12: putimage

void NetPlayerInfoView::show()
{
	if (buffer_img_.img)
	{
		putimage(buffer_img_.x, buffer_img_.y, buffer_img_.img);
		delimage(buffer_img_.img);
		buffer_img_.img = NULL;
	}
	calc_view_width_height();
	buffer_img_.x = pos_x_;
	buffer_img_.y = pos_y_;
	int temp_viewport_left, temp_viewport_right, temp_viewport_top, temp_viewport_bottom;
	getviewport(&temp_viewport_left, &temp_viewport_top, &temp_viewport_right, &temp_viewport_bottom);
	setviewport(pos_x_, pos_y_, pos_x_ + view_width_, pos_y_ + view_height_);
	buffer_img_.img = newimage(view_width_, view_height_);
	putimage(buffer_img_.img, 0, 0, NULL);
	setviewport(temp_viewport_left, temp_viewport_top, temp_viewport_right, temp_viewport_bottom);

	int target_top = pos_y_;
	if (player_pic_)
	{
		player_pic_->show_image_with_alpha(pos_x_ + view_width_ / 2 - player_pic_->get_width() / 2, target_top, 1.0);
		target_top += player_pic_->get_width() + margin_;
	}

	setcolor(WHITE);
	if (player_name_.length() > 0)
	{
		Gobang::set_font(Gobang::font_default, name_font_size_, true);
		xyprintf(pos_x_ + view_width_ / 2 - textwidth(player_name_.c_str()) / 2, target_top, player_name_.c_str());
		target_top += textheight(player_name_.c_str()) + margin_;
	}

	if (is_ready_)
	{
		Gobang::set_font(Gobang::font_default, ready_font_size_);
		xyprintf(pos_x_ + view_width_ / 2 - textwidth("Ready!") / 2, target_top, "Ready!");
		target_top += textheight("Ready!") + margin_;
		if (is_playing_)
		{
			playing_indicator_->show_image_with_alpha(pos_x_ + view_width_ / 2 - playing_indicator_->get_width() / 2, target_top, 1.0);
			target_top += playing_indicator_->get_height() + margin_;
		}
	}
	else if (!is_opposite_)
	{
		button_ready_->set_position(pos_x_ + view_width_ / 2 - button_ready_->get_width() / 2, target_top);
		button_ready_->show();
		target_top += button_ready_->get_height() + margin_;
	}
}
开发者ID:BUPTSSE-Zero,项目名称:Dream-Gobang,代码行数:51,代码来源:NetPlayerInfoView.cpp


示例13: updatespbp

int updatespbp(spbulletplus **first,spbulletplus **tail,plane *myplane)
{
	spbulletplus *ptr = *first, *dhp;
    int w,h;
    int maxx,maxy;
    double dir;
    maxx = getmaxx();
    maxy = getmaxy();
    while(ptr != NULL){
    	ptr -> x += (int) ((ptr -> speed)*cos(ptr -> angle));	//update position
    	ptr -> y += (int) ((ptr ->	speed)*sin(ptr -> angle));
    	if(sq(ptr->x - myplane->x)+sq(ptr->y - myplane->y) < sq(ptr->r))
    	{
    		deletespbp(ptr,first,tail);
    		return 1;
    	}
    	else if(ptr -> y + ptr->r > getmaxy()){
					ptr -> y = getmaxy() - ptr->r;
					dir = 2.0 * PI - ptr -> angle;
					changespbp(ptr, 3, dir);
				}else if(ptr -> y - ptr->r < 0){
					ptr -> y = ptr->r;
					dir = 2.0 * PI - ptr -> angle;
					changespbp(ptr, 3, dir);
				}else if(ptr -> x + ptr->r > getmaxx()){
					ptr -> x = getmaxx() - ptr->r;
					if(ptr -> angle > PI)
						dir = 3.0*PI - ptr -> angle;
					else
						dir = PI - ptr -> angle;
					changespbp(ptr, 3, dir);
				}else if(ptr -> x - ptr->r < 0){
					ptr -> x = ptr->r;
					if(ptr -> angle > PI)
						dir = 3.0*PI - ptr -> angle;
					else
						dir = PI - ptr -> angle;
					changespbp(ptr, 3, dir);
				}
    	if(ptr!=NULL){
			w = ptr -> w;
			h = ptr -> h;	
			putimage(ptr -> x - w/2, ptr -> y - h/2, ptr -> img[1], 3);
			putimage(ptr -> x - w/2, ptr -> y - h/2, ptr -> img[0], 2);
			ptr = ptr -> next;
		}	
    }
    return 0;
}
开发者ID:ernie0218e,项目名称:Sora,代码行数:49,代码来源:utilize.cpp


示例14: main

main()
{
   int gd = DETECT, gm, area, temp1, temp2, left = 25, top = 75;
   void *p;
 
   initgraph(&gd,&gm,"C:\\TC\\BGI");
 
   setcolor(YELLOW);
   circle(50,100,25);
   setfillstyle(SOLID_FILL,YELLOW);
   floodfill(50,100,YELLOW);
 
   setcolor(BLACK);
   setfillstyle(SOLID_FILL,BLACK);
   fillellipse(44,85,2,6);
   fillellipse(56,85,2,6);
 
   ellipse(50,100,205,335,20,9);
   ellipse(50,100,205,335,20,10);
   ellipse(50,100,205,335,20,11);
 
   area = imagesize(left, top, left + 50, top + 50);
   p = malloc(area);
 
   setcolor(WHITE);
   settextstyle(SANS_SERIF_FONT,HORIZ_DIR,2);
   outtextxy(155,451,"Smiling Face Animation");
 
   setcolor(BLUE);
   rectangle(0,0,639,449);
 
   while(!kbhit())
   {
      temp1 = 1 + random ( 588 );
      temp2 = 1 + random ( 380 );
 
      getimage(left, top, left + 50, top + 50, p);
      putimage(left, top, p, XOR_PUT);
      putimage(temp1 , temp2, p, XOR_PUT);
      delay(100);
      left = temp1;
      top = temp2;
   }
 
   getch();
   closegraph();
   return 0;
}
开发者ID:AnupamKhosla,项目名称:Anupam_Solutions,代码行数:48,代码来源:chekc-23.c


示例15: tmap_tiff

static int
tmap_tiff(			/* tone map SGILOG TIFF */
	char	*fname,
	TIFF	*tp
)
{
	float	xres, yres;
	uint16	orient, resunit, phot;
	int	xsiz, ysiz;
	uby8	*pix;
					/* check to make sure it's SGILOG */
	TIFFGetFieldDefaulted(tp, TIFFTAG_PHOTOMETRIC, &phot);
	if ((phot == PHOTOMETRIC_LOGL) | (phot == PHOTOMETRIC_MINISBLACK))
		flags |= TM_F_BW;
					/* read and tone map TIFF */
	if (tmMapTIFF(&pix, &xsiz, &ysiz, flags,
			rgbp, gamv, lddyn, ldmax, fname, tp) != TM_E_OK)
		return(-1);
					/* get relevant tags */
	TIFFGetFieldDefaulted(tp, TIFFTAG_RESOLUTIONUNIT, &resunit);
	TIFFGetFieldDefaulted(tp, TIFFTAG_XRESOLUTION, &xres);
	TIFFGetFieldDefaulted(tp, TIFFTAG_YRESOLUTION, &yres);
	TIFFGetFieldDefaulted(tp, TIFFTAG_ORIENTATION, &orient);
					/* put out our image */
	if (putimage(orient, (uint32)xsiz, (uint32)ysiz,
			xres, yres, resunit, pix) != 0)
		return(-1);
					/* free data and we're done */
	free((void *)pix);
	return(0);
}
开发者ID:Pizookies,项目名称:Radiance,代码行数:31,代码来源:normtiff.c


示例16: draw_char

void draw_char( void ) {
	static int first = 1;
	int i, j;
	if ( load_first ) {
		first = 1;
		load_first = 0;
	}
	if ( !first ) {
		putimage( 0 + align, 0, matrix_image, COPY_PUT );
	} else {
		draw_grid( X, Y );
		matrix_image = ( char * ) realloc( matrix_image,
			imagesize( 0 + align, 0, ( WIDTH_X + 2 )*X + align, ( WIDTH_Y + 2 )*Y ) );
		getimage( 0 + align, 0, ( WIDTH_X + 2 )*X + align,
			( WIDTH_Y + 2 )*Y, matrix_image );
	}

	for ( j = 0; j < Y; j++ ) {
		for ( i = 0; i < X; i++ ) {
			if ( edit_font[i][j] ) {
				put_dot( i, j );
			} else if ( first ) {
				square( i, j );
			}
		}
	}
	first = 0;
}
开发者ID:MegaGod,项目名称:TW,代码行数:28,代码来源:FED.C


示例17: main

int main()
{
	PIMAGE img;

	initgraph(640, 480);

	//先随便画一些东西
	setcolor(EGERGB(0xFF, 0xFF, 0x0));
	setfillcolor(EGERGB(0xFF, 0x0, 0x80));
	fillellipse(50, 50, 50, 50);

	img = newimage();
	getimage(img, 0, 0, 160, 120);

	//先画一个非黑色背景,以便于比较
	setbkcolor(EGERGB(0x80, 0x80, 0x80));
	cleardevice();

	//四种贴图比较
	putimage(0, 0, img);
	putimage_alphablend(NULL, img, 160, 0, 0x80); //半透明度为0x80
	putimage_transparent(NULL, img, 0, 80, BLACK);	//透明贴图,关键色为BLACK,源图为这个颜色的地方会被忽略
	putimage_alphatransparent(NULL, img, 160, 80, BLACK, 0xA0); //同时使用透明和半透明

	getch();

	delimage(img);

	closegraph();
	return 0;
}
开发者ID:AlexiaChen,项目名称:ConnectFive,代码行数:31,代码来源:t11.cpp


示例18: bulletattack

void bulletattack( int bullet[][2], int randx[][2], const bool decidex, IMAGE img )
{
	if( decidex == true )
	{
		for( int x=0;x<20;x++ )
		{
			if( bullet[x][1]<=384 && bullet[x][1]>=-36 )
			{
				bullet[x][1]-=3;
				putimage( bullet[x][0], bullet[x][1], &img );
			}
		}
		for( int x=0;x<100;x++ )
		{
			for( int i=0;i<20;i++ )
			{
				if( randx[x][1]>=0 && randx[x][1]<=480 && randx[x][0]<bullet[i][0]+5 && randx[x][0]>bullet[i][0]-40 && bullet[i][1]<randx[x][1]+40 )
				{
					randx[x][1]=481;
					bullet[i][1]=600;
				}
			}
		}
	}
}
开发者ID:wuzhixiang,项目名称:car,代码行数:25,代码来源:主程序.cpp


示例19: loadcar

void loadcar( int x )
{
	IMAGE img;

	loadimage( &img, _T("res/car.jpg"));
	putimage( x, 420, &img );
}
开发者ID:wuzhixiang,项目名称:car,代码行数:7,代码来源:主程序.cpp


示例20: prevent

void prevent( int randx[][2], IMAGE img, const bool decidex, Player player, int counter, int subx, int x )
{
	int cnt=0;

	if( decidex == true && player.getspeed() != 0 )
	{
		if( subx == x )
		{
			for( ;cnt<100;cnt++ )
			{
				if( randx[cnt][1]<=0 || randx[cnt][1]>480 )
					break;
			}
			if( x>( ( x/320+1 )*320-40 ) )
			{
				for( ;x>( ( x/320+1 )*320-40 ); )
					x--;
			}
			if( x/320 == 0 )
				randx[cnt][0]=x;
			else
				randx[cnt][0]=x+1;
			randx[cnt][1]=0;
			putimage( randx[cnt][0], randx[cnt][1], &img );
		}
	}
}
开发者ID:wuzhixiang,项目名称:car,代码行数:27,代码来源:主程序.cpp



注:本文中的putimage函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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