refactor level, getting to tiles
This commit is contained in:
@ -129,30 +129,47 @@ func (vp *ViewPort) Render() {
|
||||
|
||||
vp.Fov.ComputeFov(vp.level, vp.playerCoords, vp.playerTorchRadius)
|
||||
}
|
||||
|
||||
//for y := 0; y < vp.H; y++ {
|
||||
// for x := 0; x < vp.W; x++ {
|
||||
// mapCoords := types.Coords{vp.X + x, vp.Y + y}
|
||||
// tile := vp.level.Tiles[mapCoords.X][mapCoords.Y]
|
||||
//
|
||||
// if tile.Visible {
|
||||
// if tile.MustDraw {
|
||||
// //darkened version of landscape
|
||||
// vp.layer.WithRawColor(tile.ColorSet.DarkFg()).
|
||||
// PutWithRawBackground(mapCoords.X, mapCoords.Y, tile.Char, tile.ColorSet.DarkBg())
|
||||
// }
|
||||
// } else {
|
||||
// if redraw == true || tile.Colordance {
|
||||
// vp.layer.WithRawColor(tile.ColorSet.Fg()).
|
||||
// PutWithRawBackground(mapCoords.X, mapCoords.Y, tile.Char, tile.ColorSet.Bg())
|
||||
// tile.Explored = true
|
||||
// tile.MustDraw = true
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
for y := 0; y < vp.H; y++ {
|
||||
for x := 0; x < vp.W; x++ {
|
||||
mapCoords := types.Coords{vp.X + x, vp.Y + y}
|
||||
tile := vp.level.Tiles[mapCoords.X][mapCoords.Y]
|
||||
|
||||
tile := vp.level.GetTile(mapCoords)
|
||||
if tile.Visible {
|
||||
if tile.MustDraw {
|
||||
//darkened version of landscape
|
||||
vp.layer.WithRawColor(tile.ColorSet.DarkFg()).
|
||||
PutWithRawBackground(mapCoords.X, mapCoords.Y, tile.Char, tile.ColorSet.DarkBg())
|
||||
vp.layer.WithColor("green").
|
||||
Put(mapCoords.X, mapCoords.Y, tile.Char)
|
||||
}
|
||||
} else {
|
||||
if redraw == true || tile.Colordance {
|
||||
vp.layer.WithRawColor(tile.ColorSet.Fg()).
|
||||
PutWithRawBackground(mapCoords.X, mapCoords.Y, tile.Char, tile.ColorSet.Bg())
|
||||
vp.layer.WithColor("white").
|
||||
Put(mapCoords.X, mapCoords.Y, tile.Char)
|
||||
tile.Explored = true
|
||||
tile.MustDraw = true
|
||||
}
|
||||
}
|
||||
|
||||
//fg := tile.ColorSet.Fg()
|
||||
//bg := tile.ColorSet.Bg()
|
||||
//vp.layer.WithRawColor(fg).
|
||||
// PutWithRawBackground(mapCoords.X, mapCoords.Y, tile.Char, bg)
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user