Page 1 of 2

Pixel Font

Posted: October 22nd, 2016, 5:09 am
by Nny
I am sure there are MUCH better ways to do this, but based off what I've learned in the current series with the Chili Framework, this is what I came up with. I figure something similar was used back in the day on things like the 2600 when you saw badly done text drawn in the scenery of a game.

No special characters or punctuation for now, maybe later but I have a cold currently.


This part for Game.h

Code: Select all

	void Block(int x, int y, int r, int g, int b);
		void chA(int x, int y, int r, int g, int b);
		void chB(int x, int y, int r, int g, int b);
		void chC(int x, int y, int r, int g, int b);
		void chD(int x, int y, int r, int g, int b);
		void chE(int x, int y, int r, int g, int b);
		void chF(int x, int y, int r, int g, int b);
		void chG(int x, int y, int r, int g, int b);
		void chH(int x, int y, int r, int g, int b);
		void chI(int x, int y, int r, int g, int b);
		void chJ(int x, int y, int r, int g, int b);
		void chK(int x, int y, int r, int g, int b);
		void chL(int x, int y, int r, int g, int b);
		void chM(int x, int y, int r, int g, int b);
		void chN(int x, int y, int r, int g, int b);
		void chO(int x, int y, int r, int g, int b);
		void chP(int x, int y, int r, int g, int b);
		void chQ(int x, int y, int r, int g, int b);
		void chR(int x, int y, int r, int g, int b);
		void chS(int x, int y, int r, int g, int b);
		void chT(int x, int y, int r, int g, int b);
		void chU(int x, int y, int r, int g, int b);
		void chV(int x, int y, int r, int g, int b);
		void chW(int x, int y, int r, int g, int b);
		void chX(int x, int y, int r, int g, int b);
		void chY(int x, int y, int r, int g, int b);
		void chZ(int x, int y, int r, int g, int b);

This part for Game.cpp


// Each Letter is 5x6 "Pixel"s
// Each "Pixel" is actually a 3x3 cube with a 2 pixel gap between other "Pixels"
// Optimal tracking seems to be 35 with leading of 45 if you want things monospaced
// Monospaced text can look funky sometimes though, might need to tweak individual kerning if things look funky

Code: Select all

void Game::Block(int x, int y, int r, int g, int b)
{
	for (int xPos = x; xPos <= (x + 3); xPos++)
	{
		for (int yPos = y; yPos <= (y + 3); yPos++)
		{
			gfx.PutPixel(xPos, yPos, r, g, b);
		}
	}
} 

