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


C++ Timer::Connect方法代码示例

本文整理汇总了C++中Timer::Connect方法的典型用法代码示例。如果您正苦于以下问题:C++ Timer::Connect方法的具体用法?C++ Timer::Connect怎么用?C++ Timer::Connect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Timer的用法示例。


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

示例1: init

	int init() {
		// --- ezeket kell osszeszedni egy initwindowban
		const int screenWidth = m_window.getRealWidth(), screenHeight = m_window.getRealHeight();
		const int VSYNC_ENABLED = 1, FULL_SCREEN = 0;

		this->render.Initialize(screenWidth, screenHeight, VSYNC_ENABLED, this->m_window.getHWnd(), FULL_SCREEN);

		// init file loader
		this->m_file_loader = new FileAssetFactory("./../assets/");

		// --------------------------------------------------

		// -- camera
		CameraRef camera = new Camera;
		//camera->SetPosition(0.0f, 0.0f, -10.0f);
		//camera->SetLookTo(0, 0, -1);

		// -- texture
		TextureResRef texture = new TextureRes();

		texture = this->Load<TextureRes>(new TextureFromBitmap("normap", "textures/Normap.jpg"));

		// -- texture sampler
		m_textureSampler = new TextureSampler();
		m_textureSampler->Initialize(render);

		// -- load shader
		m_vertexShader = Load<ShaderRes>(new VertexShaderLoader("vShader", "shaders/vertex.hlsl", ""));
		m_fragmentShader = Load<ShaderRes>(new PixelShaderLoader("pShader", "shaders/textured.hlsl", ""));

		// -- load music
		music = Load<MusicRes>(new MusicBassLoader("alpha_c_-_euh.ogg"));

		// -- precalc
		this->DoPrecalc();

		// -- precalc utan egybol allitsuk be a synctrackert 
		// Setup syctracker
		timer = new Timer();
		timer->Initialize(music, music->Get()->GetLengthms(), 180, 8);
		timer->Connect();
		valTracker = new ValueTracker(timer);

		// -- model 
		ModelRef model = new Model;
		model->SetMaterial(new Material());
		model->GetMaterial()->AddTexture(texture, "diffuse");

		model = new Model(new Mesh());
		model->SetName("cube");
		model->GetMesh()->AddPointer("POSITION", GrafkitData::cubeVertexSize, GrafkitData::cubeVertices);
		model->GetMesh()->AddPointer("TEXCOORD", GrafkitData::cubeTextureUVsSize, GrafkitData::cubeTextureUVs);
		model->GetMesh()->AddPointer("NORMAL", GrafkitData::cubeVertexSize, GrafkitData::cubeNormals);
		model->GetMesh()->SetIndices(GrafkitData::cubeVertexCount, GrafkitData::cubeIndicesCount, GrafkitData::cubeIndices);
		model->GetMesh()->Build(render, m_vertexShader);

		// -- setup scene 
		scene = new Scene();
		this->cameraActor = new Actor(); cameraActor->AddEntity(camera);
		this->modelActor = new Actor(); modelActor->AddEntity(model);
		
		/*
		Alap right-handed koordinatarendszer szerint osszerakunk egy keresztet
		Ezeket adjuk hozza a belso kockahoz
		*/
		float3 cica[] = {
			{ 1, 0, 0 }, /* Jobb */{ -1, 0, 0 }, /* Bal */
			{ 0, 1, 0 }, /* fent */{ 0,-1, 0 }, /* lent */
			{ 0, 0, -1 }, /* elol */{ 0, 0, 1 }, /* hatul */
		};

		char *names[] = { "r", "l", "u", "d", "f", "b" };	/*right, left, up, down, front, back*/

		this->trk_rotate_root = valTracker->newFloat3Track("root", "r", "rpy");

		// size_t i = 5; 
		for (size_t i = 0; i < 6; i++)
		{
			ActorRef actor = new Actor();
			actor->AddEntity(model);
			modelActor->AddChild(actor);
			modelActors[i] = actor;

			float3 v = cica[i];
			v.x *= 3;
			v.y *= 3;
			v.z *= 3;

			actor->Matrix().Translate(v);

			this->trk_rotate[i] = valTracker->newFloat2Track("b", names[i], "rpy");

		}

		ActorRef rootActor = new Actor();
		cameraActor->Matrix().Translate(0,0,-10);

		rootActor->AddChild(cameraActor);
		rootActor->AddChild(modelActor);

//.........这里部分代码省略.........
开发者ID:caiwan,项目名称:Grafkit2,代码行数:101,代码来源:main_synctracker.cpp


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