From 93180fbabcb9e0d178a732910320f9573995b16b Mon Sep 17 00:00:00 2001 From: Andrew Cady Date: Tue, 21 Jan 2014 10:27:47 -0500 Subject: Fix bug where three keys were not drawn by allKeysOFF Not sure how I missed this! Also, changed some colors slightly. --- axis.hs | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'axis.hs') 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 _AXIS_ROWS = 7 + 4 _AXIS_UNIQUE_COLS = 7 _AXIS_COLS_REPEAT = 2 -_AXIS_TOP_PITCH = 81 + (7 * (_AXIS_ROWS - 7) `div` 2) -_AXIS_BOTTOM_PITCH = 81 - (7 * _AXIS_ROWS) - 3 +_AXIS_TOPLEFT_PITCH = 81 + (7 * (_AXIS_ROWS - 7) `div` 2) +_AXIS_BOTTOMRIGHT_PITCH = 81 - (7 * _AXIS_ROWS) - 3 +_AXIS_TOPRIGHT_PITCH = _AXIS_TOPLEFT_PITCH + _AXIS_UNIQUE_COLS `div` 2 --_KEY_BORDER_COLOR = (SDL.Color 0 0 255) _KEY_BORDER_COLOR = (SDL.Color 0 0 0) @@ -110,8 +111,8 @@ inMajorC pclass = not (pclass == 1 || pclass == 3 || pclass == 6 || pclass == 8 pitchToColor p = case p `mod` 12 of - 2 -> (SDL.Color 0xD0 0xD0 0xFF) -- D - 8 -> (SDL.Color 0x55 0x55 0x88) -- G# + 2 -> (SDL.Color 0xC0 0xC0 0xFF) -- D + 8 -> (SDL.Color 0x33 0x33 0x66) -- G# x | inMajorC x -> (SDL.Color 0xE0 0xE0 0xE0) -- _CGA !! 7 _ -> _CGA !! 8 @@ -183,12 +184,12 @@ main = --_ <- SDL.showCursor False --_ <- SDL.grabInput True --warpMouse + -- _ <- SDL.setRelativeMouseMode True -- SDL2. Should I use it? -- using the pixelFormat methods gives the wrong color, with both the -- real pixelFormat or the faked one, so fuck it. See colorToPixel --let pixelFormat = SDL.surfaceGetPixelFormat videoSurface --pixelFormat <- SDL.surfaceGetPixelFormat <$> SDL.createRGBSurfaceEndian [] 1 1 24 - -- _ <- SDL.setRelativeMouseMode True -- SDL2. Should I use it? putStrLn "Initialized." @@ -213,7 +214,7 @@ main = videoClipRect <- SDL.getClipRect videoSurface let (axis_key_size, axis_key_locations) = getKeyLocations videoClipRect - let _ALL_PITCHES = Set.fromList $ map (\p -> (Event.Channel 1, Event.Pitch p)) [_AXIS_BOTTOM_PITCH .. _AXIS_TOP_PITCH] + let _ALL_PITCHES = Set.fromList $ map (\p -> (Event.Channel 1, Event.Pitch p)) [_AXIS_BOTTOMRIGHT_PITCH .. _AXIS_TOPRIGHT_PITCH] keysOFF really = smartDrawKeys really _ALL_PITCHES Set.empty videoSurface font' axis_key_locations axis_key_size allKeysOFF = keysOFF False allKeysReallyOFF = keysOFF True @@ -290,7 +291,7 @@ centerText videoSurface x y font fgColor bgColor text = do pitchIndex = concat $ map (\x -> unique) [0 .. _AXIS_COLS_REPEAT - 1] where - 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] + 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] colfrom top = map (+ top) $ map (* (-7)) [0 .. _AXIS_ROWS - 1] unique = concat $ map colfrom toprow -- cgit v1.2.3