Пример #1
0
        /// <summary>
        /// Creates SelectionRectangle which is used for plane selects and registers it at SceneManager.
        /// Also sets the borders (for camera man movement borders).
        /// </summary>
        /// <param name="c">The reference to the game CameraMan.</param>
        /// <param name="sceneWidth">The width of the game window.</param>
        /// <param name="sceneHeight">The height of the game window.</param>
        private MouseControl(CameraMan c, int sceneWidth, int sceneHeight)
        {
            var stopBoundX = sceneHeight / 20;
            var stopBoundY = sceneWidth / 15;
            upBorder = sceneHeight / 6; ;
            upBorderStop = upBorder + stopBoundX;
            leftBorder = sceneWidth / 15;
            leftBorderStop = leftBorder + stopBoundY;
            rightBorder = sceneWidth - sceneWidth / 15;
            rightBorderStop = rightBorder - stopBoundY;
            bottomBorder = sceneHeight * 7 / 10;
            bottomBorderStop = bottomBorder - stopBoundX;

            cameraMan = c;
            mRect = new SelectionRectangle("RectangularSelect");
            Game.SceneManager.RootSceneNode.CreateChildSceneNode().AttachObject(mRect);
        }
Пример #2
0
        /// <summary>
        /// Creates SelectionRectangle which is used for plane selects and registers it at SceneManager.
        /// Also sets the borders (for camera man movement borders).
        /// </summary>
        /// <param name="c">The reference to the game CameraMan.</param>
        /// <param name="sceneWidth">The width of the game window.</param>
        /// <param name="sceneHeight">The height of the game window.</param>
        private MouseControl(CameraMan c, int sceneWidth, int sceneHeight)
        {
            var stopBoundX = sceneHeight / 20;
            var stopBoundY = sceneWidth / 15;

            upBorder         = sceneHeight / 6;;
            upBorderStop     = upBorder + stopBoundX;
            leftBorder       = sceneWidth / 15;
            leftBorderStop   = leftBorder + stopBoundY;
            rightBorder      = sceneWidth - sceneWidth / 15;
            rightBorderStop  = rightBorder - stopBoundY;
            bottomBorder     = sceneHeight * 7 / 10;
            bottomBorderStop = bottomBorder - stopBoundX;

            cameraMan = c;
            mRect     = new SelectionRectangle("RectangularSelect");
            Game.SceneManager.RootSceneNode.CreateChildSceneNode().AttachObject(mRect);
        }