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

@@ -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() {