本文整理汇总了C++中CFileHandler::Seek方法的典型用法代码示例。如果您正苦于以下问题:C++ CFileHandler::Seek方法的具体用法?C++ CFileHandler::Seek怎么用?C++ CFileHandler::Seek使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFileHandler
的用法示例。
在下文中一共展示了CFileHandler::Seek方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: VorbisStreamSeek
int VorbisStreamSeek(void* datasource, ogg_int64_t offset, int whence)
{
CFileHandler* buffer = static_cast<CFileHandler*>(datasource);
if (whence == SEEK_SET)
{
buffer->Seek(offset, std::ios_base::beg);
}
else if (whence == SEEK_CUR)
{
buffer->Seek(offset, std::ios_base::cur);
}
else if (whence == SEEK_END)
{
buffer->Seek(offset, std::ios_base::end);
}
return 0;
}
示例2: tileFile
CBFGroundTextures::CBFGroundTextures(CSmfReadMap *rm)
{
CFileHandler *ifs = rm->ifs;
map = rm;
numBigTexX=gs->mapx/128;
numBigTexY=gs->mapy/128;
MapHeader* header=&map->header;
ifs->Seek(header->tilesPtr);
tileSize = header->tilesize;
MapTileHeader tileHeader;
READPTR_MAPTILEHEADER(tileHeader,ifs);
tileMap = SAFE_NEW int[(header->mapx*header->mapy)/16];
tiles = SAFE_NEW char[tileHeader.numTiles*SMALL_TILE_SIZE];
int curTile=0;
for(int a=0;a<tileHeader.numTileFiles;++a){
PrintLoadMsg("Loading tile file");
int size;
ifs->Read(&size,4);
size = swabdword(size);
string name;
while(true){
char ch;
ifs->Read(&ch,1);
/* char, no swab */
if(ch==0)
break;
name+=ch;
}
name=string("maps/")+name;
CFileHandler tileFile(name);
if(!tileFile.FileExists()){
logOutput.Print("Couldnt find tile file %s",name.c_str());
memset(&tiles[curTile*SMALL_TILE_SIZE],0xaa,size*SMALL_TILE_SIZE);
curTile+=size;
continue;
}
PrintLoadMsg("Reading tiles");
TileFileHeader tfh;
READ_TILEFILEHEADER(tfh,tileFile);
if(strcmp(tfh.magic,"spring tilefile")!=0 || tfh.version!=1 || tfh.tileSize!=32 || tfh.compressionType!=1){
char t[500];
sprintf(t,"Error couldnt open tile file %s",name.c_str());
handleerror(0,t,"Error when reading tile file",0);
exit(0);
}
for(int b=0;b<size;++b){
tileFile.Read(&tiles[curTile*SMALL_TILE_SIZE],SMALL_TILE_SIZE);
curTile++;
}
}
PrintLoadMsg("Reading tile map");
int count = (header->mapx*header->mapy)/16;
ifs->Read(tileMap, count*sizeof(int));
for (int i = 0; i < count; i++) {
tileMap[i] = swabdword(tileMap[i]);
}
tileMapXSize = header->mapx/4;
tileMapYSize = header->mapy/4;
squares=SAFE_NEW GroundSquare[numBigTexX*numBigTexY];
for(int y=0;y<numBigTexY;++y){
for(int x=0;x<numBigTexX;++x){
GroundSquare* square=&squares[y*numBigTexX+x];
square->texLevel=1;
square->lastUsed=-100;
LoadSquare(x,y,2);
}
}
inRead=false;
}