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


C++ Part::GetSprite方法代码示例

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


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

示例1: Update

	void PuppetEditor::Update()
	{
		Editor::Update();

		if (isEnabled)
		{
			UpdateCamera();

			timeline->currentAnimation = puppetEntity->puppet.GetCurrentAnimation();

			Animation *anim = puppetEntity->puppet.GetCurrentAnimation();

			if (Input::IsKeyPressed(keyTogglePause))
			{
				puppetEntity->puppet.TogglePause();
				Debug::render = Debug::showBounds = puppetEntity->puppet.IsPaused();
				if (!puppetEntity->puppet.IsPaused())
				{
					Debug::selectedEntity = NULL;
				}
				else
				{
					if (anim)
					{
						anim->SetCurrentTime(int(anim->GetCurrentTime()/TIME_STEP)*TIME_STEP);
					}
				}
			}

			if (puppetEntity->puppet.IsPaused())
			{
				if (Input::IsMouseButtonPressed(MOUSE_BUTTON_LEFT))
					Debug::selectedEntity = scene->GetNearestEntityByControlPoint(Input::GetWorldMousePosition(), "", Debug::selectedEntity);

				if (Input::IsKeyHeld(KEY_LCTRL))
				{
					if (Input::IsKeyPressed(KEY_S))
					{
						puppetEntity->puppet.Save();
					}
				}

				if (Debug::selectedEntity)
				{
					Part *part = dynamic_cast<Part*>(Debug::selectedEntity);

					float moveSpeed = 10.0f;
					float rotateSpeed = 15.0f;

					if (Input::IsKeyHeld(KEY_LSHIFT))
					{
						float multiplier = 5.0f;
						moveSpeed *= multiplier;
						rotateSpeed *= multiplier;
					} 

					if (Input::IsKeyPressed(keyZero))
					{
						part->position = Vector2::zero;
						part->rotation = 0.0f;
						part->GetSprite()->position = Vector2::zero;
					}

					float moveAmount = Monocle::deltaTime * moveSpeed * 10.0f;
					float rotateAmount = Monocle::deltaTime * rotateSpeed;

					if (Input::IsKeyHeld(KEY_LCTRL))
					{
					}
					else
					{
						if (Input::IsKeyHeld(keyOffset))
						{
							if (part)
							{
								Sprite *sprite = part->GetSprite();

								if (Input::IsKeyHeld(keyMoveLeft))
									sprite->position += Vector2::left * moveAmount;
								if (Input::IsKeyHeld(keyMoveRight))
									sprite->position += Vector2::right * moveAmount;
								if (Input::IsKeyHeld(keyMoveUp))
									sprite->position += Vector2::up * moveAmount;
								if (Input::IsKeyHeld(keyMoveDown))
									sprite->position += Vector2::down * moveAmount;
							}
						}
						else
						{
							if (Input::IsKeyHeld(keyMoveLeft))
								Debug::selectedEntity->position += Vector2::left * moveAmount;
							if (Input::IsKeyHeld(keyMoveRight))
								Debug::selectedEntity->position += Vector2::right * moveAmount;
							if (Input::IsKeyHeld(keyMoveUp))
								Debug::selectedEntity->position += Vector2::up * moveAmount;
							if (Input::IsKeyHeld(keyMoveDown))
								Debug::selectedEntity->position += Vector2::down * moveAmount;
						}

						if (Input::IsKeyHeld(keyRotateLeft))
//.........这里部分代码省略.........
开发者ID:Chwen,项目名称:Monocle-Engine,代码行数:101,代码来源:PuppetEditor.cpp


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