diff options
| author | Jeroen van Rijn <Kelimion@users.noreply.github.com> | 2022-04-03 18:53:27 +0200 |
|---|---|---|
| committer | Jeroen van Rijn <Kelimion@users.noreply.github.com> | 2022-04-03 18:53:27 +0200 |
| commit | 376327c87b6a9398159591f775325ac16b5e0b79 (patch) | |
| tree | 3221ccfe76a43aa6c8eb17d75cab60737813ddc4 /src/main.cpp | |
| parent | f8f91e52e00eaa1630deeac51e20f1c4c724d4bf (diff) | |
[vendor:easy_font] API improvements.
Add `print(x, y, text, color, quad_buffer)` version that takes `[]quad`.
(Same internal memory layout as []u8 API, but more convenient for the caller.)
Add optional `scale := f32(1.0)` param to `print` to embiggen the glyph quads.
```odin
// Example for use with vendor:raylib
quads: [999]easy_font.Quad = ---
color := rl.GREEN
c := transmute(easy_font.Color)color
num_quads := easy_font.print(10, 60, TEXT, c, quads[:])
for q in quads[:num_quads] {
tl := q.tl.v
br := q.br.v
color = transmute(rl.Color)q.tl.c
r := rl.Rectangle{x = tl.x, y = tl.y, width = br.x - tl.x, height = br.y - tl.y}
// Yes, we could just use the `color` from above, but this shows how to get it back from the vertex.
// And in practice this code will likely not live as close to the `easy_font` call.
rl.DrawRectangleRec(r, color)
}
```
Diffstat (limited to 'src/main.cpp')
0 files changed, 0 insertions, 0 deletions