示例#1
0
        public override bool Draw(UltimaBatcher2D batcher, int x, int y)
        {
            Rectangle rectangle = ScissorStack.CalculateScissors(Matrix.Identity, x, y, Width, Height);

            if (ScissorStack.PushScissors(rectangle))
            {
                batcher.EnableScissorTest(true);

                ResetHueVector();

                if (Engine.Profile.Current != null && Engine.Profile.Current.UseXBR)
                {
                    // draw regular world
                    _xBR.SetSize(_scene.ViewportTexture.Width, _scene.ViewportTexture.Height);

                    batcher.End();

                    batcher.Begin(_xBR);
                    batcher.Draw2D(_scene.ViewportTexture, x, y, Width, Height, ref _hueVector);
                    batcher.End();

                    batcher.Begin();
                }
                else
                {
                    batcher.Draw2D(_scene.ViewportTexture, x, y, Width, Height, ref _hueVector);
                }


                // draw lights
                if (_scene.UseLights)
                {
                    batcher.SetBlendState(_blend);
                    batcher.Draw2D(_scene.Darkness, x, y, Width, Height, ref _hueVector);
                    batcher.SetBlendState(null);
                }

                // draw overheads
                _scene.DrawSelection(batcher, x, y);
                _scene.DrawOverheads(batcher, x, y);

                base.Draw(batcher, x, y);

                batcher.EnableScissorTest(false);
                ScissorStack.PopScissors();
            }

            return(true);
        }
示例#2
0
        protected override void Draw(GameTime gameTime)
        {
            Profiler.EndFrame();
            Profiler.BeginFrame();

            if (Profiler.InContext("OutOfContext"))
            {
                Profiler.ExitContext("OutOfContext");
            }
            Profiler.EnterContext("RenderFrame");

            _totalFrames++;

            if (_scene != null && _scene.IsLoaded && !_scene.IsDestroyed)
            {
                _scene.Draw(_uoSpriteBatch);
            }

            GraphicsDevice.SetRenderTarget(_buffer);
            UIManager.Draw(_uoSpriteBatch);

            base.Draw(gameTime);

            Profiler.ExitContext("RenderFrame");
            Profiler.EnterContext("OutOfContext");

            GraphicsDevice.SetRenderTarget(null);
            _uoSpriteBatch.Begin();
            _uoSpriteBatch.Draw2D(_buffer, 0, 0, ref _hueVector);
            _uoSpriteBatch.End();

            UpdateWindowCaption(gameTime);
        }
示例#3
0
        public void Draw(UltimaBatcher2D batcher, int x, int y)
        {
            if (_texture != null)
            {
                X = x - (Width >> 1);
                Y = y - (Height >> 1);

                batcher.Begin();
                batcher.SetStencil(_stencil.Value);
                //batcher.SetBlendState(_checkerBlend.Value);

                //_hueVector.X = 23;
                //_hueVector.Y = 1;
                //_hueVector.Z = 0;

                BlendState.AlphaBlend.ColorWriteChannels = ColorWriteChannels.Alpha;
                batcher.Draw2D(_texture, X, Y, ref _hueVector);
                BlendState.AlphaBlend.ColorWriteChannels = ColorWriteChannels.All;


                //batcher.SetBlendState(null);
                batcher.SetStencil(null);

                batcher.End();
            }
        }
