MrGravity.WorldSelect.CreateRegions C# (CSharp) Méthode

CreateRegions() private méthode

Creates all the regions for the level editor for easy placement within the Title Safe area
private CreateRegions ( ) : void
Résultat void
        private void CreateRegions()
        {
            _mScreenRect = _mGraphics.GraphicsDevice.Viewport.TitleSafeArea;

            _mPadding = new Vector2(_mScreenRect.Width / 100, _mScreenRect.Height / 100);

            _mLevelPanel = _mTitleBar = new Rectangle();

            //Title bar, bottom bar, and level panel is 2/3 the x size of the title safe area
            _mTitleBar.Width = _mLevelPanel.Width = _mScreenRect.Width;

            //Set the bottom and title bar to 1/8 of the title safe y area.
            //Set the level selection area to be 3/4 of the title safe y area
            _mLevelPanel.Height = _mScreenRect.Height - (_mTitleBar.Height = _mScreenRect.Height / 8);

            //Sets the x and y location of all the regions
            _mLevelPanel.X = _mTitleBar.X = _mScreenRect.Left;
            _mTitleBar.Y = _mScreenRect.Top;
            _mLevelPanel.Y = _mTitleBar.Y + _mTitleBar.Height;

            _mLevelRegions = new Rectangle[49];

            _mSelected = new Texture2D[6, 4];
            _mUnselected = new Texture2D[6];

            //Create 6 regions for image icons. The x direction is split into 3rds, which that region is 2/3rds of that area
            for (var i = 0; i < _mLevelRegions.Length; i++)
            {
                var width = _mLevelPanel.Width / 7;
                var height = _mLevelPanel.Height / 4;
                var xpadding = (i % 6) * width / 6;
                var ypadding = ((i / 6) + 1) * height / 5;

                _mLevelRegions[i] = new Rectangle(_mLevelPanel.Left + width * (i % 6) + xpadding, _mLevelPanel.Top + height * (i / 6) + ypadding, width, height);
            }
        }