示例#1
0
        public virtual void PaintToHDC(IntPtr hDC, RoomEditorState state)
        {
            _objectBaselines.Clear();
            foreach (RoomObject obj in _room.Objects)
            {
                if (obj.Baseline <= 0)
                {
                    obj.EffectiveBaseline = obj.StartY;
                }
                else
                {
                    obj.EffectiveBaseline = obj.Baseline;
                }
                _objectBaselines.Add(obj);
            }
            _objectBaselines.Sort();

            foreach (RoomObject obj in _objectBaselines)
            {
                if (!VisibleItems.Contains(GetUniqueName(obj)))
                {
                    continue;
                }
                int height = GetSpriteHeightForGameResolution(obj.Image);
                int ypos   = AdjustYCoordinateForWindowScroll(obj.StartY, state) - (height * state.ScaleFactor);
                Factory.NativeProxy.DrawSpriteToBuffer(obj.Image, AdjustXCoordinateForWindowScroll(obj.StartX, state), ypos, state.ScaleFactor);
            }
        }
示例#2
0
        private Character GetCharacter(int x, int y, RoomEditorState state)
        {
            foreach (Character character in _game.RootCharacterFolder.AllItemsFlat)
            {
                if (_room.Number != character.StartingRoom)
                {
                    continue;
                }

                if (!VisibleItems.Contains(character.ScriptName) || LockedItems.Contains(character.ScriptName))
                {
                    continue;
                }

                AgsView view = _game.FindViewByID(character.NormalView);

                if (view != null && view.Loops.Count > 0)
                {
                    if (HitTest(x, y, character, view))
                    {
                        return(character);
                    }
                }
            }
            return(null);
        }
示例#3
0
 private bool IsMoveable(SelectedEdge edge)
 {
     if (!VisibleItems.Contains(edge.ToString()) || LockedItems.Contains(edge.ToString()))
     {
         return(false);
     }
     return(true);
 }
示例#4
0
 public void PaintToHDC(IntPtr hdc, RoomEditorState state)
 {
     foreach (Character character in _game.RootCharacterFolder.AllItemsFlat)
     {
         if (_room.Number == character.StartingRoom && VisibleItems.Contains(character.ScriptName))
         {
             DrawCharacter(character, state);
         }
     }
 }
示例#5
0
 private RoomObject GetObject(int x, int y)
 {
     for (int i = _objectBaselines.Count - 1; i >= 0; i--)
     {
         RoomObject obj  = _objectBaselines[i];
         string     name = GetUniqueName(obj);
         if (!VisibleItems.Contains(name) || LockedItems.Contains(name))
         {
             continue;
         }
         if (HitTest(obj, x, y))
         {
             return(obj);
         }
     }
     return(null);
 }
示例#6
0
        public virtual void Paint(Graphics graphics, RoomEditorState state)
        {
            int xPos;
            int yPos;

            if (_selectedObject != null && VisibleItems.Contains(GetUniqueName(_selectedObject)))
            {
                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);
                }
            }
        }
示例#7
0
        public void Paint(Graphics graphics, RoomEditorState state)
        {
            int scaleFactor = state.ScaleFactor;

            if (VisibleItems.Contains(SelectedEdge.Left.ToString()))
            {
                DrawDoubleWidthVerticalLine(graphics, _room.LeftEdgeX * scaleFactor - state.ScrollOffsetX, scaleFactor);
            }
            if (VisibleItems.Contains(SelectedEdge.Right.ToString()))
            {
                DrawDoubleWidthVerticalLine(graphics, _room.RightEdgeX * scaleFactor - state.ScrollOffsetX, scaleFactor);
            }
            if (VisibleItems.Contains(SelectedEdge.Top.ToString()))
            {
                DrawDoubleHeightHorizontalLine(graphics, _room.TopEdgeY * scaleFactor - state.ScrollOffsetY, scaleFactor);
            }
            if (VisibleItems.Contains(SelectedEdge.Bottom.ToString()))
            {
                DrawDoubleHeightHorizontalLine(graphics, _room.BottomEdgeY * scaleFactor - state.ScrollOffsetY, scaleFactor);
            }
        }