aboutsummaryrefslogtreecommitdiff
path: root/src/Chelleport/Draw.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Chelleport/Draw.hs')
-rw-r--r--src/Chelleport/Draw.hs9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/Chelleport/Draw.hs b/src/Chelleport/Draw.hs
index 3720ba0..60944a3 100644
--- a/src/Chelleport/Draw.hs
+++ b/src/Chelleport/Draw.hs
@@ -12,7 +12,7 @@ import qualified SDL.Font as TTF
class (Monad m) => MonadDraw m where
drawLine :: (CInt, CInt) -> (CInt, CInt) -> m ()
- drawText :: (CInt, CInt) -> Color -> Text -> m (CInt, CInt)
+ drawText :: (CInt, CInt) -> Color -> FontSize -> Text -> m (CInt, CInt)
drawCircle :: Int -> (CInt, CInt) -> m ()
fillRect :: (CInt, CInt) -> (CInt, CInt) -> m ()
setDrawColor :: Color -> m ()
@@ -33,8 +33,11 @@ instance (MonadIO m) => MonadDraw (AppM m) where
let rect = SDL.Rectangle (SDL.P $ SDL.V2 x y) (SDL.V2 w h)
SDL.fillRect renderer (Just rect)
- drawText (x, y) color text = do
- DrawContext {ctxRenderer = renderer, ctxFont = font} <- ask
+ drawText (x, y) color size text = do
+ DrawContext {ctxRenderer = renderer, ctxFontSmall, ctxFontLarge} <- ask
+ let font = case size of
+ FontSM -> ctxFontSmall
+ FontLG -> ctxFontLarge
surface <- TTF.blended font color text
texture <- SDL.createTextureFromSurface renderer surface
SDL.freeSurface surface