Showing the changes to libraries/script-engine/src/JoystickInputController.cpp (1 of 10 files). Show all
Unified · Split
| @@ -0,0 +1,52 @@ | ||
| 1 | +// | |
| 2 | +// JoystickInputController.cpp | |
| 3 | +// interface/src/devices | |
| 4 | +// | |
| 5 | +// Created by Stephen Birarda on 2014-09-23. | |
| 6 | +// Copyright 2014 High Fidelity, Inc. | |
| 7 | +// | |
| 8 | +// Distributed under the Apache License, Version 2.0. | |
| 9 | +// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html | |
| 10 | +// | |
| 11 | + | |
| 12 | +#include <qmetatype.h> | |
| 13 | + | |
| 14 | +#include "JoystickInputController.h" | |
| 15 | + | |
| 16 | +JoystickInputController::JoystickInputController() : | |
| 17 | + _name(), | |
| 18 | + _axes(0), | |
| 19 | + _buttons(0) | |
| 20 | +{ | |
| 21 | + | |
| 22 | +} | |
| 23 | + | |
| 24 | +JoystickInputController::JoystickInputController(const QString& name, int numAxes, int numButtons) : | |
| 25 | + _name(name), | |
| 26 | + _axes(numAxes), | |
| 27 | + _buttons(numButtons) | |
| 28 | +{ | |
| 29 | + | |
| 30 | +} | |
| 31 | + | |
| 32 | +JoystickInputController::JoystickInputController(const JoystickInputController& otherJoystickController) : | |
| 33 | + _name(otherJoystickController._name), | |
| 34 | + _axes(otherJoystickController._axes), | |
| 35 | + _buttons(otherJoystickController._buttons) | |
| 36 | +{ | |
| 37 | + | |
| 38 | +} | |
| 39 | + | |
| 40 | +JoystickInputController& JoystickInputController::operator=(const JoystickInputController& otherJoystickController) { | |
| 41 | + JoystickInputController temp(otherJoystickController); | |
| 42 | + swap(temp); | |
| 43 | + return *this; | |
| 44 | +} | |
| 45 | + | |
| 46 | +void JoystickInputController::swap(JoystickInputController& otherJoystickController) { | |
| 47 | + using std::swap; | |
| 48 | + | |
| 49 | + swap(_name, otherJoystickController._name); | |
| 50 | + swap(_axes, otherJoystickController._axes); | |
| 51 | + swap(_buttons, otherJoystickController._buttons); | |
| 52 | +} | |