Beispiel #1
0
        /// <summary>
        /// Draws entire interface
        /// </summary>
        /// <param name="gameTime"></param>
        public override void Draw(GameTime gameTime, StereoEye stereoEye)
        {
            if (Config.SkipUserInterface)
            {
                return;
            }

            var sb = Game.GetService <SpriteBatch>();
            var ds = Game.GetService <DebugStrings>();
            var vp = Game.GraphicsDevice.DisplayBounds;

            int load = 0;


            Game.GraphicsDevice.ResetStates();
            Game.GraphicsDevice.RestoreBackbuffer();

            if (RootFrame != null)
            {
                var list = Frame.BFSList(RootFrame);
                foreach (var f in list)
                {
                    if (f.OnGameDraw(gameTime, stereoEye))
                    {
                        Game.GraphicsDevice.ResetStates();
                        Game.GraphicsDevice.RestoreBackbuffer();
                    }
                }
            }


            sb.Begin();

            if (RootFrame != null)
            {
                RootFrame.DrawInternal(gameTime, stereoEye, sb, Color.White);
            }

            sb.ColorMultiplier = Color.White;

            sb.End();

            if (Config.ShowProfilingInfo)
            {
                ds.Add("Viewport         : {0} {1}", vp.Width, vp.Height);
                ds.Add("UI update time   : {0}", uiUpdateProfiling);
                ds.Add("SpriteBatch load : {0}", load);
            }
        }