Пример #1
0
        public IconCounter(int max, TextureInfo texture, int fullCell, int halfCell, int emptyCell, Layer layer)
        {
            fullIndex  = fullCell;
            halfIndex  = halfCell;
            emptyIndex = emptyCell;

            icons = new SpriteGrid {
                Texture = texture, Cells = new ArrayGrid <int>(new Vector2(max / 2, 1))
            };

            CalculateIcons();

            Layer = layer;

            Position = new Rectangle(0, 0, (max / 2) * texture.CellSize.X, texture.CellSize.Y);
            Layer.AddObject(this);
        }
Пример #2
0
        public SpriteGrid GetStringSprite(string message)
        {
            var sg = new SpriteGrid
            {
                Texture = Texture,
                Cells   = new ArrayGrid <int>(message.Length, message.Select(c =>
                {
                    int val;
                    if (CharMap.TryGetValue(c, out val))
                    {
                        return(val);
                    }
                    else
                    {
                        return(CharMap[' ']);
                    }
                }))
            };


            return(sg);
        }