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


C++ setPicture函数代码示例

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


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

示例1: Hash

Picture& PictureBank::getPicture(const std::string &name)
{
  const unsigned int hash = Hash( name );
  //Logger::warning( "PictureBank getpic " + name );

  Impl::ItPicture it = _d->resources.find( hash );
  if( it == _d->resources.end() )
  {
    //can't find image in valid resources, try load from hdd
    Picture pic = _d->tryLoadPicture( name );

    if( pic.isValid() ) { setPicture( name, pic );  }
    else{ _d->resources[ hash ] = pic; }

    return _d->resources[ hash ];
  }
  return it->second;
}
开发者ID:andrelago13,项目名称:caesaria-game,代码行数:18,代码来源:picture_bank.cpp

示例2: WorkingBuilding

Granary::Granary() : WorkingBuilding( constants::building::granary, Size(3) ), _d( new Impl )
{
  _d->goodStore.granary = this;

  setPicture( ResourceGroup::commerce, 140 );
  _fgPicturesRef().resize(6);  // 1 upper level + 4 windows + animation

  _animationRef().load(ResourceGroup::commerce, 146, 7, Animation::straight);
  // do the animation in reverse
  _animationRef().load(ResourceGroup::commerce, 151, 6, Animation::reverse);
  _animationRef().setDelay( 4 );

  _fgPicturesRef().at(0) = Picture::load( ResourceGroup::commerce, 141);
  _fgPicturesRef().at(5) = _animationRef().getFrame();
  computePictures();

  _d->devastateThis = false;  
}
开发者ID:dalerank,项目名称:opencaesar3,代码行数:18,代码来源:granary.cpp

示例3: switch

bool QLabel::qt_invoke( int _id, QUObject* _o )
{
    switch ( _id - staticMetaObject()->slotOffset() ) {
    case 0: setText((const QString&)static_QUType_QString.get(_o+1)); break;
    case 1: setPixmap((const QPixmap&)*((const QPixmap*)static_QUType_ptr.get(_o+1))); break;
    case 2: setPicture((const QPicture&)*((const QPicture*)static_QUType_ptr.get(_o+1))); break;
    case 3: setMovie((const QMovie&)*((const QMovie*)static_QUType_ptr.get(_o+1))); break;
    case 4: setNum((int)static_QUType_int.get(_o+1)); break;
    case 5: setNum((double)static_QUType_double.get(_o+1)); break;
    case 6: clear(); break;
    case 7: acceleratorSlot(); break;
    case 8: buddyDied(); break;
    case 9: movieUpdated((const QRect&)*((const QRect*)static_QUType_ptr.get(_o+1))); break;
    case 10: movieResized((const QSize&)*((const QSize*)static_QUType_ptr.get(_o+1))); break;
    default:
	return QFrame::qt_invoke( _id, _o );
    }
    return TRUE;
}
开发者ID:AliYousuf,项目名称:univ-aca-mips,代码行数:19,代码来源:moc_qlabel.cpp

示例4: setPicture

