wizard-wipeout/src-client/Client/Types.hs
2024-10-28 12:20:34 +01:00

53 lines
1,018 B
Haskell

module Client.Types where
import qualified Control.Concurrent.STM as STM
import Control.Exception (Exception)
import Control.Monad.RWS
import Data.IORef (IORef)
import Data.UUID
import Graphics.Vty
import Network.Socket
import Options.Applicative as O
-- internal imports
import Library.Types
newtype Options = Options
{ optSockLoc :: FilePath
}
options :: O.Parser Options
options = Options
<$> argument str
( metavar "FILEPATH"
<> help "Location of the server's socket"
)
data ReaderContainer = ReaderContainer
{ rcSocket :: Socket
, rcClientUUID :: UUID
, rcMessageQueue :: STM.TQueue ServerMessage
, rcEventQueue :: STM.TQueue Event
}
data StateContainer = StateContainer
{ scWizard :: Wizard
, scClientState :: STM.TMVar ClientState
, scMapSlice :: MapSlice
, scStopper :: IORef Bool
}
type Game = RWST ReaderContainer String StateContainer IO
data ClientTerminate = ClientTerminate
deriving (Show)
instance Exception ClientTerminate