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

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

Issue 2150173002: Added Touched attribute to GamepadButton (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Actually remove unnecessary test. Not sure what happened last time. 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 void Gamepad::setButtons(unsigned count, const WebGamepadButton* data) 47 void Gamepad::setButtons(unsigned count, const WebGamepadButton* data)
48 { 48 {
49 if (m_buttons.size() != count) { 49 if (m_buttons.size() != count) {
50 m_buttons.resize(count); 50 m_buttons.resize(count);
51 for (unsigned i = 0; i < count; ++i) 51 for (unsigned i = 0; i < count; ++i)
52 m_buttons[i] = GamepadButton::create(); 52 m_buttons[i] = GamepadButton::create();
53 } 53 }
54 for (unsigned i = 0; i < count; ++i) { 54 for (unsigned i = 0; i < count; ++i) {
55 m_buttons[i]->setValue(data[i].value); 55 m_buttons[i]->setValue(data[i].value);
56 m_buttons[i]->setPressed(data[i].pressed); 56 m_buttons[i]->setPressed(data[i].pressed);
57 m_buttons[i]->setTouched(data[i].touched || data[i].pressed || (data[i]. value > 0.0f));
57 } 58 }
58 } 59 }
59 60
60 DEFINE_TRACE(Gamepad) 61 DEFINE_TRACE(Gamepad)
61 { 62 {
62 visitor->trace(m_buttons); 63 visitor->trace(m_buttons);
63 } 64 }
64 65
65 } // namespace blink 66 } // namespace blink
OLDNEW
« no previous file with comments | « ppapi/shared_impl/ppb_gamepad_shared.h ('k') | third_party/WebKit/Source/modules/gamepad/GamepadButton.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698