AGS.Editor.ObjectsEditorFilter.Paint C# (CSharp) Метод

Paint() публичный Метод

public Paint ( Graphics graphics, RoomEditorState state ) : void
graphics System.Drawing.Graphics
state RoomEditorState
Результат void
        public virtual void Paint(Graphics graphics, RoomEditorState state)
        {
            int xPos;
            int yPos;

            if (_selectedObject != null)
            {
                int width = GetSpriteWidthForGameResolution(_selectedObject.Image);
                int height = GetSpriteHeightForGameResolution(_selectedObject.Image);
                xPos = AdjustXCoordinateForWindowScroll(_selectedObject.StartX, state);
                yPos = AdjustYCoordinateForWindowScroll(_selectedObject.StartY, state) - (height * state.ScaleFactor);
                Pen pen = new Pen(Color.Goldenrod);
                pen.DashStyle = System.Drawing.Drawing2D.DashStyle.Dot;
                graphics.DrawRectangle(pen, xPos, yPos, width * state.ScaleFactor, height * state.ScaleFactor);

                if (_movingObjectWithMouse)
                {
                    System.Drawing.Font font = new System.Drawing.Font("Arial", 10.0f);
                    string toDraw = String.Format("X:{0}, Y:{1}", _selectedObject.StartX, _selectedObject.StartY);

                    int scaledx = xPos + (width * state.ScaleFactor / 2) - ((int)graphics.MeasureString(toDraw, font).Width / 2);
                    int scaledy = yPos - (int)graphics.MeasureString(toDraw, font).Height;
                    if (scaledx < 0) scaledx = 0;
                    if (scaledy < 0) scaledy = 0;

                    graphics.DrawString(toDraw, font, pen.Brush, (float)scaledx, (float)scaledy);
                }
                else
                    if (_selectedObject.Locked)
                    {
                        pen = new Pen(Color.Goldenrod, 2);
                        xPos = AdjustXCoordinateForWindowScroll(_selectedObject.StartX, state) + (GetSpriteWidthForGameResolution(_selectedObject.Image) / 2 * state.ScaleFactor);
                        yPos = AdjustYCoordinateForWindowScroll(_selectedObject.StartY, state) - (GetSpriteHeightForGameResolution(_selectedObject.Image) / 2 * state.ScaleFactor);
                        Point center = new Point(xPos, yPos);

                        graphics.DrawLine(pen, center.X - 3, center.Y - 3, center.X + 3, center.Y + 3);
                        graphics.DrawLine(pen, center.X - 3, center.Y + 3, center.X + 3, center.Y - 3);

                    }
            }
        }