void Game::chA(int x, int y, int r, int g, int b)
{
	Block(x+10, y, r, g, b);

	Block(x+5, y+5, r, g, b);
	Block(x+15, y+5, r, g, b);

	Block(x, y+10, r, g, b);
	Block(x+20, y+10, r, g, b);

	Block(x, y+15, r, g, b);
	Block(x+5, y + 15, r, g, b);
	Block(x+10, y + 15, r, g, b);
	Block(x+15, y + 15, r, g, b);
	Block(x+20, y + 15, r, g, b);

	Block(x, y + 20, r, g, b);
	Block(x+20, y + 20, r, g, b);

	Block(x, y + 25, r, g, b);
	Block(x+20, y + 25, r, g, b);
}
void Game::chB(int x, int y, int r, int g, int b)
{
	Block(x, y, r, g, b);
	Block(x+5, y, r, g, b);
	Block(x+10, y, r, g, b);
	Block(x+15, y, r, g, b);

	Block(x, y+5, r, g, b);
	Block(x+20, y+5, r, g, b);

	Block(x, y+10, r, g, b);
	Block(x+5, y+10, r, g, b);
	Block(x+10, y+10, r, g, b);
	Block(x+15, y+10, r, g, b);

	Block(x, y+15, r, g, b);
	Block(x+20, y+15, r, g, b);

	Block(x, y+20, r, g, b);
	Block(x+20, y+20, r, g, b);

	Block(x, y+25, r, g, b);
	Block(x+5, y+25, r, g, b);
	Block(x+10, y+25, r, g, b);
	Block(x+15, y+25, r, g, b);
}
void Game::chC(int x, int y, int r, int g, int b)
{
	Block(x+5, y, r, g, b);
	Block(x+10, y, r, g, b);
	Block(x+15, y, r, g, b);

	Block(x, y+5, r, g, b);
	Block(x+20, y+5, r, g, b);

	Block(x, y+10, r, g, b);

	Block(x, y+15, r, g, b);

	Block(x, y+20, r, g, b);
	Block(x+20, y+20, r, g, b);

	Block(x+5, y+25, r, g, b);
	Block(x+10, y+25, r, g, b);
	Block(x+15, y+25, r, g, b);
}
void Game::chD(int x, int y, int r, int g, int b)
{
	Block(x, y, r, g, b);
	Block(x+5, y, r, g, b);
	Block(x+10, y, r, g, b);

	Block(x, y+5, r, g, b);
	Block(x+15, y+5, r, g, b);

	Block(x, y+10, r, g, b);
	Block(x+20, y+10, r, g, b);

	Block(x, y+15, r, g, b);
	Block(x+20, y+15, r, g, b);

	Block(x, y+20, r, g, b);
	Block(x+15, y+20, r, g, b);

	Block(x, y+25, r, g, b);
	Block(x+5, y+25, r, g, b);
	Block(x+10, y+25, r, g, b);
}
void Game::chE(int x, int y, int r, int g, int b)
{
	Block(x, y, r, g, b);
	Block(x+5, y, r, g, b);
	Block(x+10, y, r, g, b);
	Block(x+15, y, r, g, b);
	Block(x+20, y, r, g, b);

	Block(x, y+5, r, g, b);

	Block(x, y+10, r, g, b);
	Block(x+5, y+10, r, g, b);
	Block(x+10, y+10, r, g, b);

	Block(x, y+15, r, g, b);

	Block(x, y+20, r, g, b);

	Block(x, y+25, r, g, b);
	Block(x+5, y+25, r, g, b);
	Block(x+10, y+25, r, g, b);
	Block(x+15, y+25, r, g, b);
	Block(x+20, y+25, r, g, b);
}
void Game::chF(int x, int y, int r, int g, int b)
{
	Block(x, y, r, g, b);
	Block(x+5, y, r, g, b);
	Block(x+10, y, r, g, b);
	Block(x+15, y, r, g, b);
	Block(x+20, y, r, g, b);

	Block(x, y+5, r, g, b);

	Block(x, y+10, r, g, b);
	Block(x+5, y+10, r, g, b);
	Block(x+10, y+10, r, g, b);
			  
	Block(x, y+15, r, g, b);

	Block(x, y+20, r, g, b);

	Block(x, y+25, r, g, b);
}
void Game::chG(int x, int y, int r, int g, int b)
{
	Block(x+5, y, r, g, b);
	Block(x+10, y, r, g, b);
	Block(x+15, y, r, g, b);

	Block(x, y+5, r, g, b);
	Block(x+20, y+5, r, g, b);

	Block(x, y+10, r, g, b);

	Block(x, y+15, r, g, b);
	Block(x+10, y+15, r, g, b);
	Block(x+15, y+15, r, g, b);
	Block(x+20, y+15, r, g, b);

	Block(x, y+20, r, g, b);
	Block(x+20, y+20, r, g, b);

	Block(x+5, y+25, r, g, b);
	Block(x+10, y+25, r, g, b);
	Block(x+15, y+25, r, g, b);
}
void Game::chH(int x, int y, int r, int g, int b)
{
	Block(x, y, r, g, b);
	Block(x+20, y, r, g, b);

	Block(x, y+5, r, g, b);
	Block(x+20, y+5, r, g, b);

	Block(x, y+10, r, g, b);
	Block(x+5, y+10, r, g, b);
	Block(x+10, y+10, r, g, b);
	Block(x+15, y+10, r, g, b);
	Block(x+20, y+10, r, g, b);

	Block(x, y+15, r, g, b);
	Block(x+20, y+15, r, g, b);

	Block(x, y+20, r, g, b);
	Block(x+20, y+20, r, g, b);

	Block(x, y+25, r, g, b);
	Block(x+20, y+25, r, g, b);
}
void Game::chI(int x, int y, int r, int g, int b)
{
	Block(x, y, r, g, b);
	Block(x+5, y, r, g, b);
	Block(x+10, y, r, g, b);
	Block(x+15, y, r, g, b);
	Block(x+20, y, r, g, b);

	Block(x+10, y+5, r, g, b);
		   
	Block(x+10, y+10, r, g, b);
		   
	Block(x+10, y+15, r, g, b);
		   
	Block(x+10, y+20, r, g, b);

	Block(x, y+25, r, g, b);
	Block(x+5, y+25, r, g, b);
	Block(x+10, y+25, r, g, b);
	Block(x+15, y+25, r, g, b);
	Block(x+20, y+25, r, g, b);
}
void Game::chJ(int x, int y, int r, int g, int b)
{
	Block(x, y, r, g, b);
	Block(x+5, y, r, g, b);
	Block(x+10, y, r, g, b);
	Block(x+15, y, r, g, b);
	Block(x+20, y, r, g, b);

	Block(x+10, y+5, r, g, b);

	Block(x+10, y+10, r, g, b);

	Block(x+10, y+15, r, g, b);

	Block(x, y+20, r, g, b);
	Block(x+10, y+20, r, g, b);

	Block(x+5, y+25, r, g, b);
	Block(x+10, y+25, r, g, b);
}
void Game::chK(int x, int y, int r, int g, int b)
{
	Block(x, y, r, g, b);
	Block(x+20, y, r, g, b);

	Block(x, y+5, r, g, b);
	Block(x+15, y+5, r, g, b);

	Block(x, y+10, r, g, b);
	Block(x+5, y+10, r, g, b);
	Block(x+10, y+10, r, g, b);

	Block(x, y+15, r, g, b);
	Block(x+10, y+15, r, g, b);

	Block(x, y+20, r, g, b);
	Block(x+15, y+20, r, g, b);

	Block(x, y+25, r, g, b);
	Block(x+20, y+25, r, g, b);
}
void Game::chL(int x, int y, int r, int g, int b)
{
	Block(x, y, r, g, b);

	Block(x, y+5, r, g, b);

	Block(x, y+10, r, g, b);

	Block(x, y+15, r, g, b);

	Block(x, y+20, r, g, b);

	Block(x, y+25, r, g, b);
	Block(x+5, y+25, r, g, b);
	Block(x+10, y+25, r, g, b);
	Block(x+15, y+25, r, g, b);
	Block(x+20, y+25, r, g, b);
}
void Game::chM(int x, int y, int r, int g, int b)
{
	Block(x, y, r, g, b);
	Block(x+20, y, r, g, b);

	Block(x, y+5, r, g, b);
	Block(x+5, y+5, r, g, b);
	Block(x+15, y+5, r, g, b);
	Block(x+20, y+5, r, g, b);

	Block(x, y+10, r, g, b);
	Block(x+10, y+10, r, g, b);
	Block(x+20, y+10, r, g, b);

	Block(x, y+15, r, g, b);
	Block(x+10, y+15, r, g, b);
	Block(x+20, y+15, r, g, b);

	Block(x, y+20, r, g, b);
	Block(x+20, y+20, r, g, b);

	Block(x, y+25, r, g, b);
	Block(x+20, y+25, r, g, b);
}
void Game::chN(int x, int y, int r, int g, int b)
{
	Block(x, y, r, g, b);
	Block(x+20, y, r, g, b);

	Block(x, y+5, r, g, b);
	Block(x+5, y+5, r, g, b);
	Block(x+20, y+5, r, g, b);

	Block(x, y+10, r, g, b);
	Block(x+10, y+10, r, g, b);
	Block(x+20, y+10, r, g, b);

	Block(x, y+15, r, g, b);
	Block(x+15, y+15, r, g, b);
	Block(x+20, y+15, r, g, b);

	Block(x, y+20, r, g, b);
	Block(x+20, y+20, r, g, b);

	Block(x, y+25, r, g, b);
	Block(x+20, y+25, r, g, b);
}
void Game::chO(int x, int y, int r, int g, int b)
{
	Block(x+5, y, r, g, b);
	Block(x+10, y, r, g, b);
	Block(x+15, y, r, g, b);

	Block(x, y+5, r, g, b);
	Block(x+20, y+5, r, g, b);

	Block(x, y+10, r, g, b);
	Block(x+20, y+10, r, g, b);

	Block(x, y+15, r, g, b);
	Block(x+20, y+15, r, g, b);

	Block(x, y+20, r, g, b);
	Block(x+20, y+20, r, g, b);

	Block(x+5, y+25, r, g, b);
	Block(x+10, y+25, r, g, b);
	Block(x+15, y+25, r, g, b);
}
void Game::chP(int x, int y, int r, int g, int b)
{
	Block(x, y, r, g, b);
	Block(x+5, y, r, g, b);
	Block(x+10, y, r, g, b);
	Block(x+15, y, r, g, b);

	Block(x, y+5, r, g, b);
	Block(x+20, y+5, r, g, b);

	Block(x, y+10, r, g, b);
	Block(x+5, y+10, r, g, b);
	Block(x+10, y+10, r, g, b);
	Block(x+15, y+10, r, g, b);

	Block(x, y+15, r, g, b);

	Block(x, y+20, r, g, b);

	Block(x, y+25, r, g, b);
}
void Game::chQ(int x, int y, int r, int g, int b)
{
	Block(x+5, y, r, g, b);
	Block(x+10, y, r, g, b);
	Block(x+15, y, r, g, b);

	Block(x, y+5, r, g, b);
	Block(x+20, y+5, r, g, b);

	Block(x, y+10, r, g, b);
	Block(x+20, y+10, r, g, b);

	Block(x, y+15, r, g, b);
	Block(x+10, y+15, r, g, b);
	Block(x+20, y+15, r, g, b);

	Block(x, y+20, r, g, b);
	Block(x+15, y+20, r, g, b);

	Block(x+5, y+25, r, g, b);
	Block(x+10, y+25, r, g, b);
	Block(x+20, y+25, r, g, b);
}
void Game::chR(int x, int y, int r, int g, int b)
{
	Block(x, y, r, g, b);
	Block(x+5, y, r, g, b);
	Block(x+10, y, r, g, b);
	Block(x+15, y, r, g, b);

	Block(x, y+5, r, g, b);
	Block(x+20, y+5, r, g, b);

	Block(x, y+10, r, g, b);
	Block(x+5, y+10, r, g, b);
	Block(x+10, y+10, r, g, b);
	Block(x+15, y+10, r, g, b);

	Block(x, y+15, r, g, b);
	Block(x+20, y+15, r, g, b);

	Block(x, y+20, r, g, b);
	Block(x+20, y+20, r, g, b);

	Block(x, y+25, r, g, b);
	Block(x+20, y+25, r, g, b);
}
void Game::chS(int x, int y, int r, int g, int b)
{
	Block(x+5, y, r, g, b);
	Block(x+10, y, r, g, b);
	Block(x+15, y, r, g, b);
	Block(x+20, y, r, g, b);

	Block(x, y+5, r, g, b);

	Block(x+5, y+10, r, g, b);
	Block(x+10, y+10, r, g, b);
	Block(x+15, y+10, r, g, b);

	Block(x+20, y+15, r, g, b);

	Block(x+20, y+20, r, g, b);

	Block(x, y+25, r, g, b);
	Block(x+5, y+25, r, g, b);
	Block(x+10, y+25, r, g, b);
	Block(x+15, y+25, r, g, b);
}
void Game::chT(int x, int y, int r, int g, int b)
{
	Block(x, y, r, g, b);
	Block(x+5, y, r, g, b);
	Block(x+10, y, r, g, b);
	Block(x+15, y, r, g, b);
	Block(x+20, y, r, g, b);

	Block(x+10, y+5, r, g, b);

	Block(x+10, y+10, r, g, b);

	Block(x+10, y+15, r, g, b);

	Block(x+10, y+20, r, g, b);

	Block(x+10, y+25, r, g, b);
}
void Game::chU(int x, int y, int r, int g, int b)
{
	Block(x, y, r, g, b);
	Block(x+20, y, r, g, b);

	Block(x, y+5, r, g, b);
	Block(x+20, y+5, r, g, b);

	Block(x, y+10, r, g, b);
	Block(x+20, y+10, r, g, b);

	Block(x, y+15, r, g, b);
	Block(x+20, y+15, r, g, b);

	Block(x, y+20, r, g, b);
	Block(x+20, y+20, r, g, b);

	Block(x+5, y+25, r, g, b);
	Block(x+10, y+25, r, g, b);
	Block(x+15, y+25, r, g, b);
}
void Game::chV(int x, int y, int r, int g, int b)
{
	Block(x, y, r, g, b);
	Block(x+20, y, r, g, b);

	Block(x, y+5, r, g, b);
	Block(x+20, y+5, r, g, b);

	Block(x, y+10, r, g, b);
	Block(x+20, y+10, r, g, b);

	Block(x+5, y+15, r, g, b);
	Block(x+15, y+15, r, g, b);

	Block(x+5, y+20, r, g, b);
	Block(x+15, y+20, r, g, b);

	Block(x+10, y+25, r, g, b);
}
void Game::chW(int x, int y, int r, int g, int b)
{
	Block(x, y, r, g, b);
	Block(x+20, y, r, g, b);

	Block(x, y+5, r, g, b);
	Block(x+20, y+5, r, g, b);

	Block(x, y+10, r, g, b);
	Block(x+20, y+10, r, g, b);

	Block(x, y+15, r, g, b);
	Block(x+10, y+15, r, g, b);
	Block(x+20, y+15, r, g, b);

	Block(x, y+20, r, g, b);
	Block(x+10, y+20, r, g, b);
	Block(x+20, y+20, r, g, b);

	Block(x+5, y+25, r, g, b);
	Block(x+15, y+25, r, g, b);
}
void Game::chX(int x, int y, int r, int g, int b)
{
	Block(x, y, r, g, b);
	Block(x+20, y, r, g, b);

	Block(x+5, y+5, r, g, b);
	Block(x+15, y+5, r, g, b);

	Block(x+10, y+10, r, g, b);

	Block(x+10, y+15, r, g, b);

	Block(x+5, y+20, r, g, b);
	Block(x+15, y+20, r, g, b);

	Block(x, y+25, r, g, b);
	Block(x+20, y+25, r, g, b);
}
void Game::chY(int x, int y, int r, int g, int b)
{
	Block(x, y, r, g, b);
	Block(x+20, y, r, g, b);

	Block(x, y+5, r, g, b);
	Block(x+20, y+5, r, g, b);

	Block(x+5, y+10, r, g, b);
	Block(x+15, y+10, r, g, b);

	Block(x+10, y+15, r, g, b);

	Block(x+10, y+20, r, g, b);

	Block(x+10, y+25, r, g, b);
}
void Game::chZ(int x, int y, int r, int g, int b)
{
	Block(x, y, r, g, b);
	Block(x+5, y, r, g, b);
	Block(x+10, y, r, g, b);
	Block(x+15, y, r, g, b);
	Block(x+20, y, r, g, b);

	Block(x+20, y+5, r, g, b);

	Block(x+15, y+10, r, g, b);

	Block(x+10, y+15, r, g, b);

	Block(x+5, y+20, r, g, b);

	Block(x, y+25, r, g, b);
	Block(x+5, y+25, r, g, b);
	Block(x+10, y+25, r, g, b);
	Block(x+15, y+25, r, g, b);
	Block(x+20, y+25, r, g, b);
}
Image

