merge changes

This commit is contained in:
anton.gurov 2019-11-05 12:43:06 +03:00
parent e9dec9ac0a
commit 284cdc5315
3 changed files with 31 additions and 4 deletions

View File

@ -62,10 +62,34 @@ func main() {
setupLayers(mw)
level := gamemap.NewLevel(mainCtx, "test", 1)
level = mapgens.DefaultGen(level)
vp := mainwindow.NewViewPort(40, 0, 60, 47, level, mw.GetLayer("base"))
vp.Render()
//fixme
level, rooms := mapgens.DefaultGen(gamemap.NewLevel(mainCtx, "test", 1))
State.Level = level
vp := mainwindow.NewViewPort(30, 0, 70, 47, mw.GetLayer("base"))
screenMgr := types.NewScreenManager(mainCtx)
screenMgr.AddScreen("title", &screens.TitleScreen{})
screenMgr.AddScreen("game", screens.NewGameScreen(mw, &State, vp))
screenMgr.SetScreenByName("game")
//fixme
//player := &mob.Player{
// Mob: mob.Mob{
// Appearance: &types.Appearance{
// Glyph: &types.PlainGlyphHolder{"@"},
// ColorSet: &types.TileColorSet{
// Fg: &types.PlainColorHolder{255, 255, 255, 255},
// },
// },
// Coords: rooms[0].Center,
// BlocksPass: true,
// },
//}
//State.Player = player
//vp.PlayerCoords = player.Coords
//vp.Render(&State)
go decodeInput(mainCtx, mw.GetLayer("base"))
go vp.Listen(State)

View File

@ -6,6 +6,8 @@ import (
"math"
)
//fixme store separate FovMap, add method IsInMap to it
type FieldOfVision struct {
cosTable map[int]float64
sinTable map[int]float64

View File

@ -54,6 +54,7 @@ func NewLevel(ctx util.ClientCtx, branch string, depth int) *Level {
Depth: depth,
Rect: types.NewRect(0,0, mapWidth, mapHeight),
}
l.Tiles = make([]*Tile, l.W*l.H)
ctx.Logger().Debug().Msgf("Generating level of branch %s depth %d", branch, depth)
return l