diff options
author | Andrew Cady <d@jerkface.net> | 2014-01-21 13:43:03 -0500 |
---|---|---|
committer | Andrew Cady <d@jerkface.net> | 2014-01-21 13:43:03 -0500 |
commit | cfa240d7e4f18d27773fd7f6ed750e8c88501a7d (patch) | |
tree | 878b2d7c2d50062efcc7c9e28aeb7f6ea919a43e | |
parent | 272b838807ed437542fd8209bbe195ce2a5da9eb (diff) |
fix: use correct resolution when resizing
-rw-r--r-- | axis.hs | 9 |
1 files changed, 5 insertions, 4 deletions
@@ -200,15 +200,16 @@ main = | |||
200 | (ds, s') <- stepSession s | 200 | (ds, s') <- stepSession s |
201 | (ex, w') <- stepWire w ds (Right x) | 201 | (ex, w') <- stepWire w ds (Right x) |
202 | let x' = either (const "") id ex | 202 | let x' = either (const "") id ex |
203 | let restartVideo = resolution' /= resolution | ||
203 | 204 | ||
204 | Control.Monad.when (resolution' /= resolution) $ do | 205 | Control.Monad.when restartVideo $ do |
205 | let (w, h) = resolution | 206 | let (w, h) = resolution' |
206 | screen <- SDL.setVideoMode w h 32 [SDL.SWSurface, SDL.Resizable] | 207 | screen <- SDL.setVideoMode w h 32 [SDL.SWSurface, SDL.Resizable] |
207 | return () | 208 | return () |
208 | 209 | ||
209 | let (w, h) = resolution' | 210 | let (w, h) = resolution' |
210 | fontSize = chooseFontSize w h | 211 | fontSize = chooseFontSize w h |
211 | font' <- (if (resolution' /= resolution) then SDL.TTF.openFont "LiberationMono-Bold.ttf" fontSize else return font) | 212 | font' <- (if (restartVideo) then SDL.TTF.openFont "LiberationMono-Bold.ttf" fontSize else return font) |
212 | 213 | ||
213 | videoSurface <- SDL.getVideoSurface | 214 | videoSurface <- SDL.getVideoSurface |
214 | videoClipRect <- SDL.getClipRect videoSurface | 215 | videoClipRect <- SDL.getClipRect videoSurface |
@@ -234,7 +235,7 @@ main = | |||
234 | smartDrawKeys False midiKeysDown midiKeysDown' videoSurface font' axis_key_locations axis_key_size | 235 | smartDrawKeys False midiKeysDown midiKeysDown' videoSurface font' axis_key_locations axis_key_size |
235 | return () | 236 | return () |
236 | 237 | ||
237 | Control.Monad.when (resolution' /= resolution) $ do | 238 | Control.Monad.when (restartVideo) $ do |
238 | allKeysOFF | 239 | allKeysOFF |
239 | smartDrawKeys False Set.empty midiKeysDown' videoSurface font' axis_key_locations axis_key_size | 240 | smartDrawKeys False Set.empty midiKeysDown' videoSurface font' axis_key_locations axis_key_size |
240 | return () | 241 | return () |