HAXXX: make the main game UI appear at the bottom

This commit is contained in:
2020-04-19 20:57:45 +01:00
parent c058f651dc
commit 1f4bfc771c
6 changed files with 83 additions and 19 deletions

View File

@@ -13,6 +13,8 @@ import (
type button struct {
locator string
rect image.Rectangle
baseSpr *assetstore.Sprite
clickSpr *assetstore.Sprite
frozenSpr *assetstore.Sprite
@@ -37,6 +39,7 @@ func (d *Driver) buildButton(p *menus.Properties) (*button, *Widget, error) {
btn := &button{
locator: p.Locator,
rect: sprites[0].Rect.Add(p.Point()),
baseSpr: sprites[0],
clickSpr: sprites[1],
frozenSpr: sprites[2],
@@ -44,6 +47,7 @@ func (d *Driver) buildButton(p *menus.Properties) (*button, *Widget, error) {
}
widget := &Widget{
Locator: p.Locator,
Active: p.Active,
ownClickables: []clickable{btn},
ownFreezables: []freezable{btn},
@@ -69,6 +73,7 @@ func (d *Driver) buildMainButton(p *menus.Properties) (*mainButton, *Widget, err
hoverAnim: animation(hovers),
button: button{
locator: p.Locator,
rect: sprites[0].Rect.Add(p.Point()),
baseSpr: sprites[0],
clickSpr: sprites[1],
frozenSpr: sprites[2],
@@ -77,6 +82,7 @@ func (d *Driver) buildMainButton(p *menus.Properties) (*mainButton, *Widget, err
}
widget := &Widget{
Locator: p.Locator,
Active: p.Active,
ownClickables: []clickable{btn},
ownFreezables: []freezable{btn},
@@ -95,6 +101,7 @@ func (d *Driver) buildDoorHotspot(p *menus.Properties) (*button, *Widget, error)
btn := &button{
locator: p.Locator,
rect: sprites[0].Rect.Add(p.Point()),
baseSpr: sprites[0],
clickSpr: sprites[1],
frozenSpr: sprites[0], // No disabled sprite
@@ -102,6 +109,7 @@ func (d *Driver) buildDoorHotspot(p *menus.Properties) (*button, *Widget, error)
}
widget := &Widget{
Locator: p.Locator,
Active: p.Active,
ownClickables: []clickable{btn},
ownFreezables: []freezable{btn},
@@ -118,7 +126,7 @@ func (b *button) id() string {
}
func (b *button) bounds() image.Rectangle {
return b.baseSpr.Rect
return b.rect
}
func (b *button) mouseDownState() bool {