From 6592ccb9a3b4161437ca251d200681b39c142405 Mon Sep 17 00:00:00 2001 From: Schell Scivally Date: Mon, 21 Jan 2019 11:57:01 -0800 Subject: [PATCH] docs update --- package.yaml | 17 ++++++++--------- src/Typograffiti/Cache.hs | 20 ++++++++++++++++---- 2 files changed, 24 insertions(+), 13 deletions(-) diff --git a/package.yaml b/package.yaml index d452630..f8e56df 100644 --- a/package.yaml +++ b/package.yaml @@ -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 +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 diff --git a/src/Typograffiti/Cache.hs b/src/Typograffiti/Cache.hs index 9dc0ad8..97a5244 100644 --- a/src/Typograffiti/Cache.hs +++ b/src/Typograffiti/Cache.hs @@ -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) ] -- 2.30.2