//--------------------------------------------------------------------------
void VeGraphicsTest::OnTouchCancelled(VeUInt32 u32Time, VeVector<VeInputMessage::TouchPointParam>& kParams)
{
    for(VeVector<VeInputMessage::TouchPointParam>::iterator it = kParams.Begin(); it != kParams.End(); ++it)
    {
        VeDebugOutput("OnTouchCancelled[time:%d,id:%d,x:%.0f,y:%.0f]", u32Time, it->id, it->x, it->y);
    }
}
Exemple #2
0
void Compile(VeChar8* pcFileName, VeChar8* pcDstDir)
{
	VeChar8* pcFile = VeStrrchr(pcFileName, '/');
	VeSizeT stNum = pcFile - pcFileName;
	VeChar8 acBuffer[2048];
	VeMemcpy(acBuffer, pcFileName, stNum);
	acBuffer[stNum] = 0;
	++pcFile;
	VeFileDir kFile(acBuffer);
	VeChar8* pcContent;
	VeChar8* pcTemp = VeStrtok(pcDstDir, "/", &pcContent);
	VE_ASSERT(pcTemp && *pcTemp);
	VeFileDir kDstFile(pcTemp);
	pcTemp = VeStrtok(NULL, "/", &pcContent);
	while(pcTemp && *pcTemp)
	{
		kDstFile.Change(pcTemp);
		pcTemp = VeStrtok(NULL, "/", &pcContent);
	}
	

	VeBinaryIStreamPtr spStream = kFile.OpenSync(pcFile);
	VE_ASSERT(spStream);
	VeXMLDocument kDoc;
	(*spStream) >> kDoc;
	VE_ASSERT(!kDoc.Error());
	VeXMLElement* pkRoot = kDoc.RootElement();
	VeXMLElement* pkGroup = pkRoot->FirstChildElement("Group");
	while(pkGroup)
	{
		VeXMLElement* pkShader = pkGroup->FirstChildElement();
		while(pkShader)
		{
			const VeChar8* pcName = pkShader->Value();
			const VeChar8* pcSrc = pkShader->GetAttribute("src");
			const VeChar8* pcEntry = pkShader->GetAttribute("entry");
			VeStringA kFile(acBuffer);
			kFile += '/';
			kFile += pcSrc;
			VeVector<const VeChar8*> kProfileList;
			VeXMLElement* pkProfile = pkShader->FirstChildElement("Profile");
			while(pkProfile)
			{
				const VeChar8* pcProfile = pkProfile->GetAttribute("value");
				kProfileList.PushBack(pcProfile);
				pkProfile = pkProfile->NextSiblingElement("Profile");
			}
			VeVector<D3D_SHADER_MACRO> kMacroList;
			VeXMLElement* pkMacro = pkShader->FirstChildElement("Macro");
			while(pkMacro)
			{
				D3D_SHADER_MACRO kMac;
				kMac.Name = pkMacro->GetAttribute("name");
				kMac.Definition = pkMacro->GetAttribute("define");
				kMacroList.PushBack(kMac);
				pkMacro = pkMacro->NextSiblingElement("Macro");
			}
			D3D_SHADER_MACRO kLast = {NULL, NULL};
			kMacroList.PushBack(kLast);
			for(VeVector<const VeChar8*>::iterator it = kProfileList.Begin(); it != kProfileList.End(); ++it)
			{
				HRESULT hRes = S_OK;
				ID3DBlob* pkOut;
				ID3DBlob* pkErrorBlob;
				hRes = D3DX11CompileFromFile(kFile, kMacroList.Begin(), NULL, pcEntry, *it, 
					D3DCOMPILE_ENABLE_STRICTNESS | D3DCOMPILE_OPTIMIZATION_LEVEL3 | D3DCOMPILE_PACK_MATRIX_COLUMN_MAJOR,
					0, NULL, &pkOut, &pkErrorBlob, NULL);
				if(VE_FAILED(hRes))
				{
					if(pkErrorBlob)
					{
						VE_LOG_EString("HLSLComplier", (VeChar8*)pkErrorBlob->GetBufferPointer());
					}
				}
				else
				{
					VeStringA kOutputName(pcName);
					kOutputName += '.';
					kOutputName += *it;
					VeMemoryOStreamPtr spOutputStream = VE_NEW VeMemoryOStream();
					spOutputStream->AddBlob(pkOut->GetBufferPointer(), pkOut->GetBufferSize());
					kDstFile.WriteAsync(kOutputName, spOutputStream, g_kWriteDelegate);
				}
				VE_SAFE_RELEASE(pkOut);
				VE_SAFE_RELEASE(pkErrorBlob);
			}
			pkShader = pkShader->NextSiblingElement();
		}
		pkGroup = pkGroup->NextSiblingElement("Group");
	}
}