Add Framebuffer.character()

This commit is contained in:
Josh Holtrop 2022-03-22 22:11:12 -04:00
parent 9e7c3ee676
commit 6b7b14d954

View File

@ -4,6 +4,7 @@
module hulk.framebuffer;
import hos.memory;
import hulk.kfont;
/**
* Represent a graphical frame buffer.
@ -105,6 +106,20 @@ struct Framebuffer
}
}
/**
* Draw a character.
*
* @param x X coordinate of left side of character.
* @param y Y coordinate of bottom side of character.
* @param ch Character to draw.
* @param color Color of character.
*/
void character(int x, int y, char ch, uint color)
{
const(CharInfo) * ci = &kfont.chars[ch];
blit_alpha_bitmap(x + ci.left, y + kfont.baseline_offset + ci.top - ci.height, ci.bitmap, ci.width, ci.height, color);
}
/**
* Blit an 8-bit alpha bitmap to the framebuffer.
*