master
Alessandro Mauri 1 year ago
parent 60660f2388
commit e11f54f3a1
Signed by: alema
GPG Key ID: 2B7BF9531FF03BE8
  1. 2
      text_rendering/.gitignore
  2. BIN
      text_rendering/atlas.png
  3. 32
      text_rendering/ren.c
  4. BIN
      text_rendering/test

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

@ -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.
Loading…
Cancel
Save