fixes to viewport, config tuning
This commit is contained in:
@ -1,69 +1,8 @@
|
||||
package gamemap
|
||||
|
||||
import (
|
||||
"github.com/gammazero/deque"
|
||||
"lab.zaar.be/thefish/alchemyst-go/util"
|
||||
. "lab.zaar.be/thefish/alchemyst-go/engine/types"
|
||||
)
|
||||
import blt "lab.zaar.be/thefish/bearlibterminal"
|
||||
|
||||
type ColorHolder interface {
|
||||
GetColor() uint32
|
||||
}
|
||||
|
||||
type cdeque struct {
|
||||
deque.Deque
|
||||
}
|
||||
|
||||
func (c *cdeque) Next() uint8 {
|
||||
c.Rotate(1)
|
||||
return c.Front().(uint8)
|
||||
}
|
||||
|
||||
type DanceColorHolder struct {
|
||||
A uint8
|
||||
R *cdeque
|
||||
G *cdeque
|
||||
B *cdeque
|
||||
}
|
||||
|
||||
func (chd *DanceColorHolder) GetColor() uint32 {
|
||||
return blt.ColorFromARGB(
|
||||
chd.A,
|
||||
chd.R.Next(),
|
||||
chd.G.Next(),
|
||||
chd.B.Next(),
|
||||
)
|
||||
}
|
||||
|
||||
type PlainColorHolder struct {
|
||||
A uint8
|
||||
R uint8
|
||||
G uint8
|
||||
B uint8
|
||||
}
|
||||
|
||||
func (chb *PlainColorHolder) GetColor() uint32 {
|
||||
return blt.ColorFromARGB(
|
||||
chb.A,
|
||||
chb.R,
|
||||
chb.G,
|
||||
chb.B,
|
||||
)
|
||||
}
|
||||
|
||||
type TileColorSet struct {
|
||||
Fg ColorHolder
|
||||
Bg ColorHolder
|
||||
DarkFg ColorHolder
|
||||
DarkBg ColorHolder
|
||||
}
|
||||
|
||||
type Appearance struct {
|
||||
Char string `json:"char"`
|
||||
ColorSet *TileColorSet `json:"colorSet"`
|
||||
}
|
||||
|
||||
var crng = util.NewRNG()
|
||||
|
||||
type Tile struct {
|
||||
*Appearance `json:"app"`
|
||||
@ -97,33 +36,6 @@ func (t *Tile) GetRawBgColor() uint32 {
|
||||
}
|
||||
}
|
||||
|
||||
func singleColorRing(colorValue uint8) *cdeque {
|
||||
c := &cdeque{}
|
||||
c.PushBack(colorValue)
|
||||
return c
|
||||
}
|
||||
|
||||
func fillColorRing(colorValue uint8, minGlow, maxGlow, step int) *cdeque {
|
||||
q := make([]uint8, 0)
|
||||
color := int(colorValue)
|
||||
for color < maxGlow {
|
||||
q = append(q, uint8(color))
|
||||
color = crng.Range(1, step) + color
|
||||
}
|
||||
color = crng.Range(0, step+minGlow)
|
||||
q = append(q, uint8(color))
|
||||
//for uint8(color) < uint8(colorValue) {
|
||||
// q = append(q, uint8(color))
|
||||
// color = crng.Range(1, step+minGlow)
|
||||
//}
|
||||
|
||||
c := &cdeque{}
|
||||
for _, v := range q {
|
||||
c.PushBack(uint8(v))
|
||||
}
|
||||
return c
|
||||
}
|
||||
|
||||
func NewWall() *Tile {
|
||||
return &Tile{
|
||||
Name: "Wall",
|
||||
@ -178,14 +90,14 @@ func NewWaterTile() *Tile {
|
||||
Appearance: &Appearance{
|
||||
Char: " ",
|
||||
ColorSet: &TileColorSet{
|
||||
Fg: &PlainColorHolder{255, 220, 220, 250},
|
||||
Fg: &PlainColorHolder{255, 220, 220, 250},
|
||||
Bg: &DanceColorHolder{
|
||||
255,
|
||||
singleColorRing(19),
|
||||
fillColorRing(19, 0, 15, 2),
|
||||
fillColorRing(70, 120, 220, 12),
|
||||
SingleColorRing(19),
|
||||
FillColorRing(19, 0, 15, 2),
|
||||
FillColorRing(70, 120, 220, 12),
|
||||
},
|
||||
DarkFg: &PlainColorHolder{255, 30, 20, 50 },
|
||||
DarkFg: &PlainColorHolder{255, 30, 20, 50},
|
||||
DarkBg: &PlainColorHolder{255, 7, 7, 30},
|
||||
},
|
||||
},
|
||||
@ -205,16 +117,16 @@ func NewDeepWaterTile() *Tile {
|
||||
Appearance: &Appearance{
|
||||
Char: " ",
|
||||
ColorSet: &TileColorSet{
|
||||
Fg: &PlainColorHolder{255, 220, 220, 250},
|
||||
Fg: &PlainColorHolder{255, 220, 220, 250},
|
||||
Bg: &DanceColorHolder{
|
||||
255,
|
||||
singleColorRing(5),
|
||||
fillColorRing(2,2,42,4),
|
||||
fillColorRing(154, 150, 229, 12),
|
||||
SingleColorRing(5),
|
||||
FillColorRing(2, 2, 42, 4),
|
||||
FillColorRing(154, 150, 229, 12),
|
||||
},
|
||||
DarkFg: &PlainColorHolder{255, 30, 20, 50},
|
||||
DarkBg: &PlainColorHolder{255, 7, 7, 30},
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user