createTextRenderer :: ImprovizConfig -> Int -> Int -> Float -> IO TextRenderer
createTextRenderer config width height scaling =
  let front = config ^. C.screen . CS.front
      back = config ^. C.screen . CS.back
   in do cq <- createCharacterTextQuad
         cbq <- createCharacterBGQuad
         tprogram <-
           loadShaders
             [ ShaderInfo
                 VertexShader
                 (ByteStringSource
                    $(embedFile "src/assets/shaders/textrenderer.vert"))
             , ShaderInfo
                 FragmentShader
                 (ByteStringSource
                    $(embedFile "src/assets/shaders/textrenderer.frag"))
             ]
         bgshaderprogram <-
           loadShaders
             [ ShaderInfo
                 VertexShader
                 (ByteStringSource
                    $(embedFile "src/assets/shaders/textrenderer-bg.vert"))
             , ShaderInfo
                 FragmentShader
                 (ByteStringSource
                    $(embedFile "src/assets/shaders/textrenderer-bg.frag"))
             ]
         font <-
           loadFont
             (config ^. C.fontConfig . FC.filepath)
             (round (fromIntegral (config ^. C.fontConfig . FC.size) / scaling))
         let projectionMatrix =
               textCoordMatrix
                 0
                 (fromIntegral width)
                 0
                 (fromIntegral height)
                 front
                 back
         buffer <-
           createTextDisplaybuffer (fromIntegral width) (fromIntegral height)
         return $
           TextRenderer
             font
             height
             projectionMatrix
             tprogram
             bgshaderprogram
             cq
             cbq
             (config ^. C.fontConfig . FC.fgColour)
             (config ^. C.fontConfig . FC.bgColour)
             buffer
createTextRenderer :: ImprovizConfig -> Int -> Int -> Float -> IO TextRenderer
createTextRenderer config width height scaling =
  let front = config ^. C.screen . CS.front
      back = config ^. C.screen . CS.back
   in do cq <- createCharacterTextQuad
         cbq <- createCharacterBGQuad
         tprogram <-
           loadShaders
             [ ShaderInfo
                 VertexShader
                 (ByteStringSource
                    $(embedFile "src/assets/shaders/textrenderer.vert"))
             , ShaderInfo
                 FragmentShader
                 (ByteStringSource
                    $(embedFile "src/assets/shaders/textrenderer.frag"))
             ]
         bgshaderprogram <-
           loadShaders
             [ ShaderInfo
                 VertexShader
                 (ByteStringSource
                    $(embedFile "src/assets/shaders/textrenderer-bg.vert"))
             , ShaderInfo
                 FragmentShader
                 (ByteStringSource
                    $(embedFile "src/assets/shaders/textrenderer-bg.frag"))
             ]
         font <-
           loadFont
             (config ^. C.fontConfig . FC.filepath)
             (round (fromIntegral (config ^. C.fontConfig . FC.size) / scaling))
         let projectionMatrix =
               textCoordMatrix
                 0
                 (fromIntegral width)
                 0
                 (fromIntegral height)
                 front
                 back
         buffer <-
           createTextDisplaybuffer (fromIntegral width) (fromIntegral height)
         return $
           TextRenderer
             font
             height
             projectionMatrix
             tprogram
             bgshaderprogram
             cq
             cbq
             (config ^. C.fontConfig . FC.fgColour)
             (config ^. C.fontConfig . FC.bgColour)
             buffer
createTextRenderer config width height scaling =
  let front = config ^. C.screen . CS.front
      back = config ^. C.screen . CS.back
   in do cq <- createCharacterTextQuad
         cbq <- createCharacterBGQuad
         tprogram <-
           loadShaders
             [ ShaderInfo
                 VertexShader
                 (ByteStringSource
                    $(embedFile "src/assets/shaders/textrenderer.vert"))
             , ShaderInfo
                 FragmentShader
                 (ByteStringSource
                    $(embedFile "src/assets/shaders/textrenderer.frag"))
             ]
         bgshaderprogram <-
           loadShaders
             [ ShaderInfo
                 VertexShader
                 (ByteStringSource
                    $(embedFile "src/assets/shaders/textrenderer-bg.vert"))
             , ShaderInfo
                 FragmentShader
                 (ByteStringSource
                    $(embedFile "src/assets/shaders/textrenderer-bg.frag"))
             ]
         font <-
           loadFont
             (config ^. C.fontConfig . FC.filepath)
             (round (fromIntegral (config ^. C.fontConfig . FC.size) / scaling))
         let projectionMatrix =
               textCoordMatrix
                 0
                 (fromIntegral width)
                 0
                 (fromIntegral height)
                 front
                 back
         buffer <-
           createTextDisplaybuffer (fromIntegral width) (fromIntegral height)
         return $
           TextRenderer
             font
             height
             projectionMatrix
             tprogram
             bgshaderprogram
             cq
             cbq
             (config ^. C.fontConfig . FC.fgColour)
             (config ^. C.fontConfig . FC.bgColour)
             buffer