public void UseResolution() { OptionsCi options = game.options; IntRef resolutionsCount = new IntRef(); DisplayResolutionCi[] resolutions = game.platform.GetDisplayResolutions(resolutionsCount); if (resolutions == null) { return; } if (options.Resolution >= resolutionsCount.value) { options.Resolution = 0; } DisplayResolutionCi res = resolutions[options.Resolution]; if (game.platform.GetWindowState() == WindowState.Fullscreen) { game.platform.ChangeResolution(res.Width, res.Height, res.BitsPerPixel, res.RefreshRate); game.platform.SetWindowState(WindowState.Normal); game.platform.SetWindowState(WindowState.Fullscreen); } else { //d_GlWindow.Width = res.Width; //d_GlWindow.Height = res.Height; } }
string ResolutionString() { IntRef resolutionsCount = new IntRef(); DisplayResolutionCi res = game.platform.GetDisplayResolutions(resolutionsCount)[game.options.Resolution]; return(game.platform.StringFormat4("{0}x{1}, {2}, {3} Hz", game.platform.IntToString(res.Width), game.platform.IntToString(res.Height), game.platform.IntToString(res.BitsPerPixel), game.platform.IntToString(game.platform.FloatToInt(res.RefreshRate)))); }
public override DisplayResolutionCi[] GetDisplayResolutions(IntRef retResolutionsCount) { if (resolutions == null) { resolutions = new DisplayResolutionCi[1024]; foreach (var r in DisplayDevice.Default.AvailableResolutions) { if (r.Width < 800 || r.Height < 600 || r.BitsPerPixel < 16) { continue; } DisplayResolutionCi r2 = new DisplayResolutionCi(); r2.Width = r.Width; r2.Height = r.Height; r2.BitsPerPixel = r.BitsPerPixel; r2.RefreshRate = r.RefreshRate; resolutions[resolutionsCount++] = r2; } } retResolutionsCount.value = resolutionsCount; return resolutions; }
public override DisplayResolutionCi GetDisplayResolutionDefault() { DisplayDevice d = DisplayDevice.Default; DisplayResolutionCi r = new DisplayResolutionCi(); r.Width = d.Width; r.Height = d.Height; r.BitsPerPixel = d.BitsPerPixel; r.RefreshRate = d.RefreshRate; return r; }