mirror of
https://github.com/JetSetIlly/Gopher2600.git
synced 2024-05-20 05:40:49 -04:00
ROM select show options (all/hidden) available in popup menu
playmode mouse capture inhibited if any popup window is open
This commit is contained in:
parent
467d7e88b8
commit
1850b03ff5
|
@ -74,7 +74,7 @@ type manager struct {
|
|||
screenPos imgui.Vec2
|
||||
|
||||
// is true if mouse over any of the playmode windows
|
||||
playmodeWindowHover bool
|
||||
playmodeCaptureInhibit bool
|
||||
|
||||
// for convenience the dbgScr window gets it's own field
|
||||
//
|
||||
|
@ -152,14 +152,19 @@ func (wm *manager) draw() {
|
|||
case govern.ModePlay:
|
||||
// reset playmodeHover flag by default. it's only ever true if a window is open (and that
|
||||
// window is being hovered over)
|
||||
wm.playmodeWindowHover = false
|
||||
wm.playmodeCaptureInhibit = false
|
||||
|
||||
// playmode draws the screen and other windows that have been listed
|
||||
// as being safe to draw in playmode
|
||||
for _, w := range wm.playmodeWindows {
|
||||
_ = w.playmodeDraw()
|
||||
wm.playmodeWindowHover = wm.playmodeWindowHover || w.playmodeGeometry().hovered
|
||||
if w.playmodeDraw() {
|
||||
wm.playmodeCaptureInhibit = wm.playmodeCaptureInhibit || w.playmodeGeometry().hovered
|
||||
}
|
||||
}
|
||||
|
||||
// inhibit playmode capture if any popup is open
|
||||
wm.playmodeCaptureInhibit = wm.playmodeCaptureInhibit || imgui.IsPopupOpenV("", imgui.PopupFlagsAnyPopup)
|
||||
|
||||
case govern.ModeDebugger:
|
||||
// see commentary for screenPos in windowManager declaration
|
||||
wm.screenPos = imgui.WindowPos()
|
||||
|
|
|
@ -136,14 +136,12 @@ func (wm *manager) toggleOpen(winID string) bool {
|
|||
}
|
||||
w.playmodeSetOpen(!w.playmodeIsOpen())
|
||||
return w.playmodeIsOpen()
|
||||
} else {
|
||||
w, ok := wm.debuggerWindows[winID]
|
||||
if !ok {
|
||||
return false
|
||||
}
|
||||
w.debuggerSetOpen(!w.debuggerIsOpen())
|
||||
return w.debuggerIsOpen()
|
||||
}
|
||||
|
||||
return false
|
||||
w, ok := wm.debuggerWindows[winID]
|
||||
if !ok {
|
||||
return false
|
||||
}
|
||||
w.debuggerSetOpen(!w.debuggerIsOpen())
|
||||
return w.debuggerIsOpen()
|
||||
}
|
||||
|
|
|
@ -174,7 +174,7 @@ func (img *SdlImgui) Service() {
|
|||
}
|
||||
} else if img.isPlaymode() {
|
||||
// set mouse capture if mouse is not over a window
|
||||
if !img.wm.playmodeWindowHover {
|
||||
if !img.wm.playmodeCaptureInhibit {
|
||||
img.setCapture(true)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -56,8 +56,8 @@ type winSelectROM struct {
|
|||
// properties of selected
|
||||
selectedProperties properties.Entry
|
||||
|
||||
showAllFiles bool
|
||||
showHidden bool
|
||||
showAll bool
|
||||
showHidden bool
|
||||
|
||||
scrollToTop bool
|
||||
centreOnFile bool
|
||||
|
@ -91,7 +91,7 @@ const namedBoxarts = "Named_Boxarts"
|
|||
func newSelectROM(img *SdlImgui) (window, error) {
|
||||
win := &winSelectROM{
|
||||
img: img,
|
||||
showAllFiles: false,
|
||||
showAll: false,
|
||||
showHidden: false,
|
||||
scrollToTop: true,
|
||||
centreOnFile: true,
|
||||
|
@ -252,6 +252,8 @@ func (win *winSelectROM) render() {
|
|||
}
|
||||
|
||||
func (win *winSelectROM) draw() {
|
||||
imgui.BeginGroup()
|
||||
|
||||
// check for new property information
|
||||
select {
|
||||
case win.selectedProperties = <-win.propertyResult:
|
||||
|
@ -345,9 +347,9 @@ func (win *winSelectROM) draw() {
|
|||
continue
|
||||
}
|
||||
|
||||
// ignore invalid file extensions unless showAllFiles flags is set
|
||||
// ignore invalid file extensions unless showAll flags is set
|
||||
ext := strings.ToUpper(filepath.Ext(e.Name))
|
||||
if !win.showAllFiles {
|
||||
if !win.showAll {
|
||||
hasExt := false
|
||||
for _, e := range cartridgeloader.FileExtensions {
|
||||
if e == ext {
|
||||
|
@ -588,12 +590,22 @@ func (win *winSelectROM) draw() {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
imgui.Spacing()
|
||||
imgui.Checkbox("Show All", &win.showAllFiles)
|
||||
imgui.SameLine()
|
||||
imgui.Checkbox("Show Hidden", &win.showHidden)
|
||||
})
|
||||
|
||||
imgui.EndGroup()
|
||||
|
||||
const romSelectPopupID = "romSelectPopupID"
|
||||
if imgui.IsItemHovered() && imgui.IsMouseDown(1) {
|
||||
imgui.OpenPopup(romSelectPopupID)
|
||||
}
|
||||
|
||||
if imgui.BeginPopup(romSelectPopupID) {
|
||||
imgui.Text("Show Options")
|
||||
imguiSeparator()
|
||||
imgui.Checkbox("All Files", &win.showAll)
|
||||
imgui.Checkbox("Hidden", &win.showHidden)
|
||||
imgui.EndPopup()
|
||||
}
|
||||
}
|
||||
|
||||
func (win *winSelectROM) insertCartridge() {
|
||||
|
|
Loading…
Reference in a new issue