示例#1
0
        /// <summary>
        /// Allows the page to draw itself.
        /// </summary>
        private void OnDraw(object sender, GameTimerEventArgs e)
        {
            int xScrolldp = player.x - drawer.Width / 2;
            int yScrolldp = player.y - (drawer.Height - 8) / 2;

            if (xScrolldp < 16)
            {
                xScrolldp = 16;
            }
            if (yScrolldp < 16)
            {
                yScrolldp = 16;
            }
            if (xScrolldp > level.w * 16 - drawer.Width - 16)
            {
                xScrolldp = level.w * 16 - drawer.Width - 16;
            }
            if (yScrolldp > level.h * 16 - drawer.Height - 16)
            {
                yScrolldp = level.h * 16 - drawer.Height - 16;
            }



            drawer.StartDrawing();

            level.renderBackground(drawer, xScrolldp, yScrolldp);

            drawer.SetOffset(xScrolldp, yScrolldp);
            slime.Draw(drawer);

            player.Draw(drawer);

            drawer.ResetOffset();

            //fr.Draw(new GameTime(e.TotalTime, e.ElapsedTime), spriteBatch,drawer.font);
            //fr.Print(new GameTime(e.TotalTime, e.ElapsedTime));

            renderGui();

            drawer.EndDrawing();
        }