Some small visual fixes.
- Smaller font for menus/steps. - Changed level a bit. - Updated lava brick texture.
This commit is contained in:
parent
cc59236689
commit
cc58dbd06f
@ -67,7 +67,7 @@ func (g *game) loadFonts() error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = g.ui.Fonts().LoadFonts(alui.FontDescription{Path: openSansPath, Name: "default", Size: 36})
|
||||
err = g.ui.Fonts().LoadFonts(alui.FontDescription{Path: openSansPath, Name: "default", Size: 32})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -88,15 +88,18 @@ func (l *playLevel) Enter(ctx *Context) error {
|
||||
func (l *playLevel) Leave() {}
|
||||
|
||||
func (l *playLevel) posToScreen(p geom.Point) geom.PointF32 {
|
||||
return l.posToScreenF32(p.ToF32())
|
||||
return l.posToScreenF32(p.ToF32(), 0)
|
||||
}
|
||||
|
||||
func (l *playLevel) posToScreenF32(p geom.PointF32) geom.PointF32 {
|
||||
pos := p.Add2D(.5, .5)
|
||||
pos = geom.PtF32(pos.X*100-pos.Y*50, pos.Y*40)
|
||||
func (l *playLevel) posToScreenF32(p geom.PointF32, z float32) geom.PointF32 {
|
||||
pos := l.posToCabinet(p.Add2D(.5, .5)).Add2D(0, z)
|
||||
return pos.Mul(l.scale).Add(l.offset)
|
||||
}
|
||||
|
||||
func (l *playLevel) posToCabinet(p geom.PointF32) geom.PointF32 {
|
||||
return geom.PtF32(p.X*100-p.Y*50, p.Y*40)
|
||||
}
|
||||
|
||||
// <- 150->
|
||||
// <-100->
|
||||
//
|
||||
@ -113,11 +116,10 @@ func (l *playLevel) posToScreenF32(p geom.PointF32) geom.PointF32 {
|
||||
|
||||
func (l *playLevel) Layout(ctx *alui.Context, bounds geom.RectangleF32) {
|
||||
l.scale = bounds.Dy() / 1080
|
||||
l.offset = geom.PointF32{}
|
||||
|
||||
level := l.state.Level()
|
||||
tilesCenter := geom.PtF32(.5*float32(level.width), .5*float32(level.height))
|
||||
tilesCenter = geom.PtF32(tilesCenter.X*100-tilesCenter.Y*25, tilesCenter.Y*40)
|
||||
tilesCenter = geom.PtF32(tilesCenter.X*l.scale, tilesCenter.Y*l.scale)
|
||||
tilesCenter := l.posToScreenF32(geom.PtF32(.5*float32(level.width), .5*float32(level.height)), 0)
|
||||
center := bounds.Center()
|
||||
l.offset = geom.PtF32(center.X-tilesCenter.X, center.Y-tilesCenter.Y)
|
||||
|
||||
@ -163,10 +165,10 @@ func (l *playLevel) Handle(e allg5.Event) {
|
||||
}
|
||||
|
||||
func (l *playLevel) drawSpritePart(name, partName string, pos geom.PointF32) {
|
||||
l.drawSpritePartOffset(name, partName, pos, geom.PointF32{})
|
||||
l.drawSpritePartOffset(name, partName, pos, 0)
|
||||
}
|
||||
|
||||
func (l *playLevel) drawSpritePartOffset(name, partName string, pos, offset geom.PointF32) {
|
||||
func (l *playLevel) drawSpritePartOffset(name, partName string, pos geom.PointF32, z float32) {
|
||||
sprite, ok := l.ctx.Sprites[name]
|
||||
if !ok {
|
||||
return
|
||||
@ -185,7 +187,7 @@ func (l *playLevel) drawSpritePartOffset(name, partName string, pos, offset geom
|
||||
scale *= 1. / part.scale
|
||||
}
|
||||
anchor := part.sub.Min.Sub(part.anchor).ToF32().Mul(scale)
|
||||
scrPos := l.posToScreenF32(pos).Add(anchor).Add(offset.Mul(100 * l.scale))
|
||||
scrPos := l.posToScreenF32(pos, z).Add(anchor)
|
||||
left, top := scrPos.X, scrPos.Y
|
||||
partText.DrawOptions(left, top, allg5.DrawOptions{Scale: allg5.NewUniformScale(scale)})
|
||||
}
|
||||
@ -204,7 +206,7 @@ func (l *playLevel) Render(ctx *alui.Context, bounds geom.RectangleF32) {
|
||||
case tileMagma:
|
||||
l.drawSpritePart("magma", "magma", pos.ToF32())
|
||||
if l.state.IsFilledUp(pos) {
|
||||
l.drawSpritePartOffset("brick", "brick", pos.ToF32(), geom.PtF32(0, .8))
|
||||
l.drawSpritePartOffset("brick", "brick", pos.ToF32(), .8)
|
||||
l.drawSpritePart("magma", "sunken_overlay", pos.ToF32())
|
||||
}
|
||||
}
|
||||
|
@ -1,11 +1,11 @@
|
||||
level:
|
||||
._._._._._._._._._._
|
||||
._#_#_#_#_._._._._._
|
||||
._#_#_._#B._._._._._
|
||||
._#_#_#_#_._._._._._
|
||||
._#_#_._#B._._._._._
|
||||
._#_#_#_#_~_~_~_#_._
|
||||
._#_#_._#B~_~_#_#_._
|
||||
._#_#_#_#_~_~_~_#_._
|
||||
._#_#_._#B~_~_#_#_._
|
||||
._#@#_#_#_~_~_#_#X._
|
||||
._#_#_~_~_~_#_#_#_._
|
||||
._#_#_~_#_#_#_#_#_._
|
||||
._#_#_~_~_~_#_#_#_._
|
||||
._._._._._._._._._._
|
||||
:level
|
Binary file not shown.
Before Width: | Height: | Size: 310 KiB After Width: | Height: | Size: 319 KiB |
Loading…
Reference in New Issue
Block a user