Exemplo n.º 1
0
        /// <summary>
        /// As Load is run post host creation, you can override this method to alter properties of the host before it makes itself visible to the user.
        /// </summary>
        /// <param name="host"></param>
        public virtual void SetHost(BasicGameHost host)
        {
            if (Config == null)
            {
                Config = new FrameworkConfigManager(host.Storage);
            }

            this.host     = host;
            host.Size     = new Vector2(Config.Get <int>(FrameworkConfig.Width), Config.Get <int>(FrameworkConfig.Height));
            host.Exiting += OnExiting;

            if (Window != null)
            {
                Window.Title = $@"osu.Framework (running ""{Name}"")";
            }
        }
Exemplo n.º 2
0
        protected void UpdateFrame()
        {
            if (Root == null)
            {
                return;
            }

            if (Window?.WindowState != WindowState.Minimized)
            {
                Root.Size = Window != null ? new Vector2(Window.ClientSize.Width, Window.ClientSize.Height) :
                            new Vector2(config.Get <int>(FrameworkSetting.Width), config.Get <int>(FrameworkSetting.Height));
            }

            Root.UpdateSubTree();
            using (var buffer = DrawRoots.Get(UsageType.Write))
                buffer.Object = Root.GenerateDrawNodeSubtree(buffer.Index, Root.ScreenSpaceDrawQuad.AABBFloat);
        }
Exemplo n.º 3
0
        protected virtual void UpdateFrame()
        {
            if (Root == null)
            {
                return;
            }

            if (Window?.WindowState != WindowState.Minimized)
            {
                Root.Size = Window != null ? new Vector2(Window.ClientSize.Width, Window.ClientSize.Height) :
                            new Vector2(config.Get <int>(FrameworkSetting.Width), config.Get <int>(FrameworkSetting.Height));
            }

            // Ensure we maintain a valid size for any children immediately scaling by the window size
            Root.Size = Vector2.ComponentMax(Vector2.One, Root.Size);

            Root.UpdateSubTree();
            using (var buffer = DrawRoots.Get(UsageType.Write))
                buffer.Object = Root.GenerateDrawNodeSubtree(buffer.Index, Root.ScreenSpaceDrawQuad.AABBFloat);
        }
Exemplo n.º 4
0
        private void load(FrameworkConfigManager frameworkConfig)
        {
            trackSetting(frameworkConfig.GetBindable <FrameSync>(FrameworkSetting.FrameSync), v => display(v, "Frame Limiter", v.GetDescription(), "Ctrl+F7"));
            trackSetting(frameworkConfig.GetBindable <string>(FrameworkSetting.AudioDevice), v => display(v, "Audio Device", string.IsNullOrEmpty(v) ? "Default" : v, v));
            trackSetting(frameworkConfig.GetBindable <bool>(FrameworkSetting.ShowLogOverlay), v => display(v, "Debug Logs", v ? "visible" : "hidden", "Ctrl+F10"));

            Action displayResolution = delegate { display(null, "Screen Resolution", frameworkConfig.Get <int>(FrameworkSetting.Width) + "x" + frameworkConfig.Get <int>(FrameworkSetting.Height)); };

            trackSetting(frameworkConfig.GetBindable <int>(FrameworkSetting.Width), v => displayResolution());
            trackSetting(frameworkConfig.GetBindable <int>(FrameworkSetting.Height), v => displayResolution());

            trackSetting(frameworkConfig.GetBindable <WindowMode>(FrameworkSetting.WindowMode), v => display(v, "Screen Mode", v.ToString(), "Alt+Enter"));
        }
Exemplo n.º 5
0
        private void load(FrameworkConfigManager frameworkConfig)
        {
            trackSetting(frameworkConfig.GetBindable <FrameSync>(FrameworkSetting.FrameSync), v => display(v, "Frame Limiter", v.GetDescription(), "Ctrl+F7"));
            trackSetting(frameworkConfig.GetBindable <string>(FrameworkSetting.AudioDevice), v => display(v, "Audio Device", string.IsNullOrEmpty(v) ? "Default" : v, v));
            trackSetting(frameworkConfig.GetBindable <bool>(FrameworkSetting.ShowLogOverlay), v => display(v, "Debug Logs", v ? "visible" : "hidden", "Ctrl+F10"));

            Action displayResolution = delegate { display(null, "Screen Resolution", frameworkConfig.Get <int>(FrameworkSetting.Width) + "x" + frameworkConfig.Get <int>(FrameworkSetting.Height)); };

            trackSetting(frameworkConfig.GetBindable <int>(FrameworkSetting.Width), v => displayResolution());
            trackSetting(frameworkConfig.GetBindable <int>(FrameworkSetting.Height), v => displayResolution());

            trackSetting(frameworkConfig.GetBindable <double>(FrameworkSetting.CursorSensitivity), v => display(v, "Cursor Sensitivity", v.ToString(@"0.##x"), "Ctrl+Alt+R to reset"));
            trackSetting(frameworkConfig.GetBindable <string>(FrameworkSetting.ActiveInputHandlers),
                         delegate(string v)
            {
                bool raw = v.Contains("Raw");
                display(raw, "Raw Input", raw ? "enabled" : "disabled", "Ctrl+Alt+R to reset");
            });

            trackSetting(frameworkConfig.GetBindable <WindowMode>(FrameworkSetting.WindowMode), v => display(v, "Screen Mode", v.ToString(), "Alt+Enter"));
        }