diff options
author | sanine-a <sanine.not@pm.me> | 2023-02-20 11:50:15 -0600 |
---|---|---|
committer | sanine-a <sanine.not@pm.me> | 2023-02-20 11:50:15 -0600 |
commit | 3cb9054bbb32e5ae14222bcef497680736dcce0e (patch) | |
tree | b7914eb5e7a392111cca202b1e9a772261f62276 /demo/vector | |
parent | 635ed26de97dea983005456206694dca02cbd7d5 (diff) |
add font rendering to demo
Diffstat (limited to 'demo/vector')
-rw-r--r-- | demo/vector/PAPYRUS.ttf | bin | 0 -> 156000 bytes | |||
-rw-r--r-- | demo/vector/main.lua | 11 |
2 files changed, 10 insertions, 1 deletions
diff --git a/demo/vector/PAPYRUS.ttf b/demo/vector/PAPYRUS.ttf Binary files differnew file mode 100644 index 0000000..a33c7b2 --- /dev/null +++ b/demo/vector/PAPYRUS.ttf diff --git a/demo/vector/main.lua b/demo/vector/main.lua index fda4bc8..2b29999 100644 --- a/demo/vector/main.lua +++ b/demo/vector/main.lua @@ -5,9 +5,12 @@ local nvg = honey.nvg local vg +local papyrus function honey.init() vg = nvg.CreateContext() + papyrus = nvg.CreateFont(vg, "Papyrus", "PAPYRUS.ttf") + if (papyrus == -1) then error("failed to find font") end end @@ -30,8 +33,14 @@ end function honey.draw() nvg.BeginFrame(vg, 640, 480, 1.0) + + nvg.StrokeColor(vg, nvg.RGBf(1, 1, 1)) + nvg.FontFace(vg, "Papyrus") + nvg.Text(vg, 50, 50, "Hello, world! c:") + + nvg.StrokeWidth(vg, 20) - nvg.StrokeColor(vg, nvg.RGB(1, 0, 0)) + nvg.StrokeColor(vg, nvg.RGBf(1, 0, 0)) local w = 640 local h = 480 |