Drawing In Protected Mode: Difference between revisions

[unchecked revision][unchecked revision]
Content deleted Content added
Combuster (talk | contribs)
m more remaining osfaq-style markup
→‎Drawing Text: added to code example
Line 176:
Once in graphic mode, you no longer have the BIOS or the hardware to draw fonts for you. The basic idea is to have font data for each character and use it to plot (or not to plot) pixels. There are plenty of ways to store those fonts depending on whether they have multiple colors or not, alpha channel or not etc. What you will basically have, however is:
 
// holding what you need for every character of the set
font_char* font_data[CHARS];
 
// rendering one of the character, given its font_data
draw_char(screen, where, font_char*);
 
draw_string(screen, where, char* input)
{
Line 189:
input++;
}
}
draw_char(screen, where, font_char*)
{
for (l = 0; l < 8; l++)
{
for (i = 8; i > 0; i--)
{
j++;
if ((font_char[l] & (1<<i)))
{
c = c1;
put_pixel(j, h, c);
}
}
h++;
j = x;
}
}