| 674 | } |
| 675 | |
| 676 | void SystemWindow::GetInputState( InputState& out_input_state ) |
| 677 | { |
| 678 | out_input_state.keyboard.reset(); |
| 679 | |
| 680 | int key_count; |
| 681 | const Uint8* const keyboard_state= SDL_GetKeyboardState( &key_count ); |
| 682 | |
| 683 | for( int i= 0; i < key_count; i++ ) |
| 684 | { |
| 685 | SystemEvent::KeyEvent::KeyCode code= TranslateKey( SDL_Scancode(i) ); |
| 686 | if( code < SystemEvent::KeyEvent::KeyCode::KeyCount && code != SystemEvent::KeyEvent::KeyCode::Unknown ) |
| 687 | out_input_state.keyboard[ static_cast<unsigned int>(code) ]= keyboard_state[i] != 0; |
| 688 | } |
| 689 | |
| 690 | out_input_state.mouse.reset(); |
| 691 | |
| 692 | const Uint32 mouse_state= SDL_GetMouseState( nullptr, nullptr ); |
| 693 | for( unsigned int i= SDL_BUTTON_LEFT; i <= SDL_BUTTON_RIGHT; i++ ) |
| 694 | { |
| 695 | out_input_state.mouse[ static_cast<unsigned int>(TranslateMouseButton(i)) ]= |
| 696 | ( SDL_BUTTON(i) & mouse_state )!= 0u; |
| 697 | } |
| 698 | } |
| 699 | |
| 700 | void SystemWindow::CaptureMouse( const bool need_capture ) |
| 701 | { |
no test coverage detected