コード例 #1
0
//--------------------------------------------------------------------------
void VeGraphicsTest::OnInit()
{
	VeTextTablePtr spTable = VeLoadTextTableSync("text.txt", "Scripts");

	m_spTestSound = VeLoadSimpleSoundSync("stereo.ogg", "Sound");

	VeLoadRenderFrameSync("test_frame.[frm]", "Scripts");
	VeVector<const VeChar8*> kUnitArray;
	kUnitArray.PushBack("test");
	g_pRenderFrameManager->Update("default", kUnitArray);

	VeLoadTextureAtlasSync("test-hd.xml", "Textures");

	//VeTextureResourcePtr spTex = VeLoadTextureSync("logo2.png", "Textures");

	VeSceneNode2DPtr spRoot = g_pSceneManager->GetRootNode2D();
	////spRoot->SetMulColor(1,1,1,0.5f);
	//spRoot->SetAddColor(0.3f, 0.0f, 0.0f);
	//VeSprite2DPtr spSprite = VE_NEW VeSprite2D("expression_1_01.png");
	//spRoot->AttachRenderable(spSprite);
	////spSprite->SetAnchor(0,0);
	////spRoot->SetRotate(VE_MATH_2_PI_F);
	////spRoot->SetScale(2.0f, 2.0f);
	//spRoot->SetPosition(200,200);
	////spSprite->SetColor(1.0f,1.0f,1.0,0.5f);

	////m_spAnimation = VE_NEW VeMorphManual2D(spRoot);

	////VeQuaternion kQuat;
	////kQuat.FromAngleAxis(1.0f, VeVector3D::UNIT_Y);
	////spRoot->SetRotate(1.0f);

	//

	//m_spNode = VE_NEW VeSceneNode2D;
	//spRoot->AttachChild(m_spNode);
	//m_spNode->SetPosition(80, 0);

	//VeSprite2DPtr spSprite2 = VE_NEW VeSprite2D("expression_1_02.png");
	//m_spNode->AttachRenderable(spSprite2);

	//VeSceneNode2DPtr spNode2 = VE_NEW VeSceneNode2D;
	//m_spNode->AttachChild(spNode2);
	//spNode2->SetPosition(80, 0);

	//VeSprite2DPtr spSprite3 = VE_NEW VeSprite2D("expression_1_03.png");
	//spNode2->AttachRenderable(spSprite3);

	//VeBoundingBox2D kBox(VeVector2D(-40,-40), VeVector2D(40,40));
	//VeSquareFramePtr spFrame = VE_NEW VeSquareFrame(kBox);
	//spNode2->AttachRenderable(spFrame);
	//spFrame = VE_NEW VeSquareFrame(kBox);
	//m_spNode->AttachRenderable(spFrame);
	//VeSquarePtr spSquare = VE_NEW VeSquare(kBox);
	//spRoot->AttachRenderable(spSquare);

	//m_spNodeText = VE_NEW VeSceneNode2D;
	//spRoot->AttachChild(m_spNodeText);
	//m_spNodeText->SetPosition(g_pRenderer->GetWidthF() * 0.5f, g_pRenderer->GetHeightF() * 0.5f);
	////pkNodeText->SetScale(2.0f);

	//VeFontPtr spTestFont = VeLoadFontSync("black.kfont", "Fonts");

	

	//m_spNodeText->RunAction(VeRepeatForever::Create(VeSequence::Create(VeScaleTo2D::Create(0.5f, 2.0f, 2.0f, VeTweenEasing::TYPE_QUAD_IN_OUT), VeScaleTo2D::Create(0.5f, 1.0f, 1.0f, VeTweenEasing::TYPE_QUAD_IN_OUT), NULL)));



	//m_spNodeText->SetScale(2.0f);
	//m_spNodeText->SetRotate(1.0f);

	//VeSingleCharPtr spText = VE_NEW VeSingleChar();
	//spText->SetChar(L'H', spTestFont);
	////spText->SetBias(-0.5f);
	//m_spNodeText->AttachRenderable(spText);

	/*VeSingleCharPtr spText2 = VE_NEW VeSingleChar();
	spText2->SetChar(L'b', spTestFont);
	spText2->SetBias(-0.5f);
	m_spNodeText->AttachRenderable(spText2);*/
	//VeSprite2DPtr spSprite5 = VE_NEW VeSprite2D("expression_1_02.png");
	//pkNodeText->AttachRenderable(spSprite5);

	//g_pLua->DoFileSync(VE_DIR("Lua/startup.lua"));

	//VeSizeT aaa = BaseClassBias<TestClass, TestBase1>();

	//VeInt32 a,b,c;
	//g_pLua->CallFunction("Test(ii)iii", 2, 3, &a,&b,&c);
	//g_pLua->CallFunction("Print(s)", "Test");

	//VeLuaCall(a, b, c, "Test", 2, 3);
	//VeLuaCall(a, b, c, "Test2");

	//VeLuaBind::MakeFuncFormat();
	//g_pLua->CallFunction("Print(s)", VeLuaBind::TypeToCName(VeLuaBind::MakeFuncFormat(&Test)));
	/*using namespace VeLuaBind;
	Module() [
		Def("TestCFunc", (VeInt32(*)(VeInt32))&TestCFunc),
			Def("TestCFunc", (VeInt32(*)(VeInt32,VeInt32))&TestCFunc)
	];
	VeLuaCall<void>("TestRun");
	VeInt32 i32Value = VeLuaCall<VeInt32>("TestCFunc", 4);
	VE_LOG_I("luabind debug", "Value %d", i32Value);
	i32Value = VeLuaCall<VeInt32>("TestCFunc", 3, 5);
	VE_LOG_I("luabind debug", "Value %d", i32Value);
	i32Value = VeLuaCall<VeInt32>("TestFunc", 3, 5);
	VE_LOG_I("luabind debug", "Value %d", i32Value);
	VE_ASSERT(g_pLua->GetTop() == 0);*/

	VeDragonBones::SetTexScale(2.0);
	VeLoadTextureAtlasSync("card_001.xml", "Textures");
	VeLoadTextureAtlasSync("card_002.xml", "Textures");
	VeLoadTextureAtlasSync("card_003.xml", "Textures");
	VeLoadTextureAtlasSync("card_Weapons_01.xml", "Textures");
	VeLoadTextureAtlasSync("card_Weapons_02.xml", "Textures");
	VeLoadTextureAtlasSync("eff_01.xml", "Textures");
	VeLoadTextureAtlasSync("eff_02.xml", "Textures");
	VeLoadDragonBonesSync("c04_001.xml", "Animation");
	//VeLoadDragonBonesSync("test.xml", "Animation");
	//VeLoadDragonBonesSync("ui_create_ani_1.xml", "Animation");

	VeDragonBonesEntityPtr spNode = VE_NEW VeDragonBonesEntity("c04_001.xml");

	spNode->SetZOrder(3.0f);
	spNode->SetPosition(g_pRenderer->GetWidthF() * 0.5f, g_pRenderer->GetHeightF() * 0.35f);
	g_pSceneManager->GetRootNode2D()->AttachChild(spNode);
	
	spNode->Play("lv4wait", 0.0f, 0.0f);

	/*VeSimpleTextPtr spText = VE_NEW VeSimpleText(spTestFont);
	spText->SetText("Hello World!");
	spText->SetLine(0, 0);
	spText->SetType(VeSimpleText::CENTER_CENTER, VeColor::WHITE, -0.5f, 0);
	spText->SetShadowType(VeColor(0,0,0,0.5f), 1.0f, VeVector2D(3.0f, 3.0f));
	
	spNode->GetBone("ui_create_title_0")->AttachChild(spText);*/

	

	
	//m_spNodeText->AttachChild(spText);

	//VeSimpleTextPtr spText2 = VE_NEW VeSimpleText(spTestFont);
	//spText2->SetText("Hello World!");
	//spText2->SetType(VeSimpleText::CENTER_CENTER, VeColor::WHITE, -0.5f, 0);
	//spText2->SetShadowType(VeColor(0,0,0,0.5f), 1.0f, VeVector2D(3.0f, 3.0f));
	//spText2->SetPosition(g_pRenderer->GetWidthF() * 0.5f, g_pRenderer->GetHeightF() * 0.5f);
	//m_spNodeText->AttachChild(spText2);

	//spNode->Play("Weapons_r", "01", 0.0f, 0.0f);
	//spNode->Play("Weapons_l", "01", 0.0f, 0.0f);
	//spNode->Play("eff_fly0", "stand", 0.0f, 0.0f);
	//spNode->Play("eff_fire0", "stand", 0.0f, 0.0f);

	//spNode->Play("eff_shield_0", "stand", 0.0f, 0.0f);

	//g_pClientManager->AddClient(VE_NEW VeClientBase("Test"));
	//g_pClientManager->Connect("Test", "127.0.0.1", 62001, "null", true);
}
コード例 #2
0
ファイル: HLSLCompiler.cpp プロジェクト: snailwork/Texas-cs
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");
	}
}