mirror of
https://github.com/jtdaugherty/brick.git
synced 2025-01-05 21:03:07 +03:00
Update rogue demo to translate the player rather than using spaces to center it to avoid layer opacity issues
This commit is contained in:
parent
149ab2d58b
commit
32c82d0754
@ -216,4 +216,5 @@ executable brick-rogue
|
||||
vty >= 5.2.9,
|
||||
data-default,
|
||||
array,
|
||||
random
|
||||
random,
|
||||
lens
|
||||
|
@ -6,6 +6,7 @@ import Graphics.Vty
|
||||
|
||||
import Data.Array
|
||||
|
||||
import Control.Lens ((^.))
|
||||
import Control.Applicative
|
||||
import Control.Monad
|
||||
|
||||
@ -129,7 +130,10 @@ updateDisplay world = [ info, playerLayer, geoLayer ]
|
||||
(px, py) = playerCoord $ player world
|
||||
playerLoc = Location (px, py)
|
||||
theLevel = level world
|
||||
playerLayer = center $ raw (char pieceA '@')
|
||||
playerLayer = Widget Fixed Fixed $ do
|
||||
c <- getContext
|
||||
render $ translateBy (Location (c^.availW `div` 2, c^.availH `div` 2)) $
|
||||
raw $ char pieceA '@'
|
||||
geoLayer = centerAbout playerLoc $ raw $ levelGeoImage theLevel
|
||||
|
||||
imageForGeo :: LevelPiece -> Image
|
||||
|
Loading…
Reference in New Issue
Block a user