Attempt to simplify text positioning
This commit is contained in:
@@ -77,7 +77,7 @@ toggleEquipmentAt rbops invid cr w = case rbops ^? opAllocateEquipment of
|
|||||||
& crpoint . crEquipment . at newp ?~ invid
|
& crpoint . crEquipment . at newp ?~ invid
|
||||||
& crpoint . crInvEquipped . at invid ?~ newp
|
& crpoint . crInvEquipped . at invid ?~ newp
|
||||||
& onequip itm cr
|
& onequip itm cr
|
||||||
& assignNewHotkey invid
|
& crpoint %~ assignNewHotkey invid
|
||||||
Just MoveEquipment{_allocNewPos = newp, _allocOldPos = oldp} ->
|
Just MoveEquipment{_allocNewPos = newp, _allocOldPos = oldp} ->
|
||||||
w
|
w
|
||||||
& crpoint . crEquipment . at newp ?~ invid
|
& crpoint . crEquipment . at newp ?~ invid
|
||||||
@@ -97,7 +97,7 @@ toggleEquipmentAt rbops invid cr w = case rbops ^? opAllocateEquipment of
|
|||||||
& onremove (itmat rid) cr
|
& onremove (itmat rid) cr
|
||||||
& onequip itm cr
|
& onequip itm cr
|
||||||
& crpoint %~ removeHotkey rid
|
& crpoint %~ removeHotkey rid
|
||||||
& assignNewHotkey invid
|
& crpoint %~ assignNewHotkey invid
|
||||||
Just RemoveEquipment{_allocOldPos = oldp} ->
|
Just RemoveEquipment{_allocOldPos = oldp} ->
|
||||||
w
|
w
|
||||||
& crpoint . crEquipment . at oldp .~ Nothing
|
& crpoint . crEquipment . at oldp .~ Nothing
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ tryAssignHotkey w sc = fromMaybe w $ do
|
|||||||
guard (pt == InitialPress)
|
guard (pt == InitialPress)
|
||||||
cr <- w ^? cWorld . lWorld . creatures . ix 0
|
cr <- w ^? cWorld . lWorld . creatures . ix 0
|
||||||
itid <- cr ^? crManipulation . manObject . inInventory . ispItem
|
itid <- cr ^? crManipulation . manObject . inInventory . ispItem
|
||||||
return $ assignHotkey itid (scancodeToHotkey sc) w
|
return $ w & cWorld . lWorld . creatures . ix 0 %~ assignHotkey itid (scancodeToHotkey sc)
|
||||||
|
|
||||||
-- | Turn key presses into creature movement.
|
-- | Turn key presses into creature movement.
|
||||||
-- | note the order of operation, setting the posture first--this prevents the twist fire bug
|
-- | note the order of operation, setting the posture first--this prevents the twist fire bug
|
||||||
|
|||||||
@@ -119,13 +119,14 @@ listCursorChooseBorderScale ::
|
|||||||
Picture
|
Picture
|
||||||
listCursorChooseBorderScale ygap s borders xoff yoff cfig yint xint col cursxsize cursysize =
|
listCursorChooseBorderScale ygap s borders xoff yoff cfig yint xint col cursxsize cursysize =
|
||||||
translate
|
translate
|
||||||
(15 + (9 * s * (fromIntegral xint - 1)) + xoff - halfWidth cfig)
|
--(15 + (9 * s * (fromIntegral xint - 1)) + xoff - halfWidth cfig)
|
||||||
(halfHeight cfig + s * 12.5 - (yoff + (s * 10 + ygap) * (fromIntegral yint + 1)))
|
(xoff - halfWidth cfig)
|
||||||
|
(halfHeight cfig - (yoff + (s * 10 + ygap) * (fromIntegral yint + 1)))
|
||||||
. color col
|
. color col
|
||||||
$ chooseCursorBorders (s * wth) (s * hgt) borders
|
$ chooseCursorBorders (s * wth) (s * hgt) borders
|
||||||
where
|
where
|
||||||
x = 9
|
x = 9
|
||||||
wth = x * fromIntegral cursxsize + 9
|
wth = x * fromIntegral cursxsize + 10
|
||||||
hgt = 20 * fromIntegral cursysize -- TODO this should be changed!
|
hgt = 20 * fromIntegral cursysize -- TODO this should be changed!
|
||||||
|
|
||||||
-- displays a cursor that should match up to list text pictures
|
-- displays a cursor that should match up to list text pictures
|
||||||
@@ -137,15 +138,12 @@ listCursorChooseBorder = listCursorChooseBorderScale 10 1
|
|||||||
|
|
||||||
-- note we cannot simply scale lines because they are drawn as solid rectangles
|
-- note we cannot simply scale lines because they are drawn as solid rectangles
|
||||||
chooseCursorBorders :: Float -> Float -> [CardinalPoint] -> Picture
|
chooseCursorBorders :: Float -> Float -> [CardinalPoint] -> Picture
|
||||||
chooseCursorBorders wth hgt = foldMap (line . toLine)
|
chooseCursorBorders w h = foldMap (line . toLine)
|
||||||
where
|
where
|
||||||
top = 0
|
toLine North = [V2 0 h, V2 w h]
|
||||||
bot = - hgt
|
toLine East = [V2 w h, V2 w 0]
|
||||||
lef = 0
|
toLine South = [V2 w 0, V2 0 0]
|
||||||
toLine North = [V2 lef top, V2 wth top]
|
toLine West = [V2 0 0, V2 0 h]
|
||||||
toLine East = [V2 wth top, V2 wth bot]
|
|
||||||
toLine South = [V2 wth bot, V2 lef bot]
|
|
||||||
toLine West = [V2 lef bot, V2 lef top]
|
|
||||||
|
|
||||||
listCursorNS :: Float -> Float -> Configuration -> Int -> Int -> Color -> Int -> Int -> Picture
|
listCursorNS :: Float -> Float -> Configuration -> Int -> Int -> Color -> Int -> Int -> Picture
|
||||||
listCursorNS = listCursorChooseBorder [North, South]
|
listCursorNS = listCursorChooseBorder [North, South]
|
||||||
|
|||||||
+4
-1
@@ -201,9 +201,12 @@ stackText = mconcat . zipWith (\y s -> translate 0 y $ centerText s) [0, 100 ..]
|
|||||||
|
|
||||||
text :: String -> Picture
|
text :: String -> Picture
|
||||||
{-# INLINE text #-}
|
{-# INLINE text #-}
|
||||||
text = translate (-50) (-100) . drawText (-10)
|
--text = translate (-50) (-100) . drawText (-10)
|
||||||
|
text = drawText 0
|
||||||
|
--text = drawText (-10)
|
||||||
|
|
||||||
drawText :: Float -> String -> [Verx]
|
drawText :: Float -> String -> [Verx]
|
||||||
|
{-# INLINE drawText #-}
|
||||||
drawText gap = map f . stringToList gap
|
drawText gap = map f . stringToList gap
|
||||||
where
|
where
|
||||||
f (pos, col, V3 a b c) = Verx pos col [a, b, c, 1] BottomLayer textNum
|
f (pos, col, V3 a b c) = Verx pos col [a, b, c, 1] BottomLayer textNum
|
||||||
|
|||||||
Reference in New Issue
Block a user