Exemple #1
0
            private TextureData buildTextureData(int width, int height)
            {
                var textureBitmap = new Bitmap(width, height);

                using var g = System.Drawing.Graphics.FromImage(textureBitmap);
                applyGraphicsSettings(g);

                // TODO: right now the background isn't transparent white as we want, since graphics doesn't support
                // clearing to transparent AND a color

                var brush = new SolidBrush(System.Drawing.Color.White);

                foreach (var(character, info) in characterInfos)
                {
                    g.DrawString(
                        character.ToString(), font, brush,
                        info.TopLeft.X - info.Offset.X, info.TopLeft.Y - info.Offset.Y);
                }

                return(TextureData.From(textureBitmap));
            }