summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Cady <d@jerkface.net>2019-01-23 13:15:49 -0500
committerAndrew Cady <d@jerkface.net>2019-01-23 13:15:49 -0500
commit207dc7c39ecc2081b3cda8ca06989625af64b08c (patch)
tree201593160c45091dd3d581d27e7ac3d369390185
parent0b891d4136f727725cfa6f4d6fefecd1adc29d70 (diff)
use system-installed font fileHEADmaster
-rw-r--r--axis.hs7
1 files changed, 5 insertions, 2 deletions
diff --git a/axis.hs b/axis.hs
index 5363c36..3dd18ed 100644
--- a/axis.hs
+++ b/axis.hs
@@ -228,6 +228,9 @@ data Env = Env {
228 _warpMouse :: IO () 228 _warpMouse :: IO ()
229} 229}
230 230
231fontFile :: FilePath
232fontFile = "/usr/share/fonts/truetype/liberation/LiberationMono-Bold.ttf"
233
231main :: IO () 234main :: IO ()
232main = 235main =
233 withAlsaInit $ \h public private q publicAddr privateAddr -> do 236 withAlsaInit $ \h public private q publicAddr privateAddr -> do
@@ -243,7 +246,7 @@ main =
243 _ <- setVideoMode sWidth sHeight 246 _ <- setVideoMode sWidth sHeight
244 247
245 _ <- SDL.TTF.init 248 _ <- SDL.TTF.init
246 font <- SDL.TTF.openFont "LiberationMono-Bold.ttf" (chooseFontSize sWidth sHeight) 249 font <- SDL.TTF.openFont fontFile (chooseFontSize sWidth sHeight)
247 -- _ <- SDL.showCursor False _ <- SDL.grabInput True warpMouse _ <- SDL.setRelativeMouseMode True -- 250 -- _ <- SDL.showCursor False _ <- SDL.grabInput True warpMouse _ <- SDL.setRelativeMouseMode True --
248 -- SDL2. Should I use it? using the pixelFormat methods gives the wrong color, with both the real 251 -- SDL2. Should I use it? using the pixelFormat methods gives the wrong color, with both the real
249 -- pixelFormat or the faked one, so fuck it. See colorToPixel let pixelFormat = 252 -- pixelFormat or the faked one, so fuck it. See colorToPixel let pixelFormat =
@@ -261,7 +264,7 @@ setFont :: (MonadIO m, MonadState LoopState m) => (Int, Int) -> m ()
261setFont resolution = do 264setFont resolution = do
262 let (w, h) = resolution 265 let (w, h) = resolution
263 fontSize = chooseFontSize w h 266 fontSize = chooseFontSize w h
264 font' <- liftIO $ SDL.TTF.openFont "LiberationMono-Bold.ttf" fontSize 267 font' <- liftIO $ SDL.TTF.openFont fontFile fontSize
265 modify $ \s -> s { _sdlFont = font' } 268 modify $ \s -> s { _sdlFont = font' }
266 269
267parseEvents :: RWST Env () LoopState IO (Bool, Set.Set SDLKey, MidiPitchSet, (Int, Int), Integer) 270parseEvents :: RWST Env () LoopState IO (Bool, Set.Set SDLKey, MidiPitchSet, (Int, Int), Integer)