/// <summary> /// Initializes a new instance of the OpenGLUltravioletDisplay class. /// </summary> /// <param name="uv">The Ultraviolet context.</param> /// <param name="displayIndex">The SDL2 display index that this object represents.</param> public SDL2UltravioletDisplay(UltravioletContext uv, Int32 displayIndex) { Contract.Require(uv, nameof(uv)); this.uv = uv; this.displayIndex = displayIndex; this.displayModes = Enumerable.Range(0, SDL_GetNumDisplayModes(displayIndex)) .Select(modeIndex => CreateDisplayModeFromSDL(displayIndex, modeIndex)) .ToList(); this.name = SDL_GetDisplayName(displayIndex); SDL_DisplayMode sdlDesktopDisplayMode; if (SDL_GetDesktopDisplayMode(displayIndex, &sdlDesktopDisplayMode) < 0) { throw new SDL2Exception(); } this.desktopDisplayMode = CreateDisplayModeFromSDL(sdlDesktopDisplayMode); this.screenRotationService = ScreenRotationService.Create(this); this.screenDensityService = ScreenDensityService.Create(this); }
/// <summary> /// Initializes a new instance of the OpenGLUltravioletDisplay class. /// </summary> /// <param name="displayIndex">The SDL2 display index that this object represents.</param> public OpenGLUltravioletDisplay(Int32 displayIndex) { this.displayIndex = displayIndex; this.displayModes = Enumerable.Range(0, SDL.GetNumDisplayModes(displayIndex)) .Select(modeIndex => CreateDisplayModeFromSDL(displayIndex, modeIndex)) .ToList(); this.name = SDL.GetDisplayName(displayIndex); SDL_DisplayMode sdlDesktopDisplayMode; if (SDL.GetDesktopDisplayMode(displayIndex, &sdlDesktopDisplayMode) < 0) { throw new SDL2Exception(); } this.desktopDisplayMode = CreateDisplayModeFromSDL(sdlDesktopDisplayMode); this.screenRotationService = ScreenRotationService.Create(this); this.screenDensityService = ScreenDensityService.Create(this); }