2020-10-28 10:48:58 +00:00
|
|
|
module Types.Util where
|
|
|
|
|
|
|
|
import qualified Data.Text as T
|
|
|
|
|
|
|
|
import qualified Data.Map.Strict as M
|
|
|
|
|
|
|
|
import qualified SDL
|
2021-01-11 11:01:07 +00:00
|
|
|
import qualified SDL.Internal.Numbered as SDL (fromNumber)
|
|
|
|
import qualified SDL.Raw.Enum as SDLRaw
|
2020-10-28 10:48:58 +00:00
|
|
|
|
|
|
|
-- internal imports
|
|
|
|
|
|
|
|
import Types.Subsystems
|
|
|
|
|
|
|
|
type Progress = (Float, T.Text)
|
|
|
|
|
2021-01-11 11:01:07 +00:00
|
|
|
type ActionTranslation = M.Map (SDL.Scancode, SDL.KeyModifier) Action
|
|
|
|
|
|
|
|
defaultTranslation :: ActionTranslation
|
|
|
|
defaultTranslation = M.fromList
|
|
|
|
[ ((SDL.ScancodeW, SDL.fromNumber SDLRaw.KMOD_NONE), MoveUp)
|
|
|
|
, ((SDL.ScancodeS, SDL.fromNumber SDLRaw.KMOD_NONE), MoveDown)
|
|
|
|
, ((SDL.ScancodeA, SDL.fromNumber SDLRaw.KMOD_NONE), MoveLeft)
|
|
|
|
, ((SDL.ScancodeD, SDL.fromNumber SDLRaw.KMOD_NONE), MoveRight)
|
|
|
|
, ((SDL.ScancodeSpace, SDL.fromNumber SDLRaw.KMOD_NONE), Jump)
|
|
|
|
, ((SDL.ScancodeSpace, SDL.fromNumber SDLRaw.KMOD_LSHIFT), JumpDown)
|
|
|
|
, ((SDL.ScancodeF, SDL.fromNumber SDLRaw.KMOD_NONE), Activate)
|
|
|
|
, ((SDL.Scancode1, SDL.fromNumber SDLRaw.KMOD_NONE), ReleasePowerup1)
|
|
|
|
, ((SDL.Scancode2, SDL.fromNumber SDLRaw.KMOD_NONE), ReleasePowerup2)
|
|
|
|
, ((SDL.Scancode3, SDL.fromNumber SDLRaw.KMOD_NONE), ReleasePowerup3)
|
|
|
|
, ((SDL.ScancodeLCtrl, SDL.fromNumber SDLRaw.KMOD_NONE), Spit)
|
|
|
|
, ((SDL.ScancodePause, SDL.fromNumber SDLRaw.KMOD_NONE), Pause)
|
|
|
|
]
|