Re: Pixel Font

Posted: October 22nd, 2016, 5:19 am
by chili
Hmm, I would have just done it like a function full of putpixels, one for each character. I like this solution. If I do an update video I'll try and remember to pimp it out :D

Re: Pixel Font

Posted: October 22nd, 2016, 4:31 pm
by albinopapa
Did you use graph paper to determine the pixel/block locations? Or, maybe just zoomed in on some text in a paint program?

I like the effect, gives it an old computer screen look or a marquee sign.

Re: Pixel Font

Posted: October 22nd, 2016, 7:35 pm
by Nny
chili wrote:Hmm, I would have just done it like a function full of putpixels, one for each character. I like this solution. If I do an update video I'll try and remember to pimp it out :D
^_^
albinopapa wrote:Did you use graph paper to determine the pixel/block locations? Or, maybe just zoomed in on some text in a paint program?

I like the effect, gives it an old computer screen look or a marquee sign.
Graph Paper all the way. Made it easier to just look at and know what x's and y's I needed to +whatever to without a lot of back and forth.

Re: Pixel Font

Posted: October 23rd, 2016, 11:21 pm
by Alacaster
Dude, this is so awesome.

Re: Pixel Font

Posted: October 24th, 2016, 3:57 am
by chili
Now you need to make function that takes a string and a position and renders the string at that position on the screen :P