示例#4
0
        public override bool Draw(UltimaBatcher2D batcher, int x, int y)
        {
            if (Engine.Profile.Current != null && Engine.Profile.Current.UseXBR)
            {
                // draw regular world

                if (_xBR == null || _xBR.IsDisposed)
                {
                    _xBR = new MatrixEffect(batcher.GraphicsDevice, Resources.xBREffect);
                }

                _xBR.Parameters["textureSize"].SetValue(new Vector2
                {
                    X = _scene.ViewportTexture.Width,
                    Y = _scene.ViewportTexture.Height
                });

                batcher.End();

                batcher.Begin(_xBR);
                batcher.Draw2D(_scene.ViewportTexture, x, y, Width, Height, ref _zero);
                batcher.End();

                batcher.Begin();
            }
            else
            {
                batcher.Draw2D(_scene.ViewportTexture, x, y, Width, Height, ref _zero);
            }


            // draw lights
            if (_scene.UseLights)
            {
                batcher.SetBlendState(_blend);
                batcher.Draw2D(_scene.Darkness, x, y, Width, Height, ref _zero);
                batcher.SetBlendState(null);
            }

            // draw overheads
            _scene.DrawSelection(batcher, x, y);
            _scene.DrawOverheads(batcher, x, y);

            return(base.Draw(batcher, x, y));
        }
示例#5
0
        public override bool Draw(UltimaBatcher2D batcher, int x, int y)
        {
            ResetHueVector();

            if (Engine.Profile.Current != null && Engine.Profile.Current.UseXBR)
            {
                // draw regular world
                _xBR.SetSize(_scene.ViewportTexture.Width, _scene.ViewportTexture.Height);

                batcher.End();

                batcher.Begin(_xBR);
                batcher.Draw2D(_scene.ViewportTexture, x, y, Width, Height, ref _hueVector);
                batcher.End();

                batcher.Begin();
            }
            else
            {
                batcher.Draw2D(_scene.ViewportTexture, x, y, Width, Height, ref _hueVector);
            }


            // draw lights
            if (_scene.UseLights)
            {
                batcher.SetBlendState(_blend);
                batcher.Draw2D(_scene.Darkness, x, y, Width, Height, ref _hueVector);
                batcher.SetBlendState(null);
            }

            // draw overheads
            _scene.DrawSelection(batcher, x, y);
            _scene.DrawOverheads(batcher, x, y);

            return(base.Draw(batcher, x, y));
        }
示例#6
0
        protected override void Draw(GameTime gameTime)
        {
            Profiler.EndFrame();
            Profiler.BeginFrame();

            if (Profiler.InContext("OutOfContext"))
            {
                Profiler.ExitContext("OutOfContext");
            }
            Profiler.EnterContext("RenderFrame");

            _totalFrames++;

            if (_scene != null && _scene.IsLoaded && !_scene.IsDestroyed)
            {
                _scene.Draw(_uoSpriteBatch);
            }

            GraphicsDevice.SetRenderTarget(_buffer);
            UIManager.Draw(_uoSpriteBatch);

            if (ProfileManager.Current != null && ProfileManager.Current.ShowNetworkStats)
            {
                if (!NetClient.Socket.IsConnected)
                {
                    NetClient.LoginSocket.Statistics.Draw(_uoSpriteBatch, 10, 50);
                }
                else if (!NetClient.Socket.IsDisposed)
                {
                    NetClient.Socket.Statistics.Draw(_uoSpriteBatch, 10, 50);
                }
            }


            base.Draw(gameTime);

            Profiler.ExitContext("RenderFrame");
            Profiler.EnterContext("OutOfContext");

            GraphicsDevice.SetRenderTarget(null);
            _uoSpriteBatch.Begin();
            _uoSpriteBatch.Draw2D(_buffer, 0, 0, ref _hueVector);
            _uoSpriteBatch.End();

            UpdateWindowCaption(gameTime);
        }
