Paradox Game Engine  v1.0.0 beta06
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros Pages
DisplayMode.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 using System.Globalization;
4 
5 namespace SiliconStudio.Paradox.Graphics
6 {
7  /// <summary>
8  /// Describes the display mode.
9  /// </summary>
10  public partial class DisplayMode
11  {
12  /// <summary>
13  /// Initializes a new instance of the <see cref="DisplayMode"/> class.
14  /// </summary>
15  /// <param name="format">The format.</param>
16  /// <param name="width">The width.</param>
17  /// <param name="height">The height.</param>
18  /// <param name="refreshRate">The refresh rate.</param>
19  public DisplayMode(PixelFormat format, int width, int height, Rational refreshRate)
20  {
21  Format = format;
22  Width = width;
23  Height = height;
24  RefreshRate = refreshRate;
25  }
26 
27  /// <summary>
28  /// Gets the aspect ratio used by the graphics device.
29  /// </summary>
30  public float AspectRatio
31  {
32  get
33  {
34  if ((Height != 0) && (Width != 0))
35  {
36  return ((float)Width) / Height;
37  }
38  return 0f;
39  }
40  }
41 
42  /// <summary>
43  /// Gets a value indicating the surface format of the display mode.
44  /// </summary>
45  public readonly PixelFormat Format;
46 
47  /// <summary>
48  /// Gets a value indicating the screen width, in pixels.
49  /// </summary>
50  public readonly int Width;
51 
52  /// <summary>
53  /// Gets a value indicating the screen height, in pixels.
54  /// </summary>
55  public readonly int Height;
56 
57  /// <summary>
58  /// Gets a value indicating the refresh rate
59  /// </summary>
60  public readonly Rational RefreshRate;
61 
62  /// <summary>
63  /// Retrieves a string representation of this object.
64  /// </summary>
65  /// <returns></returns>
66  public override string ToString()
67  {
68  return string.Format(CultureInfo.InvariantCulture, "[Width:{0} Height:{1} Format:{2} AspectRatio:{3}]", Width, Height, Format, AspectRatio);
69  }
70  }
71 }
override string ToString()
Retrieves a string representation of this object.
Definition: DisplayMode.cs:66
readonly Rational RefreshRate
Gets a value indicating the refresh rate
Definition: DisplayMode.cs:60
Describes the display mode.
Definition: DisplayMode.cs:10
readonly int Width
Gets a value indicating the screen width, in pixels.
Definition: DisplayMode.cs:50
DisplayMode(PixelFormat format, int width, int height, Rational refreshRate)
Initializes a new instance of the DisplayMode class.
Definition: DisplayMode.cs:19
readonly PixelFormat Format
Gets a value indicating the surface format of the display mode.
Definition: DisplayMode.cs:45
_In_ size_t _In_ size_t _In_ DXGI_FORMAT format
Definition: DirectXTexP.h:175
readonly int Height
Gets a value indicating the screen height, in pixels.
Definition: DisplayMode.cs:55
PixelFormat
Defines various types of pixel formats.
Definition: PixelFormat.cs:32