Re: Pixel Font

Posted: October 24th, 2016, 9:24 pm
by reductor
One approach you could take to break this down into something more readable would be to create a function that will output a collection of pixels (based on a mask) to the screen.

Code: Select all

template<std::size_t Width, std::size_t Height>
using PixelMap = std::array<std::array<Width, bool>, Height>;

template<std::size_t Width, std::size_t Height>
void DrawPixels( int x, int y, const PixelMap<Width,Height> & pixels );
Once you have this function you can then start constructing arrays of pixels (Including reading them from disk). Instead of an std::array inside of an std::array here you could use a string then have a char mark if a pixel should be output.

Re: Pixel Font

Posted: October 25th, 2016, 12:37 am
by chili
Yes, this approach (but not with static arrays of course, and not using templates) will be taken later in the series, after we have learned about, pointers, memory allocation, file IO, etc. Nny's approach here is cool because it is achieved with a minimum of language features.

The final goal is to use GDI+ or DirectWrite to handle the font loading / text drawing for us.

Re: Pixel Font

Posted: April 22nd, 2017, 2:39 am
by krautersuppe
Nny wrote:
No special characters or punctuation for now, maybe later but I have a cold currently.
I made numbers and punctuation:
in Game.h:

Code: Select all

void ch0(int x, int y, int r, int g, int b);
void ch1(int x, int y, int r, int g, int b);
void ch2(int x, int y, int r, int g, int b);
void ch3(int x, int y, int r, int g, int b);
void ch4(int x, int y, int r, int g, int b);
void ch5(int x, int y, int r, int g, int b);
void ch6(int x, int y, int r, int g, int b);
void ch7(int x, int y, int r, int g, int b);
void ch8(int x, int y, int r, int g, int b);
void ch9(int x, int y, int r, int g, int b);

