Procházet zdrojové kódy

Input now works correctly

legacy
Benjamin ‘Touky’ Huet touky před 12 roky
rodič
revize
1e48c827a4
2 změnil soubory, kde provedl 8 přidání a 33 odebrání
  1. +7
    -32
      src/input/input.cpp
  2. +1
    -1
      test/BtPhysTest.cpp

+ 7
- 32
src/input/input.cpp Zobrazit soubor

@@ -237,49 +237,24 @@ bool InputTracker::WasPressed(ACTION_TYPE Action)
//Returns the current status of a given action //Returns the current status of a given action
int InputTracker::GetStatus(Key Button) int InputTracker::GetStatus(Key Button)
{ {
for (int i = 0; i < m_input_assocation_list.Count(); i++) return GetCurrentButtonStatus(Button);
{
ButtonSetting &CurIT = m_input_assocation_list[i];

if (Button == CurIT.m_raw_button)
return GetCurrentButtonStatus(CurIT.m_raw_button);
}
return 0;
} }


//Returns TRUE if action status went from Active to Inactive this frame //Returns TRUE if action status went from Active to Inactive this frame
bool InputTracker::WasReleased(Key Button) bool InputTracker::WasReleased(Key Button)
{ {
for (int i = 0; i < m_input_assocation_list.Count(); i++) if (GetPreviousButtonStatus(Button) &&
{ !GetCurrentButtonStatus(Button))
ButtonSetting &CurIT = m_input_assocation_list[i]; return true;
if (Button == CurIT.m_raw_button)
{
if (GetPreviousButtonStatus(CurIT.m_raw_button) &&
!GetCurrentButtonStatus(CurIT.m_raw_button))
return true;
return false;
}
}
return false; return false;
} }


//Returns TRUE if action status went from Inactive to Active this frame //Returns TRUE if action status went from Inactive to Active this frame
bool InputTracker::WasPressed(Key Button) bool InputTracker::WasPressed(Key Button)
{ {
for (int i = 0; i < m_input_assocation_list.Count(); i++) if (!GetPreviousButtonStatus(Button) &&
{ GetCurrentButtonStatus(Button))
ButtonSetting &CurIT = m_input_assocation_list[i]; return true;

if (Button == CurIT.m_raw_button)
{
if (!GetPreviousButtonStatus(CurIT.m_raw_button) &&
GetCurrentButtonStatus(CurIT.m_raw_button))
return true;
return false;
}
}
return false; return false;
} }




+ 1
- 1
test/BtPhysTest.cpp Zobrazit soubor

@@ -228,7 +228,7 @@ void BtPhysTest::TickGame(float seconds)
{ {
WorldEntity::TickGame(seconds); WorldEntity::TickGame(seconds);


if (Input::GetButtonState(27 /*SDLK_ESCAPE*/)) if (Input::WasReleased(Key::K_ESCAPE))
Ticker::Shutdown(); Ticker::Shutdown();


m_loop_value += seconds; m_loop_value += seconds;


||||||
x
 
000:0
Načítá se…
Zrušit
Uložit