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


C++ CInput::IsLeftClicked方法代码示例

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


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

示例1: Input


//.........这里部分代码省略.........
#pragma region Mouse Input for Selecting Buttons

	int _mouseX =			_input.GetMousePosX();
	int _mouseY =			_input.GetMousePosY();

	//PLAY BUTTON
	float _playWidth1 =			m_PauseElements[PAUSE_RESUME_ELEMENTS].GetRect().GetWidth();		//256
	float _playHeight1 =		m_PauseElements[PAUSE_RESUME_ELEMENTS].GetRect().GetHeight();		//64
	float _playPosX1 =			m_PauseElements[PAUSE_RESUME_ELEMENTS].GetPosX();		//280
	float _playPosY1 =			m_PauseElements[PAUSE_RESUME_ELEMENTS].GetPosY();		//612
	float _playCombinedX1 =		_playPosX1 + _playWidth1;						//536
	float _playCombinedY1 =		_playPosY1 + _playHeight1;						//676

	if (_mouseX >= _playPosX1 && _mouseX <= _playCombinedX1 && _mouseY <= _playCombinedY1 && _mouseY >= _playPosY1)
	{
		if (!m_bFadeOut)
		{
			if (m_bMouseActive)
			{
				m_Choice = P_PLAY;
				//m_PauseElements[PAUSE_HIGHLIGHTED_ELEMENTS].SetPosY(_playPosY1);
				//m_PauseElements[PAUSE_HIGHLIGHTED_ELEMENTS].BuildGeometry();
				//if (m_bSoundPlay)
				//{
				//	AudioSystemWwise::GetInstance()->PostEvent(AK::EVENTS::PLAY_FX_2D_MENUMOVE_HOVER);
				//	m_bSoundPlay = false;
				//	m_bSoundExit = true;
				//	m_bSoundOptions = true;
				//}
			}

			if (m_Timer > 0.5f)
			{
				if (_input.IsLeftClicked())
					m_bFadeOut = true;
			}
		}
	}

	//OPTIONS BUTTON
	float _optionsWidth1 =			m_PauseElements[PAUSE_OPTIONS_ELEMENTS].GetRect().GetWidth();		//256
	float _optionsHeight1 =			m_PauseElements[PAUSE_OPTIONS_ELEMENTS].GetRect().GetHeight();	//64
	float _optionsPosX1 =			m_PauseElements[PAUSE_OPTIONS_ELEMENTS].GetPosX();		//280
	float _optionsPosY1 =			m_PauseElements[PAUSE_OPTIONS_ELEMENTS].GetPosY();		//612
	float _optionsCombinedX1 =		_optionsPosX1 + _optionsWidth1;							//536
	float _optionsCombinedY1 =		_optionsPosY1 + _optionsHeight1;						//676

	if (_mouseX >= _optionsPosX1 && _mouseX <= _optionsCombinedX1 && _mouseY <= _optionsCombinedY1 && _mouseY >= _optionsPosY1)
	{
		if(!m_bFadeOut)
		{
			if (m_bMouseActive)
			{
				m_Choice = P_OPTIONS;
				//m_PauseElements[PAUSE_HIGHLIGHTED_ELEMENTS].SetPosY(_optionsPosY1);
				//m_PauseElements[PAUSE_HIGHLIGHTED_ELEMENTS].BuildGeometry();
				//if (m_bSoundOptions)
				//{
				//	AudioSystemWwise::GetInstance()->PostEvent(AK::EVENTS::PLAY_FX_2D_MENUMOVE_HOVER);
				//	m_bSoundPlay = true;
				//	m_bSoundExit = true;
				//	m_bSoundOptions = false;
				//}
			}
			if (m_Timer > 0.5f)
			{
开发者ID:dtbinh,项目名称:FinalProject2,代码行数:67,代码来源:PauseState.cpp

示例2: Input


//.........这里部分代码省略.........
	//				m_bFadeOut = true;
	//			}
	//			/*ProcessStates((eWinChoices)m_Choice);*/
	//		}
	//	}
	//}

	//CREDITS BUTTON
	float _creditsWidth1 =		m_WinElements[WIN_CREDITS_ELEMENT].GetRect().GetWidth();		//256
	float _creditsHeight1 =		m_WinElements[WIN_CREDITS_ELEMENT].GetRect().GetHeight();		//64
	float _creditsPosX1 =		m_WinElements[WIN_CREDITS_ELEMENT].GetPosX();		//280
	float _creditsPosY1 =		m_WinElements[WIN_CREDITS_ELEMENT].GetPosY();		//612
	float _creditsCombinedX1 =	_creditsPosX1 + _creditsWidth1;						//536
	float _creditsCombinedY1 =	_creditsPosY1 + _creditsHeight1;						//676

	if (_mouseX >= _creditsPosX1 && _mouseX <= _creditsCombinedX1 && _mouseY <= _creditsCombinedY1 && _mouseY >= _creditsPosY1)
	{
		if (m_FadeTimer <= 1.0f && !m_bFadeOut)	//Fadded in, set to 0, and not FadeOut.
		{
			if (m_bMouseActive)
			{
				m_Choice = W_CREDITS;
				if (m_bSoundCredits)
				{
					//					AudioSystemWwise::GetInstance()->PostEvent(AK::EVENTS::PLAY_FX_2D_MENUMOVE_HOVER);
					AudioSystemWwise::GetInstance()->PostEvent(AK::EVENTS::PLAY_SFX_MENU_HOVER);

					m_bSoundMain = true;
					m_bSoundCredits = false;
				}
			}
			if (m_Timer > 0.5f)
			{
				if (_input.IsLeftClicked())
				{
					//					AudioSystemWwise::GetInstance()->PostEvent(AK::EVENTS::PLAY_FX_2D_MENUACCEPT);
					AudioSystemWwise::GetInstance()->PostEvent(AK::EVENTS::PLAY_SFX_MENU_ACCEPT);

					m_bFadeOut = true;
				}
			}
		}
	}

#pragma endregion

	//KEYBOARD INPUT FOR SELECTING BUTTONS----------------------------------------------------------------------	
#pragma region Keyboard Input for Selecting Buttons

	//float _winPosY1 = m_WinElements[WIN_HIGHLIGHTED_ELEMENT].GetPosY();

	/*if(_input.KeyDown(DIK_A) || _input.KeyDown(DIK_LEFT) || _input.GetController().GetControllerState().Gamepad.sThumbLY < - 8000 || _input.GetController().GetControllerState().Gamepad.wButtons & XINPUT_GAMEPAD_DPAD_LEFT)
	{
		if (m_FadeTimer <= 1.0f && !m_bFadeOut)
		{
			if(!ifPressedD_WIN)
			{
				m_Choice++;
				if(m_Choice == WIN_NUM_CHOICES)
				{
					m_Choice = W_MAIN_MENU;
				}
				ifPressedD_WIN = true;
			}	
		}
	}
开发者ID:dtbinh,项目名称:FinalProject2,代码行数:67,代码来源:WinState.cpp

示例3: Input


//.........这里部分代码省略.........
	};

	if(_input.KeyDown(DIK_RETURN) || (_input.GetController().GetControllerState().Gamepad.wButtons & XINPUT_GAMEPAD_A) )
	{
		if(!ifPressedEnter1)
		{
			m_FadeOut = true;
//			AudioSystemWwise::GetInstance()->PostEvent(AK::EVENTS::PLAY_FX_2D_MENUACCEPT);
			AudioSystemWwise::GetInstance()->PostEvent(AK::EVENTS::PLAY_SFX_MENU_ACCEPT);

			ifPressedEnter1 = true;
		}
	}
	else
		ifPressedEnter1 = false;

#pragma region Mouse Input
	int _mX = _input.GetMousePosX();
	int _mY = _input.GetMousePosY();
	static bool ifLeftClickEasy = false;
	static bool ifLeftClickMedium = false;
	static bool ifLeftClickHard = false;
	static bool ifLeftClickBack = false;

	// play -> options -> credits
	// EASY
	float _assetwidth		=		m_DMElements[DM_EASY].GetRect().GetWidth();
	float _assetHeight		=		m_DMElements[DM_EASY].GetRect().GetHeight();	
	float _assetPosX		=		m_DMElements[DM_EASY].GetPosX();		
	float _assetPosY		=		m_DMElements[DM_EASY].GetPosY();		
	float _assetCombinedX	=		_assetPosX + _assetwidth;			
	float _assetCombinedY	=		_assetPosY + _assetHeight;

	if(_input.IsLeftClicked())
	{
		if(!ifLeftClickEasy)
		{
			ifLeftClickEasy = true;
			if( _mX >= _assetPosX && _mX <= _assetCombinedX && _mY <= _assetCombinedY && _mY >= _assetPosY )
			{
				if( m_Timer > 0.5f)
				{
					m_FadeOut = true;
//					AudioSystemWwise::GetInstance()->PostEvent(AK::EVENTS::PLAY_FX_2D_MENUACCEPT);
				AudioSystemWwise::GetInstance()->PostEvent(AK::EVENTS::PLAY_SFX_MENU_ACCEPT);
				//AudioSystemWwise::GetInstance()->PostEvent(AK::EVENTS::);


				}
			}
		}
	}
	else
	{
		ifLeftClickEasy = false;
	}


	if (_mX >= _assetPosX && _mX <= _assetCombinedX && _mY <= _assetCombinedY && _mY >= _assetPosY )
	{
		if(m_FadeTimer <= 1.0f && !m_FadeOut)
		{
			if(m_MouseActive)
			{
				m_Choice = CHOICE_EASY;
				if(m_SoundEasy)
开发者ID:dtbinh,项目名称:FinalProject2,代码行数:67,代码来源:DifficultyMenu.cpp


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