void chPoint(int x, int y, int r, int g, int b);
void chApostrophe(int x, int y, int r, int g, int b);
void chExMark(int x, int y, int r, int g, int b);
void chQMark(int x, int y, int r, int g, int b);
void chDash(int x, int y, int r, int g, int b);
in Game.cpp:

Code: Select all

void Game::ch0(int x, int y, int r, int g, int b)
{
	Block(x + 5, y, r, g, b);
	Block(x + 10, y, r, g, b);
	Block(x + 15, y, r, g, b);

	Block(x, y + 5, r, g, b);
	Block(x + 15, y + 5, r, g, b);
	Block(x + 20, y + 5, r, g, b);

	Block(x, y + 10, r, g, b);
	Block(x + 10, y + 10, r, g, b);
	Block(x + 20, y + 10, r, g, b);

	Block(x, y + 15, r, g, b);
	Block(x + 10, y + 15, r, g, b);
	Block(x + 20, y + 15, r, g, b);

	Block(x, y + 20, r, g, b);
	Block(x + 5, y + 20, r, g, b);
	Block(x + 20, y + 20, r, g, b);

	Block(x + 5, y + 25, r, g, b);
	Block(x + 10, y + 25, r, g, b);
	Block(x + 15, y + 25, r, g, b);
}

