OSDN Git Service

DTXMania089リリースに際してのtag付け。
[dtxmania/dtxmania.git] / 110401(DTXMania089) / SlimDXc_Jun2010(VC++2008) / source / direct3d11 / Viewport11.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 "Viewport11.h"\r
25 \r
26 using namespace System;\r
27 using namespace System::Globalization;\r
28 \r
29 namespace SlimDX\r
30 {\r
31 namespace Direct3D11\r
32 {\r
33         Viewport::Viewport( float x, float y, float width, float height )\r
34         : m_X( x ), m_Y( y ), m_Width( width ), m_Height( height ),\r
35           m_MinZ( 0.0f ), m_MaxZ( 1.0f )\r
36         {\r
37         }\r
38         \r
39         Viewport::Viewport( float x, float y, float width, float height, float minZ, float maxZ )\r
40         : m_X( x ), m_Y( y ), m_Width( width ), m_Height( height ),\r
41           m_MinZ( minZ ), m_MaxZ( maxZ )\r
42         {\r
43         }\r
44 \r
45         float Viewport::X::get()\r
46         {\r
47                 return m_X;\r
48         }\r
49         \r
50         void Viewport::X::set( float value )\r
51         {\r
52                 m_X = value;\r
53         }\r
54         \r
55         float Viewport::Y::get()\r
56         {\r
57                 return m_Y;\r
58         }\r
59         \r
60         void Viewport::Y::set( float value )\r
61         {\r
62                 m_Y = value;\r
63         }\r
64         \r
65         float Viewport::Width::get()\r
66         {\r
67                 return m_Width;\r
68         }\r
69         \r
70         void Viewport::Width::set( float value )\r
71         {\r
72                 m_Width = value;\r
73         }\r
74         \r
75         float Viewport::Height::get()\r
76         {\r
77                 return m_Height;\r
78         }\r
79         \r
80         void Viewport::Height::set( float value )\r
81         {\r
82                 m_Height = value;\r
83         }\r
84         \r
85         float Viewport::MinZ::get()\r
86         {\r
87                 return m_MinZ;\r
88         }\r
89         \r
90         void Viewport::MinZ::set( float value )\r
91         {\r
92                 m_MinZ = value;\r
93         }\r
94         \r
95         float Viewport::MaxZ::get()\r
96         {\r
97                 return m_MaxZ;\r
98         }\r
99         \r
100         void Viewport::MaxZ::set( float value )\r
101         {\r
102                 m_MaxZ = value;\r
103         }\r
104 \r
105         bool Viewport::operator == ( Viewport left, Viewport right )\r
106         {\r
107                 return Viewport::Equals( left, right );\r
108         }\r
109 \r
110         bool Viewport::operator != ( Viewport left, Viewport right )\r
111         {\r
112                 return !Viewport::Equals( left, right );\r
113         }\r
114 \r
115         String^ Viewport::ToString()\r
116         {\r
117                 return String::Format( CultureInfo::CurrentCulture, "X:{0} Y:{1} Width:{2} Height:{3} MinZ:{4} MaxZ:{5}",\r
118                         X, Y, Width, Height, MinZ, MaxZ );\r
119         }\r
120 \r
121         int Viewport::GetHashCode()\r
122         {\r
123                 return m_X.GetHashCode() + m_Y.GetHashCode() + m_Width.GetHashCode()\r
124                          + m_Height.GetHashCode() + m_MinZ.GetHashCode() + m_MaxZ.GetHashCode();\r
125         }\r
126 \r
127         bool Viewport::Equals( Object^ value )\r
128         {\r
129                 if( value == nullptr )\r
130                         return false;\r
131 \r
132                 if( value->GetType() != GetType() )\r
133                         return false;\r
134 \r
135                 return Equals( safe_cast<Viewport>( value ) );\r
136         }\r
137 \r
138         bool Viewport::Equals( Viewport value )\r
139         {\r
140                 return ( m_X == value.m_X && m_Y == value.m_Y && m_Width == value.m_Width\r
141                          && m_Height == value.m_Height && m_MinZ == value.m_MinZ && m_MaxZ == value.m_MaxZ );\r
142         }\r
143 \r
144         bool Viewport::Equals( Viewport% value1, Viewport% value2 )\r
145         {\r
146                 return ( value1.m_X == value2.m_X && value1.m_Y == value2.m_Y && value1.m_Width == value2.m_Width\r
147                          && value1.m_Height == value2.m_Height && value1.m_MinZ == value2.m_MinZ && value1.m_MaxZ == value2.m_MaxZ );\r
148         }\r
149 }\r
150 }