How to create an Alphabet bitmap in CSharp
Here’s another short utility. I have been looking for a decent alphabet to look in my next game (called HogWash) . As before, I want to create a sprite sheet with letters. But every alphabet set that I found had issues with kerning. I kid you not, usually but not always with M, W, or even Q.
Even when I put together a sprite sheet manually, the editor didn’t quite get it right and letters didn’t quite fit the grid. So to simplify it, here;’s a 50 line C# program that takes the letters you supply in a string, combined with a font (Liberation Mono- from Red Hat) and a brush (black solid). It does a double loop that I exit with a goto (shock horror!) when it reaches the a terminating * in the string I supplied.
That is the graphic file above that the program below generated. As you can see the letters are far enough apart so no overlapping. Just put in your path where I have for the source and dest consts. You can use this technique for building sprite sheet.
// Author D. Bolton Learncgames.com You are free to use and copy this program as you wish but please leave this line in.
using System;
using System.Drawing;
using System.Drawing.Imaging;
namespace buildfont
{
class Program
{
const int LetterWidth = 100;
const int LetterHeight = 120;
const string source = "Your path"
const string dest = @"YourPath\letters.png";
static Bitmap allLetters = new Bitmap(LetterWidth * 8,LetterHeight * 5);
static void Main(string[] args)
{
BuildOneImage();
}
private static void BuildOneImage()
{
var font = new Font("Liberation Mono",95);
var brush = new SolidBrush(Color.Black);
var str = "ABCDEFGHIJKLMNOPQRSTUVWXYZ*";
Console.WriteLine("Creating letters.png");
var aty = 0.0f;
using (Graphics g = Graphics.FromImage(allLetters))
{
var strindex = 0;
for (var y = 0; y < 5; y++)
{
var atx = 0.0f;
for (int x = 0; x < 6; x++)
{
string aLetter = str[strindex++].ToString();
if (aLetter == "*") goto Done;
g.DrawString(aLetter, font, brush, atx, aty);
atx += LetterWidth;
}
aty += LetterHeight;
}
}
Done:
allLetters.Save(dest, ImageFormat.Png);
}
}
}

As the picture shows, no one has ever accused me of being artistic! Hey I can’t be good at everything (sometimes it feels like anything but it passes!) and I’ve long ago accepted that I never will be an artist.
These don’t come that often and this one has quite a few changes. You can read all about it on their
This is very clever. The website 
Not the face to face type but actual networking. This is needed because I’m working on a game server. My mobile game (Manana Banana) will become networked enabled and thus multiplayer. C# is ideal for this type of thing but I’m not using the networking capability of MonoGame instead managing the whole lot myself.
I’m using this in Android games but the principle applies to any MonoGame game. Here clickable and touchable mean the same.
To set the TouchArea of the ClearButton, I do it in the Draw method. It’s as simple as this:
I’ve been using virtual machines for years. Originally I started with VirtualBox, the free VM manager from Oracle. I’m not sure why I switched to Hyper-V, about five or six years ago but I’ve been on Hyper-V since then. You need to be on Windows Pro and have at least 8 GB though the more RAM the better. I have 64 GB and the most I’ve ever had in use at one time is 29 GB. I always try to keep RAM use below 50% as there’s less disk swapping.
