PlayScene: Set the Edit Button's position correctly

This commit is contained in:
Noah 2019-12-29 00:01:47 -08:00
parent b924ea9467
commit c08a1bc13e
2 changed files with 50 additions and 49 deletions

View File

@ -136,7 +136,7 @@ func (s *MenuScene) setupNewWindow(d *Doodle) error {
{
frame := ui.NewFrame("New Level Frame")
window.Pack(frame, ui.Pack{
Side: ui.N,
Side: ui.N,
Fill: true,
Expand: true,
})
@ -150,14 +150,14 @@ func (s *MenuScene) setupNewWindow(d *Doodle) error {
Font: balance.LabelFont,
})
frame.Pack(label1, ui.Pack{
Side: ui.N,
FillX: true,
Side: ui.N,
FillX: true,
})
typeFrame := ui.NewFrame("Page Type Options Frame")
frame.Pack(typeFrame, ui.Pack{
Side: ui.N,
FillX: true,
Side: ui.N,
FillX: true,
})
type typeObj struct {
@ -197,7 +197,7 @@ func (s *MenuScene) setupNewWindow(d *Doodle) error {
s.Supervisor.Add(radio)
typeFrame.Pack(radio, ui.Pack{
Side: ui.W,
PadX: 4,
PadX: 4,
})
}(t)
}
@ -211,14 +211,14 @@ func (s *MenuScene) setupNewWindow(d *Doodle) error {
Font: balance.LabelFont,
})
frame.Pack(label2, ui.Pack{
Side: ui.N,
FillX: true,
Side: ui.N,
FillX: true,
})
wpFrame := ui.NewFrame("Wallpaper Frame")
frame.Pack(wpFrame, ui.Pack{
Side: ui.N,
FillX: true,
Side: ui.N,
FillX: true,
})
type wallpaperObj struct {
@ -247,7 +247,7 @@ func (s *MenuScene) setupNewWindow(d *Doodle) error {
s.Supervisor.Add(radio)
wpFrame.Pack(radio, ui.Pack{
Side: ui.W,
PadX: 4,
PadX: 4,
})
}(t)
}
@ -264,9 +264,9 @@ func (s *MenuScene) setupNewWindow(d *Doodle) error {
// })
// bottomFrame.SetBackground(render.Grey)
frame.Pack(bottomFrame, ui.Pack{
Side: ui.N,
FillX: true,
PadY: 8,
Side: ui.N,
FillX: true,
PadY: 8,
})
var buttons = []struct {
@ -310,8 +310,8 @@ func (s *MenuScene) setupNewWindow(d *Doodle) error {
s.Supervisor.Add(btn)
bottomFrame.Pack(btn, ui.Pack{
Side: ui.W,
PadX: 4,
PadY: 8,
PadX: 4,
PadY: 8,
})
}
}
@ -333,7 +333,7 @@ func (s *MenuScene) setupLoadWindow(d *Doodle) error {
{
frame := ui.NewFrame("Open Drawing Frame")
window.Pack(frame, ui.Pack{
Side: ui.N,
Side: ui.N,
Fill: true,
Expand: true,
})
@ -347,8 +347,8 @@ func (s *MenuScene) setupLoadWindow(d *Doodle) error {
Font: balance.LabelFont,
})
frame.Pack(label1, ui.Pack{
Side: ui.N,
FillX: true,
Side: ui.N,
FillX: true,
})
// Get the user's levels.
@ -360,9 +360,9 @@ func (s *MenuScene) setupLoadWindow(d *Doodle) error {
lvlRow := ui.NewFrame("Level Row 0")
frame.Pack(lvlRow, ui.Pack{
Side: ui.N,
FillX: true,
PadY: 1,
Side: ui.N,
FillX: true,
PadY: 1,
})
for i, lvl := range levels {
func(i int, lvl string) {
@ -380,7 +380,7 @@ func (s *MenuScene) setupLoadWindow(d *Doodle) error {
})
s.Supervisor.Add(btn)
lvlRow.Pack(btn, ui.Pack{
Side: ui.W,
Side: ui.W,
Expand: true,
Fill: true,
})
@ -389,9 +389,9 @@ func (s *MenuScene) setupLoadWindow(d *Doodle) error {
log.Warn("i=%d wrapped at mod 4", i)
lvlRow = ui.NewFrame(fmt.Sprintf("Level Row %d", i))
frame.Pack(lvlRow, ui.Pack{
Side: ui.N,
FillX: true,
PadY: 1,
Side: ui.N,
FillX: true,
PadY: 1,
})
}
}(i, lvl)
@ -409,16 +409,16 @@ func (s *MenuScene) setupLoadWindow(d *Doodle) error {
Font: balance.LabelFont,
})
frame.Pack(label2, ui.Pack{
Side: ui.N,
FillX: true,
Side: ui.N,
FillX: true,
})
files, _ := userdir.ListDoodads()
ddRow := ui.NewFrame("Doodad Row 0")
frame.Pack(ddRow, ui.Pack{
Side: ui.N,
FillX: true,
PadY: 1,
Side: ui.N,
FillX: true,
PadY: 1,
})
for i, dd := range files {
func(i int, dd string) {
@ -431,7 +431,7 @@ func (s *MenuScene) setupLoadWindow(d *Doodle) error {
})
s.Supervisor.Add(btn)
ddRow.Pack(btn, ui.Pack{
Side: ui.W,
Side: ui.W,
Expand: true,
Fill: true,
})
@ -439,9 +439,9 @@ func (s *MenuScene) setupLoadWindow(d *Doodle) error {
if i > 0 && (i+1)%4 == 0 {
ddRow = ui.NewFrame(fmt.Sprintf("Doodad Row %d", i))
frame.Pack(ddRow, ui.Pack{
Side: ui.N,
FillX: true,
PadY: 1,
Side: ui.N,
FillX: true,
PadY: 1,
})
}
}(i, dd)
@ -460,9 +460,9 @@ func (s *MenuScene) setupLoadWindow(d *Doodle) error {
// })
// bottomFrame.SetBackground(render.Grey)
frame.Pack(bottomFrame, ui.Pack{
Side: ui.N,
FillX: true,
PadY: 8,
Side: ui.N,
FillX: true,
PadY: 8,
})
var buttons = []struct {
@ -482,8 +482,8 @@ func (s *MenuScene) setupLoadWindow(d *Doodle) error {
s.Supervisor.Add(btn)
bottomFrame.Pack(btn, ui.Pack{
Side: ui.W,
PadX: 4,
PadY: 8,
PadX: 4,
PadY: 8,
})
}
}

View File

@ -199,7 +199,7 @@ func (s *PlayScene) SetupAlertbox() {
{
frame := ui.NewFrame("Open Drawing Frame")
window.Pack(frame, ui.Pack{
Side: ui.N,
Side: ui.N,
Fill: true,
Expand: true,
})
@ -213,9 +213,9 @@ func (s *PlayScene) SetupAlertbox() {
Font: balance.LabelFont,
})
frame.Pack(s.alertBoxLabel, ui.Pack{
Side: ui.N,
FillX: true,
PadY: 16,
Side: ui.N,
FillX: true,
PadY: 16,
})
/******************
@ -224,9 +224,9 @@ func (s *PlayScene) SetupAlertbox() {
bottomFrame := ui.NewFrame("Button Frame")
frame.Pack(bottomFrame, ui.Pack{
Side: ui.N,
FillX: true,
PadY: 8,
Side: ui.N,
FillX: true,
PadY: 8,
})
// Button factory for the various options.
@ -240,7 +240,7 @@ func (s *PlayScene) SetupAlertbox() {
})
bottomFrame.Pack(btn, ui.Pack{
Side: ui.W,
PadX: 2,
PadX: 2,
})
s.supervisor.Add(btn)
btn.Hide() // all buttons hidden by default
@ -362,10 +362,11 @@ func (s *PlayScene) Draw(d *Doodle) error {
size = s.editButton.Size()
padding = 8
)
s.editButton.Present(d.Engine, render.Point{
s.editButton.MoveTo(render.Point{
X: canSize.W - size.W - padding,
Y: canSize.H - size.H - padding,
})
s.editButton.Present(d.Engine, s.editButton.Point())
// Draw the alert box window.
if !s.alertBox.Hidden() {