Paradox Game Engine  v1.0.0 beta06
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros Pages
GraphicsDeviceInformation.cs
Go to the documentation of this file.
1 // Copyright (c) 2014 Silicon Studio Corp. (http://siliconstudio.co.jp)
2 // This file is distributed under GPL v3. See LICENSE.md for details.
3 //
4 // Copyright (c) 2010-2013 SharpDX - Alexandre Mutel
5 //
6 // Permission is hereby granted, free of charge, to any person obtaining a copy
7 // of this software and associated documentation files (the "Software"), to deal
8 // in the Software without restriction, including without limitation the rights
9 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 // copies of the Software, and to permit persons to whom the Software is
11 // furnished to do so, subject to the following conditions:
12 //
13 // The above copyright notice and this permission notice shall be included in
14 // all copies or substantial portions of the Software.
15 //
16 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 // THE SOFTWARE.
23 
24 using System;
25 
26 using SiliconStudio.Paradox.Graphics;
27 
28 namespace SiliconStudio.Paradox.Games
29 {
31  {
32  #region Fields
33 
34  private GraphicsAdapter adapter;
35 
36  private GraphicsProfile graphicsProfile;
37 
38  private PresentationParameters presentationParameters;
39 
40  #endregion
41 
42  #region Constructors and Destructors
43 
44  /// <summary>
45  /// Initializes a new instance of the <see cref="GraphicsDeviceInformation" /> class.
46  /// </summary>
48  {
49  Adapter = GraphicsAdapterFactory.Default;
51  }
52 
53  #endregion
54 
55  #region Public Properties
56 
57  /// <summary>
58  /// Gets or sets the adapter.
59  /// </summary>
60  /// <value>The adapter.</value>
61  /// <exception cref="System.ArgumentNullException">if value is null</exception>
62  public GraphicsAdapter Adapter
63  {
64  get
65  {
66  return adapter;
67  }
68 
69  set
70  {
71  adapter = value;
72  }
73  }
74 
75  /// <summary>
76  /// Gets or sets the graphics profile.
77  /// </summary>
78  /// <value>The graphics profile.</value>
79  /// <exception cref="System.ArgumentNullException">if value is null</exception>
81  {
82  get
83  {
84  return graphicsProfile;
85  }
86 
87  set
88  {
89  graphicsProfile = value;
90  }
91  }
92 
93  /// <summary>
94  /// Gets or sets the presentation parameters.
95  /// </summary>
96  /// <value>The presentation parameters.</value>
97  /// <exception cref="System.ArgumentNullException">if value is null</exception>
99  {
100  get
101  {
102  return presentationParameters;
103  }
104 
105  set
106  {
107  presentationParameters = value;
108  }
109  }
110 
111  /// <summary>
112  /// Gets or sets the creation flags.
113  /// </summary>
114  /// <value>The creation flags.</value>
116 
117  #endregion
118 
119  #region Public Methods and Operators
120 
121  /// <summary>Returns a value that indicates whether the current instance is equal to a specified object.</summary>
122  /// <param name="obj">The Object to compare with the current GraphicsDeviceInformation.</param>
123  public override bool Equals(object obj)
124  {
125  var information = obj as GraphicsDeviceInformation;
126  if (information == null)
127  {
128  return false;
129  }
130 
131  if (!Equals(information.adapter, adapter))
132  {
133  return false;
134  }
135 
136  if (information.graphicsProfile != this.graphicsProfile)
137  {
138  return false;
139  }
140 
141  return information.PresentationParameters == this.PresentationParameters;
142  }
143 
144  /// <summary>Gets the hash code for this object.</summary>
145  public override int GetHashCode()
146  {
147  return graphicsProfile.GetHashCode()
148  ^ (adapter == null ? 0 : adapter.GetHashCode())
149  ^ presentationParameters.GetHashCode();
150  }
151 
152  /// <summary>
153  /// Clones this instance.
154  /// </summary>
155  /// <returns>A new copy-instance of this GraphicsDeviceInformation.</returns>
157  {
158  return new GraphicsDeviceInformation { Adapter = Adapter, GraphicsProfile = GraphicsProfile, PresentationParameters = PresentationParameters.Clone() };
159  }
160 
161  #endregion
162  }
163 }
GraphicsDeviceInformation Clone()
Clones this instance.
override bool Equals(object obj)
Returns a value that indicates whether the current instance is equal to a specified object...
override int GetHashCode()
Gets the hash code for this object.
This class represents a graphics adapter.
GraphicsDeviceInformation()
Initializes a new instance of the GraphicsDeviceInformation class.
GraphicsProfile
Identifies the set of supported devices for the demo based on device capabilities.
Describess how data will be displayed to the screen.