Add selection box on left click drag
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
module Dodge.Render.Picture (fixedCoordPictures) where
|
||||
|
||||
import qualified SDL
|
||||
import Control.Lens
|
||||
import qualified Data.Map.Strict as M
|
||||
import Data.Maybe
|
||||
@@ -30,6 +31,7 @@ fixedCoordPictures u =
|
||||
(u ^. uvWorld . cWorld . lWorld . lTestString)
|
||||
)
|
||||
<> displayFrameTicks u
|
||||
<> drawAnySelectionBox u
|
||||
<> drawMouseCursor u
|
||||
<> toTopLeft
|
||||
cfig
|
||||
@@ -44,7 +46,7 @@ fixedCoordPictures u =
|
||||
hw = halfWidth cfig
|
||||
hh = halfHeight cfig
|
||||
ttl = toTopLeft cfig
|
||||
f (k, l) = (show k, foldMap _debugMessage l)
|
||||
f (k, l) = (show k, map _debugMessage l)
|
||||
|
||||
displayFrameTicks :: Universe -> Picture
|
||||
displayFrameTicks u
|
||||
@@ -125,6 +127,13 @@ mouseCursorType u = case u ^. uvWorld . input . mouseContext of
|
||||
argV (w ^. cWorld . lWorld . lAimPos -.- cpos)
|
||||
- w ^. wCam . camRot
|
||||
|
||||
drawAnySelectionBox :: Universe -> Picture
|
||||
drawAnySelectionBox u = case u ^. uvWorld . input . mouseContext of
|
||||
OverInvDragSelect{} -> fold $ do
|
||||
p <- u ^. uvWorld . input . clickPos . at SDL.ButtonLeft
|
||||
return . color white . polygonWire $ rectVV (u ^. uvWorld . input . mousePos) p
|
||||
_ -> mempty
|
||||
|
||||
drawCursorByTerminalStatus :: TerminalStatus -> Picture
|
||||
drawCursorByTerminalStatus = \case
|
||||
TerminalPressTo "QUIT" -> drawQuitTerminal 5
|
||||
|
||||
Reference in New Issue
Block a user