diff options
Diffstat (limited to 'axis.hs')
-rw-r--r-- | axis.hs | 15 |
1 files changed, 8 insertions, 7 deletions
@@ -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 | ||
111 | pitchToColor p = | 112 | pitchToColor 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 | ||
291 | pitchIndex = concat $ map (\x -> unique) [0 .. _AXIS_COLS_REPEAT - 1] | 292 | pitchIndex = 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 | ||