From 3cb9054bbb32e5ae14222bcef497680736dcce0e Mon Sep 17 00:00:00 2001 From: sanine-a Date: Mon, 20 Feb 2023 11:50:15 -0600 Subject: add font rendering to demo --- demo/vector/PAPYRUS.ttf | Bin 0 -> 156000 bytes demo/vector/main.lua | 11 ++++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 demo/vector/PAPYRUS.ttf (limited to 'demo') diff --git a/demo/vector/PAPYRUS.ttf b/demo/vector/PAPYRUS.ttf new file mode 100644 index 0000000..a33c7b2 Binary files /dev/null and b/demo/vector/PAPYRUS.ttf differ 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 -- cgit v1.2.1