本文整理汇总了C++中CInput::IsEscapePressed方法的典型用法代码示例。如果您正苦于以下问题:C++ CInput::IsEscapePressed方法的具体用法?C++ CInput::IsEscapePressed怎么用?C++ CInput::IsEscapePressed使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CInput
的用法示例。
在下文中一共展示了CInput::IsEscapePressed方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Input
bool CPauseState::Input( CInput& _input )
{
static bool ifPressedD = false;
static bool ifPressedU = false;
static bool ifPressedEnter_Paused = false;
// Updates the reticle location based on the mouse pos.
m_reticle.SetPosX(_input.GetMousePosX() - m_reticle.GetRect().GetWidth() * 0.5f);
m_reticle.SetPosY(_input.GetMousePosY() - m_reticle.GetRect().GetHeight() * 0.5f);
m_reticle.BuildGeometry(m_Renderer->GetScreenWidth(), m_Renderer->GetScreenHeight());
//Mouse Active over keybard
if(_input.GetMousePosX() == m_PrevMousePosX && _input.GetMousePosY() == m_PrevMousePosY)
{
m_bMouseActive = false;
}
if(_input.GetMousePosX() != m_PrevMousePosX)
{
m_bMouseActive = true;
m_PrevMousePosX = _input.GetMousePosX();
}
if(_input.GetMousePosY() != m_PrevMousePosY)
{
m_bMouseActive = true;
m_PrevMousePosY = _input.GetMousePosY();
}
if (m_Timer > 0.5f)
{
static bool ifPressEsc = true;
if(_input.IsEscapePressed() )
{
if(!ifPressEsc)
{
m_bFadeOut = true;
m_Esc = true;
m_Choice = P_PLAY;
ifPressEsc = true;
/// AudioSystemWwise::GetInstance()->PostEvent(AK::EVENTS::PLAY_FX_2D_MENUUNPAUSE);
}
}
else
ifPressEsc = false;
}
if (m_bFadeOut && m_FadeTimer >= 1.0f )
{
switch(m_Choice)
{
case P_PLAY:
{
// AudioSystemWwise::GetInstance()->PostEvent(AK::EVENTS::PLAY_FX_2D_MENUUNPAUSE);
m_Game->GetStateManager()->PopState();
return true;
}
break;
case P_OPTIONS:
{
// AudioSystemWwise::GetInstance()->PostEvent(AK::EVENTS::PLAY_FX_2D_MENUACCEPT);
AudioSystemWwise::GetInstance()->PostEvent(AK::EVENTS::PLAY_SFX_MENU_ACCEPT);
m_Game->GetStateManager()->PushState(OPTIONS_STATE);
return true;
}
break;
case P_EXIT:
{
// AudioSystemWwise::GetInstance()->PostEvent(AK::EVENTS::PLAY_FX_2D_MENUACCEPT);
AudioSystemWwise::GetInstance()->PostEvent(AK::EVENTS::PLAY_SFX_MENU_ACCEPT);
m_Game->GetStateManager()->ChangeState(MAINMENU_STATE);
return true;
}
break;
};
}
//KEYBOARD INPUT FOR SELECTING BUTTONS----------------------------------------------------------------------
#pragma region Keyboard Input for Selecting Buttons
if((_input.KeyDown(DIK_S) || _input.KeyDown(DIK_DOWN) || _input.GetController().GetControllerState().Gamepad.sThumbLY < - 8000 ||
_input.GetController().GetControllerState().Gamepad.wButtons & XINPUT_GAMEPAD_DPAD_DOWN) && !m_bFadeOut )
{
if(!ifPressedD)
{
m_Choice++;
//m_PauseElements[PAUSE_HIGHLIGHTED_ELEMENTS].SetPosX((m_Game->GetScreenWidth() / 2.0f) - 150);
//m_PauseElements[PAUSE_HIGHLIGHTED_ELEMENTS].SetPosY(m_Choice * 128.0f + 128.0f);
//m_PauseElements[PAUSE_HIGHLIGHTED_ELEMENTS].BuildGeometry();
if(m_Choice == PAUSE_NUM_CHOICES)
{
m_Choice = P_PLAY;
//m_PauseElements[PAUSE_HIGHLIGHTED_ELEMENTS].SetPosY((m_Game->GetScreenHeight() / 2.0f) - 160);
//m_PauseElements[PAUSE_HIGHLIGHTED_ELEMENTS].BuildGeometry();
}
ifPressedD = true;
//.........这里部分代码省略.........