static SdlScreens() { int displays = GetNumVideoDisplays(); devices = new IScreen[displays]; for (int d = 0; d < displays; d++) { IRectangle bounds; SdlFactory.GetDisplayBounds(d, out Rect rc); bounds = Factory.newRectangle(rc.X, rc.Y, rc.Width, rc.Height); SdlFactory.GetCurrentDisplayMode(d, out DisplayMode dm); int total = GetNumDisplayModes(d); var list = new IResolution[total]; for (int m = 0; m < total; m++) { GetDisplayMode(d, m, out DisplayMode sdm); list[m] = new SdlResolution(bounds.X, bounds.Y, sdm.Width, sdm.Height, sdm.Format, sdm.RefreshRate); } var current_resolution = new SdlResolution(bounds.X, bounds.Y, dm.Width, dm.Height, dm.Format, dm.RefreshRate); var device = new SdlScreen(current_resolution, d == 0, list, bounds, d); devices[d] = (device); if (d == 0) primary = device; } }
public void ChangeResolution(int resolutionIndex) { if (resolutionIndex >= resolutions.Length) return; var resolution = resolutions[resolutionIndex]; if (!resolution.Valid) RestoreResolution(); if (resolution == this.Resolution) return; //effect.FadeOut(); if (changeResolution(this, resolution)) { this.Resolution = resolution; } else { throw new System.Exception(string.Format("Device {0}: Failed to change resolution to {1}.", this, resolution)); } //effect.FadeIn(); }
private void ChangeDisplayWindow(IResolution resolution) { currentResolution = resolution; wind?.Dispose(); wind = DisplayWindow.CreateFullScreen(Name, resolution); Display.RenderTarget = wind.FrameBuffer; }
public Game1() { graphics = new GraphicsDeviceManager(this); graphics.SupportedOrientations = DisplayOrientation.Portrait | DisplayOrientation.PortraitDown; _resolution = new ResolutionComponent(this, graphics, new Point(720, 1280), new Point(720, 1280), false, false); Content.RootDirectory = "Content"; }
private void ChangeDisplayWindow(IResolution resolution) { currentResolution = resolution; var screen = window.Screen; var createWindowParams = CreateWindowParams.FullScreen( Name, resolution, null); }
private void ChangeResolution(IResolution resolution) { currentResolution = resolution; foreach (var window in windows) { window.Resolution = resolution; } }
public static ReadOnlyCollection <Element> GetElementsEx(this IResolution r, string path = "") { var container = r.GetElementEx(path) as Container; if (container == null) { throw new Exception("Element does not have child elements."); } return(container.elements); }
/// <summary> /// Constructs a new ScreenManager instance. /// </summary> /// <param name="Input">An InputHelper instance, used for updating screens.</param> public ScreenManager(Game Gme, GraphicsDevice Graphics, SpriteFont[] Fonts, InputHelper Input, IResolution Res) { m_Game = Gme; m_Graphics = Graphics; m_SBatch = new SpriteBatch(Graphics); m_Camera = new Camera(Graphics); m_Input = Input; m_Fonts = Fonts; m_Resolution = Res; }
protected PluginsProvider( IMixinProvider mixinProvider, IResolution container) { Contract.Requires(mixinProvider != null); Contract.Requires(container != null); this.MixinProvider = mixinProvider; this.Container = container; }
public static string GetDataEx(this IResolution r, string path = "") { var valueElement = r.GetElementEx(path) as ValueElement; if (valueElement == null) { throw new Exception("Element does not have a value."); } return(valueElement.data); }
public static void SetData(this IResolution r, string path, dynamic data) { var valueElement = r.GetElement(path) as ValueElement; if (valueElement == null) { return; } valueElement.data = data; }
public Game1() { graphics = new GraphicsDeviceManager(this); Content.RootDirectory = "Content"; graphics.IsFullScreen = true; graphics.SupportedOrientations = DisplayOrientation.LandscapeLeft | DisplayOrientation.LandscapeRight; resolution = new ResolutionComponent(this, graphics, new Point(1024, 576), new Point(1024, 576), false, true); }
public static bool GetFlag(this IResolution r, string flagsPath, string flag) { var valueElement = r.GetElement(flagsPath) as ValueElement; var flagsDef = valueElement?.flagsDef; if (flagsDef == null) { return(false); } return(flagsDef.FlagIsSet(valueElement.data, flag)); }
internal SdlScreen(IResolution currentResolution, bool primary, IResolution[] resolutions, IRectangle bounds, object id) { // Todo: Consolidate current resolution with bounds? Can they fall out of sync right now? this.Resolution = currentResolution; this.original = currentResolution; IsPrimary = primary; this.resolutions = (resolutions); #pragma warning disable 612, 618 this.Bounds = bounds.Width ==0|| bounds.Height==0 ? currentResolution.Bounds : bounds; #pragma warning restore 612, 618 this.monitorID = id; }
public static void SetValue( this IResolution r, string path, string value ) { var valueElement = r.GetElement(path) as ValueElement; if (valueElement == null) { return; } valueElement.value = value; }
public void RestoreResolution() { if (original.Valid) { //effect.FadeOut(); if (restoreResolution(this)) Resolution = original; else throw new System.Exception(string.Format("Device {0}: Failed to restore resolution.", this)); //effect.FadeIn(); } }
public static Element GetElement(this IResolution r, string path = "") { var element = r as Element; while (path.Length > 0) { if (element == null) { return(null); } StringHelpers.SplitPath(path, out string pathPart, out path); element = element.ResolveElement(pathPart); } return(element); }
public static Element AddElement(this IResolution r, string path) { Element element = (Element)r; while (path.Length > 0) { if (element == null) { return(null); } StringHelpers.SplitPath(path, out string pathPart, out path); element = element.CreateElement(pathPart); } return(element); }
private void ChangeDisplayWindow(IResolution resolution) { currentResolution = resolution; foreach (var window in windows) { var screen = window.Screen; var createWindowParams = CreateWindowParams.FullScreen( Name, resolution, null); createWindowParams.TargetScreen = screen; windows.Add(new DisplayWindow(createWindowParams)); } }
public static Element GetParentElement( this IResolution r, Func <Element, bool> test ) { var parent = r.container; while (parent != null) { if (test(parent)) { return(parent); } parent = parent.container; } return(null); }
public static bool GetFlagEx(this IResolution r, string flagsPath, string flag) { var valueElement = r.GetElementEx(flagsPath) as ValueElement; if (valueElement == null) { throw new Exception("Element does not have a value."); } FlagsDef flagsDef = valueElement.flagsDef; if (flagsDef == null) { throw new Exception("Element does not have flags."); } return(flagsDef.FlagIsSet(valueElement.data, flag)); }
public static Element CreateElement(this IResolution r, string pathPart) { foreach (var strategy in strategies) { MatchData match = strategy.Match((Element)r, pathPart); if (match == null) { continue; } if (!strategy.canResolve) { return(strategy.Create(match)); } return(strategy.Resolve(match) ?? strategy.Create(match)); } return(null); }
public static Element GetElementEx(this IResolution r, string path = "") { var element = r as Element; if (element == null) { throw new Exception("Cannot resolve element from null."); } while (path.Length > 0) { StringHelpers.SplitPath(path, out string pathPart, out path); element = element.ResolveElement(pathPart); if (element == null) { throw new Exception($"Failed to resolve element {pathPart}"); } } return(element); }
public Game1() { graphics = new GraphicsDeviceManager(this); graphics.PreferredBackBufferWidth = GlobalSettings.Default.ScreenWidth; graphics.PreferredBackBufferHeight = GlobalSettings.Default.ScreenHeight; graphics.IsFullScreen = GlobalSettings.Default.Fullscreen; m_Resolution = new ResolutionComponent(this, graphics, new Point(800, 600), new Point(GlobalSettings.Default.ScreenWidth, GlobalSettings.Default.ScreenHeight), GlobalSettings.Default.Fullscreen, false, false); Window.Title = "The Sims Online"; Window.TextInput += Window_TextInput; IsFixedTimeStep = true; Application.ApplicationExit += Application_ApplicationExit; Content.RootDirectory = "Content"; }
public LedSendServer(IRedisManager redis, IResolution resolution, IDTCache cache) { _serverUrl = ConfigurationManager.ConnectionStrings["Signalr"].ConnectionString; _log = LogManager.GetLogger(typeof(LedSendServer)); _timer = new Timer(10000) { Enabled = true }; _redis = redis; _resolution = resolution; fontList = _redis.Get <List <FontLibrary> >("Default:Kylin:LED:FontLibrary"); _cache = cache; }
public static ReadOnlyCollection <Element> GetElements(this IResolution r, string path = "") { Container container = (Container)r.GetElement(path); return(container?.elements); }
public static bool RemoveElement(this IResolution r, string path) { var element = r.GetElement(path); return(element.Remove()); }
public ResolutionContext(IResolution resolution) { this.resolution = resolution; }
public static dynamic GetData(this IResolution r, string path = "") { ValueElement valueElement = (ValueElement)r.GetElement(path); return(valueElement?.data); }
public static string GetValue(this IResolution r, string path = "") { var valueElement = r.GetElement(path) as ValueElement; return(valueElement?.value); }