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 28 matching lines...) Expand all Loading... |
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 gamepad.setPose(webGamepad.pose); |
| 49 gamepad.setHand(webGamepad.hand); |
49 } | 50 } |
50 | 51 |
51 template<typename GamepadType, typename ListType> | 52 template<typename GamepadType, typename ListType> |
52 static void sampleGamepads(ListType* into) | 53 static void sampleGamepads(ListType* into) |
53 { | 54 { |
54 WebGamepads gamepads; | 55 WebGamepads gamepads; |
55 | 56 |
56 GamepadDispatcher::instance().sampleGamepads(gamepads); | 57 GamepadDispatcher::instance().sampleGamepads(gamepads); |
57 | 58 |
58 for (unsigned i = 0; i < WebGamepads::itemsLengthCap; ++i) { | 59 for (unsigned i = 0; i < WebGamepads::itemsLengthCap; ++i) { |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 if (connectedGamepadChanged || (!oldWasConnected && newIsConnected)) { | 275 if (connectedGamepadChanged || (!oldWasConnected && newIsConnected)) { |
275 m_pendingEvents.append(newGamepad); | 276 m_pendingEvents.append(newGamepad); |
276 } | 277 } |
277 } | 278 } |
278 | 279 |
279 if (!m_pendingEvents.isEmpty()) | 280 if (!m_pendingEvents.isEmpty()) |
280 m_dispatchOneEventRunner->runAsync(); | 281 m_dispatchOneEventRunner->runAsync(); |
281 } | 282 } |
282 | 283 |
283 } // namespace blink | 284 } // namespace blink |
OLD | NEW |