~alcinnz/Typograffiti

6592ccb9a3b4161437ca251d200681b39c142405 — Schell Scivally 5 years ago a77f277
docs update
2 files changed, 24 insertions(+), 13 deletions(-)

M package.yaml
M src/Typograffiti/Cache.hs
M package.yaml => package.yaml +8 -9
@@ 1,23 1,24 @@
name:                typograffiti
version:             0.1.0.0
github:              "githubuser/typograffiti"
github:              "schell/typograffiti"
license:             BSD3
author:              "Author name here"
maintainer:          "example@example.com"
copyright:           "2018 Author name here"
author:              "Schell Scivally"
maintainer:          "schell@takt.com"
copyright:           "2018 Schell Scivally"

extra-source-files:
- README.md
- ChangeLog.md

# Metadata used when publishing your package
# synopsis:            Short description of your package
# category:            Web
synopsis:            Display TTF fonts in OpenGL. Includes caching for fast
                     rendering.
category:            Graphics

# To avoid duplicated efforts in documentation and dealing with the
# complications of embedding Haddock markup inside cabal files, it is
# common to point users to the README.md file.
description:         Please see the README on GitHub at <https://github.com/githubuser/typograffiti#readme>
description:         A library that lets you draw nice text already!

dependencies:
- base >= 4.7 && < 5


@@ 39,14 40,12 @@ executables:
  typograffiti-exe:
    main:                Main.hs
    source-dirs:         app
    other-modules:       Paths_typograffiti
    ghc-options:
    - -threaded
    - -rtsopts
    - -with-rtsopts=-N
    dependencies:
    - filepath
    - JuicyPixels
    - pretty-show
    - sdl2
    - typograffiti

M src/Typograffiti/Cache.hs => src/Typograffiti/Cache.hs +16 -4
@@ 271,6 271,19 @@ fragmentShader = B8.pack $ unlines
  ]


liftGL
  :: ( MonadIO m
     , MonadError TypograffitiError m
     )
  => m (Either String a)
  -> m a
liftGL n = do
  let lft = liftEither . first TypograffitiErrorGL
  n >>= lft


-- | A default operation for allocating one word worth of geometry. This is "word" as in
-- an English word, not a data type.
makeDefaultAllocateWord
  :: ( MonadIO m
     , MonadError TypograffitiError m


@@ 286,10 299,9 @@ makeDefaultAllocateWord
makeDefaultAllocateWord getContextSize = do
  let position = 0
      uv       = 1
      liftGL   = liftEither . first TypograffitiErrorGL
  vert <- liftGL =<< compileOGLShader vertexShader GL_VERTEX_SHADER
  frag <- liftGL =<< compileOGLShader fragmentShader GL_FRAGMENT_SHADER
  prog <- liftGL =<< compileOGLProgram
  vert <- liftGL $ compileOGLShader vertexShader GL_VERTEX_SHADER
  frag <- liftGL $ compileOGLShader fragmentShader GL_FRAGMENT_SHADER
  prog <- liftGL $ compileOGLProgram
    [ ("position", fromIntegral position)
    , ("uv", fromIntegral uv)
    ]