3 * Copyright (c) 2007-2010 SlimDX Group
\r
5 * Permission is hereby granted, free of charge, to any person obtaining a copy
\r
6 * of this software and associated documentation files (the "Software"), to deal
\r
7 * in the Software without restriction, including without limitation the rights
\r
8 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
\r
9 * copies of the Software, and to permit persons to whom the Software is
\r
10 * furnished to do so, subject to the following conditions:
\r
12 * The above copyright notice and this permission notice shall be included in
\r
13 * all copies or substantial portions of the Software.
\r
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
\r
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
\r
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
\r
18 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
\r
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
\r
20 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
\r
24 #include <windows.h>
\r
27 #include "Vibration.h"
\r
29 using namespace System;
\r
35 Vibration::Vibration( const XINPUT_VIBRATION& native )
\r
37 m_LeftMotorSpeed = native.wLeftMotorSpeed;
\r
38 m_RightMotorSpeed = native.wRightMotorSpeed;
\r
41 XINPUT_VIBRATION Vibration::CreateNativeVersion()
\r
43 XINPUT_VIBRATION native;
\r
44 native.wLeftMotorSpeed = m_LeftMotorSpeed;
\r
45 native.wRightMotorSpeed = m_RightMotorSpeed;
\r
50 UInt16 Vibration::LeftMotorSpeed::get()
\r
52 return m_LeftMotorSpeed;
\r
55 void Vibration::LeftMotorSpeed::set( UInt16 value )
\r
57 m_LeftMotorSpeed = value;
\r
60 UInt16 Vibration::RightMotorSpeed::get()
\r
62 return m_RightMotorSpeed;
\r
65 void Vibration::RightMotorSpeed::set( UInt16 value )
\r
67 m_RightMotorSpeed = value;
\r
70 bool Vibration::operator == ( Vibration left, Vibration right )
\r
72 return Vibration::Equals( left, right );
\r
75 bool Vibration::operator != ( Vibration left, Vibration right )
\r
77 return !Vibration::Equals( left, right );
\r
80 int Vibration::GetHashCode()
\r
82 return m_LeftMotorSpeed.GetHashCode() + m_RightMotorSpeed.GetHashCode();
\r
85 bool Vibration::Equals( Object^ value )
\r
87 if( value == nullptr )
\r
90 if( value->GetType() != GetType() )
\r
93 return Equals( safe_cast<Vibration>( value ) );
\r
96 bool Vibration::Equals( Vibration value )
\r
98 return ( m_LeftMotorSpeed == value.m_LeftMotorSpeed && m_RightMotorSpeed == value.m_RightMotorSpeed );
\r
101 bool Vibration::Equals( Vibration% value1, Vibration% value2 )
\r
103 return ( value1.m_LeftMotorSpeed == value2.m_LeftMotorSpeed && value1.m_RightMotorSpeed == value2.m_RightMotorSpeed );
\r