+++ /dev/null
-#include "stdafx.h"\r
-/*\r
-* Copyright (c) 2007-2010 SlimDX Group\r
-* \r
-* Permission is hereby granted, free of charge, to any person obtaining a copy\r
-* of this software and associated documentation files (the "Software"), to deal\r
-* in the Software without restriction, including without limitation the rights\r
-* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r
-* copies of the Software, and to permit persons to whom the Software is\r
-* furnished to do so, subject to the following conditions:\r
-* \r
-* The above copyright notice and this permission notice shall be included in\r
-* all copies or substantial portions of the Software.\r
-* \r
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r
-* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r
-* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\r
-* THE SOFTWARE.\r
-*/\r
-#include "Keystroke.h"\r
-\r
-#include "XInputException.h"\r
-\r
-namespace SlimDX\r
-{\r
-namespace XInput\r
-{\r
- Keystroke::Keystroke( const XINPUT_KEYSTROKE &native )\r
- {\r
- m_VirtualKey = static_cast<GamepadKeyCode>( native.VirtualKey );\r
- m_Flags = static_cast<KeystrokeFlags>( native.Flags );\r
- m_UserIndex = static_cast<XInput::UserIndex>( native.UserIndex );\r
- m_HidCode = native.HidCode;\r
- }\r
- \r
- GamepadKeyCode Keystroke::VirtualKey::get()\r
- {\r
- return m_VirtualKey;\r
- }\r
- \r
- KeystrokeFlags Keystroke::Flags::get()\r
- {\r
- return m_Flags;\r
- }\r
- \r
- XInput::UserIndex Keystroke::UserIndex::get()\r
- {\r
- return m_UserIndex;\r
- }\r
- \r
- int Keystroke::HidCode::get()\r
- {\r
- return m_HidCode;\r
- }\r
-\r
- bool Keystroke::operator == ( Keystroke left, Keystroke right )\r
- {\r
- return Keystroke::Equals( left, right );\r
- }\r
-\r
- bool Keystroke::operator != ( Keystroke left, Keystroke right )\r
- {\r
- return !Keystroke::Equals( left, right );\r
- }\r
-\r
- int Keystroke::GetHashCode()\r
- {\r
- return m_VirtualKey.GetHashCode() + m_Flags.GetHashCode() + m_UserIndex.GetHashCode()\r
- + m_HidCode.GetHashCode();\r
- }\r
-\r
- bool Keystroke::Equals( Object^ value )\r
- {\r
- if( value == nullptr )\r
- return false;\r
-\r
- if( value->GetType() != GetType() )\r
- return false;\r
-\r
- return Equals( safe_cast<Keystroke>( value ) );\r
- }\r
-\r
- bool Keystroke::Equals( Keystroke value )\r
- {\r
- return ( m_VirtualKey == value.m_VirtualKey && m_Flags == value.m_Flags && m_UserIndex == value.m_UserIndex\r
- && m_HidCode == value.m_HidCode );\r
- }\r
-\r
- bool Keystroke::Equals( Keystroke% value1, Keystroke% value2 )\r
- {\r
- return ( value1.m_VirtualKey == value2.m_VirtualKey && value1.m_Flags == value2.m_Flags && value1.m_UserIndex == value2.m_UserIndex\r
- && value1.m_HidCode == value2.m_HidCode );\r
- }\r
-}\r
-}
\ No newline at end of file