public MyAspectRatio(bool isTripleHead, MyAspectRatioEnum aspectRatioEnum, float aspectRatioNumber, string textShort, bool isSupported) { IsTripleHead = isTripleHead; AspectRatioEnum = aspectRatioEnum; AspectRatioNumber = aspectRatioNumber; TextShort = textShort; IsSupported = isSupported; }
public MyAspectRatioEx(bool isTripleHead, MyAspectRatioEnum aspectRatioEnum, float aspectRatioNumber, MyTextsWrapperEnum textLong, MyTextsWrapperEnum textShort) { IsTripleHead = isTripleHead; AspectRatioEnum = aspectRatioEnum; AspectRatioNumber = aspectRatioNumber; TextLong = textLong; TextShort = textShort; }
public MyVideoModeEx(int width, int height, float trueAspectRatio) { Width = width; Height = height; AspectRatioEnum = MyAspectRatioExList.GetClosestAspectRatio(trueAspectRatio); IsTripleHead = MyAspectRatioExList.Get(AspectRatioEnum).IsTripleHead; // MyAspectRatioExList.IsTripleHeadAspectRatio(AspectRatioEnum); AspectRatio = MyAspectRatioExList.Get(AspectRatioEnum).AspectRatioNumber; // aspect ratio needs to be adjusted to be one of the system defined }
public MyAspectRatio(bool isTripleHead, MyAspectRatioEnum aspectRatioEnum, float aspectRatioNumber, string textShort, bool isSupported) { this.IsTripleHead = isTripleHead; this.AspectRatioEnum = aspectRatioEnum; this.AspectRatioNumber = aspectRatioNumber; this.TextShort = textShort; this.IsSupported = isSupported; }
public static MyAspectRatioEnum GetClosestAspectRatio(float aspectRatio) { MyAspectRatioEnum aspectRatioEnum = MyAspectRatioEnum.Normal_4_3; float maxValue = float.MaxValue; for (int i = 0; i < m_aspectRatios.Length; i++) { float num3 = Math.Abs((float)(aspectRatio - m_aspectRatios[i].AspectRatioNumber)); if (num3 < maxValue) { maxValue = num3; aspectRatioEnum = m_aspectRatios[i].AspectRatioEnum; } } return(aspectRatioEnum); }
// This video mode is used when user has empty config and we need to set some default resolution // The idea is to find resolution which is close to 1280x720 because that one is high-res enough // and runs smoothly on all sorts of computers public static MyVideoModeEx GetDefaultVideoModeForEmptyConfigWithClosestAspectRatio(int adapterIndex, float aspectRatio) { List <MyVideoModeEx> sortByClosestAspectRatio = new List <MyVideoModeEx>(); for (int i = 0; i < m_videoModeList[adapterIndex].Count; i++) { MyVideoModeEx videoMode = m_videoModeList[adapterIndex][i]; if (videoMode.Width <= 1280) { sortByClosestAspectRatio.Add(videoMode); } } if (sortByClosestAspectRatio.Count > 0) { sortByClosestAspectRatio.Sort( delegate(MyVideoModeEx p1, MyVideoModeEx p2) { float deltaP1 = Math.Abs(aspectRatio - p1.AspectRatio); float deltaP2 = Math.Abs(aspectRatio - p2.AspectRatio); return(deltaP1.CompareTo(deltaP2)); } ); MyAspectRatioEnum thisAspectRatio = sortByClosestAspectRatio[0].AspectRatioEnum; // Now look for highest resolution (we have guaranteed that none is more than 1280x***) MyVideoModeEx maxVideoMode = null; for (int i = 0; i < sortByClosestAspectRatio.Count; i++) { MyVideoModeEx videoMode = sortByClosestAspectRatio[i]; if (videoMode.AspectRatioEnum == thisAspectRatio) { if ((maxVideoMode == null) || (videoMode.Width > maxVideoMode.Width)) { maxVideoMode = videoMode; } } } return(maxVideoMode); } else { return(null); } }
// Finds aspect ratio that is closest to aspectRatio paremeter aspect ratio (we assume that this aspect ration is good) public static MyAspectRatioEnum GetClosestAspectRatio(float aspectRatio) { MyAspectRatioEnum closestAspectRatioEnum = default(MyAspectRatioEnum); float closestDistance = float.MaxValue; for (int i = 0; i < m_aspectRatios.Length; i++) { float tempDistance = Math.Abs(aspectRatio - m_aspectRatios[i].AspectRatioNumber); if (tempDistance < closestDistance) { closestDistance = tempDistance; closestAspectRatioEnum = m_aspectRatios[i].AspectRatioEnum; } } return(closestAspectRatioEnum); }
// Finds aspect ratio that is closest to aspectRatio paremeter aspect ratio (we assume that this aspect ration is good) public static MyAspectRatioEnum GetClosestAspectRatio(float aspectRatio) { MyAspectRatioEnum closestAspectRatioEnum = MyAspectRatioEnum.NORMAL_4_3; // We assign this value only because compiler needs some value! It's not default or something! float closestDistance = float.MaxValue; for (int i = 0; i < List.Length; i++) { float tempDistance = Math.Abs(aspectRatio - List[i].AspectRatioNumber); if (tempDistance < closestDistance) { closestDistance = tempDistance; closestAspectRatioEnum = List[i].AspectRatioEnum; } } return(closestAspectRatioEnum); }
// Finds aspect ration that is closest to actual Windows desktop aspect ratio (we assume that this aspect ration is good) public static MyAspectRatioEnum GetWindowsDesktopClosestAspectRatio(int adapterIndex) { float actualDesktopAspectRatio = (float)GraphicsAdapter.Adapters[adapterIndex].CurrentDisplayMode.Width / (float)GraphicsAdapter.Adapters[adapterIndex].CurrentDisplayMode.Height; MyAspectRatioEnum closestAspectRatioEnum = MyAspectRatioEnum.NORMAL_4_3; // We assign this value only because compiler needs some value! It's not default or something! float closestDistance = float.MaxValue; for (int i = 0; i < List.Length; i++) { float tempDistance = Math.Abs(actualDesktopAspectRatio - List[i].AspectRatioNumber); if (tempDistance < closestDistance) { closestDistance = tempDistance; closestAspectRatioEnum = List[i].AspectRatioEnum; } } return(closestAspectRatioEnum); }
public static MyAspectRatioEx Get(MyAspectRatioEnum aspectRatioEnum) { return List[(int)aspectRatioEnum]; }
static void Add(bool isTripleHead, MyAspectRatioEnum aspectRatioEnum, float aspectRatioNumber, MyTextsWrapperEnum textLong, MyTextsWrapperEnum textShort) { List[(int)aspectRatioEnum] = new MyAspectRatioEx(isTripleHead, aspectRatioEnum, aspectRatioNumber, textLong, textShort); }
public static MyAspectRatio GetAspectRatio(MyAspectRatioEnum aspectRatioEnum) { return(m_aspectRatios[(int)aspectRatioEnum]); }
internal void <.cctor> b__22_0(bool isTripleHead, MyAspectRatioEnum aspectRatioEnum, float aspectRatioNumber, string textShort, bool isSupported) { MyVideoSettingsManager.m_aspectRatios[(int)aspectRatioEnum] = new MyAspectRatio(isTripleHead, aspectRatioEnum, aspectRatioNumber, textShort, isSupported); }
public static MyAspectRatio GetAspectRatio(MyAspectRatioEnum aspectRatioEnum) => m_aspectRatios[(int)aspectRatioEnum];
public static MyAspectRatioEx Get(MyAspectRatioEnum aspectRatioEnum) { return(List[(int)aspectRatioEnum]); }