40 lines
1.2 KiB
Haskell
40 lines
1.2 KiB
Haskell
{-# LANGUAGE DeriveGeneric #-}
|
|
{-# LANGUAGE TemplateHaskell #-}
|
|
{-# LANGUAGE StrictData #-}
|
|
module Dodge.Data.Targeting where
|
|
import GHC.Generics
|
|
import Data.Aeson
|
|
import Geometry.Data
|
|
import Control.Lens
|
|
data Targeting
|
|
= NoTargeting
|
|
| Targeting
|
|
{ _tgPos :: Maybe Point2
|
|
, _tgUpdate :: TargetUpdate --Item -> Creature -> World -> Targeting -> (World, Targeting)
|
|
, _tgDraw :: TargetDraw --Item -> Creature -> Configuration -> World -> Picture
|
|
, _tgID :: Maybe Int
|
|
, _tgActive :: Bool
|
|
}
|
|
deriving (Eq,Ord,Show,Read,Generic)
|
|
instance ToJSON Targeting where
|
|
toEncoding = genericToEncoding defaultOptions
|
|
instance FromJSON Targeting
|
|
data TargetUpdate = NoTargetUpdate
|
|
| TargetLaserUpdate
|
|
| TargetRBPressUpdate
|
|
| TargetRBCreatureUpdate
|
|
| TargetCursorUpdate
|
|
deriving (Eq,Ord,Show,Read,Generic)
|
|
instance ToJSON TargetUpdate where
|
|
toEncoding = genericToEncoding defaultOptions
|
|
instance FromJSON TargetUpdate
|
|
data TargetDraw = NoTargetDraw
|
|
| TargetDistanceDraw
|
|
| SimpleDrawTarget
|
|
| TargetRBCreatureDraw
|
|
deriving (Eq,Ord,Show,Read,Generic)
|
|
instance ToJSON TargetDraw where
|
|
toEncoding = genericToEncoding defaultOptions
|
|
instance FromJSON TargetDraw
|
|
makeLenses ''Targeting
|