summaryrefslogtreecommitdiff
path: root/axis.hs
diff options
context:
space:
mode:
authorAndrew Cady <d@jerkface.net>2014-01-17 10:42:14 -0500
committerAndrew Cady <d@jerkface.net>2014-01-17 10:42:14 -0500
commit0693006606d8e14754effcce75787014433117d6 (patch)
tree857ddc8e34207790bebcb93e502b8497a46cf162 /axis.hs
parent786fe2c1ea79c3305eb340f25b2e1cec2515d6ff (diff)
press 'c' to erase all key borders; they come back after notes are played
Diffstat (limited to 'axis.hs')
-rw-r--r--axis.hs15
1 files changed, 10 insertions, 5 deletions
diff --git a/axis.hs b/axis.hs
index 00e6998..a17df54 100644
--- a/axis.hs
+++ b/axis.hs
@@ -34,7 +34,7 @@ netwireIsCool =
34 34
35smartShowPitch p = showPitch p -- TODO: use flat for Eb, Bb; use unicode flat/sharp chars 35smartShowPitch p = showPitch p -- TODO: use flat for Eb, Bb; use unicode flat/sharp chars
36 36
37_USE_HEXAGONS = True 37_USE_HEXAGONS = False
38 38
39_drawHexircle f v x y s c = 39_drawHexircle f v x y s c =
40 if _USE_HEXAGONS 40 if _USE_HEXAGONS
@@ -65,14 +65,17 @@ drawKeys pitches videoSurface font axis_key_locations axis_key_size = do
65 drawFilledHexircle videoSurface (fromIntegral x) (fromIntegral y) (fromIntegral axis_key_size) _KEY_COLOR_PIXEL 65 drawFilledHexircle videoSurface (fromIntegral x) (fromIntegral y) (fromIntegral axis_key_size) _KEY_COLOR_PIXEL
66 centerText videoSurface x y font _KEY_TEXT_COLOR _KEY_COLOR (smartShowPitch pitch) 66 centerText videoSurface x y font _KEY_TEXT_COLOR _KEY_COLOR (smartShowPitch pitch)
67 67
68eraseKeys pitches videoSurface font axis_key_locations axis_key_size = do 68reallyEraseKeys = eraseKeys_ True
69eraseKeys = eraseKeys_ False
70
71eraseKeys_ really pitches videoSurface font axis_key_locations axis_key_size = do
69 72
70 forM_ pitches $ \pitch -> do 73 forM_ pitches $ \pitch -> do
71 forM_ (elemIndices pitch pitchIndex) $ \idx -> do 74 forM_ (elemIndices pitch pitchIndex) $ \idx -> do
72 let (x, y) = axis_key_locations !! idx 75 let (x, y) = axis_key_locations !! idx
73 drawFilledHexircle videoSurface (fromIntegral x) (fromIntegral y) (fromIntegral axis_key_size) _KEY_BG_COLOR_PIXEL 76 drawFilledHexircle videoSurface (fromIntegral x) (fromIntegral y) (fromIntegral axis_key_size) _KEY_BG_COLOR_PIXEL
74 drawHexircle videoSurface (fromIntegral x) (fromIntegral y) (fromIntegral axis_key_size) _KEY_COLOR_PIXEL 77 drawHexircle videoSurface (fromIntegral x) (fromIntegral y) (fromIntegral axis_key_size) (if really then _KEY_BG_COLOR_PIXEL else _KEY_COLOR_PIXEL)
75 centerText videoSurface x y font _KEY_TEXT_COLOR _KEY_BG_COLOR (smartShowPitch pitch) 78-- centerText videoSurface x y font _KEY_TEXT_COLOR _KEY_BG_COLOR (smartShowPitch pitch)
76 79
77fi = fromIntegral 80fi = fromIntegral
78rgbColor r g b = SDL.Pixel (shiftL (fi r) 24 .|. shiftL (fi g) 16 .|. shiftL (fi b) 8 .|. (fi 255)) 81rgbColor r g b = SDL.Pixel (shiftL (fi r) 24 .|. shiftL (fi g) 16 .|. shiftL (fi b) 8 .|. (fi 255))
@@ -106,7 +109,8 @@ main =
106 let (axis_key_size, axis_key_locations) = getKeyLocations videoClipRect 109 let (axis_key_size, axis_key_locations) = getKeyLocations videoClipRect
107 110
108 let _ALL_PITCHES = [_AXIS_BOTTOM_PITCH .. _AXIS_TOP_PITCH] 111 let _ALL_PITCHES = [_AXIS_BOTTOM_PITCH .. _AXIS_TOP_PITCH]
109 let allKeysOFF = eraseKeys _ALL_PITCHES videoSurface font axis_key_locations axis_key_size 112 let allKeysOFF = eraseKeys _ALL_PITCHES videoSurface font axis_key_locations axis_key_size
113 allKeysReallyOFF = reallyEraseKeys _ALL_PITCHES videoSurface font axis_key_locations axis_key_size
110 allKeysOFF 114 allKeysOFF
111 115
112 putStrLn "Initialized." 116 putStrLn "Initialized."
@@ -137,6 +141,7 @@ main =
137 return () 141 return ()
138 142
139 Control.Monad.when (keysDown' /= keysDown && keyDown SDL.SDLK_BACKSPACE keysDown') allKeysOFF 143 Control.Monad.when (keysDown' /= keysDown && keyDown SDL.SDLK_BACKSPACE keysDown') allKeysOFF
144 Control.Monad.when (keysDown' /= keysDown && keyDown SDL.SDLK_c keysDown') allKeysReallyOFF
140 145
141-- Control.Monad.when (keysDown' /= keysDown) $ do 146-- Control.Monad.when (keysDown' /= keysDown) $ do
142-- let chord = unwords $ map (\k -> drop 5 (show k)) $ Set.toList keysDown' 147-- let chord = unwords $ map (\k -> drop 5 (show k)) $ Set.toList keysDown'