nanovg-simple: Simple interface to rendering with NanoVG

[ bsd3, graphics, library ] [ Propose Tags ]

Modules

[Last Documentation]

  • Graphics
    • NanoVG
      • Graphics.NanoVG.Picture
      • Graphics.NanoVG.Simple

Flags

Automatic Flags
NameDescriptionDefault
library-onlyEnabled

Use -f <flag> to enable a flag, or -f -<flag> to disable that flag. More info

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

Versions [RSS] 0.4.0.0, 0.5.0.0
Dependencies base (>=4.7 && <5), GLFW-b (>=3.2.1.0 && <3.4), monad-loops (>=0.4.3 && <0.5), nanovg (>=0.6.0.0 && <0.7), nanovg-simple, OpenGL (>=3.0.2.2 && <3.1), safe-exceptions (>=0.1.7.0 && <0.2), text (>=1.2.3.0 && <1.3), time (>=1.8.0.2 && <1.10) [details]
License BSD-3-Clause
Copyright Cthulhu (c) 2018
Author Cthulhu
Maintainer cthulhu.den@gmail.com
Category Graphics
Home page https://github.com/CthulhuDen/nanovg-simple#readme
Bug tracker https://github.com/CthulhuDen/nanovg-simple/issues
Source repo head: git clone https://github.com/CthulhuDen/nanovg-simple
Uploaded by CthulhuDen at 2020-12-06T13:04:22Z
Distributions
Executables nanovg-simple
Downloads 722 total (6 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs not available [build log]
All reported builds failed as of 2020-12-06 [all 2 reports]

Readme for nanovg-simple-0.5.0.0

[back to package description]

nanovg-simple

Simple interface to creating window with associated NanoVG context. See nanovg.h for comprehensive listing of methods.

Refer to Graphics.NanoVG.Simple module for utilities to create NanoVG window. Simple example:

import           Graphics.NanoVG.Simple
import qualified NanoVG as NVG

main :: IO ()
main = run 800 600 "Simple app" $ simpleWindow $
  NVG.circle ctx 10 10 10 *> NVG.fill ctx

Also provided is wrapper for rendering combination of composable picture pieces: see Graphics.NanoVG.Picture.

import           Graphics.NanoVG.Picture
import           Graphics.NanoVG.Simple

main :: IO ()
main = run 800 600 "Simple app" $ asWindow $
  pure $ translateP 50 0 $ mconcat
    [ fill (Color 1 1 1 1) $ circle (10, 10) 10
    , stroke (Color 1 1 1 1) $ circle (10, 10) 15
    , fill (Color 0 1 0 1) $ $ translateS (-50) 0 $ line (0, 0) (5, 5)
    ]