A game framework written with osu! in mind.
at master 55 lines 1.8 kB view raw
1// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. 2// See the LICENCE file in the repository root for full licence text. 3 4using System.Drawing; 5 6namespace osu.Framework.Platform 7{ 8 /// <summary> 9 /// Represents a display mode on a given <see cref="Display"/>. 10 /// </summary> 11 public readonly struct DisplayMode 12 { 13 /// <summary> 14 /// The pixel format of the display mode, if available. 15 /// </summary> 16 public readonly string Format; 17 18 /// <summary> 19 /// The dimensions of the screen resolution in pixels. 20 /// </summary> 21 public readonly Size Size; 22 23 /// <summary> 24 /// The number of bits that represent the colour value for each pixel. 25 /// </summary> 26 public readonly int BitsPerPixel; 27 28 /// <summary> 29 /// The refresh rate in hertz. 30 /// </summary> 31 public readonly int RefreshRate; 32 33 /// <summary> 34 /// The index of the display mode as determined by the windowing backend. 35 /// </summary> 36 public readonly int Index; 37 38 /// <summary> 39 /// The index of the display this mode belongs to as determined by the windowing backend. 40 /// </summary> 41 public readonly int DisplayIndex; 42 43 public DisplayMode(string format, Size size, int bitsPerPixel, int refreshRate, int index, int displayIndex) 44 { 45 Format = format ?? "Unknown"; 46 Size = size; 47 BitsPerPixel = bitsPerPixel; 48 RefreshRate = refreshRate; 49 Index = index; 50 DisplayIndex = displayIndex; 51 } 52 53 public override string ToString() => $"Size: {Size}, BitsPerPixel: {BitsPerPixel}, RefreshRate: {RefreshRate}, Format: {Format}, Index: {Index}, DisplayIndex: {DisplayIndex}"; 54 } 55}