Esempio n. 1
0
void Replay::StartRecord(const FilePath & dirName)
{
    DVASSERT(!isRecord);
    DVASSERT(!isPlayback);
    isRecord = true;
    pauseReplay = false;

    FileSystem::Instance()->DeleteDirectoryFiles(dirName, false);
    FileSystem::Instance()->CreateDirectory(dirName);

    FileList * list = new FileList("~doc:/");
    int32 listSize = list->GetCount();
    for(int32 i = 0; i < listSize; ++i)
    {
        String fileName = list->GetFilename(i);
        if(!list->IsNavigationDirectory(i) && !list->IsDirectory(i) && fileName != "LastReplay.rep")
        {
            FileSystem::Instance()->CopyFile(list->GetPathname(i), dirName + fileName);
        }
    }

    list->Release();

    FilePath filePath = dirName + "LastReplay.rep";
    file = File::Create(filePath, File::CREATE | File::WRITE);

    Random::Instance()->Seed();
}
Esempio n. 2
0
void Replay::StartPlayback(const FilePath & dirName)
{
    DVASSERT(!isRecord);
    DVASSERT(!isPlayback);
    pauseReplay = false;
    isPlayback = true;

    FileSystem::Instance()->DeleteDirectoryFiles("~doc:/", false);
    FileList * list = new FileList(dirName);
    int32 listSize = list->GetCount();
    for(int32 i = 0; i < listSize; ++i)
    {
        String fileName = list->GetFilename(i);
        if(!list->IsNavigationDirectory(i) && !list->IsDirectory(i))
        {
            FilePath existingFile = dirName + fileName;
            FilePath newFile("~doc:/" + fileName);

            FileSystem::Instance()->CopyFile(existingFile, newFile);
        }
    }

    list->Release();


    skipType = false;
    file = File::Create("~doc:/LastReplay.rep", File::OPEN | File::READ);
}
void LightmapsPacker::ParseSpriteDescriptors()
{
	FileList * fileList = new FileList(outputDir);

	char8 buf[512];
	uint32 readSize; 

	int32 itemsCount = fileList->GetCount();
	for(int32 i = 0; i < itemsCount; ++i)
	{
		const FilePath & filePath = fileList->GetPathname(i);
		if(fileList->IsDirectory(i) || !filePath.IsEqualToExtension(".txt"))
		{
			continue;
		}

		LightmapAtlasingData data;

		data.meshInstanceName = filePath.GetBasename();
        
		File * file = File::Create(filePath, File::OPEN | File::READ);
		
		file->ReadLine(buf, sizeof(buf)); //textures count

		readSize = file->ReadLine(buf, sizeof(buf)); //texture name
		FilePath originalTextureName = outputDir + String(buf, readSize);
		data.textureName = originalTextureName;

		file->ReadLine(buf, sizeof(buf)); //image size

		file->ReadLine(buf, sizeof(buf)); //frames count

		file->ReadLine(buf, sizeof(buf)); //frame rect
		int32 x, y, dx, dy, unused0, unused1, unused2;
		sscanf(buf, "%d %d %d %d %d %d %d", &x, &y, &dx, &dy, &unused0, &unused1, &unused2);
		dx++;//cause TexturePacker::ReduceRectToOriginalSize removed one pixel by default
		dy++;

		Vector2 textureSize = GetTextureSize(originalTextureName);
		data.uvOffset = Vector2((float32)x/textureSize.x, (float32)y/textureSize.y);
		data.uvScale = Vector2((float32)dx/textureSize.x, (float32)dy/textureSize.y);
		
		file->Release();

		atlasingData.push_back(data);

		FileSystem::Instance()->DeleteFile(filePath);
	}

	fileList->Release();
}
void LightmapsPacker::CreateDescriptors()
{
	FileList * fileList = new FileList(outputDir);

	int32 itemsCount = fileList->GetCount();
	for(int32 i = 0; i < itemsCount; ++i)
	{
		const FilePath & filePath = fileList->GetPathname(i);
		if(fileList->IsDirectory(i) || !filePath.IsEqualToExtension(".png"))
		{
			continue;
		}

		TextureDescriptor descriptor;
        descriptor.Save(TextureDescriptor::GetDescriptorPathname(filePath));
	}

	fileList->Release();
}