wizard-wipeout/src-client/Client/Types.hs

54 lines
1,018 B
Haskell
Raw Normal View History

module Client.Types where
2023-12-12 11:21:25 +01:00
import qualified Control.Concurrent.STM as STM
2024-04-17 19:44:47 +02:00
import Control.Exception (Exception)
2023-12-10 15:18:40 +01:00
import Control.Monad.RWS
2024-04-19 20:18:49 +02:00
import Data.IORef (IORef)
2023-12-10 15:18:40 +01:00
import Data.UUID
import Graphics.Vty
2023-12-10 20:12:53 +01:00
import Network.Socket
2023-12-10 20:12:53 +01:00
import Options.Applicative as O
2023-12-10 15:18:40 +01:00
-- 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"
)
2023-12-10 15:18:40 +01:00
data ReaderContainer = ReaderContainer
{ rcSocket :: Socket
, rcClientUUID :: UUID
, rcMessageQueue :: STM.TQueue ServerMessage
, rcEventQueue :: STM.TQueue Event
2023-12-10 15:18:40 +01:00
}
2023-12-12 11:21:25 +01:00
data StateContainer = StateContainer
2023-12-12 09:47:50 +01:00
{ scWizard :: Wizard
2023-12-12 11:21:25 +01:00
, scClientState :: STM.TMVar ClientState
2023-12-20 08:12:22 +01:00
, scMapSlice :: MapSlice
2024-04-19 20:18:49 +02:00
, scStopper :: IORef Bool
2023-12-10 15:18:40 +01:00
}
type Game = RWST ReaderContainer String StateContainer IO
2024-04-17 19:44:47 +02:00
data ClientTerminate = ClientTerminate
deriving (Show)
instance Exception ClientTerminate