OSDN Git Service

#36897 [DTXC] MIDIインポート機能の呼び出し口を、ファイルメニュー内にも配置。
[dtxmania/dtxmania.git] / SlimDXc_Jun2010(VC++2008) / source / xinput / Vibration.cpp
1 #include "stdafx.h"\r
2 /*\r
3 * Copyright (c) 2007-2010 SlimDX Group\r
4\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
11\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
14\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
21 * THE SOFTWARE.\r
22 */\r
23 \r
24 #include <windows.h>\r
25 #include <xinput.h>\r
26 \r
27 #include "Vibration.h"\r
28 \r
29 using namespace System;\r
30 \r
31 namespace SlimDX\r
32 {\r
33 namespace XInput\r
34 {\r
35         Vibration::Vibration( const XINPUT_VIBRATION& native )\r
36         {\r
37                 m_LeftMotorSpeed = native.wLeftMotorSpeed;\r
38                 m_RightMotorSpeed = native.wRightMotorSpeed;\r
39         }\r
40         \r
41         XINPUT_VIBRATION Vibration::CreateNativeVersion()\r
42         {\r
43                 XINPUT_VIBRATION native;\r
44                 native.wLeftMotorSpeed = m_LeftMotorSpeed;\r
45                 native.wRightMotorSpeed = m_RightMotorSpeed;\r
46                 \r
47                 return native;\r
48         }\r
49         \r
50         UInt16 Vibration::LeftMotorSpeed::get()\r
51         {\r
52                 return m_LeftMotorSpeed;\r
53         }\r
54         \r
55         void Vibration::LeftMotorSpeed::set( UInt16 value )\r
56         {\r
57                 m_LeftMotorSpeed = value;\r
58         }\r
59         \r
60         UInt16 Vibration::RightMotorSpeed::get()\r
61         {\r
62                 return m_RightMotorSpeed;\r
63         }\r
64         \r
65         void Vibration::RightMotorSpeed::set( UInt16 value )\r
66         {\r
67                 m_RightMotorSpeed = value;\r
68         }\r
69         \r
70         bool Vibration::operator == ( Vibration left, Vibration right )\r
71         {\r
72                 return Vibration::Equals( left, right );\r
73         }\r
74 \r
75         bool Vibration::operator != ( Vibration left, Vibration right )\r
76         {\r
77                 return !Vibration::Equals( left, right );\r
78         }\r
79 \r
80         int Vibration::GetHashCode()\r
81         {\r
82                 return m_LeftMotorSpeed.GetHashCode() + m_RightMotorSpeed.GetHashCode();\r
83         }\r
84 \r
85         bool Vibration::Equals( Object^ value )\r
86         {\r
87                 if( value == nullptr )\r
88                         return false;\r
89 \r
90                 if( value->GetType() != GetType() )\r
91                         return false;\r
92 \r
93                 return Equals( safe_cast<Vibration>( value ) );\r
94         }\r
95 \r
96         bool Vibration::Equals( Vibration value )\r
97         {\r
98                 return ( m_LeftMotorSpeed == value.m_LeftMotorSpeed && m_RightMotorSpeed == value.m_RightMotorSpeed );\r
99         }\r
100 \r
101         bool Vibration::Equals( Vibration% value1, Vibration% value2 )\r
102         {\r
103                 return ( value1.m_LeftMotorSpeed == value2.m_LeftMotorSpeed && value1.m_RightMotorSpeed == value2.m_RightMotorSpeed );\r
104         }\r
105 }\r
106 }