| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011, Google Inc. All rights reserved. | 2 * Copyright (C) 2011, Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are met: | 5 * modification, are permitted provided that the following conditions are met: |
| 6 * | 6 * |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 template<typename T> | 38 template<typename T> |
| 39 static void sampleGamepad(unsigned index, T& gamepad, const WebGamepad& webGamep
ad) | 39 static void sampleGamepad(unsigned index, T& gamepad, const WebGamepad& webGamep
ad) |
| 40 { | 40 { |
| 41 gamepad.setId(webGamepad.id); | 41 gamepad.setId(webGamepad.id); |
| 42 gamepad.setIndex(index); | 42 gamepad.setIndex(index); |
| 43 gamepad.setConnected(webGamepad.connected); | 43 gamepad.setConnected(webGamepad.connected); |
| 44 gamepad.setTimestamp(webGamepad.timestamp); | 44 gamepad.setTimestamp(webGamepad.timestamp); |
| 45 gamepad.setMapping(webGamepad.mapping); | 45 gamepad.setMapping(webGamepad.mapping); |
| 46 gamepad.setAxes(webGamepad.axesLength, webGamepad.axes); | 46 gamepad.setAxes(webGamepad.axesLength, webGamepad.axes); |
| 47 gamepad.setButtons(webGamepad.buttonsLength, webGamepad.buttons); | 47 gamepad.setButtons(webGamepad.buttonsLength, webGamepad.buttons); |
| 48 gamepad.setPose(webGamepad.pose); |
| 48 } | 49 } |
| 49 | 50 |
| 50 template<typename GamepadType, typename ListType> | 51 template<typename GamepadType, typename ListType> |
| 51 static void sampleGamepads(ListType* into) | 52 static void sampleGamepads(ListType* into) |
| 52 { | 53 { |
| 53 WebGamepads gamepads; | 54 WebGamepads gamepads; |
| 54 | 55 |
| 55 GamepadDispatcher::instance().sampleGamepads(gamepads); | 56 GamepadDispatcher::instance().sampleGamepads(gamepads); |
| 56 | 57 |
| 57 for (unsigned i = 0; i < WebGamepads::itemsLengthCap; ++i) { | 58 for (unsigned i = 0; i < WebGamepads::itemsLengthCap; ++i) { |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 if (connectedGamepadChanged || (!oldWasConnected && newIsConnected)) { | 274 if (connectedGamepadChanged || (!oldWasConnected && newIsConnected)) { |
| 274 m_pendingEvents.append(newGamepad); | 275 m_pendingEvents.append(newGamepad); |
| 275 } | 276 } |
| 276 } | 277 } |
| 277 | 278 |
| 278 if (!m_pendingEvents.isEmpty()) | 279 if (!m_pendingEvents.isEmpty()) |
| 279 m_dispatchOneEventRunner->runAsync(); | 280 m_dispatchOneEventRunner->runAsync(); |
| 280 } | 281 } |
| 281 | 282 |
| 282 } // namespace blink | 283 } // namespace blink |
| OLD | NEW |