diff --git a/text_rendering/.gitignore b/text_rendering/.gitignore new file mode 100644 index 0000000..e179b20 --- /dev/null +++ b/text_rendering/.gitignore @@ -0,0 +1,2 @@ +*.png +test \ No newline at end of file diff --git a/text_rendering/atlas.png b/text_rendering/atlas.png index e27682c..24279e1 100644 Binary files a/text_rendering/atlas.png and b/text_rendering/atlas.png differ diff --git a/text_rendering/ren.c b/text_rendering/ren.c index 5a54a3e..b68078a 100644 --- a/text_rendering/ren.c +++ b/text_rendering/ren.c @@ -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; diff --git a/text_rendering/test b/text_rendering/test index 454bb48..3215d3f 100755 Binary files a/text_rendering/test and b/text_rendering/test differ