void Garden::build( CityPtr city, const TilePos& pos )
{
  // this is the same arrangement of garden tiles as existed in C3
  int theGrid[2][2] = {{113, 110}, {112, 111}};

  Construction::build( city, pos );
  setPicture( ResourceGroup::entertaiment, theGrid[pos.getI() % 2][pos.getJ() % 2] );

  if( getSize().getArea() == 1 )
  {
    TilemapTiles tilesAround = city->getTilemap().getRectangle( getTilePos() - TilePos( 1, 1),
                                                                getTilePos() + TilePos( 1, 1 ) );
    foreach( Tile* tile, tilesAround )
    {
      GardenPtr garden = tile->getOverlay().as<Garden>();
      if( garden.isValid() )
      {
        garden->update();
      }
    }
开发者ID:brobits,项目名称:opencaesar3,代码行数:20,代码来源:garden.cpp

示例5: start

void PictureBank::Impl::loadAtlas(const vfs::Path& filePath)
{
  if( !filePath.exist() )
  {
    Logger::warning( "PictureBank: cant find atlas " + filePath.toString() );
    return;
  }

  VariantMap info = config::load( filePath );

  vfs::Path texturePath = info.get( "texture" ).toString();

  vfs::NFile file = vfs::NFile::open( texturePath );

  Picture mainTexture;
  if( file.isOpen() )
  {
    mainTexture = PictureLoader::instance().load( file );
  }
  else
  {
    Logger::warning( "PictureBank: load atlas failed for texture" + texturePath.toString() );
    mainTexture = Picture::getInvalid();
  }

  //SizeF mainRectSize = mainTexture.size().toSizeF();
  if( !info.empty() )
  {
    VariantMap items = info.get( framesSection ).toMap();
    for( auto& i : items )
    {
      VariantList rInfo = i.second.toList();
      Picture pic = mainTexture;
      Point start( rInfo.get( 0 ).toInt(), rInfo.get( 1 ).toInt() );
      Size size( rInfo.get( 2 ).toInt(), rInfo.get( 3 ).toInt() );

      pic.setOriginRect( Rect( start, size ) );
      setPicture( i.first, pic );
    }
  }
}
开发者ID:andrelago13,项目名称:caesaria-game,代码行数:41,代码来源:picture_bank.cpp

示例6: setPicture

void Road::build(const TilePos& pos )
{
    Tilemap& tilemap = Scenario::instance().getCity().getTilemap();
    LandOverlay* saveOverlay = tilemap.at( pos ).get_terrain().getOverlay();

    Construction::build( pos );
    setPicture(computePicture());

    if( Aqueduct* aqua = safety_cast< Aqueduct* >( saveOverlay ) )
    {
        aqua->build( pos );
        return;
    }

  // update adjacent roads
  for (std::list<Tile*>::iterator itTile = _accessRoads.begin(); itTile != _accessRoads.end(); ++itTile)
  {
    Road* road = safety_cast< Road* >( (*itTile)->get_terrain().getOverlay() ); // let's think: may here different type screw up whole program?
    if( road )
    {
        road->computeAccessRoads();
        road->setPicture(road->computePicture());
    }
  }
  // NOTE: also we need to update accessRoads for adjacent building
  // how to detect them if MaxDistance2Road can be any
  // so let's recompute accessRoads for every _building_
  std::list<LandOverlay*> list = Scenario::instance().getCity().getOverlayList(); // it looks terrible!!!!
  for (std::list<LandOverlay*>::iterator itOverlay = list.begin(); itOverlay!=list.end(); ++itOverlay)
  {
    LandOverlay *overlay = *itOverlay;
    Building *construction = dynamic_cast<Building*>(overlay);
    if (construction != NULL) // if NULL then it ISN'T building
    {
      construction->computeAccessRoads();
    }
  }
}
开发者ID:Ilgrim,项目名称:opencaesar3,代码行数:38,代码来源:oc3_building.cpp

示例7: getPicture

void getPicture(int sock){
	int size = 0;
	unsigned int file_size = 555555;
	int sum = 0;
	int image_size;

	//save image data
	static unsigned char buf[200000];

	memset(buf, 0, sizeof(buf));
	size = recv(sock, &image_size, 4, 0);
	while(1){
		//recieve image data
		size = recv(sock1, buf+sum, image_size-sum, 0);
		sum += size;

		if(sum == image_size){
            setPicture(buf,sum);
			break;
		}
	}

}
开发者ID:CPFL,项目名称:netim,代码行数:23,代码来源:camera_native.c

示例8: ServiceBuilding

BigTempleMars::BigTempleMars() : ServiceBuilding(S_TEMPLE_MARS, B_BIG_TEMPLE_MARS, Size(3))
{
  setPicture( Picture::load( ResourceGroup::security, 52));
}
开发者ID:LMG,项目名称:opencaesar3,代码行数:4,代码来源:oc3_service_building.cpp

示例9: setType

Road::Road()
{
  setType(B_ROAD);
  setPicture(PicLoader::instance().get_picture( rcRoadGroup, 44));  // default picture for build tool
}
开发者ID:Ilgrim,项目名称:opencaesar3,代码行数:5,代码来源:oc3_building.cpp


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