summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Cady <d@jerkface.net>2014-01-21 10:27:47 -0500
committerAndrew Cady <d@jerkface.net>2014-01-21 10:27:47 -0500
commit93180fbabcb9e0d178a732910320f9573995b16b (patch)
treed6ca1b945c4aa55511647ec45a3eb638df9ba158
parentd3201069a8b5deb15300601ea6b7d688ff57d1ee (diff)
Fix bug where three keys were not drawn by allKeysOFF
Not sure how I missed this! Also, changed some colors slightly.
-rw-r--r--axis.hs15
1 files changed, 8 insertions, 7 deletions
diff --git a/axis.hs b/axis.hs
index 3b3ba8f..6866ed5 100644
--- a/axis.hs
+++ b/axis.hs
@@ -42,8 +42,9 @@ _LABEL_ALL_KEYS = False
42_AXIS_ROWS = 7 + 4 42_AXIS_ROWS = 7 + 4
43_AXIS_UNIQUE_COLS = 7 43_AXIS_UNIQUE_COLS = 7
44_AXIS_COLS_REPEAT = 2 44_AXIS_COLS_REPEAT = 2
45_AXIS_TOP_PITCH = 81 + (7 * (_AXIS_ROWS - 7) `div` 2) 45_AXIS_TOPLEFT_PITCH = 81 + (7 * (_AXIS_ROWS - 7) `div` 2)
46_AXIS_BOTTOM_PITCH = 81 - (7 * _AXIS_ROWS) - 3 46_AXIS_BOTTOMRIGHT_PITCH = 81 - (7 * _AXIS_ROWS) - 3
47_AXIS_TOPRIGHT_PITCH = _AXIS_TOPLEFT_PITCH + _AXIS_UNIQUE_COLS `div` 2
47 48
48--_KEY_BORDER_COLOR = (SDL.Color 0 0 255) 49--_KEY_BORDER_COLOR = (SDL.Color 0 0 255)
49_KEY_BORDER_COLOR = (SDL.Color 0 0 0) 50_KEY_BORDER_COLOR = (SDL.Color 0 0 0)
@@ -110,8 +111,8 @@ inMajorC pclass = not (pclass == 1 || pclass == 3 || pclass == 6 || pclass == 8
110 111
111pitchToColor p = 112pitchToColor p =
112 case p `mod` 12 of 113 case p `mod` 12 of
113 2 -> (SDL.Color 0xD0 0xD0 0xFF) -- D 114 2 -> (SDL.Color 0xC0 0xC0 0xFF) -- D
114 8 -> (SDL.Color 0x55 0x55 0x88) -- G# 115 8 -> (SDL.Color 0x33 0x33 0x66) -- G#
115 x | inMajorC x -> (SDL.Color 0xE0 0xE0 0xE0) -- _CGA !! 7 116 x | inMajorC x -> (SDL.Color 0xE0 0xE0 0xE0) -- _CGA !! 7
116 _ -> _CGA !! 8 117 _ -> _CGA !! 8
117 118
@@ -183,12 +184,12 @@ main =
183--_ <- SDL.showCursor False 184--_ <- SDL.showCursor False
184--_ <- SDL.grabInput True 185--_ <- SDL.grabInput True
185--warpMouse 186--warpMouse
187 -- _ <- SDL.setRelativeMouseMode True -- SDL2. Should I use it?
186 188
187 -- using the pixelFormat methods gives the wrong color, with both the 189 -- using the pixelFormat methods gives the wrong color, with both the
188 -- real pixelFormat or the faked one, so fuck it. See colorToPixel 190 -- real pixelFormat or the faked one, so fuck it. See colorToPixel
189--let pixelFormat = SDL.surfaceGetPixelFormat videoSurface 191--let pixelFormat = SDL.surfaceGetPixelFormat videoSurface
190--pixelFormat <- SDL.surfaceGetPixelFormat <$> SDL.createRGBSurfaceEndian [] 1 1 24 192--pixelFormat <- SDL.surfaceGetPixelFormat <$> SDL.createRGBSurfaceEndian [] 1 1 24
191 -- _ <- SDL.setRelativeMouseMode True -- SDL2. Should I use it?
192 193
193 putStrLn "Initialized." 194 putStrLn "Initialized."
194 195
@@ -213,7 +214,7 @@ main =
213 videoClipRect <- SDL.getClipRect videoSurface 214 videoClipRect <- SDL.getClipRect videoSurface
214 let (axis_key_size, axis_key_locations) = getKeyLocations videoClipRect 215 let (axis_key_size, axis_key_locations) = getKeyLocations videoClipRect
215 216
216 let _ALL_PITCHES = Set.fromList $ map (\p -> (Event.Channel 1, Event.Pitch p)) [_AXIS_BOTTOM_PITCH .. _AXIS_TOP_PITCH] 217 let _ALL_PITCHES = Set.fromList $ map (\p -> (Event.Channel 1, Event.Pitch p)) [_AXIS_BOTTOMRIGHT_PITCH .. _AXIS_TOPRIGHT_PITCH]
217 keysOFF really = smartDrawKeys really _ALL_PITCHES Set.empty videoSurface font' axis_key_locations axis_key_size 218 keysOFF really = smartDrawKeys really _ALL_PITCHES Set.empty videoSurface font' axis_key_locations axis_key_size
218 allKeysOFF = keysOFF False 219 allKeysOFF = keysOFF False
219 allKeysReallyOFF = keysOFF True 220 allKeysReallyOFF = keysOFF True
@@ -290,7 +291,7 @@ centerText videoSurface x y font fgColor bgColor text = do
290 291
291pitchIndex = concat $ map (\x -> unique) [0 .. _AXIS_COLS_REPEAT - 1] 292pitchIndex = concat $ map (\x -> unique) [0 .. _AXIS_COLS_REPEAT - 1]
292 where 293 where
293 toprow = map (\i -> if (i `mod` 2) == 0 then (_AXIS_TOP_PITCH + i `div` 2) else (_AXIS_TOP_PITCH - 3 + i `div` 2)) [0 .. _AXIS_UNIQUE_COLS - 1] 294 toprow = map (\i -> if (i `mod` 2) == 0 then (_AXIS_TOPLEFT_PITCH + i `div` 2) else (_AXIS_TOPLEFT_PITCH - 3 + i `div` 2)) [0 .. _AXIS_UNIQUE_COLS - 1]
294 colfrom top = map (+ top) $ map (* (-7)) [0 .. _AXIS_ROWS - 1] 295 colfrom top = map (+ top) $ map (* (-7)) [0 .. _AXIS_ROWS - 1]
295 unique = concat $ map colfrom toprow 296 unique = concat $ map colfrom toprow
296 297