Exemple #1
0
        internal void UpdateDisplay()
        {
            if (this.Visible == false)
            {
                return;
            }

            Display.BeginFrame();
            Display.Clear(AgateLib.Geometry.Color.LightGray);

            // draw the grid
            AgateLib.Geometry.Color clr = AgateLib.Geometry.Color.Gray;

            for (int x = 0; x < pctGraphics.Width; x += 30)
            {
                Display.DrawRect(new AgateLib.Geometry.Rectangle(0, 0, x, pctGraphics.Height), clr);
            }

            for (int y = 0; y < pctGraphics.Height; y += 30)
            {
                Display.DrawRect(new AgateLib.Geometry.Rectangle(0, 0, pctGraphics.Width, y), clr);
            }

            if (mSurface != null)
            {
                // set all the state-drawing options on the surface
                UpdateSurface();

                mSurface.Draw((int)nudX.Value, (int)nudY.Value);


                // this image should be drawn at 200, 100 unrotated.
                // this is to test to make sure that RotationCenter does not have
                // any effect on a displayed, unrotated sprite.
                mSurface.RotationAngleDegrees = 0;
                mSurface.DisplayAlignment     = OriginAlignment.TopLeft;
                mSurface.Alpha = 1.0;
                mSurface.SetScale(1.0, 1.0);

                mSurface.Draw(200, 100);
            }

            // box around sprite point to check alignment
            const int rectsize = 3;

            Display.DrawRect(new AgateLib.Geometry.Rectangle((int)nudX.Value - rectsize, (int)nudY.Value - rectsize,
                                                             2 * rectsize, 2 * rectsize), AgateLib.Geometry.Color.Fuchsia);


            Display.EndFrame();
            Core.KeepAlive();
        }
Exemple #2
0
        internal void UpdateDisplay()
        {
            if (this.Visible == false)
            {
                return;
            }

            Display.BeginFrame();
            Display.Clear(AgateLib.Geometry.Color.Green);


            // draw the grid
            AgateLib.Geometry.Color clr = AgateLib.Geometry.Color.FromArgb(0, 164, 0);

            for (int x = 0; x < pctGraphics.Width; x += 16)
            {
                Display.DrawRect(new AgateLib.Geometry.Rectangle(0, 0, x, Display.RenderTarget.Height), clr);
            }

            for (int y = 0; y < pctGraphics.Height; y += 16)
            {
                Display.DrawRect(new AgateLib.Geometry.Rectangle(0, 0, Display.RenderTarget.Width, y), clr);
            }


            int crossSize = 5;

            Display.DrawRect(new AgateLib.Geometry.Rectangle(mSpritePosition, mSprite.DisplaySize), AgateLib.Geometry.Color.Red);

            // draw cross
            Display.DrawRect(new AgateLib.Geometry.Rectangle(mSpritePosition.X - crossSize, mSpritePosition.Y, crossSize * 2 + 1, 1),
                             AgateLib.Geometry.Color.White);
            Display.DrawRect(new AgateLib.Geometry.Rectangle(mSpritePosition.X, mSpritePosition.Y - crossSize, 1, crossSize * 2 + 1),
                             AgateLib.Geometry.Color.White);

            mSprite.Update();
            mSprite.Draw(mSpritePosition);

            //srcSurf.Draw(10, 300);

            Display.EndFrame();

            lblFrameRate.Text = "Frame Rate: " + Display.FramesPerSecond.ToString();
        }