-------------------------------------------------------------------------------- -- Nonbuffering getChar -- 2017 Francesco Ariis GPLv3 80cols -------------------------------------------------------------------------------- {-# LANGUAGE ForeignFunctionInterface #-} -- see .cabal conditionals for more info module Terminal.Game.Input where import qualified Foreign.C.Types as FT import qualified Data.Char as C inputCharTerminal :: IO Char inputCharTerminal = getCharWindows -- no idea but unsafe breaks it getCharWindows :: IO Char getCharWindows = fmap (C.chr . fromEnum) c_getch foreign import ccall safe "conio.h getch" c_getch :: IO FT.CInt