コード例 #1
0
        public void DrawText(SpriteBatch spriteBatch, string text, Vector2 position)
        {
            int positionX = (int)position.X * 2;

            for (int i = 0; i < text.Length && text[i] != 0; ++i)
            {
                ScummChar chr = chars[text[i]];
                if (chr.height == 0)
                {
                    continue;
                }
                spriteBatch.Draw(chr.pic, new Rectangle((int)(positionX + chr.offX), (int)(position.Y + chr.offY) * 2 - chr.height * 2, chr.width * 2, chr.height * 2), null, Color.White, 0, Vector2.Zero, SpriteEffects.None, 0);
                positionX += chr.width * 2;
            }
        }
コード例 #2
0
        public int GetTextWidth(string text)
        {
            int sum = 0;

            for (int i = 0; i < text.Length && text[i] != 0; ++i)
            {
                ScummChar chr = chars[text[i]];
                if (chr.height == 0)
                {
                    continue;
                }
                sum += chr.width * 2;
            }
            return(sum);
        }