Skip to content

Instantly share code, notes, and snippets.

@cdegroot
Created August 12, 2026 13:40
Show Gist options
  • Select an option

  • Save cdegroot/df2bcd91c2a4f2e619a441cf72e1a33c to your computer and use it in GitHub Desktop.

Select an option

Save cdegroot/df2bcd91c2a4f2e619a441cf72e1a33c to your computer and use it in GitHub Desktop.
def_c paint_background(win_width, win_height) do
cdecl double: [win_width, win_height]
cdecl "NVGpaint": air
cdecl "NVGpaint": sun
air = nvgLinearGradient(vg, win_width / 2, 0, win_width / 2, win_height, nvgRGBA(0, 64, 196, 255), nvgRGBA(0, 196, 255, 255))
#air = nvgLinearGradient(vg, win_width / 2, 0, win_width / 2, win_height, nvgRGBA(0, 0, 128, 255), nvgRGBA(128, 64, 0, 255))
nvgBeginPath(vg)
nvgRect(vg, 0, 0, win_width, win_height)
nvgFillPaint(vg, air)
nvgFill(vg)
sun = nvgRadialGradient(vg, win_width * 0.8, win_height * 0.2, 0.04 * win_width, 0.05 * win_width, nvgRGBA(255, 255, 0, 255), nvgRGBA(128, 128, 0, 0))
nvgBeginPath(vg)
nvgCircle(vg, win_width * 0.8, win_height * 0.2, 0.1 * win_width)
nvgFillPaint(vg, sun)
nvgFill(vg)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment