nanovg-simple: Simple interface to rendering with NanoVG

This is a package candidate release! Here you can preview how this package release will appear once published to the main package index (which can be accomplished via the 'maintain' link below). Please note that once a package has been published to the main package index it cannot be undone! Please consult the package uploading documentation for more information.

[maintain] [Publish]

Please see the README on GitHub at https://github.com/CthulhuDen/nanovg-simple#readme


[Skip to Readme]

Properties

Versions 0.4.0.0, 0.5.0.0, 0.5.0.0
Change log None available
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-06T12:45:17Z

Modules

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


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)
    ]