diff options
| author | Akshay Nair <phenax5@gmail.com> | 2024-12-28 22:14:05 +0530 |
|---|---|---|
| committer | Akshay Nair <phenax5@gmail.com> | 2024-12-28 22:14:05 +0530 |
| commit | 1bd86a46dcf21a75656edd181f97035739fa238d (patch) | |
| tree | 3f6e1aafa95351cd3e5d8a3d77bf90630d57e852 /src/Chelleport/Draw.hs | |
| parent | 9b5c8368daa97a5b58a378d9c4eab66ebb018cb0 (diff) | |
| download | chelleport-1bd86a46dcf21a75656edd181f97035739fa238d.tar.gz chelleport-1bd86a46dcf21a75656edd181f97035739fa238d.zip | |
Refactor text styles
Diffstat (limited to 'src/Chelleport/Draw.hs')
| -rw-r--r-- | src/Chelleport/Draw.hs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/Chelleport/Draw.hs b/src/Chelleport/Draw.hs index afb72ca..2d3a77c 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 -> FontSize -> Text -> m (CInt, CInt) + drawText :: (CInt, CInt) -> TextStyle -> Text -> m (CInt, CInt) drawCircle :: Int -> (CInt, CInt) -> m () fillRect :: (CInt, CInt) -> (CInt, CInt) -> m () setDrawColor :: Color -> m () @@ -33,12 +33,12 @@ 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 size text = do + drawText (x, y) (TextStyle {textColor, textSize}) text = do DrawContext {ctxRenderer = renderer, ctxFontSmall, ctxFontLarge} <- ask - let font = case size of + let font = case textSize of FontSM -> ctxFontSmall FontLG -> ctxFontLarge - surface <- TTF.blended font color text + surface <- TTF.blended font textColor text texture <- SDL.createTextureFromSurface renderer surface SDL.freeSurface surface |
