HAXXX: make the main game UI appear at the bottom
This commit is contained in:
@@ -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 {
|
||||
|
@@ -67,7 +67,7 @@ func (d *Driver) buildNoninteractive(p *menus.Properties) (*noninteractive, erro
|
||||
ni := &noninteractive{
|
||||
locator: p.Locator,
|
||||
frames: animation{sprite.Image},
|
||||
rect: sprite.Rect,
|
||||
rect: sprite.Rect.Add(p.Point()),
|
||||
}
|
||||
|
||||
return ni, nil
|
||||
@@ -154,7 +154,7 @@ func (d *Driver) buildAnimationSample(p *menus.Properties) (*noninteractive, *Wi
|
||||
locator: p.Locator,
|
||||
frames: animation(frames),
|
||||
hoverImpl: hoverImpl{text: p.Text},
|
||||
rect: sprite.Rect,
|
||||
rect: sprite.Rect.Add(p.Point()),
|
||||
}
|
||||
|
||||
widget := &Widget{
|
||||
@@ -187,7 +187,7 @@ func (d *Driver) buildAnimationHover(p *menus.Properties) (*animationHover, *Wid
|
||||
locator: p.Locator,
|
||||
frames: animation(enterFrames),
|
||||
hoverImpl: hoverImpl{text: p.Text},
|
||||
rect: sprite.Rect,
|
||||
rect: sprite.Rect.Add(p.Point()),
|
||||
},
|
||||
|
||||
exitFrames: animation(exitFrames),
|
||||
|
@@ -20,6 +20,8 @@ type checkbox struct {
|
||||
type slider struct {
|
||||
locator string
|
||||
|
||||
rect image.Rectangle
|
||||
|
||||
baseSpr *assetstore.Sprite
|
||||
clickSpr *assetstore.Sprite
|
||||
sliderSpr *assetstore.Sprite
|
||||
@@ -42,6 +44,7 @@ func (d *Driver) buildCheckbox(p *menus.Properties) (*checkbox, *Widget, error)
|
||||
checkbox := &checkbox{
|
||||
button: button{
|
||||
locator: p.Locator,
|
||||
rect: sprites[0].Rect.Add(p.Point()),
|
||||
baseSpr: sprites[0], // unchecked
|
||||
clickSpr: sprites[2], // checked
|
||||
frozenSpr: sprites[1], // disabled
|
||||
@@ -71,6 +74,7 @@ func (d *Driver) buildSlider(p *menus.Properties) (*slider, *Widget, error) {
|
||||
|
||||
slider := &slider{
|
||||
locator: p.Locator,
|
||||
rect: sprites[0].Rect.Add(p.Point()),
|
||||
baseSpr: sprites[0],
|
||||
clickSpr: sprites[1],
|
||||
sliderSpr: sprites[2],
|
||||
@@ -115,7 +119,7 @@ func (s *slider) id() string {
|
||||
|
||||
// The bounds of the slider are the whole thing
|
||||
func (s *slider) bounds() image.Rectangle {
|
||||
return s.baseSpr.Rect
|
||||
return s.rect
|
||||
}
|
||||
|
||||
func (s *slider) registerMouseClick() {
|
||||
|
Reference in New Issue
Block a user