Refactor event handling. Allow mouse movement in menus

This commit is contained in:
2021-04-07 21:59:44 +02:00
parent d42cb89dd2
commit 294f2509d0
12 changed files with 319 additions and 317 deletions
+18
View File
@@ -14,6 +14,9 @@ module Sound (
, playPositionalSoundQueue
-- * Complex Playback
, playAndUpdate
-- * Volume Control
, setSoundVolume
, setMusicVolume
) where
import Sound.Data
@@ -149,3 +152,18 @@ setChannelPos :: Int16 -> Mix.Channel -> MaybeT IO Mix.Channel
setChannelPos a i = do
liftIO $ Mix.effectPosition i a 0
return i
-----------------------------------------------------------------
{- | Set the volume for all sound channels.
Behind the scenes, scales a float [0,1] to an Int [0..128].
-}
setSoundVolume :: Float -> IO ()
setSoundVolume x = Mix.setVolume (round (x * 128)) Mix.AllChannels
{- | Set the music volume.
Behind the scenes, scales a float [0,1] to an Int [0..128].
-}
setMusicVolume :: Float -> IO ()
setMusicVolume x = Mix.setMusicVolume (round (x * 128))