with backgroung + composition
This commit is contained in:
parent
184ac149ee
commit
4a77323aab
@ -94,6 +94,15 @@ Cursus in hac habitasse platea. Aliquet risus feugiat in ante metus dictum. Maec
|
||||
Sed euismod nisi porta lorem mollis aliquam ut porttitor leo. Ut tellus elementum sagittis vitae et leo duis ut diam. Elementum curabitur vitae nunc sed velit dignissim. Auctor elit sed vulputate mi sit. Consectetur adipiscing elit ut aliquam purus. Feugiat vivamus at augue eget arcu. Duis ut diam quam nulla porttitor massa id neque. Pharetra magna ac placerat vestibulum lectus mauris ultrices. Non sodales neque sodales ut etiam. Massa ultricies mi quis hendrerit dolor. Est sit amet facilisis magna etiam. Ornare suspendisse sed nisi lacus sed viverra tellus in.
|
||||
`)
|
||||
|
||||
menuLayer.WithColor("red").PutWithBackground(40,40,"Ы", "#aa1257d4")
|
||||
menuLayer.WithColor("white").PutWithBackground(41,40,"Щ", "#cd31ed12")
|
||||
menuLayer.WithColor("yellow").PutWithBackground(42,40,"Ц", "#efcccccc")
|
||||
|
||||
menuLayer.WithColor("red").PutWithBackground(40,1,"Ы", "#aa1257d4")
|
||||
menuLayer.WithColor("white").PutWithBackground(41,1,"Щ", "#cd31ed12")
|
||||
menuLayer.WithColor("yellow").PutWithBackground(42,1,"Ц", "#efcccccc")
|
||||
|
||||
|
||||
bgLayer.WithColor("#77cfcfcf").NewWindow(45, 5, 40, 40).Splash()
|
||||
menuLayer.WithColor("#aaed26ca").NewWindow(45, 5, 40, 40).DoubleBordered("Transparent BG window test")
|
||||
blt.PrintExt(46, 6, 40, 39, 1, `Lorem mollis aliquam ut porttitor leo a diam sollicitudin tempor. Convallis tellus id interdum velit. Enim nunc faucibus a pellentesque. Tincidunt augue interdum velit euismod in pellentesque massa placerat duis. Leo duis ut diam quam nulla porttitor massa id. Eu feugiat pretium nibh ipsum consequat nisl. Eget est lorem ipsum dolor sit amet. Et sollicitudin ac orci phasellus egestas. Donec adipiscing tristique risus nec. Et molestie ac feugiat sed. Ante in nibh mauris cursus mattis molestie a iaculis at. Neque laoreet suspendisse interdum consectetur. Vitae et leo duis ut diam quam nulla. Sed ullamcorper morbi tincidunt ornare massa eget egestas purus viverra. Ornare lectus sit amet est placerat in egestas erat.
|
||||
@ -105,6 +114,7 @@ Sed euismod nisi porta lorem mollis aliquam ut porttitor leo. Ut tellus elementu
|
||||
|
||||
baseLayer.Print(1, 1, "Hello, [font=bold]world[/font]!")
|
||||
baseLayer.Print(1, 4, "Testing line-[color=orange]spacing[/color]")
|
||||
|
||||
blt.Refresh()
|
||||
}
|
||||
|
||||
|
@ -45,11 +45,14 @@ func (layer *Layer) PutWithRawBackground(x,y int, symbol interface{}, bgColor ui
|
||||
func (layer *Layer) PutWithBackground(x,y int, symbol interface{}, bgColorName string) {
|
||||
layer.before()
|
||||
prevColor := uint32(blt.State(blt.TK_COLOR))
|
||||
prevCompMode := blt.State(blt.TK_COMPOSITION)
|
||||
c := blt.ColorFromName(bgColorName)
|
||||
blt.Color(c)
|
||||
blt.Composition(1)
|
||||
layer.Put(x,y,"█")
|
||||
blt.Color(prevColor)
|
||||
layer.Put(x,y, symbol)
|
||||
blt.Composition(prevCompMode)
|
||||
}
|
||||
|
||||
func (layer *Layer) after() *Layer {
|
||||
|
@ -53,49 +53,49 @@ func (vp *ViewPort) ToVPCoords(c *types.Coords) (newCoords *types.Coords, err er
|
||||
}
|
||||
|
||||
//call only from main thread
|
||||
func (vp *ViewPort) Render() {
|
||||
//fixme get these from state chan(s)
|
||||
var fpsTicker int
|
||||
var fovRecompute bool
|
||||
redraw := false
|
||||
//fixme get player instance
|
||||
|
||||
vp.Move(player.Coords)
|
||||
//fixme detect fovRecompute
|
||||
if fovRecompute {
|
||||
vp.layer.Clear(vp.Rect)
|
||||
fovRecompute = false
|
||||
redraw = true
|
||||
//fixme
|
||||
vp.level.ComputeFov(FovMap, player.Coords, player.TorchRadius, FovLightWalls, FovAlgo)
|
||||
}
|
||||
//increase ticker
|
||||
fpsTicker++
|
||||
|
||||
if redraw || fpsTicker % (FPS_LIMIT / 10) == 0 {
|
||||
fpsTicker := 0
|
||||
|
||||
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]
|
||||
visible := vp.IsInFov(mapCoords)
|
||||
if !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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
//func (vp *ViewPort) Render() {
|
||||
// //fixme get these from state chan(s)
|
||||
// var fpsTicker int
|
||||
// var fovRecompute bool
|
||||
// redraw := false
|
||||
// //fixme get player instance
|
||||
//
|
||||
// vp.Move(player.Coords)
|
||||
// //fixme detect fovRecompute
|
||||
// if fovRecompute {
|
||||
// vp.layer.Clear(vp.Rect)
|
||||
// fovRecompute = false
|
||||
// redraw = true
|
||||
// //fixme
|
||||
// vp.level.ComputeFov(FovMap, player.Coords, player.TorchRadius, FovLightWalls, FovAlgo)
|
||||
// }
|
||||
// //increase ticker
|
||||
// fpsTicker++
|
||||
//
|
||||
// if redraw || fpsTicker % (FPS_LIMIT / 10) == 0 {
|
||||
// fpsTicker := 0
|
||||
//
|
||||
// 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]
|
||||
// visible := vp.IsInFov(mapCoords)
|
||||
// if !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
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// }
|
||||
//}
|
Loading…
x
Reference in New Issue
Block a user