当前位置: 首页>>代码示例>>C++>>正文


C++ CSurface::GetDDrawSurface方法代码示例

本文整理汇总了C++中CSurface::GetDDrawSurface方法的典型用法代码示例。如果您正苦于以下问题:C++ CSurface::GetDDrawSurface方法的具体用法?C++ CSurface::GetDDrawSurface怎么用?C++ CSurface::GetDDrawSurface使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CSurface的用法示例。


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

示例1: AddTile

bool NOX_MAP::AddTile(char objName[], int X, int Y, int variation)
{
	if( X < 0 || X > 255 ||
		Y < 0 || Y > 255)
		return(false);
	int ObjNum=0;
	ROLF *tile = NULL;
	for(tile = Thing.Thing.Tile.Tiles.Get(); tile && strcmp(tile->Name,objName); tile = Thing.Thing.Tile.Tiles.Get(), ObjNum++);
	Thing.Thing.Tile.Tiles.ClearGet();

	if( tile == NULL )
		return false;
	IDX_DB::Entry * Entry = NULL;
	IDX_DB::SectionHeader * Section = NULL;
	CSurface * surf;
    SURFACE tem;
	SURFACE * test;
	
		unsigned int val = *tile->Images.Get(variation); 
		tile->Images.ClearGet();
		val++;

test = Floor.TileImgs.Find(val);
if( !test )
{
	surf = NULL;
    fstream file;
	file.open(Video.bagpath,ios::in | ios::binary);
		Video.idx.GetAll(val,&Entry,&Section);
		
		if( Entry )
		{
		
			NxImage *img = Video.Extract(&file,Section,Entry);
			Display.Display->CreateSurface(&surf,img->width,img->height);
			if(surf)
				surf->SetColorKey(RGB(248,7,248));
			Display.BltBitmapData(img->data,img->width,img->height,surf->GetDDrawSurface());
			tem.surface = surf;
			tem.Height = img->height;
			tem.Width = img->width;
			tem.Image_ID = val;
			tem.ImgType = Entry->Entry_Type;
			tem.OffsetX = Entry->OffsetX;
			tem.OffsetY = Entry->OffsetY;
			img->Unload();
		}


		//LOAD THE NAME AS WELL NOW!!!!!
		Floor.TileImgs.Add(tem,val);    
		file.close();
		Floor.tileMap[X][Y].pTile = &Floor.TileImgs.last->msg;
}
else
{
  Floor.tileMap[X][Y].pTile = test;
}
		Floor.tileMap[X][Y].Tile = ObjNum;
		Floor.tileMap[X][Y].tVari = variation;
		Floor.tileMap[X][Y].TileImg = val;
		Floor.TileImgs.ClearGet();
	
		tem.surface = NULL;
		tem.name = NULL;
		surf = NULL;


return(true);
}
开发者ID:elitak,项目名称:NoxTools,代码行数:70,代码来源:NOXMAP.cpp

示例2: AddObject

bool NOX_MAP::AddObject(char objName[], int X, int Y, int callback)
{
	/*RGBQUAD test;
	test.rgbBlue = 255;
	test.rgbRed = 255;
	Video.bmpfile.Set_Color(test);
*/
	int ObjNum =0;
	GNHT * obj;
	for(obj = Thing.Thing.Object.Objects.Get(); obj && strcmp(obj->Name,objName); obj = Thing.Thing.Object.Objects.Get(), ObjNum++);
	Thing.Thing.Object.Objects.ClearGet();

	OBJECT object;
    CSurface * surf = NULL;
    SURFACE tem;
    SURFACE * test = NULL;

	if( !obj )
      return(false);

	IDX_DB::Entry * Entry = NULL;
	IDX_DB::SectionHeader * Section = NULL;
    long val = 0;


		 // else if(obj->Stats.numNodes > 0 && obj->Stats.numNodes<2)
           //   val = *obj->Stats.Get(0)->Images.Get(0);

		  if(obj->Stats.numNodes)
              val = *obj->Stats.Get(0)->Images.Get(0);
		  else if(obj->PrettyImage!=NULL)
			  val = obj->PrettyImage;
		  else if(obj->MenuIcon!=NULL)
			  val = obj->MenuIcon;	
		  else
			  return(false);
	      if( val )
			  val++;
		  else
			  return(false);
          
		  if( !val || val < 0 )
			  return(false);

          //test = Objects.ObjImages.Find(val);
          if( val && !(test = Objects.ObjImages.Find(val)) )
		  {

		  Video.idx.GetAll((unsigned long)val,&Entry,&Section);


			  //Video.Extract(&file,Section,Entry,"c://TESTMAP.bmp");
			 // Display.Display->CreateSurfaceFromBitmap(&surf,"C://TESTMAP.bmp");
			 // if( surf )
			 //     surf->SetColorKey(RGB(0,0,0));
			  //remove("c://TESTMAP.bmp");
			  

///////////////////////////////////////////////////////////////////////////////////////////////
if( Entry )
{		  
	fstream file;
    file.open(Video.bagpath,ios::in | ios::binary);

	NxImage *img = Video.Extract(&file,Section,Entry);

	if( img && img->height >0 && img->width >0)
	{
		Display.Display->CreateSurface(&surf,img->width,img->height);
	if( surf )
		surf->SetColorKey(RGB(248,7,248));
		Display.BltBitmapData(img->data, img->width, img->height, surf->GetDDrawSurface());
	}	
		tem.surface = surf;
		tem.Height = img->height;
		tem.Width = img->width;
		tem.Image_ID = val;
		tem.ImgType = Entry->Entry_Type;
		tem.OffsetX = Entry->OffsetX;
		tem.OffsetY = Entry->OffsetY;
		//tem.img.Load(img->width,img->height,img->offsetX,img->offsetY,img->data,(char*)&img->ID);
		img->Unload();
		//LOAD THE NAME AS WELL NOW!!!!!
		Objects.ObjImages.Add(tem,val);
		test = &Objects.ObjImages.last->msg;

	file.close();
}	  
///////////////////////////////////////////////////////////////////////////////////////////////
		  }
		 object.imgID = val;
		 object.objID = ObjNum;
		 object.X = X;
		 object.Y = Y;
		 object.callbackID = callback;
		 if(test)
		 {
			object.Height = test->Height;
			object.Width = test->Width;
		 }
//.........这里部分代码省略.........
开发者ID:elitak,项目名称:NoxTools,代码行数:101,代码来源:NOXMAP.cpp


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