示例#7
0
        protected override void Draw(GameTime gameTime)
        {
            Profiler.EndFrame();
            Profiler.BeginFrame();

            if (Profiler.InContext("OutOfContext"))
            {
                Profiler.ExitContext("OutOfContext");
            }
            Profiler.EnterContext("RenderFrame");

            _totalFrames++;

            if (_scene != null && _scene.IsLoaded && !_scene.IsDestroyed)
            {
                _scene.Draw(_uoSpriteBatch);
            }

            GraphicsDevice.SetRenderTarget(_buffer);
            UIManager.Draw(_uoSpriteBatch);

            if (World.InGame && SelectedObject.LastObject is TextObject t)
            {
                if (t.IsTextGump)
                {
                    t.ToTopD();
                }
                else
                {
                    World.WorldTextManager?.MoveToTop(t);
                }
            }

            base.Draw(gameTime);

            Profiler.ExitContext("RenderFrame");
            Profiler.EnterContext("OutOfContext");

            GraphicsDevice.SetRenderTarget(null);
            _uoSpriteBatch.Begin();
            _uoSpriteBatch.Draw2D(_buffer, 0, 0, ref _hueVector);
            _uoSpriteBatch.End();

            UpdateWindowCaption(gameTime);
        }
示例#8
0
        public static void Draw(UltimaBatcher2D batcher)
        {
            SortControlsByInfo();

            batcher.GraphicsDevice.Clear(Color.Transparent);

            batcher.Begin();

            for (int i = Gumps.Count - 1; i >= 0; i--)
            {
                Control g = Gumps[i];
                g.Draw(batcher, g.X, g.Y);
            }

            GameCursor?.Draw(batcher);

            batcher.End();
        }
示例#9
0
        public static void Draw(UltimaBatcher2D batcher)
        {
            SortControlsByInfo();

            batcher.GraphicsDevice.Clear(Color.Black);

            batcher.Begin();

            for (var last = Gumps.Last; last != null; last = last.Previous)
            {
                var g = last.Value;
                g.Draw(batcher, g.X, g.Y);
            }

            GameCursor?.Draw(batcher);

            batcher.End();
        }
示例#10
0
 public void Draw(UltimaBatcher2D batcher, int x, int y)
 {
     batcher.Begin();
     _renderedText.Draw(batcher, x, y);
     batcher.End();
 }
示例#11
0
        public override bool Draw(UltimaBatcher2D batcher, int x, int y)
        {
            if (_scene.ViewportTexture == null)
            {
                return(false);
            }

            Rectangle rectangle = ScissorStack.CalculateScissors(Matrix.Identity, x, y, Width, Height);

            if (ScissorStack.PushScissors(batcher.GraphicsDevice, rectangle))
            {
                batcher.EnableScissorTest(true);

                ResetHueVector();

                if (ProfileManager.Current != null && ProfileManager.Current.UseXBR)
                {
                    // draw regular world
                    if (_xBR == null)
                    {
                        _xBR = new XBREffect(batcher.GraphicsDevice);
                    }

                    _xBR.SetSize(_scene.ViewportTexture.Width, _scene.ViewportTexture.Height);

                    batcher.End();

                    batcher.Begin(_xBR);
                    batcher.Draw2D(_scene.ViewportTexture, x, y, Width, Height, ref _hueVector);
                    batcher.End();

                    batcher.Begin();
                }
                else
                {
                    batcher.Draw2D(_scene.ViewportTexture, x, y, Width, Height, ref _hueVector);
                }


                // draw lights
                // if (_scene.UseAltLights)
                // {
                //     batcher.SetBlendState(_altLightsBlend);
                //     _hueVector.Z = 0.5f;
                //     batcher.Draw2D(_scene.LightRenderTarget, x, y, Width, Height, ref _hueVector);
                //     _hueVector.Z = 0;
                //     batcher.SetBlendState(null);
                // }
                // else if (_scene.UseLights)
                // {
                //     batcher.SetBlendState(_darknessBlend);
                //     batcher.Draw2D(_scene.LightRenderTarget, x, y, Width, Height, ref _hueVector);
                //     batcher.SetBlendState(null);
                // }

                // draw overheads
                _scene.DrawSelection(batcher, x, y);
                _scene.DrawOverheads(batcher, x, y);

                base.Draw(batcher, x, y);

                batcher.EnableScissorTest(false);
                ScissorStack.PopScissors(batcher.GraphicsDevice);
            }

            return(true);
        }