Changeset 1794


Ignore:
Timestamp:
Aug 23, 2012, 2:32:02 PM (11 years ago)
Author:
touky
Message:

Input now works correctly

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/input/input.cpp

    r1789 r1794  
    238238int InputTracker::GetStatus(Key Button)
    239239{
    240         for (int i = 0; i < m_input_assocation_list.Count(); i++)
    241         {
    242                 ButtonSetting &CurIT = m_input_assocation_list[i];
    243 
    244                 if (Button == CurIT.m_raw_button)
    245                         return GetCurrentButtonStatus(CurIT.m_raw_button);
    246         }
    247         return 0;
     240        return GetCurrentButtonStatus(Button);
    248241}
    249242
     
    251244bool InputTracker::WasReleased(Key Button)
    252245{
    253         for (int i = 0; i < m_input_assocation_list.Count(); i++)
    254         {
    255                 ButtonSetting &CurIT = m_input_assocation_list[i];
    256                
    257                 if (Button == CurIT.m_raw_button)
    258                 {
    259                         if (GetPreviousButtonStatus(CurIT.m_raw_button) &&
    260                                 !GetCurrentButtonStatus(CurIT.m_raw_button))
    261                                 return true;
    262                         return false;
    263                 }
    264         }
     246        if (GetPreviousButtonStatus(Button) &&
     247                !GetCurrentButtonStatus(Button))
     248                return true;
    265249        return false;
    266250}
     
    269253bool InputTracker::WasPressed(Key Button)
    270254{
    271         for (int i = 0; i < m_input_assocation_list.Count(); i++)
    272         {
    273                 ButtonSetting &CurIT = m_input_assocation_list[i];
    274 
    275                 if (Button == CurIT.m_raw_button)
    276                 {
    277                         if (!GetPreviousButtonStatus(CurIT.m_raw_button) &&
    278                                 GetCurrentButtonStatus(CurIT.m_raw_button))
    279                                 return true;
    280                         return false;
    281                 }
    282         }
     255        if (!GetPreviousButtonStatus(Button) &&
     256                GetCurrentButtonStatus(Button))
     257                return true;
    283258        return false;
    284259}
  • trunk/test/BtPhysTest.cpp

    r1790 r1794  
    229229    WorldEntity::TickGame(seconds);
    230230
    231     if (Input::GetButtonState(27 /*SDLK_ESCAPE*/))
     231    if (Input::WasReleased(Key::K_ESCAPE))
    232232        Ticker::Shutdown();
    233233
Note: See TracChangeset for help on using the changeset viewer.