Пример #1
0
        private Town(int columnSize, int rowSize)
        {
            this.columnSize = columnSize;
            this.rowSize    = rowSize;

            currentColumn = this.columnSize / 2;
            currentRow    = this.rowSize / 2;

            ground = new Component
            {
                Subject = new Rectangle
                {
                    Width  = 1,
                    Height = 1,
                    Fill   = Brushes.Red
                },
                X = 0,
                Y = 0
            };
            current = new Component
            {
                Subject = new Rectangle
                {
                    Width  = 1,
                    Height = 1,
                    Fill   = Brushes.Green
                },
                X = 0,
                Y = 0
            };

            CM.Add(this);
        }
Пример #2
0
            public void Visit(Group f)
            {
                if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON) &&
                    f.Collide(GetMousePosition())
                    )
                {
                    f.OldX          = f.Size().x;
                    f.OldY          = f.Size().y;
                    f.mouseMoveMode = true;
                }

                if (f.mouseMoveMode)
                {
                    f.RelMove(GetMousePosition().X - f.mousePositionLastFrame.X, GetMousePosition().Y - f.mousePositionLastFrame.Y);
                }

                if (IsMouseButtonReleased(MOUSE_LEFT_BUTTON) && f.mouseMoveMode == true)
                {
                    canvasManager.Add(new MoveFigure(f.OldX, f.OldY, f.Size().x, f.Size().y, f));
                    f.mouseMoveMode = false;
                }

                f.mousePositionLastFrame = GetMousePosition();
            }