void Game::ch1(int x, int y, int r, int g, int b)
{
	Block(x + 10, y, r, g, b);

	Block(x + 5, y + 5, r, g, b);
	Block(x + 10, y + 5, r, g, b);

	Block(x, y + 10, r, g, b);
	Block(x + 10, y + 10, r, g, b);

	Block(x + 10, y + 15, r, g, b);

	Block(x + 10, y + 20, r, g, b);

	Block(x, y + 25, r, g, b);
	Block(x + 5, y + 25, r, g, b);
	Block(x + 10, y + 25, r, g, b);
	Block(x + 15, y + 25, r, g, b);
	Block(x + 20, y + 25, r, g, b);
}

void Game::ch2(int x, int y, int r, int g, int b)
{
	Block(x + 5, y, r, g, b);
	Block(x + 10, y, r, g, b);
	Block(x + 15, y, r, g, b);

	Block(x, y + 5, r, g, b);
	Block(x + 20, y + 5, r, g, b);

	Block(x + 20, y + 10, r, g, b);

	Block(x + 5, y + 15, r, g, b);
	Block(x + 10, y + 15, r, g, b);
	Block(x + 15, y + 15, r, g, b);

	Block(x, y + 20, r, g, b);

	Block(x, y + 25, r, g, b);
	Block(x + 5, y + 25, r, g, b);
	Block(x + 10, y + 25, r, g, b);
	Block(x + 15, y + 25, r, g, b);
	Block(x + 20, y + 25, r, g, b);
}

