{-# LANGUAGE DeriveAnyClass #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE StrictData #-} {-# LANGUAGE TemplateHaskell #-} module Dodge.Data.Input where import Control.Lens import qualified Data.Map.Strict as M import Geometry.Data import SDL (MouseButton, Scancode) data PressType = InitialPress | ShortPress | LongPress deriving (Eq, Show) data Input = Input { _mousePos :: Point2 -- in pixels, from the center of the screen , _mouseMoving :: Bool , _pressedKeys :: M.Map Scancode PressType , _mouseButtons :: M.Map MouseButton Bool -- shortpress False, repeatpress True , _scrollAmount :: Int , _previousScrollAmount :: Int , _lLine :: (Point2, Point2) , _rLine :: (Point2, Point2) , _lrLine :: (Point2, Point2) , _lSelect :: Point2 , _rSelect :: Point2 , _clickMousePos :: Point2 , _textInput :: [Either TermSignal Char] , _scrollTestFloat :: Float , _scrollTestInt :: Int } data TermSignal = TSescape | TSreturn | TSbackspace | TSdelete | TStab | TSleft | TSright | TSup | TSdown makeLenses ''Input