private void UpdateSurface() { mSurface.RotationAngleDegrees = (double)nudAngle.Value; mSurface.DisplayAlignment = (OriginAlignment)cboAlignment.SelectedItem; mSurface.RotationCenter = (OriginAlignment)cboRotation.SelectedItem; mSurface.SetScale((double)nudScaleWidth.Value / 100.0, (double)nudScaleHeight.Value / 100.0); mSurface.Color = Color.FromArgb(colorBox.BackColor.ToArgb()); mSurface.Alpha = (double)nudAlpha.Value / 100.0; }
internal void UpdateDisplay() { if (this.Visible == false) { return; } Display.BeginFrame(); Display.Clear(Color.LightGray); // draw the grid Color clr = Color.Gray; for (int x = 0; x < pctGraphics.Width; x += 30) { Display.Primitives.DrawRect(clr, new Rectangle(0, 0, x, pctGraphics.Height)); } for (int y = 0; y < pctGraphics.Height; y += 30) { Display.Primitives.DrawRect(clr, new Rectangle(0, 0, pctGraphics.Width, y)); } 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.Primitives.DrawRect(Color.Fuchsia, new Rectangle( (int)nudX.Value - rectsize, (int)nudY.Value - rectsize, 2 * rectsize, 2 * rectsize)); Display.EndFrame(); AgateApp.KeepAlive(); }
internal void UpdateDisplay() { if (this.Visible == false) { return; } Display.BeginFrame(); Display.Clear(Color.Green); // draw the grid Color clr = Color.FromRgb(0, 164, 0); for (int x = 0; x < pctGraphics.Width; x += 16) { Display.Primitives.DrawRect(clr, new Rectangle(0, 0, x, Display.RenderTarget.Height)); } for (int y = 0; y < pctGraphics.Height; y += 16) { Display.Primitives.DrawRect(clr, new Rectangle(0, 0, Display.RenderTarget.Width, y)); } int crossSize = 5; Display.Primitives.DrawRect(Color.Red, new Rectangle(mSpritePosition, mSprite.DisplaySize)); // draw cross Display.Primitives.DrawRect(Color.White, new Rectangle(mSpritePosition.X - crossSize, mSpritePosition.Y, crossSize * 2 + 1, 1)); Display.Primitives.DrawRect(Color.White, new Rectangle(mSpritePosition.X, mSpritePosition.Y - crossSize, 1, crossSize * 2 + 1)); mSprite.Update(); mSprite.Draw(mSpritePosition); //srcSurf.Draw(10, 300); Display.EndFrame(); lblFrameRate.Text = "Frame Rate: " + Display.FramesPerSecond.ToString(); }