本文整理汇总了C++中CInput::GetController方法的典型用法代码示例。如果您正苦于以下问题:C++ CInput::GetController方法的具体用法?C++ CInput::GetController怎么用?C++ CInput::GetController使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CInput
的用法示例。
在下文中一共展示了CInput::GetController方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
//.........这里部分代码省略.........
示例2: Input
//.........这里部分代码省略.........
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;
}
}
}
else
ifPressedD_WIN = false;
if(_input.KeyDown(DIK_D) || _input.KeyDown(DIK_RIGHT) || _input.GetController().GetControllerState().Gamepad.sThumbLY > 8000 || _input.GetController().GetControllerState().Gamepad.wButtons & XINPUT_GAMEPAD_DPAD_RIGHT)
{
if (m_FadeTimer <= 1.0f && !m_bFadeOut)
{
if(!ifPressedU_WIN)
{
m_Choice--;
if(m_Choice < 0)
{
m_Choice = W_CREDITS;
}
ifPressedU_WIN = true;
}
}
}
else
ifPressedU_WIN = false;*/
if (m_Timer > 0.5f)
{
if(_input.KeyDown(DIK_RETURN) || (_input.GetController().GetControllerState().Gamepad.wButtons & XINPUT_GAMEPAD_A) )
{
if(!ifPressedEnter_WIN)
{
m_bFadeOut = true;
ifPressedEnter_WIN = true;
}
}
else
ifPressedEnter_WIN = false;
}
示例3: Input
bool CDifficultyMenu::Input( CInput& _input )
{
_input.ReadMouse();
_input.ReadKeyboard();
static bool ifPressedDown = false;
static bool ifPressedUp = false;
static bool ifPressedEnter1 = false;
static bool ifPressedEnter2 = false;
//static bool ifPressedEsc = 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());
if(_input.GetMousePosX() == m_PrevMousePosX && _input.GetMousePosY() == m_PrevMousePosY)
m_MouseActive = true;
if(_input.GetMousePosX() != m_PrevMousePosX || _input.GetMousePosY() != m_PrevMousePosY)
{
m_MouseActive = true;
m_PrevMousePosX = _input.GetMousePosX();
m_PrevMousePosY = _input.GetMousePosY();
}
//Esc (EXIT THE PROGRAM)
static bool ifPressedEsc_Cred = false;
if(!ifPressedEsc_Cred)
{
if(_input.KeyDown(DIK_ESCAPE))
{
m_Choice = CHOICE_BACK;
m_FadeOut = true;
ifPressedEsc_Cred = true;
return true;
}
}
else
ifPressedEsc_Cred = false;
#pragma region Keyboard inputs
if(_input.KeyDown(DIK_S) || _input.KeyDown(DIK_DOWN) || _input.GetController().GetControllerState().Gamepad.sThumbLY < - 8000 || _input.GetController().GetControllerState().Gamepad.wButtons & XINPUT_GAMEPAD_DPAD_DOWN )
{
if(m_FadeTimer <= 1.0f && !m_FadeOut)
{
if(!ifPressedDown)
{
m_Choice++;
if(m_Choice == CHOICE_TOTAL)
{
m_Choice = CHOICE_EASY;
}
ifPressedDown = true;
}
}
}
else
ifPressedDown = false;
if(_input.KeyDown(DIK_W) || _input.KeyDown(DIK_UP) || _input.GetController().GetControllerState().Gamepad.sThumbLY > 8000 || _input.GetController().GetControllerState().Gamepad.wButtons & XINPUT_GAMEPAD_DPAD_UP)
{
if(m_FadeTimer <= 1.0f && !m_FadeOut)
{
if(!ifPressedUp)
{
m_Choice--;
if(m_Choice < 0)
{
m_Choice = CHOICE_BACK;
}
ifPressedUp = true;
}
}
}
else
ifPressedUp = false;
#pragma endregion
switch(m_Choice)
{
case CHOICE_EASY:
{
if(m_SoundEasy)
{
// AudioSystemWwise::GetInstance()->PostEvent(AK::EVENTS::PLAY_FX_2D_MENUMOVE_HOVER);
AudioSystemWwise::GetInstance()->PostEvent(AK::EVENTS::PLAY_SFX_MENU_HOVER);
m_SoundEasy = false;
m_SoundNormal = true;
m_SoundHard = true;
m_SoundBack = true;
m_isHighlighted = true;
}
}
break;
case CHOICE_NORMAL:
{
if(m_SoundNormal)
{
//.........这里部分代码省略.........