fond memleak, colordance broken
This commit is contained in:
@ -54,6 +54,22 @@ func (layer *Layer) PutWithBackground(x,y int, symbol interface{}, bgColorName s
|
||||
blt.Composition(prevCompMode)
|
||||
}
|
||||
|
||||
func (Layer *Layer) PutToBase(x,y int, symbol interface{}, fg uint32, bg uint32) {
|
||||
if symbol == nil {
|
||||
return
|
||||
}
|
||||
rnes := []rune(symbol.(string))
|
||||
prevColor := uint32(blt.State(blt.TK_COLOR))
|
||||
prevBgColor := uint32(blt.State(blt.TK_BKCOLOR))
|
||||
blt.BkColor(bg)
|
||||
blt.Color(fg)
|
||||
if (len(rnes)) > 0 {
|
||||
blt.Put(x, y, int(rnes[0]))
|
||||
}
|
||||
blt.Color(prevColor)
|
||||
blt.BkColor(prevBgColor)
|
||||
}
|
||||
|
||||
func (layer *Layer) after() *Layer {
|
||||
blt.Color(layer.defaultColor)
|
||||
blt.Layer(0)
|
||||
|
@ -155,21 +155,30 @@ func (vp *ViewPort) Render() {
|
||||
for y := 0; y < vp.H; y++ {
|
||||
for x := 0; x < vp.W; x++ {
|
||||
mapCoords := types.Coords{vp.X + x, vp.Y + y}
|
||||
//vp.level.GetTile(mapCoords).Render()
|
||||
|
||||
tile := vp.level.GetTile(mapCoords)
|
||||
if tile.Visible {
|
||||
if tile.MustDraw {
|
||||
//darkened version of landscape
|
||||
vp.layer.WithColor("green").
|
||||
Put(mapCoords.X, mapCoords.Y, tile.Char)
|
||||
}
|
||||
} else {
|
||||
if redraw == true || tile.Colordance {
|
||||
vp.layer.WithColor("white").
|
||||
Put(mapCoords.X, mapCoords.Y, tile.Char)
|
||||
tile.Explored = true
|
||||
tile.MustDraw = true
|
||||
}
|
||||
}
|
||||
|
||||
//vp.layer.
|
||||
// WithRawColor(tile.GetRawColor()).
|
||||
// PutWithBackground(mapCoords.X, mapCoords.Y, tile.GetChar(), "grey")
|
||||
|
||||
vp.layer.PutToBase(mapCoords.X,mapCoords.Y,tile.GetChar(), tile.GetRawColor(), tile.GetRawBgColor())
|
||||
|
||||
//if tile.Visible {
|
||||
// if tile.MustDraw {
|
||||
// //darkened version of landscape
|
||||
// vp.layer.WithColor("green").
|
||||
// Put(mapCoords.X, mapCoords.Y, tile.Char)
|
||||
// }
|
||||
//} else {
|
||||
// if redraw == true || tile.Colordance {
|
||||
// vp.layer.WithColor("grey").
|
||||
// Put(mapCoords.X, mapCoords.Y, tile.Char)
|
||||
// tile.Explored = true
|
||||
// tile.MustDraw = true
|
||||
// }
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user