Window Focus Bugfixes
* Fix the Doodad Dropper and Registration windows not stealing the focus when they are opened via menu bars. * Bugfixes in gamepad support: stop at the first controller found, Draw() to handle controllers going away and hide the mouse cursor
This commit is contained in:
parent
4de0126b19
commit
0fc046250e
|
@ -427,7 +427,7 @@ func (s *EditorScene) Loop(d *Doodle, ev *event.State) error {
|
|||
s.UI.Canvas.Tool = drawtool.EraserTool
|
||||
s.UI.activeTool = s.UI.Canvas.Tool.String()
|
||||
} else if keybind.DoodadDropper(ev) {
|
||||
s.UI.doodadWindow.Show()
|
||||
s.UI.OpenDoodadDropper()
|
||||
}
|
||||
|
||||
s.UI.Loop(ev)
|
||||
|
|
|
@ -246,7 +246,7 @@ func (u *EditorUI) SetupMenuBar(d *Doodle) *ui.MenuBar {
|
|||
if u.Scene.DrawingType == enum.LevelDrawing {
|
||||
toolMenu.AddItemAccel("Doodads", "q", func() {
|
||||
log.Info("Open the DoodadDropper")
|
||||
u.doodadWindow.Show()
|
||||
u.OpenDoodadDropper()
|
||||
})
|
||||
toolMenu.AddItem("Link Tool", func() {
|
||||
u.Canvas.Tool = drawtool.LinkTool
|
||||
|
@ -267,6 +267,7 @@ func (u *EditorUI) SetupMenuBar(d *Doodle) *ui.MenuBar {
|
|||
}
|
||||
helpMenu.AddItem(registerText, func() {
|
||||
u.licenseWindow.Show()
|
||||
u.Supervisor.FocusWindow(u.licenseWindow)
|
||||
})
|
||||
|
||||
menu.Supervise(u.Supervisor)
|
||||
|
|
|
@ -46,6 +46,7 @@ func (u *EditorUI) OpenDoodadDropper() {
|
|||
// NOTE: most places in the code call this directly, nice
|
||||
// and simple window :) but OpenDoodadDropper() added for consistency.
|
||||
u.doodadWindow.Show()
|
||||
u.Supervisor.FocusWindow(u.doodadWindow)
|
||||
}
|
||||
|
||||
// OpenPublishWindow opens the Publisher window.
|
||||
|
|
|
@ -110,7 +110,7 @@ func (u *EditorUI) SetupToolbar(d *Doodle) *ui.Frame {
|
|||
Style: &balance.ButtonBabyBlue,
|
||||
Click: func() {
|
||||
u.Canvas.Tool = drawtool.ActorTool
|
||||
u.doodadWindow.Show()
|
||||
u.OpenDoodadDropper()
|
||||
d.Flash("Actor Tool selected. Drag a Doodad from the drawer into your level.")
|
||||
},
|
||||
},
|
||||
|
|
|
@ -126,6 +126,7 @@ func Loop(ev *event.State) {
|
|||
for idx, ctrl := range ev.Controllers {
|
||||
SetControllerIndex(idx)
|
||||
log.Info("gamepad: using controller #%d (%s) as Player 1", idx, ctrl)
|
||||
break
|
||||
}
|
||||
} else {
|
||||
return
|
||||
|
@ -377,7 +378,7 @@ func Loop(ev *event.State) {
|
|||
|
||||
// Draw the cursor on screen if the game controller is emulating a mouse.
|
||||
func Draw(e render.Engine) {
|
||||
if p1mode != MouseMode || !cursorVisible {
|
||||
if playerOne == nil || p1mode != MouseMode || !cursorVisible {
|
||||
return
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user