示例#1
0
        private void AddTexture2D(string key, Rectangle destination, Color color, int borderThickness, int borderRadius, int borderShadow)
        {
            if (!_textureDict.ContainsKey(key))
            {
                int width  = destination.Width;
                int height = destination.Height;

                Texture2D texture = new Texture2D(GraphicsDevice, width, height);
                StaticTexture2D.FillTexture2DWithRoundCorners(ref texture, width, height, color, borderThickness, borderRadius, borderShadow);

                _textureDict[key] = new ExTexture2D(texture, destination);
            }
        }
示例#2
0
        private void AddTexture2D(string key, Color color)
        {
            if (!_textureDict.ContainsKey(key))
            {
                int width  = GraphicsDevice.Viewport.Width;
                int height = GraphicsDevice.Viewport.Height;

                Texture2D texture = new Texture2D(GraphicsDevice, width, height);
                StaticTexture2D.FillTexture2D(ref texture, width, height, color);

                _textureDict[key] = new ExTexture2D(texture, new Rectangle(0, 0, width, height));
            }
        }
示例#3
0
        private void AddTexture2D(string key, Rectangle destination, Color color)
        {
            if (!_textureDict.ContainsKey(key))
            {
                int width  = destination.Width;
                int height = destination.Height;

                Texture2D texture = new Texture2D(GraphicsDevice, width, height);
                StaticTexture2D.FillTexture2D(ref texture, width, height, color);

                _textureDict[key] = new ExTexture2D(texture, destination);
            }
        }
示例#4
0
        protected void LoadContentEngine()
        {
            separator  = (Game.GraphicsDevice.Viewport.Width * 0.1f) / (_screenManager.BlockInLine * 2);
            blockWidth = (Game.GraphicsDevice.Viewport.Width / _screenManager.BlockInLine) - (2 * separator);

            float y = (Game.GraphicsDevice.Viewport.Height - Game.GraphicsDevice.Viewport.Width) / 2;

            for (int i = 0; i < _screenManager.BlockInLine; i++)
            {
                float x      = 0;
                float top    = 0;
                float bottom = 0;

                y  += separator;
                top = y;

                y     += blockWidth;
                bottom = y;

                y += separator;

                for (int j = 0; j < _screenManager.BlockInLine; j++)
                {
                    x += separator;

                    Vector2 start = new Vector2(x, top);

                    x += blockWidth;

                    Vector2 stop = new Vector2(x, bottom);

                    x += separator;

                    Block layoutItem = new Block(i * _screenManager.BlockInLine + j, start, stop);
                    layoutItems.Add(layoutItem);
                }
            }

            foreach (BlockType item in Enum.GetValues(typeof(BlockType)))
            {
                Color colorBackgroundBlock = Color.White;

                switch (item)
                {
                case BlockType.EMPTY:
                    colorBackgroundBlock = General.Colors.BLOCK_EMPTY;
                    break;

                case BlockType.MINUS:
                case BlockType.BAD:
                    colorBackgroundBlock = General.Colors.BLOCK_RED;
                    break;

                case BlockType.PLUS:
                case BlockType.GOOD:
                    colorBackgroundBlock = General.Colors.BLOCK_GREEN;
                    break;
                }

                Texture2D blockBackgroundTexture = new Texture2D(Game.GraphicsDevice, (int)blockWidth, (int)blockWidth, false, SurfaceFormat.Color);
                StaticTexture2D.FillTexture2DWithRoundCorners(ref blockBackgroundTexture, (int)blockWidth, (int)blockWidth, colorBackgroundBlock, 0, 45, 0);

                blockItems[item] = blockBackgroundTexture;
            }
        }