about summary refs log tree commit diff
path: root/users/grfn/xanthous/src/Xanthous/Data/App.hs
blob: 0361d2a59ed519f11c49129afbe0df2820819f65 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
--------------------------------------------------------------------------------
module Xanthous.Data.App
  ( Panel(..)
  , ResourceName(..)
  , AppEvent(..)
  ) where
--------------------------------------------------------------------------------
import Xanthous.Prelude
--------------------------------------------------------------------------------
import Test.QuickCheck
import Data.Aeson (ToJSON, FromJSON)
--------------------------------------------------------------------------------
import Xanthous.Util.QuickCheck
--------------------------------------------------------------------------------

-- | Enum for "panels" displayed in the game's UI.
data Panel
  = InventoryPanel -- ^ A panel displaying the character's inventory
  deriving stock (Show, Eq, Ord, Generic, Enum, Bounded)
  deriving anyclass (NFData, CoArbitrary, Function, ToJSON, FromJSON)
  deriving Arbitrary via GenericArbitrary Panel


data ResourceName
  = MapViewport -- ^ The main viewport where we display the game content
  | Character   -- ^ The character
  | MessageBox  -- ^ The box where we display messages to the user
  | Prompt      -- ^ The game's prompt
  | Panel Panel -- ^ A panel in the game
  deriving stock (Show, Eq, Ord, Generic)
  deriving anyclass (NFData, CoArbitrary, Function, ToJSON, FromJSON)
  deriving Arbitrary via GenericArbitrary ResourceName

data AppEvent
  = AutoContinue -- ^ Continue whatever autocommand has been requested by the
                 --   user
  deriving stock (Show, Eq, Ord, Generic)
  deriving anyclass (NFData, CoArbitrary, Function, ToJSON, FromJSON)
  deriving Arbitrary via GenericArbitrary AppEvent