void Game::ch3(int x, int y, int r, int g, int b)
{
	Block(x, y, r, g, b);
	Block(x + 5, y, r, g, b);
	Block(x + 10, y, r, g, b);
	Block(x + 15, y, r, g, b);

	Block(x + 20, y + 5, r, g, b);

	Block(x + 20, y + 10, r, g, b);

	Block(x, y + 15, r, g, b);
	Block(x + 5, y + 15, r, g, b);
	Block(x + 10, y + 15, r, g, b);
	Block(x + 15, y + 15, r, g, b);

	Block(x + 20, y + 20, r, g, b);

	Block(x, y + 25, r, g, b);
	Block(x + 5, y + 25, r, g, b);
	Block(x + 10, y + 25, r, g, b);
	Block(x + 15, y + 25, r, g, b);
	Block(x + 20, y + 25, r, g, b);
}

void Game::ch4(int x, int y, int r, int g, int b)
{
	Block(x + 15, y, r, g, b);

	Block(x + 10, y + 5, r, g, b);
	Block(x + 15, y + 5, r, g, b);

	Block(x + 5, y + 10, r, g, b);
	Block(x + 15, y + 10, r, g, b);

	Block(x, y + 15, r, g, b);
	Block(x + 15, y + 15, r, g, b);

	Block(x, y + 20, r, g, b);
	Block(x + 5, y + 20, r, g, b);
	Block(x + 10, y + 20, r, g, b);
	Block(x + 15, y + 20, r, g, b);
	Block(x + 20, y + 20, r, g, b);

	Block(x + 15, y + 25, r, g, b);
}

void Game::ch5(int x, int y, int r, int g, int b)
{
	Block(x, y, r, g, b);
	Block(x + 5, y, r, g, b);
	Block(x + 10, y, r, g, b);
	Block(x + 15, y, r, g, b);
	Block(x + 20, y, r, g, b);

	Block(x, y + 5, r, g, b);

	Block(x, y + 10, r, g, b);
	Block(x + 5, y + 10, r, g, b);
	Block(x + 10, y + 10, r, g, b);
	Block(x + 15, y + 10, r, g, b);


	Block(x + 20, y + 15, r, g, b);

	Block(x + 20, y + 20, r, g, b);

	Block(x, y + 25, r, g, b);
	Block(x + 5, y + 25, r, g, b);
	Block(x + 10, y + 25, r, g, b);
	Block(x + 15, y + 25, r, g, b);
}

void Game::ch6(int x, int y, int r, int g, int b)
{
	Block(x + 10, y, r, g, b);
	Block(x + 15, y, r, g, b);
	Block(x + 20, y, r, g, b);

	Block(x + 5, y + 5, r, g, b);

	Block(x, y + 10, r, g, b);

	Block(x, y + 15, r, g, b);
	Block(x + 5, y + 15, r, g, b);
	Block(x + 10, y + 15, r, g, b);
	Block(x + 15, y + 15, r, g, b);

	Block(x, y + 20, r, g, b);
	Block(x + 20, y + 20, r, g, b);

	Block(x + 5, y + 25, r, g, b);
	Block(x + 10, y + 25, r, g, b);
	Block(x + 15, y + 25, r, g, b);
}

