Defines a display device on the underlying system, and provides methods to query and change its display parameters. More...
Public Member Functions | |
| DisplayResolution | SelectResolution (int width, int height, int bitsPerPixel, float refreshRate) |
| Selects an available resolution that matches the specified parameters. | |
| void | ChangeResolution (DisplayResolution resolution) |
| Changes the resolution of the DisplayDevice. | |
| void | ChangeResolution (int width, int height, int bitsPerPixel, float refreshRate) |
| Changes the resolution of the DisplayDevice. | |
| void | RestoreResolution () |
| Restores the original resolution of the DisplayDevice. | |
| override string | ToString () |
| Returns a System.String representing this DisplayDevice. | |
Properties | |
| Rectangle | Bounds [get, set] |
| Gets the bounds of this instance in pixel coordinates.. | |
| int | Width [get] |
| Gets a System.Int32 that contains the width of this display in pixels. | |
| int | Height [get] |
| Gets a System.Int32 that contains the height of this display in pixels. | |
| int | BitsPerPixel [get, set] |
| Gets a System.Int32 that contains number of bits per pixel of this display. Typical values include 8, 16, 24 and 32. | |
| float | RefreshRate [get, set] |
| Gets a System.Single representing the vertical refresh rate of this display. | |
| bool | IsPrimary [get, set] |
| Gets a System.Boolean that indicates whether this Display is the primary Display in systems with multiple Displays. | |
| IList< DisplayResolution > | AvailableResolutions [get, set] |
| Gets the list of DisplayResolution objects available on this device. | |
| static IList< DisplayDevice > | AvailableDisplays [get] |
| Gets the list of available DisplayDevice objects. | |
| static DisplayDevice | Default [get] |
| Gets the default (primary) display of this system. | |
Defines a display device on the underlying system, and provides methods to query and change its display parameters.
Definition at line 22 of file DisplayDevice.cs.
| void OpenTK.DisplayDevice.ChangeResolution | ( | int | width, | |
| int | height, | |||
| int | bitsPerPixel, | |||
| float | refreshRate | |||
| ) |
Changes the resolution of the DisplayDevice.
| width | The new width of the DisplayDevice. | |
| height | The new height of the DisplayDevice. | |
| bitsPerPixel | The new bits per pixel of the DisplayDevice. | |
| refreshRate | The new refresh rate of the DisplayDevice. |
| Graphics.GraphicsModeException | Thrown if the requested resolution could not be set. |
Definition at line 249 of file DisplayDevice.cs.
00250 { 00251 this.ChangeResolution(this.SelectResolution(width, height, bitsPerPixel, refreshRate)); 00252 }
| void OpenTK.DisplayDevice.ChangeResolution | ( | DisplayResolution | resolution | ) |
Changes the resolution of the DisplayDevice.
| resolution | The resolution to set. DisplayDevice.SelectResolution |
| Graphics.GraphicsModeException | Thrown if the requested resolution could not be set. |
If the specified resolution is null, this function will restore the original DisplayResolution.
Definition at line 217 of file DisplayDevice.cs.
00218 { 00219 if (resolution == null) 00220 this.RestoreResolution(); 00221 00222 if (resolution == current_resolution) 00223 return; 00224 00225 //effect.FadeOut(); 00226 00227 if (implementation.TryChangeResolution(this, resolution)) 00228 { 00229 if (original_resolution == null) 00230 original_resolution = current_resolution; 00231 current_resolution = resolution; 00232 } 00233 else throw new Graphics.GraphicsModeException(String.Format("Device {0}: Failed to change resolution to {1}.", 00234 this, resolution)); 00235 00236 //effect.FadeIn(); 00237 }
| void OpenTK.DisplayDevice.RestoreResolution | ( | ) |
Restores the original resolution of the DisplayDevice.
| Graphics.GraphicsModeException | Thrown if the original resolution could not be restored. |
Definition at line 260 of file DisplayDevice.cs.
00261 { 00262 if (original_resolution != null) 00263 { 00264 //effect.FadeOut(); 00265 00266 if (implementation.TryRestoreResolution(this)) 00267 { 00268 current_resolution = original_resolution; 00269 original_resolution = null; 00270 } 00271 else throw new Graphics.GraphicsModeException(String.Format("Device {0}: Failed to restore resolution.", this)); 00272 00273 //effect.FadeIn(); 00274 } 00275 }
| DisplayResolution OpenTK.DisplayDevice.SelectResolution | ( | int | width, | |
| int | height, | |||
| int | bitsPerPixel, | |||
| float | refreshRate | |||
| ) |
Selects an available resolution that matches the specified parameters.
| width | The width of the requested resolution in pixels. | |
| height | The height of the requested resolution in pixels. | |
| bitsPerPixel | The bits per pixel of the requested resolution. | |
| refreshRate | The refresh rate of the requested resolution in hertz. |
If a matching resolution is not found, this function will retry ignoring the specified refresh rate, bits per pixel and resolution, in this order. If a matching resolution still doesn't exist, this function will return the current resolution.
A parameter set to 0 or negative numbers will not be used in the search (e.g. if refreshRate is 0, any refresh rate will be considered valid).
This function allocates memory.
Definition at line 180 of file DisplayDevice.cs.
00181 { 00182 DisplayResolution resolution = FindResolution(width, height, bitsPerPixel, refreshRate); 00183 if (resolution == null) 00184 resolution = FindResolution(width, height, bitsPerPixel, 0); 00185 if (resolution == null) 00186 resolution = FindResolution(width, height, 0, 0); 00187 if (resolution == null) 00188 return current_resolution; 00189 return resolution; 00190 }
| override string OpenTK.DisplayDevice.ToString | ( | ) |
Returns a System.String representing this DisplayDevice.
Definition at line 328 of file DisplayDevice.cs.
IList<DisplayDevice> OpenTK.DisplayDevice.AvailableDisplays [static, get] |
Gets the list of available DisplayDevice objects.
Definition at line 285 of file DisplayDevice.cs.
IList<DisplayResolution> OpenTK.DisplayDevice.AvailableResolutions [get, set] |
Gets the list of DisplayResolution objects available on this device.
Definition at line 200 of file DisplayDevice.cs.
int OpenTK.DisplayDevice.BitsPerPixel [get, set] |
Gets a System.Int32 that contains number of bits per pixel of this display. Typical values include 8, 16, 24 and 32.
Definition at line 120 of file DisplayDevice.cs.
Rectangle OpenTK.DisplayDevice.Bounds [get, set] |
Gets the bounds of this instance in pixel coordinates..
Definition at line 90 of file DisplayDevice.cs.
DisplayDevice OpenTK.DisplayDevice.Default [static, get] |
Gets the default (primary) display of this system.
Definition at line 294 of file DisplayDevice.cs.
int OpenTK.DisplayDevice.Height [get] |
Gets a System.Int32 that contains the height of this display in pixels.
Definition at line 112 of file DisplayDevice.cs.
bool OpenTK.DisplayDevice.IsPrimary [get, set] |
Gets a System.Boolean that indicates whether this Display is the primary Display in systems with multiple Displays.
Definition at line 144 of file DisplayDevice.cs.
float OpenTK.DisplayDevice.RefreshRate [get, set] |
Gets a System.Single representing the vertical refresh rate of this display.
Definition at line 133 of file DisplayDevice.cs.
int OpenTK.DisplayDevice.Width [get] |
Gets a System.Int32 that contains the width of this display in pixels.
Definition at line 105 of file DisplayDevice.cs.
1.6.1