| 301 | } |
| 302 | |
| 303 | static void ReadKeyboard() |
| 304 | { |
| 305 | if (InputLocked || OisKeyboard == nullptr) |
| 306 | return; |
| 307 | |
| 308 | try |
| 309 | { |
| 310 | OisKeyboard->capture(); |
| 311 | |
| 312 | // Poll keyboard keys. |
| 313 | for (int i = 0; i < KEYBOARD_KEY_COUNT; i++) |
| 314 | { |
| 315 | if (!OisKeyboard->isKeyDown((OIS::KeyCode)i)) |
| 316 | continue; |
| 317 | |
| 318 | int key = WrapSimilarKeys(i); |
| 319 | KeyMap[key] = 1.0f; |
| 320 | |
| 321 | // Interpret discrete directional keypresses as analog axis values. |
| 322 | SetDiscreteAxisValues(key); |
| 323 | } |
| 324 | } |
| 325 | catch (OIS::Exception& ex) |
| 326 | { |
| 327 | TENLog("Unable to poll keyboard input: " + std::string(ex.eText), LogLevel::Warning); |
| 328 | } |
| 329 | } |
| 330 | |
| 331 | static void ReadMouse() |
| 332 | { |
no test coverage detected