void Game::ch7(int x, int y, int r, int g, int b)
{
	Block(x, y, r, g, b);
	Block(x + 5, y, r, g, b);
	Block(x + 10, y, r, g, b);
	Block(x + 15, y, r, g, b);
	Block(x + 20, y, r, g, b);

	Block(x + 20, y + 5, r, g, b);

	Block(x + 15, y + 10, r, g, b);

	Block(x + 10, y + 15, r, g, b);

	Block(x + 5, y + 20, r, g, b);

	Block(x, y + 25, r, g, b);
}

void Game::ch8(int x, int y, int r, int g, int b)
{
	Block(x + 5, y, r, g, b);
	Block(x + 10, y, r, g, b);
	Block(x + 15, y, r, g, b);

	Block(x, y + 5, r, g, b);
	Block(x + 20, y + 5, r, g, b);

	Block(x + 5, y + 10, r, g, b);
	Block(x + 10, y + 10, r, g, b);
	Block(x + 15, y + 10, r, g, b);

	Block(x, y + 15, r, g, b);
	Block(x + 20, y + 15, r, g, b);

	Block(x, y + 20, r, g, b);
	Block(x + 20, y + 20, r, g, b);

	Block(x + 5, y + 25, r, g, b);
	Block(x + 10, y + 25, r, g, b);
	Block(x + 15, y + 25, r, g, b);
}

void Game::ch9(int x, int y, int r, int g, int b)
{
	Block(x + 5, y, r, g, b);
	Block(x + 10, y, r, g, b);
	Block(x + 15, y, r, g, b);

	Block(x, y + 5, r, g, b);
	Block(x + 20, y + 5, r, g, b);

	Block(x + 5, y + 10, r, g, b);
	Block(x + 10, y + 10, r, g, b);
	Block(x + 15, y + 10, r, g, b);
	Block(x + 20, y + 10, r, g, b);

	Block(x + 20, y + 15, r, g, b);

	Block(x + 15, y + 20, r, g, b);

	Block(x + 10, y + 25, r, g, b);
}


void Game::chPoint(int x, int y, int r, int g, int b)
{
	Block(x, y + 25, r, g, b);
}

void Game::chApostrophe(int x, int y, int r, int g, int b)
{
	Block(x, y, r, g, b);

	Block(x, y + 5, r, g, b);
}

void Game::chExMark(int x, int y, int r, int g, int b)
{
	Block(x, y, r, g, b);

	Block(x, y + 5, r, g, b);

	Block(x, y + 10, r, g, b);

	Block(x, y + 15, r, g, b);

	Block(x, y + 25, r, g, b);
}

void Game::chDash(int x, int y, int r, int g, int b)
{
	Block(x, y + 10, r, g, b);
	Block(x + 5, y + 10, r, g, b);
	Block(x + 10, y + 10, r, g, b);
}

void Game::chQMark(int x, int y, int r, int g, int b)
{
	Block(x + 5, y, r, g, b);
	Block(x + 10, y, r, g, b);
	Block(x + 15, y, r, g, b);

	Block(x, y + 5, r, g, b);
	Block(x + 20, y + 5, r, g, b);

	Block(x + 15, y + 10, r, g, b);

	Block(x + 10, y + 15, r, g, b);

	Block(x + 10, y + 25, r, g, b);
}
Numbers.png
Numbers.png (1.15 KiB) Viewed 3843 times

Re: Pixel Font

Posted: April 30th, 2017, 8:57 pm
by DEM0N194
First of all, thank you Nny and krautersuppe for making this.
This is something I wanted to do for a very long time, but never got to it... cuz I'm a lazy mofo.
So thx for making this really.

So .. I created some functionality around this...
a Text class where you can input a string and set the position, color, etc. and it draws every character for you.
I also created a Counter class, which behaves like an int except it draws itself to the screen.
(I can finally add a score counter to my pong game yay :D)

Here it is if you want to check it out: https://github.com/DEM0N194/PixelFont

Once again thx for sharing this with us :)