Exemplo n.º 1
0
        public virtual void Render()
        {
            System.Diagnostics.Debug.WriteLine("--------------------------Begin render--------------------------");
            if (graphic != null && graphic.Visible)
            {
                //Graphics g = (renderTarget != null ? renderTarget : MP.BeginRender())

                if (renderTarget != null)
                {
                    using (var g = Graphics.FromImage(renderTarget))
                    {
                        graphic.Render(g, Position, MP.Camera);
                    }
                }
                else
                {
                    var g = MP.BeginRender();
                    try
                    {
                        graphic.Render(g, Position, MP.Camera);
                    }
                    finally
                    {
                        MP.EndRender();
                    }
                }
            }
            System.Diagnostics.Debug.WriteLine("-----------------------------End render----------------------------");
        }
Exemplo n.º 2
0
        /**
         * Renders the game, rendering the World and Entities.
         */

        public void Render()
        {
            MP.BeginRender();
            try
            {
                ClearScreen();

                Update((uint)DateTime.Now.Ticks);

                MP.CurrentWorld.Render();
            }
            finally
            {
                MP.EndRender();
            }
        }
Exemplo n.º 3
0
        private void ClearScreen()
        {
            //using (var graphics = System.Drawing.Graphics.FromImage(MP.Buffer))
            //{
            //    graphics.Clear(Color.CornflowerBlue); //FillRectangle(new SolidBrush(Color.CornflowerBlue), 0.0f, 0.0f, MP.Width, MP.Height);
            //}

            var g = MP.BeginRender();

            try
            {
                g.Clear(Color.CornflowerBlue);
            }
            finally
            {
                MP.EndRender();
            }
        }