This commit is contained in:
Alessandro Mauri 2023-02-24 14:58:10 +01:00
parent 60660f2388
commit e11f54f3a1
Signed by: alema
GPG Key ID: 2B7BF9531FF03BE8
4 changed files with 23 additions and 11 deletions

2
text_rendering/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
*.png
test

Binary file not shown.

Before

(image error) Size: 11 KiB

After

(image error) Size: 11 KiB

View File

@ -452,17 +452,27 @@ int ren_set_scissor(int x, int y, int w, int h)
// TODO: implement font size
int ren_render_text(const char *str, int x, int y, int w, int h, int size)
{
// x4,y4 x3,y3
// +-------------+
// |(x,y) /|
// | / |
// | 2 / |
// | / |
// | / |
// | / 1 |
// |/ |
// +-------------+
// x1,y1 x2,y2
/* x4,y4 x3,y3
* +-------------+
* |(x,y) /|
* | / |
* | 2 / |
* | / |
* | / |
* | / 1 |
* |/ |
* +-------------+
* x1,y1 x2,y2 */
// TODO: stop drawing when outside the bounding box
// TODO: check size, if the current font is not of the same size then load
// load a new font and use that texture instead, this implies making
// a system to store and use different fonts, like:
// struct font_atlas * font_by_size(int size);
// FIXME: the bounding box (scissor) logic does not work
// TODO: create a method for calculating the total bounding box of a string
// given the box size
const struct font_glyph *g;
struct font_glyph c;

Binary file not shown.