Пример #1
0
        public void Draw()
        {
            Game1.graphicsDevice.SetRenderTarget(null);
            Game1.graphicsDevice.Clear(Color.Black);

#if !EDITOR
            //try
#endif
            {
                if (!Loading && MyScene != null)
                {
#if EDITOR && WINDOWS
                    Render.RenderTime.Reset();
#endif

                    if (!MyScene.CanLoad)
                    {
                        MyScene.Load();
                    }

#if !EDITOR
                    if (MyScene.WindowSize.X != Game1.ResolutionX || MyScene.WindowSize.Y != Game1.ResolutionY)
                    {
                        MyScene.SetWindowSize(new Vector2(Game1.ResolutionX, Game1.ResolutionY));
                    }
#endif
#if EDITOR
                    if (MyScene.WindowSize.X != Game1.self.Window.ClientBounds.Width || MyScene.WindowSize.Y != Game1.self.Window.ClientBounds.Height)
                    {
                        MyScene.SetWindowSize(new Vector2(Game1.self.Window.ClientBounds.Width, Game1.self.Window.ClientBounds.Height));
                    }
#endif

#if WINDOWS && EDITOR
                    if (!LevelForEditing || Game1.self.IsActive)
#endif
                    MyScene.PreDraw();

                    MyScene.Draw2D(GameObjectTag.SceneDrawScene);
                    Game1.graphicsDevice.SetRenderTarget(null);
                    MasterManager.SetViewportToFullscreen();
                }
            }
#if !EDITOR
            //catch (Exception e)
            //{ MasterManager.e = e; }
#endif
            loadingScreen.Draw(Math.Min(LoadingProgressBar, LoadingProgressBarMax), LoadingProgressBarMax, LoadingProgressBarAlpha);
            PlayerProfile.Draw();
        }
        public override void DrawWindowContents()
        {
            if (GameManager.GetEditorLevel() != null && GameManager.GetEditorLevel().MyScene != null)
            {
                SceneObject s = GameManager.GetEditorLevel().MyScene;

                s.Draw2D(GameObjectTag.SceneDrawScene);
                InnerColor = GameManager.GetEditorLevel().MyScene.ClearColor;
            }



            Matrix scrollbarMatrix = Matrix.CreateTranslation(new Vector3(-ScrollBarHorizontal.self.X * ScrollBarHorizontal.difference, -ScrollBarVertical.self.Y * ScrollBarVertical.difference, 0));

            Game1.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, RasterizerState.CullNone, null, scrollbarMatrix);
            DrawChildren();
            Game1.spriteBatch.End();

            Game1.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, SamplerState.PointClamp, DepthStencilState.None, RasterizerState.CullNone, null, scrollbarMatrix);
            DrawAdditiveChildren();
            Game1.spriteBatch.End();
        }