Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9)

Side by Side Diff: third_party/WebKit/Source/modules/gamepad/NavigatorGamepad.cpp

Issue 2300543003: Added Pose attribute to Gamepad (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@gamepad_touched
Patch Set: Rebase Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/modules/gamepad/GamepadPose.idl ('k') | third_party/WebKit/Source/modules/modules_idl_files.gni » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698