fond memleak, colordance broken

This commit is contained in:
anton.gurov
2019-10-31 15:08:09 +03:00
parent c372670953
commit 96d6818754
4 changed files with 166 additions and 78 deletions

View File

@ -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)