diff options
Diffstat (limited to 'axis.hs')
-rw-r--r-- | axis.hs | 15 |
1 files changed, 11 insertions, 4 deletions
@@ -68,6 +68,14 @@ drawKeys pitches videoSurface font axis_key_locations axis_key_size = do | |||
68 | reallyEraseKeys = eraseKeys_ True | 68 | reallyEraseKeys = eraseKeys_ True |
69 | eraseKeys = eraseKeys_ False | 69 | eraseKeys = eraseKeys_ False |
70 | 70 | ||
71 | smartDrawKeys really drawSet eraseSet videoSurface font axis_key_locations axis_key_size = do | ||
72 | |||
73 | let drawList = map (\ (_, n) -> unPitch n) $ Set.toList drawSet | ||
74 | let eraseList = map (\ (_, n) -> unPitch n) $ Set.toList eraseSet | ||
75 | |||
76 | drawKeys drawList videoSurface font axis_key_locations axis_key_size | ||
77 | eraseKeys_ really eraseList videoSurface font axis_key_locations axis_key_size | ||
78 | |||
71 | eraseKeys_ really pitches videoSurface font axis_key_locations axis_key_size = do | 79 | eraseKeys_ really pitches videoSurface font axis_key_locations axis_key_size = do |
72 | 80 | ||
73 | forM_ pitches $ \pitch -> do | 81 | forM_ pitches $ \pitch -> do |
@@ -133,11 +141,10 @@ main = | |||
133 | -- let chord = show $ map (\i->elemIndices i pitchIndex) $ pitchList midiKeysDown' | 141 | -- let chord = show $ map (\i->elemIndices i pitchIndex) $ pitchList midiKeysDown' |
134 | -- textBand videoSurface videoClipRect (SDL.Rect 0 70 0 70) font chord | 142 | -- textBand videoSurface videoClipRect (SDL.Rect 0 70 0 70) font chord |
135 | let ignoreThese = Set.intersection midiKeysDown' midiKeysDown | 143 | let ignoreThese = Set.intersection midiKeysDown' midiKeysDown |
136 | let drawThese = pitchList $ Set.difference midiKeysDown' ignoreThese | 144 | let drawThese = Set.difference midiKeysDown' ignoreThese |
137 | let eraseThese = pitchList $ Set.difference midiKeysDown ignoreThese | 145 | let eraseThese = Set.difference midiKeysDown ignoreThese |
138 | 146 | ||
139 | drawKeys drawThese videoSurface font axis_key_locations axis_key_size | 147 | smartDrawKeys False drawThese eraseThese videoSurface font axis_key_locations axis_key_size |
140 | eraseKeys eraseThese videoSurface font axis_key_locations axis_key_size | ||
141 | return () | 148 | return () |
142 | 149 | ||
143 | Control.Monad.when (keysDown' /= keysDown && keyDown SDL.SDLK_BACKSPACE keysDown') allKeysOFF | 150 | Control.Monad.when (keysDown' /= keysDown && keyDown SDL.SDLK_BACKSPACE keysDown') allKeysOFF |