diff options
| author | Akshay Nair <phenax5@gmail.com> | 2024-12-19 22:40:41 +0530 |
|---|---|---|
| committer | Akshay Nair <phenax5@gmail.com> | 2024-12-19 22:40:41 +0530 |
| commit | 5dc3696f38433c79939bb182c4590a6ce04f4c63 (patch) | |
| tree | 4329988cad9afa9c58f8a4c66419d23bc0ddc55d /src | |
| parent | d44103add77718ae650bc0ad5e708e984192c29d (diff) | |
| download | chelleport-5dc3696f38433c79939bb182c4590a6ce04f4c63.tar.gz chelleport-5dc3696f38433c79939bb182c4590a6ce04f4c63.zip | |
Test mock setup for update + 1 spec for update case
Diffstat (limited to 'src')
| -rw-r--r-- | src/Chelleport.hs | 4 | ||||
| -rw-r--r-- | src/Chelleport/Types.hs | 6 |
2 files changed, 8 insertions, 2 deletions
diff --git a/src/Chelleport.hs b/src/Chelleport.hs index 2a95a9a..6b443b5 100644 --- a/src/Chelleport.hs +++ b/src/Chelleport.hs @@ -11,7 +11,7 @@ import Chelleport.Types import Chelleport.Utils (intToCInt) import qualified Chelleport.View import Control.Monad.IO.Class (MonadIO) -import Control.Monad.Reader (MonadReader, ReaderT (runReaderT)) +import Control.Monad.Reader (ReaderT (runReaderT)) import Data.List ((\\)) import Data.Maybe (fromMaybe, isJust) import qualified SDL @@ -66,7 +66,7 @@ eventToAction _state event = _ -> Nothing update :: - (MonadIO m, MonadAppShell m, MonadDraw m, MonadControl m, MonadReader DrawContext m) => + (MonadAppShell m, MonadDraw m, MonadControl m) => State -> AppAction -> m (State, Maybe AppAction) diff --git a/src/Chelleport/Types.hs b/src/Chelleport/Types.hs index c1cf386..a6aa7cc 100644 --- a/src/Chelleport/Types.hs +++ b/src/Chelleport/Types.hs @@ -1,12 +1,15 @@ module Chelleport.Types where import Control.Monad.Reader (MonadIO, MonadReader, ReaderT) +import Data.Word (Word8) import qualified Graphics.X11 as X11 import qualified SDL import qualified SDL.Font as TTF type Cell = [Char] +type Color = SDL.V4 Word8 + type KeySequence = [Char] type KeyGrid = [[Cell]] @@ -17,6 +20,7 @@ data State = State stateIsMatched :: Bool, stateIsShiftPressed :: Bool } + deriving (Show, Eq) data AppAction = HandleKeyInput SDL.Keycode @@ -26,6 +30,7 @@ data AppAction | IncrementMouseCursor (Int, Int) | ShutdownApp | UpdateShiftState Bool + deriving (Show, Eq) data DrawContext = DrawContext { ctxWindow :: SDL.Window, @@ -43,6 +48,7 @@ type View state = state -> IO () type Initializer state = IO state data MouseButtonType = LeftClick + deriving (Show, Eq) newtype AppM m a = AppM {runAppM :: ReaderT DrawContext m a} deriving (Functor, Applicative, Monad, MonadIO, MonadReader DrawContext) |
