packages feed

SDL-ttf (empty) → 0.4.0

raw patch · 12 files changed

+653/−0 lines, 12 filesdep +SDLdep +basebuild-type:Customsetup-changed

Dependencies added: SDL, base

Files

+ Graphics/UI/SDL/TTF.hs view
@@ -0,0 +1,26 @@+-----------------------------------------------------------------------------+-- |+-- Module      :  Graphics.UI.SDL.TTF+-- Copyright   :  (c) David Himmelstrup 2005+-- License     :  BSD-like+--+-- Maintainer  :  lemmih@gmail.com+-- Stability   :  provisional+-- Portability :  portable+--+-----------------------------------------------------------------------------+module Graphics.UI.SDL.TTF+    ( module Graphics.UI.SDL.TTF.Attributes+    , module Graphics.UI.SDL.TTF.Management+    , module Graphics.UI.SDL.TTF.Render+    , module Graphics.UI.SDL.TTF.Types+    , module Graphics.UI.SDL.TTF.General+    ) where++import Graphics.UI.SDL.TTF.Attributes+import Graphics.UI.SDL.TTF.Management+import Graphics.UI.SDL.TTF.Render+import Graphics.UI.SDL.TTF.Types+import Graphics.UI.SDL.TTF.General++
+ Graphics/UI/SDL/TTF/Attributes.hs view
@@ -0,0 +1,151 @@+-----------------------------------------------------------------------------+-- |+-- Module      :  Graphics.UI.SDL.TTF.Attributes+-- Copyright   :  (c) David Himmelstrup 2005+-- License     :  BSD-like+--+-- Maintainer  :  lemmih@gmail.com+-- Stability   :  provisional+-- Portability :  portable+--+-----------------------------------------------------------------------------+module Graphics.UI.SDL.TTF.Attributes+    ( getFontStyle+    , setFontStyle+    , fontHeight+    , fontAscent+    , fontDescent+    , fontLineSkip+    , fontFaces+    , fontFaceIsFixedWidth+    , fontFaceFamilyName+    , fontFaceStyleName+    , tryTextSize+    , textSize+    , tryUTF8Size+    , utf8Size+    , FontStyle(..)+    ) where++import Foreign+import Foreign.C+import Prelude hiding (Enum(..))++import Graphics.UI.SDL.TTF.Types+import Graphics.UI.SDL.Utilities+import Graphics.UI.SDL.General++data FontStyle+    = StyleBold+    | StyleItalic+    | StyleUnderline+      deriving (Show,Eq,Ord)++instance Bounded FontStyle where+    minBound = StyleBold+    maxBound = StyleUnderline++instance Enum FontStyle Int where+    fromEnum StyleBold = 1+    fromEnum StyleItalic = 2+    fromEnum StyleUnderline = 4+    toEnum 1 = StyleBold+    toEnum 2 = StyleItalic+    toEnum 4 = StyleUnderline+    toEnum _ = error "Graphics.UI.SDL.TTF.Attributes.toEnum: bad argument"+    succ StyleBold = StyleItalic+    succ StyleItalic = StyleUnderline+    succ _ = error "Graphics.UI.SDL.TTF.Attributes.succ: bad argument"+    pred StyleItalic = StyleBold+    pred StyleUnderline = StyleItalic+    pred _ = error "Graphics.UI.SDL.TTF.Attributes.pred: bad argument"+    enumFromTo x y | x > y = []+                   | x == y = [y]+                   | True = x : enumFromTo (succ x) y+++-- int TTF_GetFontStyle(TTF_Font *font)+foreign import ccall unsafe "TTF_GetFontStyle" ttfGetFontStyle :: Ptr FontStruct -> IO Int+getFontStyle :: Font -> IO [FontStyle]+getFontStyle font+    = withForeignPtr font $+      fmap fromBitmask . ttfGetFontStyle ++-- void TTF_SetFontStyle(TTF_Font *font, int style)+foreign import ccall unsafe "TTF_SetFontStyle" ttfSetFontStyle :: Ptr FontStruct -> Int -> IO ()+setFontStyle :: Font -> [FontStyle] -> IO ()+setFontStyle font style+    = withForeignPtr font $ \fontPtr ->+      ttfSetFontStyle fontPtr (toBitmask style)++-- int TTF_FontHeight(TTF_Font *font)+foreign import ccall unsafe "TTF_FontHeight" ttfFontHeight :: Ptr FontStruct -> IO Int+fontHeight :: Font -> IO Int+fontHeight font = withForeignPtr font ttfFontHeight++-- int TTF_FontAscent(TTF_Font *font)+foreign import ccall unsafe "TTF_FontAscent" ttfFontAscent :: Ptr FontStruct -> IO Int+fontAscent :: Font -> IO Int+fontAscent font = withForeignPtr font ttfFontAscent++-- int TTF_FontDecent(TTF_Font *font)+foreign import ccall unsafe "TTF_FontAscent" ttfFontDescent :: Ptr FontStruct -> IO Int+fontDescent :: Font -> IO Int+fontDescent font = withForeignPtr font ttfFontDescent++-- int TTF_FontLineSkip(TTF_Font *font)+foreign import ccall unsafe "TTF_FontLineSkip" ttfFontLineSkip :: Ptr FontStruct -> IO Int+fontLineSkip :: Font -> IO Int+fontLineSkip font = withForeignPtr font ttfFontLineSkip++-- long TTF_FontFaces(TTF_Font *font);+foreign import ccall unsafe "TTF_FontFaces" ttfFontFaces :: Ptr FontStruct -> IO Int+fontFaces :: Font -> IO Int+fontFaces font = withForeignPtr font ttfFontFaces++-- int SDLCALL TTF_FontFaceIsFixedWidth(TTF_Font *font);+foreign import ccall unsafe "TTF_FontFaceIsFixedWidth" ttfFontFaceIsFixedWidth :: Ptr FontStruct -> IO Int+fontFaceIsFixedWidth :: Font -> IO Int+fontFaceIsFixedWidth font = withForeignPtr font ttfFontFaceIsFixedWidth++-- char * SDLCALL TTF_FontFaceFamilyName(TTF_Font *font);+foreign import ccall unsafe "TTF_FontFaceFamilyName" ttfFontFaceFamilyName :: Ptr FontStruct -> IO CString+fontFaceFamilyName :: Font -> IO String+fontFaceFamilyName font = withForeignPtr font ttfFontFaceFamilyName >>= peekCString++-- char * SDLCALL TTF_FontFaceStyleName(TTF_Font *font);+foreign import ccall unsafe "TTF_FontFaceStyleName" ttfFontFaceStyleName :: Ptr FontStruct -> IO CString+fontFaceStyleName :: Font -> IO String+fontFaceStyleName font = withForeignPtr font ttfFontFaceStyleName >>= peekCString+++getSize :: (Ptr FontStruct -> CString -> Ptr Int -> Ptr Int -> IO Int) -> Font -> String -> IO (Maybe (Int,Int))+getSize getter font string+    = withCString string $ \cString ->+      alloca $ \width ->+      alloca $ \height ->+      withForeignPtr font $ \fontPtr ->+      do ret <- getter fontPtr cString width height+         case ret of+           0 -> do [w,h] <- mapM peek [width,height]+                   return (Just (w,h))+           _ -> return Nothing++-- int SDLCALL TTF_SizeText(TTF_Font *font, const char *text, int *w, int *h);+foreign import ccall unsafe "TTF_SizeText" ttfSizeText+    :: Ptr FontStruct -> CString -> Ptr Int -> Ptr Int -> IO Int+tryTextSize :: Font -> String -> IO (Maybe (Int,Int))+tryTextSize = getSize ttfSizeText++textSize :: Font -> String -> IO (Int,Int)+textSize font string = unwrapMaybe "TTF_SizeText" (tryTextSize font string)++-- int SDLCALL TTF_SizeUTF8(TTF_Font *font, const char *text, int *w, int *h);+foreign import ccall unsafe "TTF_SizeUTF8" ttfSizeUTF8+    :: Ptr FontStruct -> CString -> Ptr Int -> Ptr Int -> IO Int+tryUTF8Size :: Font -> String -> IO (Maybe (Int,Int))+tryUTF8Size = getSize ttfSizeUTF8++utf8Size :: Font -> String -> IO (Int,Int)+utf8Size font string = unwrapMaybe "TTF_SizeUTF8" (tryUTF8Size font string)+
+ Graphics/UI/SDL/TTF/General.hs view
@@ -0,0 +1,37 @@+-----------------------------------------------------------------------------+-- |+-- Module      :  Graphics.UI.SDL.TTF.General+-- Copyright   :  (c) David Himmelstrup 2005+-- License     :  BSD-like+--+-- Maintainer  :  lemmih@gmail.com+-- Stability   :  provisional+-- Portability :  portable+--+-----------------------------------------------------------------------------+module Graphics.UI.SDL.TTF.General+    ( init+    , wasInit+    , quit+    ) where++import Foreign++-- import Graphics.UI.SDL.General (failWithError)++import Prelude hiding (init)++-- int TTF_Init()+foreign import ccall unsafe "TTF_Init" ttfInit :: IO Int+init :: IO Bool+init = fmap (not.toBool) ttfInit+++--int TTF_WasInit()+foreign import ccall unsafe "TTF_WasInit" ttfWasInit :: IO Int+wasInit :: IO Bool+wasInit = fmap toBool ttfWasInit++-- void TTF_Quit()+foreign import ccall unsafe "TTF_Quit" quit :: IO ()+
+ Graphics/UI/SDL/TTF/Management.hs view
@@ -0,0 +1,72 @@+-----------------------------------------------------------------------------+-- |+-- Module      :  Graphics.UI.SDL.TTF.Management+-- Copyright   :  (c) David Himmelstrup 2005+-- License     :  BSD-like+--+-- Maintainer  :  lemmih@gmail.com+-- Stability   :  provisional+-- Portability :  portable+--+-----------------------------------------------------------------------------+module Graphics.UI.SDL.TTF.Management+    ( tryOpenFont+    , openFont+    , closeFont+    , tryOpenFontRW+    , openFontRW+    , tryOpenFontIndex+    , openFontIndex+    ) where++import Graphics.UI.SDL.TTF.Types+import Graphics.UI.SDL.General (unwrapMaybe)+import Graphics.UI.SDL.Types++import Foreign+import Foreign.C++-- void TTF_CloseFont(TTF_Font *font)+foreign import ccall unsafe "&TTF_CloseFont" ttfCloseFontFinal :: FunPtr (Ptr FontStruct -> IO ())+mkFinalizedFont :: Ptr FontStruct -> IO Font+mkFinalizedFont = newForeignPtr ttfCloseFontFinal++foreign import ccall unsafe "TTF_CloseFont" ttfCloseFont :: Ptr FontStruct -> IO ()+closeFont :: Font -> IO ()+closeFont font = withForeignPtr font ttfCloseFont++-- TTF_Font *TTF_OpenFont(const char *file, int ptsize)+foreign import ccall unsafe "TTF_OpenFont" ttfOpenFont :: CString -> Int -> IO (Ptr FontStruct)+tryOpenFont :: String -> Int -> IO (Maybe Font)+tryOpenFont path ptsize+    = withCString path $ \cPath ->+      ttfOpenFont cPath ptsize >>= maybePeek mkFinalizedFont++openFont :: String -> Int -> IO Font+openFont path ptsize = unwrapMaybe "TTF_OpenFont" (tryOpenFont path ptsize)++-- TTF_Font *TTF_OpenFontRW(SDL_RWops *src, int freesrc, int ptsize)+foreign import ccall unsafe "TTF_OpenFontRW" ttfOpenFontRW :: Ptr RWopsStruct -> Int -> Int -> IO (Ptr FontStruct)+tryOpenFontRW :: RWops -> Bool -> Int -> IO (Maybe Font)+tryOpenFontRW rw freesrc ptsize+    = withForeignPtr rw $ \rwPtr ->+      ttfOpenFontRW rwPtr (fromBool freesrc) ptsize >>= maybePeek mkFinalizedFont++openFontRW :: RWops -> Bool -> Int -> IO Font+openFontRW rw freesrc ptsize+    = unwrapMaybe "TTF_OpenFontRW" (tryOpenFontRW rw freesrc ptsize)++-- TTF_Font *TTF_OpenFontIndex(const char *file, int ptsize, long index)+foreign import ccall unsafe "TTF_OpenFontIndex" ttfOpenFontIndex :: CString -> Int -> Int -> IO (Ptr FontStruct)+tryOpenFontIndex :: String -> Int -> Int -> IO (Maybe Font)+tryOpenFontIndex file ptsize index+    = withCString file $ \cFile ->+      ttfOpenFontIndex cFile ptsize index >>= maybePeek mkFinalizedFont++openFontIndex :: String -> Int -> Int -> IO Font+openFontIndex file ptsize index = unwrapMaybe "TTF_OpenFontIndex" (tryOpenFontIndex file ptsize index)++-- TODO:+-- +-- TTF_Font *TTF_OpenFontIndexRW(SDL_RWops *src, int freesrc, int ptsize, long index)+
+ Graphics/UI/SDL/TTF/Render.hs view
@@ -0,0 +1,185 @@+-----------------------------------------------------------------------------+-- |+-- Module      :  Graphics.UI.SDL.TTF.Render+-- Copyright   :  (c) David Himmelstrup 2005+-- License     :  BSD-like+--+-- Maintainer  :  lemmih@gmail.com+-- Stability   :  provisional+-- Portability :  portable+--+-----------------------------------------------------------------------------++{-# CFILES Graphics/UI/SDL/TTF/Wrapper.c #-}++module Graphics.UI.SDL.TTF.Render+    ( tryRenderTextSolid+    , renderTextSolid+    , tryRenderUTF8Solid+    , renderUTF8Solid+    , tryRenderGlyphSolid+    , renderGlyphSolid++    , tryRenderTextShaded+    , renderTextShaded+    , tryRenderUTF8Shaded+    , renderUTF8Shaded+    , tryRenderGlyphShaded+    , renderGlyphShaded++    , tryRenderTextBlended+    , renderTextBlended+    , tryRenderUTF8Blended+    , renderUTF8Blended+    , tryRenderGlyphBlended+    , renderGlyphBlended++    ) where++import Graphics.UI.SDL.TTF.Types+import Graphics.UI.SDL.General+import Graphics.UI.SDL.Video+import Graphics.UI.SDL.Color+import Graphics.UI.SDL.Types+import Foreign+import Foreign.C++import Data.Char++renderOneColor :: (Ptr FontStruct -> CString -> Ptr Color -> IO (Ptr SurfaceStruct))+            -> Font -> String -> Color -> IO (Maybe Surface)+renderOneColor render font text color+    = withForeignPtr font $ \fontPtr ->+      withCString text $ \cString ->+      with color $ \colorPtr ->+      do image <- render fontPtr cString colorPtr+         if image == nullPtr+            then return Nothing+            else fmap Just (mkFinalizedSurface image)++renderTwoColor :: (Ptr FontStruct -> CString -> Ptr Color -> Ptr Color -> IO (Ptr SurfaceStruct))+            -> Font -> String -> Color -> Color -> IO (Maybe Surface)+renderTwoColor render font text color1 color2+    = withForeignPtr font $ \fontPtr ->+      withCString text $ \cString ->+      with color1 $ \colorPtr1 ->+      with color2 $ \colorPtr2 -> +      do image <- render fontPtr cString colorPtr1 colorPtr2+         if image == nullPtr+            then return Nothing+            else fmap Just (mkFinalizedSurface image)++--------------------------------------------------------------+-- Solid+--------------------------------------------------------------+++-- SDL_Surface *TTF_RenderText_Solid(TTF_Font *font, const char *text, SDL_Color fg)+foreign import ccall unsafe "renderTextSolid" ttfRenderTextSolid+    :: Ptr FontStruct -> CString -> Ptr Color -> IO (Ptr SurfaceStruct)+tryRenderTextSolid :: Font -> String -> Color -> IO (Maybe Surface)+tryRenderTextSolid = renderOneColor ttfRenderTextSolid++renderTextSolid :: Font -> String -> Color -> IO Surface+renderTextSolid font text color+    = unwrapMaybe "TTF_RenderText_Solid" (tryRenderTextSolid font text color)++-- SDL_Surface * SDLCALL TTF_RenderUTF8_Solid(TTF_Font *font, const char *text, SDL_Color fg);+foreign import ccall unsafe "renderUTF8Solid" ttfRenderUTF8Solid+    :: Ptr FontStruct -> CString -> Ptr Color -> IO (Ptr SurfaceStruct)+tryRenderUTF8Solid :: Font -> String -> Color -> IO (Maybe Surface)+tryRenderUTF8Solid = renderOneColor ttfRenderUTF8Solid++renderUTF8Solid :: Font -> String -> Color -> IO Surface+renderUTF8Solid font text color+    = unwrapMaybe "TTF_RenderUTF8_Solid" (tryRenderUTF8Solid font text color)++-- SDL_Surface * renderGlyphSolid(TTF_Font *font, Uint16 ch, SDL_Color *fg);+foreign import ccall unsafe "renderGlyphSolid" renderGlyphSolid+    :: Ptr FontStruct -> Word16 -> Ptr Color -> IO (Ptr SurfaceStruct)+tryRenderGlyphSolid :: Font -> Char -> Color -> IO (Maybe Surface)+tryRenderGlyphSolid font ch fg+    = withForeignPtr font $ \fontPtr ->+      with fg $ \color ->+      do image <- renderGlyphSolid fontPtr (fromIntegral (ord ch)) color+         if image == nullPtr+            then return Nothing+            else fmap Just (mkFinalizedSurface image)++--------------------------------------------------------------+-- Shaded+--------------------------------------------------------------+++-- SDL_Surface *TTF_RenderText_Shaded(TTF_Font *font, const char *text, SDL_Color fg)+foreign import ccall unsafe "renderTextShaded" ttfRenderTextShaded+    :: Ptr FontStruct -> CString -> Ptr Color -> Ptr Color -> IO (Ptr SurfaceStruct)+tryRenderTextShaded :: Font -> String -> Color -> Color -> IO (Maybe Surface)+tryRenderTextShaded = renderTwoColor ttfRenderTextShaded++renderTextShaded :: Font -> String -> Color -> Color -> IO Surface+renderTextShaded font text fg bg+    = unwrapMaybe "TTF_RenderText_Shaded" (tryRenderTextShaded font text fg bg)++-- SDL_Surface * SDLCALL TTF_RenderUTF8_Shaded(TTF_Font *font, const char *text, SDL_Color fg);+foreign import ccall unsafe "renderUTF8Shaded" ttfRenderUTF8Shaded+    :: Ptr FontStruct -> CString -> Ptr Color -> Ptr Color -> IO (Ptr SurfaceStruct)+tryRenderUTF8Shaded :: Font -> String -> Color -> Color -> IO (Maybe Surface)+tryRenderUTF8Shaded = renderTwoColor ttfRenderUTF8Shaded++renderUTF8Shaded :: Font -> String -> Color -> Color -> IO Surface+renderUTF8Shaded font text fg bg+    = unwrapMaybe "TTF_RenderUTF8_Shaded" (tryRenderUTF8Shaded font text fg bg)++-- SDL_Surface * renderGlyphShaded(TTF_Font *font, Uint16 ch, SDL_Color *fg);+foreign import ccall unsafe "renderGlyphShaded" renderGlyphShaded+    :: Ptr FontStruct -> Word16 -> Ptr Color -> Ptr Color -> IO (Ptr SurfaceStruct)+tryRenderGlyphShaded :: Font -> Char -> Color -> Color -> IO (Maybe Surface)+tryRenderGlyphShaded font ch fg bg+    = withForeignPtr font $ \fontPtr ->+      with fg $ \fgPtr ->+      with bg $ \bgPtr ->+      do image <- renderGlyphShaded fontPtr (fromIntegral (ord ch)) fgPtr bgPtr+         if image == nullPtr+            then return Nothing+            else fmap Just (mkFinalizedSurface image)++--------------------------------------------------------------+-- Blended+--------------------------------------------------------------+++-- SDL_Surface *TTF_RenderText_Blended(TTF_Font *font, const char *text, SDL_Color fg)+foreign import ccall unsafe "renderTextBlended" ttfRenderTextBlended+    :: Ptr FontStruct -> CString -> Ptr Color -> IO (Ptr SurfaceStruct)+tryRenderTextBlended :: Font -> String -> Color -> IO (Maybe Surface)+tryRenderTextBlended = renderOneColor ttfRenderTextBlended++renderTextBlended :: Font -> String -> Color -> IO Surface+renderTextBlended font text color+    = unwrapMaybe "TTF_RenderText_Blended" (tryRenderTextBlended font text color)++-- SDL_Surface * SDLCALL TTF_RenderUTF8_Blended(TTF_Font *font, const char *text, SDL_Color fg);+foreign import ccall unsafe "renderUTF8Blended" ttfRenderUTF8Blended+    :: Ptr FontStruct -> CString -> Ptr Color -> IO (Ptr SurfaceStruct)+tryRenderUTF8Blended :: Font -> String -> Color -> IO (Maybe Surface)+tryRenderUTF8Blended = renderOneColor ttfRenderUTF8Blended++renderUTF8Blended :: Font -> String -> Color -> IO Surface+renderUTF8Blended font text color+    = unwrapMaybe "TTF_RenderUTF8_Blended" (tryRenderUTF8Blended font text color)++-- SDL_Surface * renderGlyphBlended(TTF_Font *font, Uint16 ch, SDL_Color *fg);+foreign import ccall unsafe "renderGlyphBlended" renderGlyphBlended+    :: Ptr FontStruct -> Word16 -> Ptr Color -> IO (Ptr SurfaceStruct)+tryRenderGlyphBlended :: Font -> Char -> Color -> IO (Maybe Surface)+tryRenderGlyphBlended font ch fg+    = withForeignPtr font $ \fontPtr ->+      with fg $ \color ->+      do image <- renderGlyphBlended fontPtr (fromIntegral (ord ch)) color+         if image == nullPtr+            then return Nothing+            else fmap Just (mkFinalizedSurface image)+++
+ Graphics/UI/SDL/TTF/Types.hsc view
@@ -0,0 +1,22 @@+-----------------------------------------------------------------------------+-- |+-- Module      :  Graphics.UI.SDL.TTF.Types+-- Copyright   :  (c) David Himmelstrup 2005+-- License     :  BSD-like+--+-- Maintainer  :  lemmih@gmail.com+-- Stability   :  provisional+-- Portability :  portable+--+-----------------------------------------------------------------------------+module Graphics.UI.SDL.TTF.Types+    ( FontStruct+    , Font+    ) where++import Foreign+++data FontStruct+type Font = ForeignPtr FontStruct+
+ Graphics/UI/SDL/TTF/Version.hsc view
@@ -0,0 +1,32 @@+#include "SDL_ttf.h"+module Graphics.UI.SDL.TTF.Version+    ( compiledFor+    , linkedWith+    ) where++import Data.Version (Version(Version))++import Foreign (Word8, Ptr, Storable(sizeOf, alignment, peekByteOff, peek))++data SDLVersion+    = SDLVersion Word8 Word8 Word8++instance Storable SDLVersion where+    sizeOf _ = #{size SDL_version}+    alignment _ = 1+    peek ptr = do major <- #{peek SDL_version, major} ptr+                  minor <- #{peek SDL_version, minor} ptr+                  patch <- #{peek SDL_version, patch} ptr+                  return (SDLVersion major minor patch)++compiledFor :: Version+compiledFor = Version [ #{const TTF_MAJOR_VERSION}+                      , #{const TTF_MINOR_VERSION}+                      , #{const TTF_PATCHLEVEL}+                      ] []++foreign import ccall unsafe "TTF_Linked_Version" sdlLinkedVersion :: IO (Ptr SDLVersion)+linkedWith :: IO Version+linkedWith = do versionPtr <- sdlLinkedVersion+                SDLVersion major minor patch <- peek versionPtr+                return (Version (map fromIntegral [major,minor,patch]) [])
+ Graphics/UI/SDL/TTF/Wrapper.c view
@@ -0,0 +1,47 @@+++#include <SDL_ttf.h>++#include "Wrapper.h"++SDL_Surface * renderTextSolid(TTF_Font *font, const char *text, SDL_Color *fg)+{+  return TTF_RenderText_Solid(font,text,*fg);+}+SDL_Surface * renderUTF8Solid(TTF_Font *font, const char *text, SDL_Color *fg)+{+  return TTF_RenderUTF8_Solid(font,text,*fg);+}+SDL_Surface * renderGlyphSolid(TTF_Font *font, Uint16 ch, SDL_Color *fg)+{+  return TTF_RenderGlyph_Solid(font,ch,*fg);+}+++SDL_Surface * renderTextShaded(TTF_Font *font, const char *text, SDL_Color *fg, SDL_Color *bg)+{+  return TTF_RenderText_Shaded(font,text,*fg,*bg);+}+SDL_Surface * renderUTF8Shaded(TTF_Font *font, const char *text, SDL_Color *fg, SDL_Color *bg)+{+  return TTF_RenderUTF8_Shaded(font,text,*fg,*bg);+}+SDL_Surface * renderGlyphShaded(TTF_Font *font, Uint16 ch, SDL_Color *fg, SDL_Color *bg)+{+  return TTF_RenderGlyph_Shaded(font,ch,*fg,*bg);+}+++SDL_Surface * renderTextBlended(TTF_Font *font, const char *text, SDL_Color *fg)+{+  return TTF_RenderText_Blended(font,text,*fg);+}+SDL_Surface * renderUTF8Blended(TTF_Font *font, const char *text, SDL_Color *fg)+{+  return TTF_RenderUTF8_Blended(font,text,*fg);+}+SDL_Surface * renderGlyphBlended(TTF_Font *font, Uint16 ch, SDL_Color *fg)+{+  return TTF_RenderGlyph_Blended(font,ch,*fg);+}+
+ Graphics/UI/SDL/TTF/Wrapper.h view
@@ -0,0 +1,17 @@++#include <SDL.h>+#include <SDL_ttf.h>++SDL_Surface * renderTextSolid(TTF_Font *font, const char *text, SDL_Color *fg);+SDL_Surface * renderUTF8Solid(TTF_Font *font, const char *text, SDL_Color *fg);+SDL_Surface * renderGlyphSolid(TTF_Font *font, Uint16 ch, SDL_Color *fg);++SDL_Surface * renderTextShaded(TTF_Font *font, const char *text, SDL_Color *fg, SDL_Color *bg);+SDL_Surface * renderUTF8Shaded(TTF_Font *font, const char *text, SDL_Color *fg, SDL_Color *bg);+SDL_Surface * renderGlyphShaded(TTF_Font *font, Uint16 ch, SDL_Color *fg, SDL_Color *bg);++SDL_Surface * renderTextBlended(TTF_Font *font, const char *text, SDL_Color *fg);+SDL_Surface * renderUTF8Blended(TTF_Font *font, const char *text, SDL_Color *fg);+SDL_Surface * renderGlyphBlended(TTF_Font *font, Uint16 ch, SDL_Color *fg);++
+ LICENSE view
@@ -0,0 +1,35 @@+Copyright (c) 2004-2006, David Himmelstrup+All rights reserved.++Redistribution and use in source and binary forms,+with or without modification, are permitted provided+that the following conditions are met:++    * Redistributions of source code must retain+      the above copyright notice, this list of+      conditions and the following disclaimer.+    * Redistributions in binary form must reproduce+      the above copyright notice, this list of+      conditions and the following disclaimer in the+      documentation and/or other materials provided+      with the distribution.+    * Neither the name of David Himmelstrup nor the+      names of other contributors may be used to+      endorse or promote products derived from this+      software without specific prior written permission.+++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND+CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,+INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES+OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER+OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,+BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,+WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE+USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY+OF SUCH DAMAGE.
+ SDL-ttf.cabal view
@@ -0,0 +1,24 @@+Name: SDL-ttf+Version: 0.4.0+Maintainer: Lemmih (lemmih@gmail.com)+Author: Lemmih (lemmih@gmail.com)+Copyright: 2004-2005, Lemmih+License-File: LICENSE+License: BSD3+Build-Depends: base, SDL+Category: Foreign binding+Synopsis: Binding to libSDL_ttf+Extensions: ForeignFunctionInterface+Exposed-Modules:+  Graphics.UI.SDL.TTF,+  Graphics.UI.SDL.TTF.Version,+  Graphics.UI.SDL.TTF.Types,+  Graphics.UI.SDL.TTF.Render,+  Graphics.UI.SDL.TTF.Management,+  Graphics.UI.SDL.TTF.Attributes,+  Graphics.UI.SDL.TTF.General+C-Sources: Graphics/UI/SDL/TTF/Wrapper.c+Include-Dirs: .+Includes: Graphics/UI/SDL/TTF/Wrapper.h SDL.h SDL_ttf.h+Extra-Source-Files: Graphics/UI/SDL/TTF/Wrapper.h+GHC-Options: -fglasgow-exts -O2 -Wall -Werror
+ Setup.lhs view
@@ -0,0 +1,5 @@+#!/usr/bin/env runhaskell+> module Main where+> import Distribution.Simple+> main :: IO ()+> main = defaultMainWithHooks defaultUserHooks