I have a set_pixel
function (a function that sets the color of a pixel in a example display), and I only have this method of output to print to a display.
I was trying to print some characters to the screen for debugging and other general purposes, but the only way I found to accomplish this is by printing each letter pixel by pixel, a very slow and tedious thing, considering that I will use uppercases and numbers.
For example, this is some code used to print a 'A' with a simple set_line
function made up with the set_pixel
function.
void draw_A(int x, int y, int charWidth, int charHeight, int RGB)
{
//first draw a line along the left side:
set_line(x, y, x, y+charHeight,RGB);
//draw a line across the top:
set_line(x,y,x+charWidth,y,RGB);
//draw a line along the right side:
set_line(x+charWidth,y,x+charWidth,y+charHeight,RGB);
//finally close in the box half way up
set_line(x,y+(charHeight/2),x+charWidth,y+(charHeight/2),RGB);
}
For this I'm using C
as my language in a freestanding
environment, without the standard libraries, like <stdio.h>
or any kind of library, but I could re-implement something I guess or port some libraries.
How I can accomplish this without going pixel by pixel or line by line? Thanks in advance!