Make combine and tweak menus servicable
This commit is contained in:
+34
-17
@@ -4,34 +4,51 @@ import Dodge.Base.Window
|
||||
import Dodge.WinScale
|
||||
import Picture
|
||||
import Geometry
|
||||
--import Control.Monad
|
||||
import Data.Maybe
|
||||
|
||||
-- given a list of pictures that are each the size of a "text" call, displays them as
|
||||
-- a list on the screen
|
||||
listTextPicturesAt :: Float -> Float -> Configuration -> [Picture] -> Picture
|
||||
listTextPicturesAt tx ty cfig = mconcat . zipWith (listTextPictureAt tx ty cfig) [0..]
|
||||
|
||||
|
||||
-- displays a cursor that should match up to list text pictures
|
||||
-- the width of a character appears to be 9(?!)
|
||||
listCursorAt :: Float -> Float -> Configuration -> Int -> Color -> Int -> Int -> Picture
|
||||
listCursorAt xoff yoff cfig yint col cursxsize cursysize = winScale cfig
|
||||
. translate (10.5+xoff-halfWidth cfig) (halfHeight cfig - (20* fromIntegral yint + yoff) - 20)
|
||||
$ lineCol
|
||||
[(V2 0 12.5 , col)
|
||||
,(V2 wth 12.5 ,col)
|
||||
] <>
|
||||
lineCol
|
||||
[(V2 0 (12.5 - hgt),col)
|
||||
,(V2 wth (12.5 - hgt),col)
|
||||
]
|
||||
--[(V2 wth 12.5 ,withAlpha 0 col)
|
||||
--,(V2 0 12.5 ,col)
|
||||
--,(V2 0 (12.5 - hgt),col)
|
||||
--,(V2 wth (12.5 - hgt),withAlpha 0 col)
|
||||
--]
|
||||
-- this is probably because it is 8 pixels plus one for the border
|
||||
listCursorChooseBorder :: [Bool] -> Float -> Float -> Configuration -> Int -> Color -> Int -> Int -> Picture
|
||||
listCursorChooseBorder borders xoff yoff cfig yint col cursxsize cursysize = winScale cfig
|
||||
. translate (6+xoff-halfWidth cfig)
|
||||
(halfHeight cfig + 12.5 - (20* fromIntegral yint + yoff + 20 + hgt))
|
||||
. color col
|
||||
$ chooseCursorBorders wth hgt borders
|
||||
where
|
||||
x = 9
|
||||
wth = x * fromIntegral cursxsize
|
||||
wth = x * fromIntegral cursxsize + 9
|
||||
hgt = 20 * fromIntegral cursysize
|
||||
-- note we cannot simply scale lines because they are drawn as solid rectangles
|
||||
chooseCursorBorders :: Float -> Float -> [Bool] -> Picture
|
||||
chooseCursorBorders wth hgt = concat . catMaybes . zipWith f
|
||||
[ line [V2 0 hgt , V2 wth hgt ]
|
||||
, line [V2 wth hgt , V2 wth 0 ]
|
||||
, line [V2 wth 0 , V2 0 0 ]
|
||||
, line [V2 0 0 , V2 0 hgt ]
|
||||
]
|
||||
where
|
||||
f _ False = Nothing
|
||||
f a True = Just a
|
||||
|
||||
listCursorNS :: Float -> Float -> Configuration -> Int -> Color -> Int -> Int -> Picture
|
||||
listCursorNS = listCursorChooseBorder [True,False,True]
|
||||
|
||||
listCursorNES :: Float -> Float -> Configuration -> Int -> Color -> Int -> Int -> Picture
|
||||
listCursorNES = listCursorChooseBorder [True,True,True]
|
||||
|
||||
listCursorNESW :: Float -> Float -> Configuration -> Int -> Color -> Int -> Int -> Picture
|
||||
listCursorNESW = listCursorChooseBorder [True,True,True,True]
|
||||
|
||||
listCursorNSW :: Float -> Float -> Configuration -> Int -> Color -> Int -> Int -> Picture
|
||||
listCursorNSW = listCursorChooseBorder [True,False,True,True]
|
||||
|
||||
listTextPictureAt :: Float -> Float -> Configuration -> Int -> Picture -> Picture
|
||||
listTextPictureAt xoff yoff cfig yint = winScale cfig
|
||||
|
||||
Reference in New Issue
Block a user