From 5d7a07479c6630f55c2760f900e66b8922f3f34d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Andr=C3=A9=20Santoni?= Date: Sun, 2 Aug 2020 20:15:50 +0700 Subject: [PATCH 01/52] Home page layout --- menu/hints.go | 14 +- menu/menu.go | 2 + menu/scene.go | 18 +- menu/scene_core_options.go | 13 +- menu/scene_history.go | 13 +- menu/scene_keyboard.go | 17 +- menu/scene_playlist.go | 13 +- menu/scene_savestates.go | 15 +- menu/scene_settings.go | 15 +- menu/scene_tabs.go | 461 ++++++++++++++++++++----------------- menu/scene_wifi.go | 11 +- 11 files changed, 326 insertions(+), 266 deletions(-) diff --git a/menu/hints.go b/menu/hints.go index e6809d9f..5eed6fcf 100644 --- a/menu/hints.go +++ b/menu/hints.go @@ -8,17 +8,17 @@ import ( // Used to easily compose different hint bars based on the context. func stackHint(stack *float32, icon uint32, label string, h int) { - c := video.Color{R: 0.25, G: 0.25, B: 0.25, A: 1} - vid.Font.SetColor(0.25, 0.25, 0.25, 1.0) - *stack += 30 * menu.ratio - vid.DrawImage(icon, *stack, float32(h)-70*menu.ratio, 70*menu.ratio, 70*menu.ratio, 1.0, c) - *stack += 70 * menu.ratio - vid.Font.Printf(*stack, float32(h)-23*menu.ratio, 0.4*menu.ratio, label) + c := video.Color{R: 0.28, G: 0.28, B: 0.28, A: 1} + vid.Font.SetColor(0.28, 0.28, 0.28, 1.0) + vid.DrawImage(icon, *stack, float32(h)-88*menu.ratio, 88*menu.ratio, 88*menu.ratio, 1.0, c) + *stack += 80 * menu.ratio + vid.Font.Printf(*stack, float32(h)-30*menu.ratio, 0.5*menu.ratio, label) *stack += vid.Font.Width(0.4*menu.ratio, label) + *stack += 32 * menu.ratio } func hintIcons() (arrows, upDown, leftRight, a, b, x, y, start, slct, guide uint32) { - if glfw.Joystick(0).Present() && input.HasBinding(glfw.Joystick(0)) { + if true || glfw.Joystick(0).Present() && input.HasBinding(glfw.Joystick(0)) { return menu.icons["pad-arrows"], menu.icons["pad-up-down"], menu.icons["pad-left-right"], diff --git a/menu/menu.go b/menu/menu.go index 997675fe..c90f19ab 100644 --- a/menu/menu.go +++ b/menu/menu.go @@ -66,6 +66,8 @@ func (m *Menu) Render(dt float32) { if state.Global.CoreRunning { vid.DrawRect(0, 0, float32(w), float32(h), 0, video.Color{R: 0, G: 0, B: 0, A: 0.85}) + } else { + vid.DrawImage(menu.icons["bg"], 0, 0, float32(w), float32(h), 1, video.Color{1, 1, 1, 1}) } m.tweens.Update(dt) diff --git a/menu/scene.go b/menu/scene.go index ee9643a2..22846bf7 100644 --- a/menu/scene.go +++ b/menu/scene.go @@ -10,8 +10,10 @@ import ( // entry is a menu entry. It can also represent a scene. // The menu data is a tree of entries. type entry struct { + alpha float32 yp, scale float32 - width, margin float32 + width, height float32 + margin float32 label, subLabel string path string // full path of the rom linked to the entry system string // name of the game system @@ -20,6 +22,7 @@ type entry struct { iconAlpha float32 tagAlpha float32 subLabelAlpha float32 + borderAlpha float32 callbackOK func() // callback executed when user presses OK value func() interface{} stringValue func() string @@ -230,15 +233,16 @@ func genericRender(list *entry) { func genericDrawHintBar() { w, h := vid.Window.GetFramebufferSize() - vid.DrawRect(0, float32(h)-70*menu.ratio, float32(w), 70*menu.ratio, 0, video.Color{R: 0.75, G: 0.75, B: 0.75, A: 1}) + vid.DrawRect(0, float32(h)-88*menu.ratio, float32(w), 88*menu.ratio, 0, video.Color{R: 1, G: 1, B: 1, A: 1}) + vid.DrawRect(0, float32(h)-88*menu.ratio, float32(w), 2*menu.ratio, 0, video.Color{R: 0.85, G: 0.85, B: 0.85, A: 1}) _, upDown, _, a, b, _, _, _, _, guide := hintIcons() - var stack float32 + stack := float32(96) if state.Global.CoreRunning { - stackHint(&stack, guide, "RESUME", h) + stackHint(&stack, guide, "Resume", h) } - stackHint(&stack, upDown, "NAVIGATE", h) - stackHint(&stack, b, "BACK", h) - stackHint(&stack, a, "OK", h) + stackHint(&stack, upDown, "Navigate", h) + stackHint(&stack, b, "Back", h) + stackHint(&stack, a, "Ok", h) } diff --git a/menu/scene_core_options.go b/menu/scene_core_options.go index 7166d5b5..506e7045 100644 --- a/menu/scene_core_options.go +++ b/menu/scene_core_options.go @@ -82,15 +82,16 @@ func (s *sceneCoreOptions) render() { func (s *sceneCoreOptions) drawHintBar() { w, h := vid.Window.GetFramebufferSize() - vid.DrawRect(0, float32(h)-70*menu.ratio, float32(w), 70*menu.ratio, 0, video.Color{R: 0.75, G: 0.75, B: 0.75, A: 1}) + vid.DrawRect(0, float32(h)-88*menu.ratio, float32(w), 88*menu.ratio, 0, video.Color{R: 1, G: 1, B: 1, A: 1}) + vid.DrawRect(0, float32(h)-88*menu.ratio, float32(w), 2*menu.ratio, 0, video.Color{R: 0.85, G: 0.85, B: 0.85, A: 1}) _, upDown, leftRight, _, b, _, _, _, _, guide := hintIcons() - var stack float32 + stack := float32(96) if state.Global.CoreRunning { - stackHint(&stack, guide, "RESUME", h) + stackHint(&stack, guide, "Resume", h) } - stackHint(&stack, upDown, "NAVIGATE", h) - stackHint(&stack, b, "BACK", h) - stackHint(&stack, leftRight, "SET", h) + stackHint(&stack, upDown, "Navigate", h) + stackHint(&stack, b, "Back", h) + stackHint(&stack, leftRight, "Set", h) } diff --git a/menu/scene_history.go b/menu/scene_history.go index e79c6cc5..22d864b4 100644 --- a/menu/scene_history.go +++ b/menu/scene_history.go @@ -196,15 +196,16 @@ func (s *sceneHistory) render() { func (s *sceneHistory) drawHintBar() { w, h := vid.Window.GetFramebufferSize() - vid.DrawRect(0, float32(h)-70*menu.ratio, float32(w), 70*menu.ratio, 0, video.Color{R: 0.75, G: 0.75, B: 0.75, A: 1}) + vid.DrawRect(0, float32(h)-88*menu.ratio, float32(w), 88*menu.ratio, 0, video.Color{R: 1, G: 1, B: 1, A: 1}) + vid.DrawRect(0, float32(h)-88*menu.ratio, float32(w), 2*menu.ratio, 0, video.Color{R: 0.85, G: 0.85, B: 0.85, A: 1}) _, upDown, _, a, b, _, _, _, _, guide := hintIcons() - var stack float32 + stack := float32(96) if state.Global.CoreRunning { - stackHint(&stack, guide, "RESUME", h) + stackHint(&stack, guide, "Resume", h) } - stackHint(&stack, upDown, "NAVIGATE", h) - stackHint(&stack, b, "BACK", h) - stackHint(&stack, a, "RUN", h) + stackHint(&stack, upDown, "Navigate", h) + stackHint(&stack, b, "Back", h) + stackHint(&stack, a, "Run", h) } diff --git a/menu/scene_keyboard.go b/menu/scene_keyboard.go index 20138688..0500ff4b 100644 --- a/menu/scene_keyboard.go +++ b/menu/scene_keyboard.go @@ -206,15 +206,16 @@ func (s *sceneKeyboard) render() { func (s *sceneKeyboard) drawHintBar() { w, h := vid.Window.GetFramebufferSize() - vid.DrawRect(0, float32(h)-70*menu.ratio, float32(w), 70*menu.ratio, 0, video.Color{R: 0.75, G: 0.75, B: 0.75, A: 1}) + vid.DrawRect(0, float32(h)-88*menu.ratio, float32(w), 88*menu.ratio, 0, video.Color{R: 1, G: 1, B: 1, A: 1}) + vid.DrawRect(0, float32(h)-88*menu.ratio, float32(w), 2*menu.ratio, 0, video.Color{R: 0.85, G: 0.85, B: 0.85, A: 1}) arrows, _, _, a, b, x, y, start, _, _ := hintIcons() - var stack float32 - stackHint(&stack, arrows, "SELECT", h) - stackHint(&stack, b, "BACK", h) - stackHint(&stack, x, "SHIFT", h) - stackHint(&stack, y, "DELETE", h) - stackHint(&stack, a, "INSERT", h) - stackHint(&stack, start, "DONE", h) + stack := float32(96) + stackHint(&stack, arrows, "Select", h) + stackHint(&stack, b, "Back", h) + stackHint(&stack, x, "Shift", h) + stackHint(&stack, y, "Delete", h) + stackHint(&stack, a, "Insert", h) + stackHint(&stack, start, "Done", h) } diff --git a/menu/scene_playlist.go b/menu/scene_playlist.go index f8744b9b..a9ade8df 100644 --- a/menu/scene_playlist.go +++ b/menu/scene_playlist.go @@ -217,15 +217,16 @@ func (s *scenePlaylist) render() { func (s *scenePlaylist) drawHintBar() { w, h := vid.Window.GetFramebufferSize() - vid.DrawRect(0, float32(h)-70*menu.ratio, float32(w), 70*menu.ratio, 0, video.Color{R: 0.75, G: 0.75, B: 0.75, A: 1}) + vid.DrawRect(0, float32(h)-88*menu.ratio, float32(w), 88*menu.ratio, 0, video.Color{R: 1, G: 1, B: 1, A: 1}) + vid.DrawRect(0, float32(h)-88*menu.ratio, float32(w), 2*menu.ratio, 0, video.Color{R: 0.85, G: 0.85, B: 0.85, A: 1}) _, upDown, _, a, b, _, _, _, _, guide := hintIcons() - var stack float32 + stack := float32(96) if state.Global.CoreRunning { - stackHint(&stack, guide, "RESUME", h) + stackHint(&stack, guide, "Resume", h) } - stackHint(&stack, upDown, "NAVIGATE", h) - stackHint(&stack, b, "BACK", h) - stackHint(&stack, a, "RUN", h) + stackHint(&stack, upDown, "Navigate", h) + stackHint(&stack, b, "Back", h) + stackHint(&stack, a, "Run", h) } diff --git a/menu/scene_savestates.go b/menu/scene_savestates.go index ae4c44ee..dfc50588 100644 --- a/menu/scene_savestates.go +++ b/menu/scene_savestates.go @@ -142,21 +142,22 @@ func (s *sceneSavestates) render() { func (s *sceneSavestates) drawHintBar() { w, h := vid.Window.GetFramebufferSize() - vid.DrawRect(0, float32(h)-70*menu.ratio, float32(w), 70*menu.ratio, 0, video.Color{R: 0.75, G: 0.75, B: 0.75, A: 1}) + vid.DrawRect(0, float32(h)-88*menu.ratio, float32(w), 88*menu.ratio, 0, video.Color{R: 1, G: 1, B: 1, A: 1}) + vid.DrawRect(0, float32(h)-88*menu.ratio, float32(w), 2*menu.ratio, 0, video.Color{R: 0.85, G: 0.85, B: 0.85, A: 1}) ptr := menu.stack[len(menu.stack)-1].Entry().ptr _, upDown, _, a, b, _, _, _, _, guide := hintIcons() - var stack float32 + stack := float32(96) if state.Global.CoreRunning { - stackHint(&stack, guide, "RESUME", h) + stackHint(&stack, guide, "Resume", h) } - stackHint(&stack, upDown, "NAVIGATE", h) - stackHint(&stack, b, "BACK", h) + stackHint(&stack, upDown, "Navigate", h) + stackHint(&stack, b, "Back", h) if ptr == 0 { - stackHint(&stack, a, "SAVE", h) + stackHint(&stack, a, "Save", h) } else { - stackHint(&stack, a, "LOAD", h) + stackHint(&stack, a, "Load", h) } } diff --git a/menu/scene_settings.go b/menu/scene_settings.go index 7509edca..3f9ae318 100644 --- a/menu/scene_settings.go +++ b/menu/scene_settings.go @@ -270,20 +270,21 @@ func (s *sceneSettings) render() { func (s *sceneSettings) drawHintBar() { w, h := vid.Window.GetFramebufferSize() - vid.DrawRect(0, float32(h)-70*menu.ratio, float32(w), 70*menu.ratio, 0, video.Color{R: 0.75, G: 0.75, B: 0.75, A: 1}) + vid.DrawRect(0, float32(h)-88*menu.ratio, float32(w), 88*menu.ratio, 0, video.Color{R: 1, G: 1, B: 1, A: 1}) + vid.DrawRect(0, float32(h)-88*menu.ratio, float32(w), 2*menu.ratio, 0, video.Color{R: 0.85, G: 0.85, B: 0.85, A: 1}) _, upDown, leftRight, a, b, _, _, _, _, guide := hintIcons() - var stack float32 + stack := float32(96) list := menu.stack[len(menu.stack)-1].Entry() if state.Global.CoreRunning { - stackHint(&stack, guide, "RESUME", h) + stackHint(&stack, guide, "Resume", h) } - stackHint(&stack, upDown, "NAVIGATE", h) - stackHint(&stack, b, "BACK", h) + stackHint(&stack, upDown, "Navigate", h) + stackHint(&stack, b, "Back", h) if list.children[list.ptr].callbackOK != nil { - stackHint(&stack, a, "SET", h) + stackHint(&stack, a, "Set", h) } else { - stackHint(&stack, leftRight, "SET", h) + stackHint(&stack, leftRight, "Set", h) } } diff --git a/menu/scene_tabs.go b/menu/scene_tabs.go index 899f13a7..2e2fc546 100644 --- a/menu/scene_tabs.go +++ b/menu/scene_tabs.go @@ -1,19 +1,17 @@ package menu import ( - "fmt" - "os/user" + "math" "sort" "github.com/libretro/ludo/audio" + "github.com/libretro/ludo/history" "github.com/libretro/ludo/input" "github.com/libretro/ludo/libretro" "github.com/libretro/ludo/playlists" - "github.com/libretro/ludo/scanner" "github.com/libretro/ludo/state" "github.com/libretro/ludo/utils" "github.com/libretro/ludo/video" - colorful "github.com/lucasb-eyer/go-colorful" "github.com/tanema/gween" "github.com/tanema/gween/ease" @@ -21,110 +19,46 @@ import ( type sceneTabs struct { entry + yptr int + yscroll float32 + xscrolls []float32 + xptrs []int } func buildTabs() Scene { var list sceneTabs - list.label = "Ludo" - - list.children = append(list.children, entry{ - label: "Main Menu", - subLabel: "Load cores and games manually", - icon: "main", - callbackOK: func() { - menu.Push(buildMainMenu()) - }, - }) - - list.children = append(list.children, entry{ - label: "Settings", - subLabel: "Configure Ludo", - icon: "setting", - callbackOK: func() { - menu.Push(buildSettings()) - }, - }) + list.label = "Home" - list.children = append(list.children, entry{ - label: "History", - subLabel: "Play again", - icon: "history", - callbackOK: func() { - menu.Push(buildHistory()) - }, - }) - - list.children = append(list.children, getPlaylists()...) - - list.children = append(list.children, entry{ - label: "Add games", - subLabel: "Scan your collection", - icon: "add", - callbackOK: func() { - usr, _ := user.Current() - menu.Push(buildExplorer(usr.HomeDir, nil, - func(path string) { - scanner.ScanDir(path, refreshTabs) + cat := 0 + history.Load() + if len(history.List) > 0 { + list.children = append(list.children, entry{ + label: "Recently played", + }) + list.xscrolls = append(list.xscrolls, 0) + list.xptrs = append(list.xptrs, 0) + + for _, game := range history.List { + game := game + strippedName, _ := extractTags(game.Name) + //baseName := filepath.Base(game.Path) + list.children[cat].children = append(list.children[cat].children, entry{ + label: strippedName, + gameName: game.Name, + subLabel: game.System, + callbackOK: func() { + // menu.Push(buildGamePage( + // game.CorePath, + // game.Path, + // game.Name, + // "roms/"+baseName, + // )) }, - &entry{ - label: "", - icon: "scan", - })) - }, - }) - - list.segueMount() - - return &list -} - -// refreshTabs is called after playlist scanning is complete. It inserts the new -// playlists in the tabs, and makes sure that all the icons are positioned and -// sized properly. -func refreshTabs() { - e := menu.stack[0].Entry() - l := len(e.children) - pls := getPlaylists() - - // This assumes that the 3 first tabs are not playlists, and that the last - // tab is the scanner. - e.children = append(e.children[:3], append(pls, e.children[l-1:]...)...) - - // Update which tab is the active tab after the refresh - if e.ptr >= 3 { - e.ptr += len(pls) - (l - 4) - } - - // Ensure new icons are styled properly - for i := range e.children { - if i == e.ptr { - e.children[i].iconAlpha = 1 - e.children[i].scale = 0.75 - e.children[i].width = 500 - } else if i < e.ptr { - e.children[i].iconAlpha = 1 - e.children[i].scale = 0.25 - e.children[i].width = 128 - } else if i > e.ptr { - e.children[i].iconAlpha = 1 - e.children[i].scale = 0.25 - e.children[i].width = 128 + }) } + cat++ } - // Adapt the tabs scroll value - if len(menu.stack) == 1 { - menu.scroll = float32(e.ptr * 128) - } else { - e.children[e.ptr].margin = 1360 - menu.scroll = float32(e.ptr*128 + 680) - } -} - -// getPlaylists browse the filesystem for CSV files, parse them and returns -// a list of menu entries. It is used in the tabs, but could be used somewhere -// else too. -func getPlaylists() []entry { playlists.Load() // To store the keys in slice in sorted order @@ -134,168 +68,281 @@ func getPlaylists() []entry { } sort.Strings(keys) - var pls []entry for _, path := range keys { path := path filename := utils.FileName(path) - count := playlists.Count(path) label := playlists.ShortName(filename) - pls = append(pls, entry{ - label: label, - subLabel: fmt.Sprintf("%d Games - 0 Favorites", count), - icon: filename, - callbackOK: func() { - menu.Push(buildPlaylist(path)) - }, + + list.children = append(list.children, entry{ + label: label, }) + list.xscrolls = append(list.xscrolls, 0) + list.xptrs = append(list.xptrs, 0) + + for _, game := range playlists.Playlists[path] { + game := game + strippedName, tags := extractTags(game.Name) + list.children[cat].children = append(list.children[cat].children, entry{ + label: strippedName, + gameName: game.Name, + path: game.Path, + tags: tags, + icon: utils.FileName(path) + "-content", + //callbackOK: func() { loadPlaylistEntry(&list, list.label, game) }, + }) + } + cat++ } - return pls + + list.segueMount() + + return &list } -func (tabs *sceneTabs) Entry() *entry { - return &tabs.entry +func (s *sceneTabs) Entry() *entry { + return &s.entry } -func (tabs *sceneTabs) segueMount() { - for i := range tabs.children { - e := &tabs.children[i] - - if i == tabs.ptr { - e.labelAlpha = 1 - e.iconAlpha = 1 - e.scale = 0.75 - e.width = 500 - } else if i < tabs.ptr { - e.labelAlpha = 0 - e.iconAlpha = 1 - e.scale = 0.25 - e.width = 128 - } else if i > tabs.ptr { - e.labelAlpha = 0 - e.iconAlpha = 1 - e.scale = 0.25 - e.width = 128 +func (s *sceneTabs) segueMount() { + s.alpha = 0 + for j := range s.children { + s.xscrolls[j] = 0 + } + s.yscroll = -500 + + for j := range s.children { + ve := &s.children[j] + ve.labelAlpha = 0 + ve.height = 504 + 136 + if j == s.yptr { + ve.height = 240 + 136 + } + + for i := range ve.children { + e := &s.children[j].children[i] + + if j == s.yptr && i == s.xptrs[j] { + e.labelAlpha = 0 + e.iconAlpha = 0 + e.scale = 2.1 + e.borderAlpha = 0 + } else if i < s.xptrs[j] { + e.labelAlpha = 0 + e.iconAlpha = 0 + e.scale = 1 + e.borderAlpha = 0 + } else { + e.labelAlpha = 0 + e.iconAlpha = 0 + e.scale = 1 + e.borderAlpha = 0 + } } } - tabs.animate() + s.animate() } -func (tabs *sceneTabs) segueBack() { - tabs.animate() +func (s *sceneTabs) segueBack() { + s.animate() } -func (tabs *sceneTabs) animate() { - for i := range tabs.children { - e := &tabs.children[i] +func (s *sceneTabs) animate() { + alpha := float32(1) - var labelAlpha, scale, width float32 - if i == tabs.ptr { - labelAlpha = 1 - scale = 0.75 - width = 500 - } else if i < tabs.ptr { - labelAlpha = 0 - scale = 0.25 - width = 128 - } else if i > tabs.ptr { + for j := range s.children { + ve := &s.children[j] + + var labelAlpha = float32(0.8) + if j < s.yptr { labelAlpha = 0 - scale = 0.25 - width = 128 } + menu.tweens[&ve.labelAlpha] = gween.New(ve.labelAlpha, labelAlpha, 0.15, ease.OutSine) + height := float32(240 + 136) + if j == s.yptr { + height = 504 + 136 + } + menu.tweens[&ve.height] = gween.New(ve.height, height, 0.15, ease.OutSine) + + for i := range ve.children { + e := &s.children[j].children[i] + + var labelAlpha, iconAlpha, scale, borderAlpha float32 + if j == s.yptr && i == s.xptrs[j] { + labelAlpha = 1 + iconAlpha = 1 + scale = 2.1 + borderAlpha = 1 + } else if j < s.yptr { + labelAlpha = 0 + iconAlpha = 0 + scale = 1 + borderAlpha = 0 + } else { + labelAlpha = 0 + iconAlpha = 1 + scale = 1 + borderAlpha = 0 + } + + menu.tweens[&e.labelAlpha] = gween.New(e.labelAlpha, labelAlpha, 0.15, ease.OutSine) + menu.tweens[&e.iconAlpha] = gween.New(e.iconAlpha, iconAlpha, 0.15, ease.OutSine) + menu.tweens[&e.borderAlpha] = gween.New(e.borderAlpha, borderAlpha, 0.15, ease.OutSine) + menu.tweens[&e.scale] = gween.New(e.scale, scale, 0.15, ease.OutSine) + } + } - menu.tweens[&e.labelAlpha] = gween.New(e.labelAlpha, labelAlpha, 0.15, ease.OutSine) - menu.tweens[&e.iconAlpha] = gween.New(e.iconAlpha, 1, 0.15, ease.OutSine) - menu.tweens[&e.scale] = gween.New(e.scale, scale, 0.15, ease.OutSine) - menu.tweens[&e.width] = gween.New(e.width, width, 0.15, ease.OutSine) - menu.tweens[&e.margin] = gween.New(e.margin, 0, 0.15, ease.OutSine) + for j := range s.children { + menu.tweens[&s.xscrolls[j]] = gween.New(s.xscrolls[j], float32(s.xptrs[j]*(320+32)), 0.15, ease.OutSine) } - menu.tweens[&menu.scroll] = gween.New(menu.scroll, float32(tabs.ptr*128), 0.15, ease.OutSine) + + vst := float32(0) + for j := range s.children { + if j == s.yptr { + break + } + vst += 240 + 136 + } + + menu.tweens[&s.yscroll] = gween.New(s.yscroll, vst, 0.15, ease.OutSine) + menu.tweens[&s.alpha] = gween.New(s.alpha, alpha, 0.15, ease.OutSine) } -func (tabs *sceneTabs) segueNext() { - cur := &tabs.children[tabs.ptr] - menu.tweens[&cur.margin] = gween.New(cur.margin, 1360, 0.15, ease.OutSine) - menu.tweens[&menu.scroll] = gween.New(menu.scroll, menu.scroll+680, 0.15, ease.OutSine) - for i := range tabs.children { - e := &tabs.children[i] - if i != tabs.ptr { +func (s *sceneTabs) segueNext() { + menu.tweens[&s.alpha] = gween.New(s.alpha, 0, 0.15, ease.OutSine) + menu.tweens[&s.yscroll] = gween.New(s.yscroll, s.yscroll+300, 0.15, ease.OutSine) + + for j := range s.children { + ve := &s.children[j] + for i := range ve.children { + e := &s.children[j].children[i] menu.tweens[&e.iconAlpha] = gween.New(e.iconAlpha, 0, 0.15, ease.OutSine) } } } -func (tabs *sceneTabs) update(dt float32) { +func (s *sceneTabs) update(dt float32) { // Right repeatRight(dt, input.NewState[0][libretro.DeviceIDJoypadRight], func() { - tabs.ptr++ - if tabs.ptr >= len(tabs.children) { - tabs.ptr = 0 + if s.xptrs[s.yptr] < len(s.children[s.yptr].children)-1 { + s.xptrs[s.yptr]++ + audio.PlayEffect(audio.Effects["down"]) + menu.t = 0 + s.animate() } - audio.PlayEffect(audio.Effects["down"]) - tabs.animate() }) // Left repeatLeft(dt, input.NewState[0][libretro.DeviceIDJoypadLeft], func() { - tabs.ptr-- - if tabs.ptr < 0 { - tabs.ptr = len(tabs.children) - 1 + if s.xptrs[s.yptr] > 0 { + s.xptrs[s.yptr]-- + audio.PlayEffect(audio.Effects["up"]) + menu.t = 0 + s.animate() + } else if s.xptrs[s.yptr] == 0 && len(menu.stack) > 1 { + // Pressing left on the leftmost item should come back to the left tabs + audio.PlayEffect(audio.Effects["cancel"]) + menu.stack[len(menu.stack)-2].segueBack() + //menu.focus-- + menu.t = 0 + } + }) + + // Down + repeatDown(dt, input.NewState[0][libretro.DeviceIDJoypadDown], func() { + if s.yptr < len(s.children)-1 { + s.yptr++ + audio.PlayEffect(audio.Effects["down"]) + menu.t = 0 + s.animate() + } + }) + + // Up + repeatUp(dt, input.NewState[0][libretro.DeviceIDJoypadUp], func() { + if s.yptr > 0 { + s.yptr-- + audio.PlayEffect(audio.Effects["up"]) + menu.t = 0 + s.animate() } - audio.PlayEffect(audio.Effects["up"]) - tabs.animate() }) // OK if input.Released[0][libretro.DeviceIDJoypadA] { - if tabs.children[tabs.ptr].callbackOK != nil { + if s.children[s.yptr].children[s.xptrs[s.yptr]].callbackOK != nil { audio.PlayEffect(audio.Effects["ok"]) - tabs.segueNext() - tabs.children[tabs.ptr].callbackOK() + s.segueNext() + s.children[s.yptr].children[s.xptrs[s.yptr]].callbackOK() } } } -func (tabs sceneTabs) render() { - _, h := vid.Window.GetFramebufferSize() - - stackWidth := 710 * menu.ratio - for i, e := range tabs.children { - - c := colorful.Hcl(float64(i)*20, 0.5, 0.5) - - x := -menu.scroll*menu.ratio + stackWidth + e.width/2*menu.ratio - - stackWidth += e.width*menu.ratio + e.margin*menu.ratio - - if e.labelAlpha > 0 { - vid.Font.SetColor(float32(c.R), float32(c.B), float32(c.G), e.labelAlpha) - lw := vid.Font.Width(0.5*menu.ratio, e.label) - vid.Font.Printf(x-lw/2, float32(int(float32(h)/2+250*menu.ratio)), 0.5*menu.ratio, e.label) - lw = vid.Font.Width(0.4*menu.ratio, e.subLabel) - vid.Font.Printf(x-lw/2, float32(int(float32(h)/2+330*menu.ratio)), 0.4*menu.ratio, e.subLabel) +func (s sceneTabs) render() { + //_, h := vid.Window.GetFramebufferSize() + + vst := float32(0) + for j, ve := range s.children { + vid.Font.SetColor(0.129, 0.443, 0.686, ve.labelAlpha*s.alpha) + vid.Font.Printf( + 96*menu.ratio, + 230*menu.ratio+vst*menu.ratio-s.yscroll*menu.ratio, + 0.5*menu.ratio, ve.label) + + y := 272 + vst - s.yscroll + + stackWidth := float32(96) + for i, e := range ve.children { + blink := float32(1) + if j == s.yptr && i == s.xptrs[s.yptr] { + blink = float32(math.Cos(menu.t)) + } + + x := -s.xscrolls[j] + stackWidth + + vid.Font.SetColor(0, 0, 0, e.iconAlpha*s.alpha*0.75) + + vid.DrawRect( + x*menu.ratio-8*menu.ratio, + y*menu.ratio-8*menu.ratio, + 320*e.scale*menu.ratio+16*menu.ratio, 240*e.scale*menu.ratio+16*menu.ratio, + 0, video.Color{R: 1, G: 0.557, B: 0.220, A: e.borderAlpha*s.alpha - blink}) + + vid.DrawImage(menu.icons["img-broken"], + x*menu.ratio, + y*menu.ratio, + 320*e.scale*menu.ratio, 240*e.scale*menu.ratio, + 1, video.Color{R: 1, G: 1, B: 1, A: e.iconAlpha * s.alpha}) + + vid.Font.SetColor(0, 0, 0, e.labelAlpha*s.alpha) + vid.Font.Printf( + (x+672+32)*menu.ratio, + (y+360)*menu.ratio, + 0.7*menu.ratio, e.label) + + vid.Font.SetColor(0.56, 0.56, 0.56, e.labelAlpha*s.alpha) + vid.Font.Printf( + (x+672+32)*menu.ratio, + (y+430)*menu.ratio, + 0.5*menu.ratio, e.subLabel) + + stackWidth += 320*e.scale + e.margin + 32 } - - vid.DrawImage(menu.icons["hexagon"], - x-220*e.scale*menu.ratio, float32(h)/2-220*e.scale*menu.ratio, - 440*menu.ratio, 440*menu.ratio, e.scale, video.Color{R: float32(c.R), G: float32(c.B), B: float32(c.G), A: e.iconAlpha}) - - vid.DrawImage(menu.icons[e.icon], - x-128*e.scale*menu.ratio, float32(h)/2-128*e.scale*menu.ratio, - 256*menu.ratio, 256*menu.ratio, e.scale, video.Color{R: 1, G: 1, B: 1, A: e.iconAlpha}) + vst += ve.height } } -func (tabs sceneTabs) drawHintBar() { +func (s sceneTabs) drawHintBar() { w, h := vid.Window.GetFramebufferSize() - vid.DrawRect(0, float32(h)-70*menu.ratio, float32(w), 70*menu.ratio, 0, video.Color{R: 0.75, G: 0.75, B: 0.75, A: 1}) + vid.DrawRect(0, float32(h)-88*menu.ratio, float32(w), 88*menu.ratio, 0, video.Color{R: 1, G: 1, B: 1, A: 1}) + vid.DrawRect(0, float32(h)-88*menu.ratio, float32(w), 2*menu.ratio, 0, video.Color{R: 0.85, G: 0.85, B: 0.85, A: 1}) _, _, leftRight, a, _, _, _, _, _, guide := hintIcons() - var stack float32 + stack := float32(96) if state.Global.CoreRunning { - stackHint(&stack, guide, "RESUME", h) + stackHint(&stack, guide, "Resume", h) } - stackHint(&stack, leftRight, "NAVIGATE", h) - stackHint(&stack, a, "OPEN", h) + stackHint(&stack, leftRight, "Navigate", h) + stackHint(&stack, a, "Open", h) } diff --git a/menu/scene_wifi.go b/menu/scene_wifi.go index e3e28fb5..111a4f17 100644 --- a/menu/scene_wifi.go +++ b/menu/scene_wifi.go @@ -87,14 +87,15 @@ func (s *sceneWiFi) render() { func (s *sceneWiFi) drawHintBar() { w, h := vid.Window.GetFramebufferSize() - vid.DrawRect(0, float32(h)-70*menu.ratio, float32(w), 70*menu.ratio, 0, video.Color{R: 0.75, G: 0.75, B: 0.75, A: 1}) + vid.DrawRect(0, float32(h)-88*menu.ratio, float32(w), 88*menu.ratio, 0, video.Color{R: 1, G: 1, B: 1, A: 1}) + vid.DrawRect(0, float32(h)-88*menu.ratio, float32(w), 2*menu.ratio, 0, video.Color{R: 0.85, G: 0.85, B: 0.85, A: 1}) _, upDown, _, a, b, _, _, _, _, _ := hintIcons() - var stack float32 - stackHint(&stack, upDown, "NAVIGATE", h) - stackHint(&stack, b, "BACK", h) + stack := float32(96) + stackHint(&stack, upDown, "Navigate", h) + stackHint(&stack, b, "Back", h) if s.children[0].callbackOK != nil { - stackHint(&stack, a, "CONNECT", h) + stackHint(&stack, a, "Connect", h) } } From 1b82ca1aae9d0d17a8e7676414e43ec177066585 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Andr=C3=A9=20Santoni?= Date: Sun, 2 Aug 2020 22:54:11 +0700 Subject: [PATCH 02/52] Thumbnails and bold fonts --- main.go | 3 +++ menu/notifications.go | 2 -- menu/scene.go | 2 +- menu/scene_core_options.go | 2 +- menu/scene_history.go | 2 +- menu/scene_keyboard.go | 2 +- menu/scene_playlist.go | 2 +- menu/scene_savestates.go | 2 +- menu/scene_settings.go | 2 +- menu/scene_tabs.go | 43 +++++++++++++++++--------------------- menu/scene_wifi.go | 2 +- menu/thumbnail.go | 3 +++ video/video.go | 11 +++++++--- 13 files changed, 41 insertions(+), 37 deletions(-) diff --git a/main.go b/main.go index 7e2577bf..76d5e7da 100644 --- a/main.go +++ b/main.go @@ -35,6 +35,9 @@ func runLoop(vid *video.Video, m *menu.Menu) { m.ProcessHotkeys() ntf.Process(dt) vid.ResizeViewport() + w, h := vid.Window.GetFramebufferSize() + vid.Font.UpdateResolution(w, h) + vid.BoldFont.UpdateResolution(w, h) if !state.Global.MenuActive { if state.Global.CoreRunning { state.Global.Core.Run() diff --git a/menu/notifications.go b/menu/notifications.go index 2b909002..90f4ab14 100644 --- a/menu/notifications.go +++ b/menu/notifications.go @@ -22,8 +22,6 @@ var severityBgColor = map[ntf.Severity]colorful.Color{ // RenderNotifications draws the list of notification messages on the viewport func (m *Menu) RenderNotifications() { - fbw, fbh := vid.Window.GetFramebufferSize() - vid.Font.UpdateResolution(fbw, fbh) var h float32 = 75 stack := h for _, n := range ntf.List() { diff --git a/menu/scene.go b/menu/scene.go index 22846bf7..47df7c25 100644 --- a/menu/scene.go +++ b/menu/scene.go @@ -238,7 +238,7 @@ func genericDrawHintBar() { _, upDown, _, a, b, _, _, _, _, guide := hintIcons() - stack := float32(96) + stack := float32(96) * menu.ratio if state.Global.CoreRunning { stackHint(&stack, guide, "Resume", h) } diff --git a/menu/scene_core_options.go b/menu/scene_core_options.go index 506e7045..33ca0c08 100644 --- a/menu/scene_core_options.go +++ b/menu/scene_core_options.go @@ -87,7 +87,7 @@ func (s *sceneCoreOptions) drawHintBar() { _, upDown, leftRight, _, b, _, _, _, _, guide := hintIcons() - stack := float32(96) + stack := float32(96) * menu.ratio if state.Global.CoreRunning { stackHint(&stack, guide, "Resume", h) } diff --git a/menu/scene_history.go b/menu/scene_history.go index 22d864b4..b1f4adf7 100644 --- a/menu/scene_history.go +++ b/menu/scene_history.go @@ -201,7 +201,7 @@ func (s *sceneHistory) drawHintBar() { _, upDown, _, a, b, _, _, _, _, guide := hintIcons() - stack := float32(96) + stack := float32(96) * menu.ratio if state.Global.CoreRunning { stackHint(&stack, guide, "Resume", h) } diff --git a/menu/scene_keyboard.go b/menu/scene_keyboard.go index 0500ff4b..ec8a491d 100644 --- a/menu/scene_keyboard.go +++ b/menu/scene_keyboard.go @@ -211,7 +211,7 @@ func (s *sceneKeyboard) drawHintBar() { arrows, _, _, a, b, x, y, start, _, _ := hintIcons() - stack := float32(96) + stack := float32(96) * menu.ratio stackHint(&stack, arrows, "Select", h) stackHint(&stack, b, "Back", h) stackHint(&stack, x, "Shift", h) diff --git a/menu/scene_playlist.go b/menu/scene_playlist.go index a9ade8df..595026e4 100644 --- a/menu/scene_playlist.go +++ b/menu/scene_playlist.go @@ -222,7 +222,7 @@ func (s *scenePlaylist) drawHintBar() { _, upDown, _, a, b, _, _, _, _, guide := hintIcons() - stack := float32(96) + stack := float32(96) * menu.ratio if state.Global.CoreRunning { stackHint(&stack, guide, "Resume", h) } diff --git a/menu/scene_savestates.go b/menu/scene_savestates.go index dfc50588..dcc1e32f 100644 --- a/menu/scene_savestates.go +++ b/menu/scene_savestates.go @@ -149,7 +149,7 @@ func (s *sceneSavestates) drawHintBar() { _, upDown, _, a, b, _, _, _, _, guide := hintIcons() - stack := float32(96) + stack := float32(96) * menu.ratio if state.Global.CoreRunning { stackHint(&stack, guide, "Resume", h) } diff --git a/menu/scene_settings.go b/menu/scene_settings.go index 3f9ae318..927ef0ce 100644 --- a/menu/scene_settings.go +++ b/menu/scene_settings.go @@ -275,7 +275,7 @@ func (s *sceneSettings) drawHintBar() { _, upDown, leftRight, a, b, _, _, _, _, guide := hintIcons() - stack := float32(96) + stack := float32(96) * menu.ratio list := menu.stack[len(menu.stack)-1].Entry() if state.Global.CoreRunning { stackHint(&stack, guide, "Resume", h) diff --git a/menu/scene_tabs.go b/menu/scene_tabs.go index 2e2fc546..b8ad5a73 100644 --- a/menu/scene_tabs.go +++ b/menu/scene_tabs.go @@ -41,11 +41,11 @@ func buildTabs() Scene { for _, game := range history.List { game := game strippedName, _ := extractTags(game.Name) - //baseName := filepath.Base(game.Path) list.children[cat].children = append(list.children[cat].children, entry{ label: strippedName, gameName: game.Name, subLabel: game.System, + system: game.System, callbackOK: func() { // menu.Push(buildGamePage( // game.CorePath, @@ -71,10 +71,9 @@ func buildTabs() Scene { for _, path := range keys { path := path filename := utils.FileName(path) - label := playlists.ShortName(filename) list.children = append(list.children, entry{ - label: label, + label: filename, }) list.xscrolls = append(list.xscrolls, 0) list.xptrs = append(list.xptrs, 0) @@ -88,6 +87,8 @@ func buildTabs() Scene { path: game.Path, tags: tags, icon: utils.FileName(path) + "-content", + subLabel: filename, + system: filename, //callbackOK: func() { loadPlaylistEntry(&list, list.label, game) }, }) } @@ -153,7 +154,7 @@ func (s *sceneTabs) animate() { for j := range s.children { ve := &s.children[j] - var labelAlpha = float32(0.8) + labelAlpha := float32(1) if j < s.yptr { labelAlpha = 0 } @@ -239,12 +240,6 @@ func (s *sceneTabs) update(dt float32) { audio.PlayEffect(audio.Effects["up"]) menu.t = 0 s.animate() - } else if s.xptrs[s.yptr] == 0 && len(menu.stack) > 1 { - // Pressing left on the leftmost item should come back to the left tabs - audio.PlayEffect(audio.Effects["cancel"]) - menu.stack[len(menu.stack)-2].segueBack() - //menu.focus-- - menu.t = 0 } }) @@ -279,18 +274,18 @@ func (s *sceneTabs) update(dt float32) { } func (s sceneTabs) render() { - //_, h := vid.Window.GetFramebufferSize() - vst := float32(0) for j, ve := range s.children { - vid.Font.SetColor(0.129, 0.443, 0.686, ve.labelAlpha*s.alpha) - vid.Font.Printf( + ve := ve + + y := 272 + vst - s.yscroll + + vid.BoldFont.SetColor(0.129, 0.443, 0.686, ve.labelAlpha*s.alpha) + vid.BoldFont.Printf( 96*menu.ratio, 230*menu.ratio+vst*menu.ratio-s.yscroll*menu.ratio, 0.5*menu.ratio, ve.label) - y := 272 + vst - s.yscroll - stackWidth := float32(96) for i, e := range ve.children { blink := float32(1) @@ -300,28 +295,28 @@ func (s sceneTabs) render() { x := -s.xscrolls[j] + stackWidth - vid.Font.SetColor(0, 0, 0, e.iconAlpha*s.alpha*0.75) - vid.DrawRect( x*menu.ratio-8*menu.ratio, y*menu.ratio-8*menu.ratio, 320*e.scale*menu.ratio+16*menu.ratio, 240*e.scale*menu.ratio+16*menu.ratio, 0, video.Color{R: 1, G: 0.557, B: 0.220, A: e.borderAlpha*s.alpha - blink}) - vid.DrawImage(menu.icons["img-broken"], + drawThumbnail( + &ve, i, + e.system, e.gameName, x*menu.ratio, y*menu.ratio, 320*e.scale*menu.ratio, 240*e.scale*menu.ratio, 1, video.Color{R: 1, G: 1, B: 1, A: e.iconAlpha * s.alpha}) - vid.Font.SetColor(0, 0, 0, e.labelAlpha*s.alpha) - vid.Font.Printf( + vid.BoldFont.SetColor(0, 0, 0, e.labelAlpha*s.alpha) + vid.BoldFont.Printf( (x+672+32)*menu.ratio, (y+360)*menu.ratio, 0.7*menu.ratio, e.label) - vid.Font.SetColor(0.56, 0.56, 0.56, e.labelAlpha*s.alpha) - vid.Font.Printf( + vid.BoldFont.SetColor(0.56, 0.56, 0.56, e.labelAlpha*s.alpha) + vid.BoldFont.Printf( (x+672+32)*menu.ratio, (y+430)*menu.ratio, 0.5*menu.ratio, e.subLabel) @@ -339,7 +334,7 @@ func (s sceneTabs) drawHintBar() { _, _, leftRight, a, _, _, _, _, _, guide := hintIcons() - stack := float32(96) + stack := float32(96) * menu.ratio if state.Global.CoreRunning { stackHint(&stack, guide, "Resume", h) } diff --git a/menu/scene_wifi.go b/menu/scene_wifi.go index 111a4f17..26e80518 100644 --- a/menu/scene_wifi.go +++ b/menu/scene_wifi.go @@ -92,7 +92,7 @@ func (s *sceneWiFi) drawHintBar() { _, upDown, _, a, b, _, _, _, _, _ := hintIcons() - stack := float32(96) + stack := float32(96) * menu.ratio stackHint(&stack, upDown, "Navigate", h) stackHint(&stack, b, "Back", h) if s.children[0].callbackOK != nil { diff --git a/menu/thumbnail.go b/menu/thumbnail.go index a97c8836..2eee5631 100644 --- a/menu/thumbnail.go +++ b/menu/thumbnail.go @@ -14,6 +14,9 @@ import ( // Downloads a thumbnail from the web and cache it to the local filesystem. func downloadThumbnail(list *entry, i int, url, folderPath, path string) { + if i >= len(list.children) { + return + } resp, err := http.Get(url) if err != nil { list.children[i].thumbnail = menu.icons["img-broken"] diff --git a/video/video.go b/video/video.go index 49b86dbb..ef0a6e21 100644 --- a/video/video.go +++ b/video/video.go @@ -31,9 +31,10 @@ type WindowInterface interface { // Video holds the state of the video package type Video struct { - Window WindowInterface - Geom libretro.GameGeometry - Font *Font + Window WindowInterface + Geom libretro.GameGeometry + Font *Font + BoldFont *Font program uint32 // current program used for the game quad defaultProgram uint32 // default program used for the game quad @@ -111,6 +112,10 @@ func (video *Video) Configure(fullscreen bool) { if err != nil { panic(err) } + video.BoldFont, err = LoadFont(assets+"/boldfont.ttf", int32(36*2), fbw, fbh) + if err != nil { + panic(err) + } // Configure the vertex and fragment shaders video.defaultProgram, err = newProgram(vertexShader, defaultFragmentShader) From 9c516b7fdfd4a29069c011ad85e7d64a751e83bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Andr=C3=A9=20Santoni?= Date: Mon, 3 Aug 2020 14:30:37 +0700 Subject: [PATCH 03/52] Perf improvement --- menu/scene_tabs.go | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/menu/scene_tabs.go b/menu/scene_tabs.go index b8ad5a73..e614934e 100644 --- a/menu/scene_tabs.go +++ b/menu/scene_tabs.go @@ -278,28 +278,41 @@ func (s sceneTabs) render() { for j, ve := range s.children { ve := ve - y := 272 + vst - s.yscroll - vid.BoldFont.SetColor(0.129, 0.443, 0.686, ve.labelAlpha*s.alpha) vid.BoldFont.Printf( 96*menu.ratio, 230*menu.ratio+vst*menu.ratio-s.yscroll*menu.ratio, 0.5*menu.ratio, ve.label) + y := 272 + vst - s.yscroll + + vst += ve.height + + if y < -400 || y > 1080 { + continue + } + stackWidth := float32(96) for i, e := range ve.children { + x := -s.xscrolls[j] + stackWidth + + stackWidth += 320*e.scale + e.margin + 32 + + if x < -400 || x > 1920 { + continue + } + blink := float32(1) if j == s.yptr && i == s.xptrs[s.yptr] { blink = float32(math.Cos(menu.t)) } - x := -s.xscrolls[j] + stackWidth - - vid.DrawRect( + vid.DrawImage( + menu.icons["selection"], x*menu.ratio-8*menu.ratio, y*menu.ratio-8*menu.ratio, 320*e.scale*menu.ratio+16*menu.ratio, 240*e.scale*menu.ratio+16*menu.ratio, - 0, video.Color{R: 1, G: 0.557, B: 0.220, A: e.borderAlpha*s.alpha - blink}) + 1, video.Color{R: 1, G: 1, B: 1, A: e.borderAlpha*s.alpha - blink}) drawThumbnail( &ve, i, @@ -320,10 +333,7 @@ func (s sceneTabs) render() { (x+672+32)*menu.ratio, (y+430)*menu.ratio, 0.5*menu.ratio, e.subLabel) - - stackWidth += 320*e.scale + e.margin + 32 } - vst += ve.height } } From 1011d9975f217308f8c4651e034b330a7201dcf2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Andr=C3=A9=20Santoni?= Date: Mon, 3 Aug 2020 15:55:41 +0700 Subject: [PATCH 04/52] Can load games --- menu/hints.go | 4 ++-- menu/menu.go | 2 +- menu/scene.go | 20 ++++++++++---------- menu/scene_core_options.go | 2 +- menu/scene_history.go | 8 ++++---- menu/scene_keyboard.go | 2 +- menu/scene_playlist.go | 10 +++++----- menu/scene_savestates.go | 8 ++++---- menu/scene_settings.go | 14 +++++++------- menu/scene_tabs.go | 38 +++++++++++++++++++------------------- menu/scene_wifi.go | 2 +- video/demul_frag_shader.go | 2 +- video/gfx.go | 4 ++-- 13 files changed, 58 insertions(+), 58 deletions(-) diff --git a/menu/hints.go b/menu/hints.go index 5eed6fcf..f4327670 100644 --- a/menu/hints.go +++ b/menu/hints.go @@ -10,8 +10,8 @@ import ( func stackHint(stack *float32, icon uint32, label string, h int) { c := video.Color{R: 0.28, G: 0.28, B: 0.28, A: 1} vid.Font.SetColor(0.28, 0.28, 0.28, 1.0) - vid.DrawImage(icon, *stack, float32(h)-88*menu.ratio, 88*menu.ratio, 88*menu.ratio, 1.0, c) - *stack += 80 * menu.ratio + vid.DrawImage(icon, *stack, float32(h)-79*menu.ratio, 70*menu.ratio, 70*menu.ratio, 1.0, c) + *stack += 70 * menu.ratio vid.Font.Printf(*stack, float32(h)-30*menu.ratio, 0.5*menu.ratio, label) *stack += vid.Font.Width(0.4*menu.ratio, label) *stack += 32 * menu.ratio diff --git a/menu/menu.go b/menu/menu.go index c90f19ab..126b148f 100644 --- a/menu/menu.go +++ b/menu/menu.go @@ -65,7 +65,7 @@ func (m *Menu) Render(dt float32) { m.ratio = float32(w) / 1920 if state.Global.CoreRunning { - vid.DrawRect(0, 0, float32(w), float32(h), 0, video.Color{R: 0, G: 0, B: 0, A: 0.85}) + vid.DrawImage(menu.icons["bg"], 0, 0, float32(w), float32(h), 1, video.Color{1, 1, 1, 0.85}) } else { vid.DrawImage(menu.icons["bg"], 0, 0, float32(w), float32(h), 1, video.Color{1, 1, 1, 1}) } diff --git a/menu/scene.go b/menu/scene.go index 47df7c25..759581fe 100644 --- a/menu/scene.go +++ b/menu/scene.go @@ -155,9 +155,9 @@ func genericSegueNext(list *entry) { func genericDrawCursor(list *entry) { w, h := vid.Window.GetFramebufferSize() c := video.Color{R: 0.8784, G: 1, B: 1, A: list.cursor.alpha} - if state.Global.CoreRunning { - c = video.Color{R: 0.1, G: 0.1, B: 0.4, A: list.cursor.alpha} - } + // if state.Global.CoreRunning { + // c = video.Color{R: 0.1, G: 0.1, B: 0.4, A: list.cursor.alpha} + // } vid.DrawImage(menu.icons["arrow"], 530*menu.ratio, float32(h)*list.cursor.yp-35*menu.ratio, 70*menu.ratio, 70*menu.ratio, 1, c) @@ -171,9 +171,9 @@ func genericDrawCursor(list *entry) { func thumbnailDrawCursor(list *entry) { w, h := vid.Window.GetFramebufferSize() c := video.Color{R: 0.8784, G: 1, B: 1, A: list.cursor.alpha} - if state.Global.CoreRunning { - c = video.Color{R: 0.1, G: 0.1, B: 0.4, A: list.cursor.alpha} - } + // if state.Global.CoreRunning { + // c = video.Color{R: 0.1, G: 0.1, B: 0.4, A: list.cursor.alpha} + // } vid.DrawImage(menu.icons["arrow"], 500*menu.ratio, float32(h)*list.cursor.yp-50*menu.ratio, 100*menu.ratio, 100*menu.ratio, 1, c) @@ -199,9 +199,9 @@ func genericRender(list *entry) { fontOffset := 64 * 0.7 * menu.ratio * 0.3 color := video.Color{R: 0, G: 0, B: 0, A: e.iconAlpha} - if state.Global.CoreRunning { - color = video.Color{R: 1, G: 1, B: 1, A: e.iconAlpha} - } + // if state.Global.CoreRunning { + // color = video.Color{R: 1, G: 1, B: 1, A: e.iconAlpha} + // } vid.DrawImage(menu.icons[e.icon], 610*menu.ratio-64*0.5*menu.ratio, @@ -238,7 +238,7 @@ func genericDrawHintBar() { _, upDown, _, a, b, _, _, _, _, guide := hintIcons() - stack := float32(96) * menu.ratio + stack := float32(75) * menu.ratio if state.Global.CoreRunning { stackHint(&stack, guide, "Resume", h) } diff --git a/menu/scene_core_options.go b/menu/scene_core_options.go index 33ca0c08..a10418e9 100644 --- a/menu/scene_core_options.go +++ b/menu/scene_core_options.go @@ -87,7 +87,7 @@ func (s *sceneCoreOptions) drawHintBar() { _, upDown, leftRight, _, b, _, _, _, _, guide := hintIcons() - stack := float32(96) * menu.ratio + stack := float32(75) * menu.ratio if state.Global.CoreRunning { stackHint(&stack, guide, "Resume", h) } diff --git a/menu/scene_history.go b/menu/scene_history.go index b1f4adf7..de609dda 100644 --- a/menu/scene_history.go +++ b/menu/scene_history.go @@ -124,9 +124,9 @@ func (s *sceneHistory) render() { fontOffset := 64 * 0.7 * menu.ratio * 0.3 color := video.Color{R: 0, G: 0, B: 0, A: e.iconAlpha} - if state.Global.CoreRunning { - color = video.Color{R: 1, G: 1, B: 1, A: e.iconAlpha} - } + // if state.Global.CoreRunning { + // color = video.Color{R: 1, G: 1, B: 1, A: e.iconAlpha} + // } if e.labelAlpha > 0 { drawThumbnail( @@ -201,7 +201,7 @@ func (s *sceneHistory) drawHintBar() { _, upDown, _, a, b, _, _, _, _, guide := hintIcons() - stack := float32(96) * menu.ratio + stack := float32(75) * menu.ratio if state.Global.CoreRunning { stackHint(&stack, guide, "Resume", h) } diff --git a/menu/scene_keyboard.go b/menu/scene_keyboard.go index ec8a491d..d2090dc2 100644 --- a/menu/scene_keyboard.go +++ b/menu/scene_keyboard.go @@ -211,7 +211,7 @@ func (s *sceneKeyboard) drawHintBar() { arrows, _, _, a, b, x, y, start, _, _ := hintIcons() - stack := float32(96) * menu.ratio + stack := float32(75) * menu.ratio stackHint(&stack, arrows, "Select", h) stackHint(&stack, b, "Back", h) stackHint(&stack, x, "Shift", h) diff --git a/menu/scene_playlist.go b/menu/scene_playlist.go index 595026e4..b065b09c 100644 --- a/menu/scene_playlist.go +++ b/menu/scene_playlist.go @@ -76,7 +76,7 @@ func extractTags(name string) (string, []string) { return name, tags } -func loadPlaylistEntry(list *scenePlaylist, playlist string, game playlists.Game) { +func loadPlaylistEntry(list Scene, playlist string, game playlists.Game) { if _, err := os.Stat(game.Path); os.IsNotExist(err) { ntf.DisplayAndLog(ntf.Error, "Menu", "Game not found.") return @@ -157,9 +157,9 @@ func (s *scenePlaylist) render() { fontOffset := 64 * 0.7 * menu.ratio * 0.3 color := video.Color{R: 0, G: 0, B: 0, A: e.iconAlpha} - if state.Global.CoreRunning { - color = video.Color{R: 1, G: 1, B: 1, A: e.iconAlpha} - } + // if state.Global.CoreRunning { + // color = video.Color{R: 1, G: 1, B: 1, A: e.iconAlpha} + // } if e.labelAlpha > 0 { drawThumbnail( @@ -222,7 +222,7 @@ func (s *scenePlaylist) drawHintBar() { _, upDown, _, a, b, _, _, _, _, guide := hintIcons() - stack := float32(96) * menu.ratio + stack := float32(75) * menu.ratio if state.Global.CoreRunning { stackHint(&stack, guide, "Resume", h) } diff --git a/menu/scene_savestates.go b/menu/scene_savestates.go index dcc1e32f..3575a974 100644 --- a/menu/scene_savestates.go +++ b/menu/scene_savestates.go @@ -105,9 +105,9 @@ func (s *sceneSavestates) render() { fontOffset := 64 * 0.7 * menu.ratio * 0.3 color := video.Color{R: 0, G: 0, B: 0, A: e.iconAlpha} - if state.Global.CoreRunning { - color = video.Color{R: 1, G: 1, B: 1, A: e.iconAlpha} - } + // if state.Global.CoreRunning { + // color = video.Color{R: 1, G: 1, B: 1, A: e.iconAlpha} + // } if e.labelAlpha > 0 { drawSavestateThumbnail( @@ -149,7 +149,7 @@ func (s *sceneSavestates) drawHintBar() { _, upDown, _, a, b, _, _, _, _, guide := hintIcons() - stack := float32(96) * menu.ratio + stack := float32(75) * menu.ratio if state.Global.CoreRunning { stackHint(&stack, guide, "Resume", h) } diff --git a/menu/scene_settings.go b/menu/scene_settings.go index 927ef0ce..76ba298c 100644 --- a/menu/scene_settings.go +++ b/menu/scene_settings.go @@ -136,9 +136,9 @@ var widgets = map[string]func(*entry){ } w, h := vid.Window.GetFramebufferSize() color := video.Color{R: 0, G: 0, B: 0, A: e.iconAlpha} - if state.Global.CoreRunning { - color = video.Color{R: 1, G: 1, B: 1, A: e.iconAlpha} - } + // if state.Global.CoreRunning { + // color = video.Color{R: 1, G: 1, B: 1, A: e.iconAlpha} + // } vid.DrawImage(menu.icons[icon], float32(w)-128*menu.ratio-128*menu.ratio, float32(h)*e.yp-64*1.25*menu.ratio, @@ -154,9 +154,9 @@ var widgets = map[string]func(*entry){ w := 175 * menu.ratio h := 8 * menu.ratio c := video.Color{R: 0, G: 0, B: 0, A: e.iconAlpha} - if state.Global.CoreRunning { - c = video.Color{R: 1, G: 1, B: 1, A: e.iconAlpha} - } + // if state.Global.CoreRunning { + // c = video.Color{R: 1, G: 1, B: 1, A: e.iconAlpha} + // } vid.DrawRect(x, y, w, h, 0.9, video.Color{R: c.R, G: c.G, B: c.B, A: e.iconAlpha / 4}) w = 175 * menu.ratio * e.value().(float32) vid.DrawRect(x, y, w, h, 0.9, c) @@ -275,7 +275,7 @@ func (s *sceneSettings) drawHintBar() { _, upDown, leftRight, a, b, _, _, _, _, guide := hintIcons() - stack := float32(96) * menu.ratio + stack := float32(75) * menu.ratio list := menu.stack[len(menu.stack)-1].Entry() if state.Global.CoreRunning { stackHint(&stack, guide, "Resume", h) diff --git a/menu/scene_tabs.go b/menu/scene_tabs.go index e614934e..a7578142 100644 --- a/menu/scene_tabs.go +++ b/menu/scene_tabs.go @@ -47,12 +47,7 @@ func buildTabs() Scene { subLabel: game.System, system: game.System, callbackOK: func() { - // menu.Push(buildGamePage( - // game.CorePath, - // game.Path, - // game.Name, - // "roms/"+baseName, - // )) + loadHistoryEntry(&list, game) }, }) } @@ -82,14 +77,14 @@ func buildTabs() Scene { game := game strippedName, tags := extractTags(game.Name) list.children[cat].children = append(list.children[cat].children, entry{ - label: strippedName, - gameName: game.Name, - path: game.Path, - tags: tags, - icon: utils.FileName(path) + "-content", - subLabel: filename, - system: filename, - //callbackOK: func() { loadPlaylistEntry(&list, list.label, game) }, + label: strippedName, + gameName: game.Name, + path: game.Path, + tags: tags, + icon: utils.FileName(path) + "-content", + subLabel: filename, + system: filename, + callbackOK: func() { loadPlaylistEntry(&list, filename, game) }, }) } cat++ @@ -149,8 +144,6 @@ func (s *sceneTabs) segueBack() { } func (s *sceneTabs) animate() { - alpha := float32(1) - for j := range s.children { ve := &s.children[j] @@ -206,7 +199,7 @@ func (s *sceneTabs) animate() { } menu.tweens[&s.yscroll] = gween.New(s.yscroll, vst, 0.15, ease.OutSine) - menu.tweens[&s.alpha] = gween.New(s.alpha, alpha, 0.15, ease.OutSine) + menu.tweens[&s.alpha] = gween.New(s.alpha, 1, 0.15, ease.OutSine) } func (s *sceneTabs) segueNext() { @@ -312,7 +305,7 @@ func (s sceneTabs) render() { x*menu.ratio-8*menu.ratio, y*menu.ratio-8*menu.ratio, 320*e.scale*menu.ratio+16*menu.ratio, 240*e.scale*menu.ratio+16*menu.ratio, - 1, video.Color{R: 1, G: 1, B: 1, A: e.borderAlpha*s.alpha - blink}) + 1, video.Color{R: 1, G: 1, B: 1, A: (e.borderAlpha - blink) * s.alpha}) drawThumbnail( &ve, i, @@ -322,6 +315,13 @@ func (s sceneTabs) render() { 320*e.scale*menu.ratio, 240*e.scale*menu.ratio, 1, video.Color{R: 1, G: 1, B: 1, A: e.iconAlpha * s.alpha}) + vid.DrawImage( + menu.icons["border"], + x*menu.ratio, + y*menu.ratio, + 320*e.scale*menu.ratio, 240*e.scale*menu.ratio, + 1, video.Color{R: 1, G: 1, B: 1, A: e.iconAlpha * s.alpha * 0.25}) + vid.BoldFont.SetColor(0, 0, 0, e.labelAlpha*s.alpha) vid.BoldFont.Printf( (x+672+32)*menu.ratio, @@ -344,7 +344,7 @@ func (s sceneTabs) drawHintBar() { _, _, leftRight, a, _, _, _, _, _, guide := hintIcons() - stack := float32(96) * menu.ratio + stack := float32(75) * menu.ratio if state.Global.CoreRunning { stackHint(&stack, guide, "Resume", h) } diff --git a/menu/scene_wifi.go b/menu/scene_wifi.go index 26e80518..aee67113 100644 --- a/menu/scene_wifi.go +++ b/menu/scene_wifi.go @@ -92,7 +92,7 @@ func (s *sceneWiFi) drawHintBar() { _, upDown, _, a, b, _, _, _, _, _ := hintIcons() - stack := float32(96) * menu.ratio + stack := float32(75) * menu.ratio stackHint(&stack, upDown, "Navigate", h) stackHint(&stack, b, "Back", h) if s.children[0].callbackOK != nil { diff --git a/video/demul_frag_shader.go b/video/demul_frag_shader.go index 23c48eec..da593842 100644 --- a/video/demul_frag_shader.go +++ b/video/demul_frag_shader.go @@ -20,7 +20,7 @@ uniform vec4 color; COMPAT_VARYING vec2 fragTexCoord; vec4 demultiply(vec4 c) { - return vec4(c.rgb/c.a, c.a); + return vec4(c.rgb/c.a, max(0.0, c.a)); } void main() { diff --git a/video/gfx.go b/video/gfx.go index d1fe2d31..a42d5332 100644 --- a/video/gfx.go +++ b/video/gfx.go @@ -174,8 +174,8 @@ func textureLoad(rgba *image.RGBA) uint32 { gl.GenTextures(1, &texture) gl.ActiveTexture(gl.TEXTURE1) gl.BindTexture(gl.TEXTURE_2D, texture) - gl.TexParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR_MIPMAP_LINEAR) - gl.TexParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR) + gl.TexParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST_MIPMAP_NEAREST) + gl.TexParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST) gl.TexParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE) gl.TexParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE) gl.PixelStorei(gl.UNPACK_ROW_LENGTH, 0) From 0ecad7cf3c7ac5af81e82e2e883b2c4500693e0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Andr=C3=A9=20Santoni?= Date: Mon, 3 Aug 2020 16:27:35 +0700 Subject: [PATCH 05/52] Allow stacking hints to the right too --- menu/hints.go | 15 +++++++++++++-- menu/scene.go | 11 ++++++----- menu/scene_core_options.go | 11 ++++++----- menu/scene_history.go | 11 ++++++----- menu/scene_keyboard.go | 15 ++++++++------- menu/scene_playlist.go | 8 ++++---- menu/scene_savestates.go | 17 +++++++++-------- menu/scene_settings.go | 17 +++++++++-------- menu/scene_tabs.go | 11 ++++++----- menu/scene_wifi.go | 9 +++++---- 10 files changed, 72 insertions(+), 53 deletions(-) diff --git a/menu/hints.go b/menu/hints.go index f4327670..1a87651d 100644 --- a/menu/hints.go +++ b/menu/hints.go @@ -7,7 +7,7 @@ import ( ) // Used to easily compose different hint bars based on the context. -func stackHint(stack *float32, icon uint32, label string, h int) { +func stackHintLeft(stack *float32, icon uint32, label string, h int) { c := video.Color{R: 0.28, G: 0.28, B: 0.28, A: 1} vid.Font.SetColor(0.28, 0.28, 0.28, 1.0) vid.DrawImage(icon, *stack, float32(h)-79*menu.ratio, 70*menu.ratio, 70*menu.ratio, 1.0, c) @@ -17,8 +17,19 @@ func stackHint(stack *float32, icon uint32, label string, h int) { *stack += 32 * menu.ratio } +// Used to easily compose different hint bars based on the context. +func stackHintRight(stack *float32, icon uint32, label string, h int) { + c := video.Color{R: 0.28, G: 0.28, B: 0.28, A: 1} + *stack -= vid.Font.Width(0.4*menu.ratio, label) + vid.Font.SetColor(0.28, 0.28, 0.28, 1.0) + vid.Font.Printf(*stack, float32(h)-30*menu.ratio, 0.5*menu.ratio, label) + *stack -= 70 * menu.ratio + vid.DrawImage(icon, *stack, float32(h)-79*menu.ratio, 70*menu.ratio, 70*menu.ratio, 1.0, c) + *stack -= 32 * menu.ratio +} + func hintIcons() (arrows, upDown, leftRight, a, b, x, y, start, slct, guide uint32) { - if true || glfw.Joystick(0).Present() && input.HasBinding(glfw.Joystick(0)) { + if glfw.Joystick(0).Present() && input.HasBinding(glfw.Joystick(0)) { return menu.icons["pad-arrows"], menu.icons["pad-up-down"], menu.icons["pad-left-right"], diff --git a/menu/scene.go b/menu/scene.go index 759581fe..c4e406ff 100644 --- a/menu/scene.go +++ b/menu/scene.go @@ -238,11 +238,12 @@ func genericDrawHintBar() { _, upDown, _, a, b, _, _, _, _, guide := hintIcons() - stack := float32(75) * menu.ratio + lstack := float32(75) * menu.ratio + rstack := float32(w-96) * menu.ratio + stackHintLeft(&lstack, upDown, "Navigate", h) + stackHintRight(&rstack, a, "Ok", h) + stackHintRight(&rstack, b, "Back", h) if state.Global.CoreRunning { - stackHint(&stack, guide, "Resume", h) + stackHintRight(&rstack, guide, "Resume", h) } - stackHint(&stack, upDown, "Navigate", h) - stackHint(&stack, b, "Back", h) - stackHint(&stack, a, "Ok", h) } diff --git a/menu/scene_core_options.go b/menu/scene_core_options.go index a10418e9..b93dc94a 100644 --- a/menu/scene_core_options.go +++ b/menu/scene_core_options.go @@ -87,11 +87,12 @@ func (s *sceneCoreOptions) drawHintBar() { _, upDown, leftRight, _, b, _, _, _, _, guide := hintIcons() - stack := float32(75) * menu.ratio + lstack := float32(75) * menu.ratio + rstack := float32(w-96) * menu.ratio + stackHintLeft(&lstack, upDown, "Navigate", h) + stackHintRight(&rstack, leftRight, "Set", h) + stackHintRight(&rstack, b, "Back", h) if state.Global.CoreRunning { - stackHint(&stack, guide, "Resume", h) + stackHintRight(&rstack, guide, "Resume", h) } - stackHint(&stack, upDown, "Navigate", h) - stackHint(&stack, b, "Back", h) - stackHint(&stack, leftRight, "Set", h) } diff --git a/menu/scene_history.go b/menu/scene_history.go index de609dda..1b7eb987 100644 --- a/menu/scene_history.go +++ b/menu/scene_history.go @@ -201,11 +201,12 @@ func (s *sceneHistory) drawHintBar() { _, upDown, _, a, b, _, _, _, _, guide := hintIcons() - stack := float32(75) * menu.ratio + lstack := float32(75) * menu.ratio + rstack := float32(w-96) * menu.ratio + stackHintLeft(&lstack, upDown, "Navigate", h) + stackHintRight(&rstack, a, "Run", h) + stackHintRight(&rstack, b, "Back", h) if state.Global.CoreRunning { - stackHint(&stack, guide, "Resume", h) + stackHintRight(&rstack, guide, "Resume", h) } - stackHint(&stack, upDown, "Navigate", h) - stackHint(&stack, b, "Back", h) - stackHint(&stack, a, "Run", h) } diff --git a/menu/scene_keyboard.go b/menu/scene_keyboard.go index d2090dc2..4ce37ada 100644 --- a/menu/scene_keyboard.go +++ b/menu/scene_keyboard.go @@ -211,11 +211,12 @@ func (s *sceneKeyboard) drawHintBar() { arrows, _, _, a, b, x, y, start, _, _ := hintIcons() - stack := float32(75) * menu.ratio - stackHint(&stack, arrows, "Select", h) - stackHint(&stack, b, "Back", h) - stackHint(&stack, x, "Shift", h) - stackHint(&stack, y, "Delete", h) - stackHint(&stack, a, "Insert", h) - stackHint(&stack, start, "Done", h) + lstack := float32(75) * menu.ratio + rstack := float32(w-96) * menu.ratio + stackHintLeft(&lstack, arrows, "Select", h) + stackHintRight(&rstack, start, "Done", h) + stackHintRight(&rstack, a, "Insert", h) + stackHintRight(&rstack, y, "Delete", h) + stackHintRight(&rstack, x, "Shift", h) + stackHintRight(&rstack, b, "Back", h) } diff --git a/menu/scene_playlist.go b/menu/scene_playlist.go index b065b09c..6b6299c2 100644 --- a/menu/scene_playlist.go +++ b/menu/scene_playlist.go @@ -224,9 +224,9 @@ func (s *scenePlaylist) drawHintBar() { stack := float32(75) * menu.ratio if state.Global.CoreRunning { - stackHint(&stack, guide, "Resume", h) + stackHintLeft(&stack, guide, "Resume", h) } - stackHint(&stack, upDown, "Navigate", h) - stackHint(&stack, b, "Back", h) - stackHint(&stack, a, "Run", h) + stackHintLeft(&stack, upDown, "Navigate", h) + stackHintLeft(&stack, b, "Back", h) + stackHintLeft(&stack, a, "Run", h) } diff --git a/menu/scene_savestates.go b/menu/scene_savestates.go index 3575a974..4fcd49ae 100644 --- a/menu/scene_savestates.go +++ b/menu/scene_savestates.go @@ -149,15 +149,16 @@ func (s *sceneSavestates) drawHintBar() { _, upDown, _, a, b, _, _, _, _, guide := hintIcons() - stack := float32(75) * menu.ratio - if state.Global.CoreRunning { - stackHint(&stack, guide, "Resume", h) - } - stackHint(&stack, upDown, "Navigate", h) - stackHint(&stack, b, "Back", h) + lstack := float32(75) * menu.ratio + rstack := float32(w-96) * menu.ratio + stackHintLeft(&lstack, upDown, "Navigate", h) if ptr == 0 { - stackHint(&stack, a, "Save", h) + stackHintRight(&rstack, a, "Save", h) } else { - stackHint(&stack, a, "Load", h) + stackHintRight(&rstack, a, "Load", h) + } + stackHintRight(&rstack, b, "Back", h) + if state.Global.CoreRunning { + stackHintRight(&rstack, guide, "Resume", h) } } diff --git a/menu/scene_settings.go b/menu/scene_settings.go index 76ba298c..3331eac2 100644 --- a/menu/scene_settings.go +++ b/menu/scene_settings.go @@ -275,16 +275,17 @@ func (s *sceneSettings) drawHintBar() { _, upDown, leftRight, a, b, _, _, _, _, guide := hintIcons() - stack := float32(75) * menu.ratio + lstack := float32(75) * menu.ratio + rstack := float32(w-96) * menu.ratio list := menu.stack[len(menu.stack)-1].Entry() - if state.Global.CoreRunning { - stackHint(&stack, guide, "Resume", h) - } - stackHint(&stack, upDown, "Navigate", h) - stackHint(&stack, b, "Back", h) + stackHintLeft(&lstack, upDown, "Navigate", h) if list.children[list.ptr].callbackOK != nil { - stackHint(&stack, a, "Set", h) + stackHintRight(&rstack, a, "Set", h) } else { - stackHint(&stack, leftRight, "Set", h) + stackHintRight(&rstack, leftRight, "Set", h) + } + stackHintRight(&rstack, b, "Back", h) + if state.Global.CoreRunning { + stackHintRight(&rstack, guide, "Resume", h) } } diff --git a/menu/scene_tabs.go b/menu/scene_tabs.go index a7578142..513a5bbd 100644 --- a/menu/scene_tabs.go +++ b/menu/scene_tabs.go @@ -342,12 +342,13 @@ func (s sceneTabs) drawHintBar() { vid.DrawRect(0, float32(h)-88*menu.ratio, float32(w), 88*menu.ratio, 0, video.Color{R: 1, G: 1, B: 1, A: 1}) vid.DrawRect(0, float32(h)-88*menu.ratio, float32(w), 2*menu.ratio, 0, video.Color{R: 0.85, G: 0.85, B: 0.85, A: 1}) - _, _, leftRight, a, _, _, _, _, _, guide := hintIcons() + arrows, _, _, a, _, _, _, _, _, guide := hintIcons() - stack := float32(75) * menu.ratio + lstack := float32(75) * menu.ratio + rstack := float32(w-96) * menu.ratio + stackHintLeft(&lstack, arrows, "Navigate", h) + stackHintRight(&rstack, a, "Open", h) if state.Global.CoreRunning { - stackHint(&stack, guide, "Resume", h) + stackHintRight(&rstack, guide, "Resume", h) } - stackHint(&stack, leftRight, "Navigate", h) - stackHint(&stack, a, "Open", h) } diff --git a/menu/scene_wifi.go b/menu/scene_wifi.go index aee67113..fd528033 100644 --- a/menu/scene_wifi.go +++ b/menu/scene_wifi.go @@ -92,10 +92,11 @@ func (s *sceneWiFi) drawHintBar() { _, upDown, _, a, b, _, _, _, _, _ := hintIcons() - stack := float32(75) * menu.ratio - stackHint(&stack, upDown, "Navigate", h) - stackHint(&stack, b, "Back", h) + lstack := float32(75) * menu.ratio + rstack := float32(w-96) * menu.ratio + stackHintLeft(&lstack, upDown, "Navigate", h) if s.children[0].callbackOK != nil { - stackHint(&stack, a, "Connect", h) + stackHintRight(&rstack, a, "Connect", h) } + stackHintRight(&rstack, b, "Back", h) } From 2a6433045eda12a1cc652506870068753f2af1f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Andr=C3=A9=20Santoni?= Date: Mon, 3 Aug 2020 19:58:40 +0700 Subject: [PATCH 06/52] Rounded corners for thumbnails --- menu/hints.go | 8 ++++---- menu/menu.go | 4 ++-- menu/scene.go | 8 ++++---- menu/scene_core_options.go | 2 +- menu/scene_dialog.go | 4 ++-- menu/scene_history.go | 6 +++--- menu/scene_keyboard.go | 2 +- menu/scene_playlist.go | 4 ++-- menu/scene_savestates.go | 4 ++-- menu/scene_settings.go | 4 ++-- menu/scene_tabs.go | 6 +++--- menu/scene_wifi.go | 2 +- menu/thumbnail.go | 4 ++-- video/gfx.go | 19 ++++++++++++++++--- video/rounded_frag_shader.go | 7 ++++++- video/video.go | 3 +++ 16 files changed, 54 insertions(+), 33 deletions(-) diff --git a/menu/hints.go b/menu/hints.go index 1a87651d..e5dec3fc 100644 --- a/menu/hints.go +++ b/menu/hints.go @@ -10,21 +10,21 @@ import ( func stackHintLeft(stack *float32, icon uint32, label string, h int) { c := video.Color{R: 0.28, G: 0.28, B: 0.28, A: 1} vid.Font.SetColor(0.28, 0.28, 0.28, 1.0) - vid.DrawImage(icon, *stack, float32(h)-79*menu.ratio, 70*menu.ratio, 70*menu.ratio, 1.0, c) + vid.DrawImage(icon, *stack, float32(h)-79*menu.ratio, 70*menu.ratio, 70*menu.ratio, 1.0, 0, c) *stack += 70 * menu.ratio vid.Font.Printf(*stack, float32(h)-30*menu.ratio, 0.5*menu.ratio, label) - *stack += vid.Font.Width(0.4*menu.ratio, label) + *stack += vid.Font.Width(0.5*menu.ratio, label) *stack += 32 * menu.ratio } // Used to easily compose different hint bars based on the context. func stackHintRight(stack *float32, icon uint32, label string, h int) { c := video.Color{R: 0.28, G: 0.28, B: 0.28, A: 1} - *stack -= vid.Font.Width(0.4*menu.ratio, label) + *stack -= vid.Font.Width(0.5*menu.ratio, label) vid.Font.SetColor(0.28, 0.28, 0.28, 1.0) vid.Font.Printf(*stack, float32(h)-30*menu.ratio, 0.5*menu.ratio, label) *stack -= 70 * menu.ratio - vid.DrawImage(icon, *stack, float32(h)-79*menu.ratio, 70*menu.ratio, 70*menu.ratio, 1.0, c) + vid.DrawImage(icon, *stack, float32(h)-79*menu.ratio, 70*menu.ratio, 70*menu.ratio, 1.0, 0, c) *stack -= 32 * menu.ratio } diff --git a/menu/menu.go b/menu/menu.go index 126b148f..49a9495a 100644 --- a/menu/menu.go +++ b/menu/menu.go @@ -65,9 +65,9 @@ func (m *Menu) Render(dt float32) { m.ratio = float32(w) / 1920 if state.Global.CoreRunning { - vid.DrawImage(menu.icons["bg"], 0, 0, float32(w), float32(h), 1, video.Color{1, 1, 1, 0.85}) + vid.DrawImage(menu.icons["bg"], 0, 0, float32(w), float32(h), 1, 0, video.Color{1, 1, 1, 0.85}) } else { - vid.DrawImage(menu.icons["bg"], 0, 0, float32(w), float32(h), 1, video.Color{1, 1, 1, 1}) + vid.DrawImage(menu.icons["bg"], 0, 0, float32(w), float32(h), 1, 0, video.Color{1, 1, 1, 1}) } m.tweens.Update(dt) diff --git a/menu/scene.go b/menu/scene.go index c4e406ff..b5817eff 100644 --- a/menu/scene.go +++ b/menu/scene.go @@ -160,7 +160,7 @@ func genericDrawCursor(list *entry) { // } vid.DrawImage(menu.icons["arrow"], 530*menu.ratio, float32(h)*list.cursor.yp-35*menu.ratio, - 70*menu.ratio, 70*menu.ratio, 1, c) + 70*menu.ratio, 70*menu.ratio, 1, 0, c) vid.DrawRect( 550*menu.ratio, float32(h)*list.cursor.yp-50*menu.ratio, float32(w)-630*menu.ratio, 100*menu.ratio, 1, c) @@ -176,7 +176,7 @@ func thumbnailDrawCursor(list *entry) { // } vid.DrawImage(menu.icons["arrow"], 500*menu.ratio, float32(h)*list.cursor.yp-50*menu.ratio, - 100*menu.ratio, 100*menu.ratio, 1, c) + 100*menu.ratio, 100*menu.ratio, 1, 0, c) vid.DrawRect( 530*menu.ratio, float32(h)*list.cursor.yp-120*menu.ratio, float32(w)-630*menu.ratio, 240*menu.ratio, 0.2, c) @@ -207,7 +207,7 @@ func genericRender(list *entry) { 610*menu.ratio-64*0.5*menu.ratio, float32(h)*e.yp-14*menu.ratio-64*0.5*menu.ratio+fontOffset, 128*menu.ratio, 128*menu.ratio, - 0.5, color) + 0.5, 0, color) if e.labelAlpha > 0 { vid.Font.SetColor(color.R, color.G, color.B, e.labelAlpha) @@ -239,7 +239,7 @@ func genericDrawHintBar() { _, upDown, _, a, b, _, _, _, _, guide := hintIcons() lstack := float32(75) * menu.ratio - rstack := float32(w-96) * menu.ratio + rstack := float32(w) - 96*menu.ratio stackHintLeft(&lstack, upDown, "Navigate", h) stackHintRight(&rstack, a, "Ok", h) stackHintRight(&rstack, b, "Back", h) diff --git a/menu/scene_core_options.go b/menu/scene_core_options.go index b93dc94a..c4e9aabb 100644 --- a/menu/scene_core_options.go +++ b/menu/scene_core_options.go @@ -88,7 +88,7 @@ func (s *sceneCoreOptions) drawHintBar() { _, upDown, leftRight, _, b, _, _, _, _, guide := hintIcons() lstack := float32(75) * menu.ratio - rstack := float32(w-96) * menu.ratio + rstack := float32(w) - 96*menu.ratio stackHintLeft(&lstack, upDown, "Navigate", h) stackHintRight(&rstack, leftRight, "Set", h) stackHintRight(&rstack, b, "Back", h) diff --git a/menu/scene_dialog.go b/menu/scene_dialog.go index 54a115c5..4cef9018 100644 --- a/menu/scene_dialog.go +++ b/menu/scene_dialog.go @@ -88,7 +88,7 @@ func (s *sceneDialog) render() { b, fw/2-width/2*menu.ratio+margin*menu.ratio, fh/2+height/2*menu.ratio-70*menu.ratio-margin*menu.ratio, - 70*menu.ratio, 70*menu.ratio, 1.0, c) + 70*menu.ratio, 70*menu.ratio, 1.0, 0, c) vid.Font.Printf( fw/2-width/2*menu.ratio+margin*menu.ratio+70*menu.ratio, fh/2+height/2*menu.ratio-23*menu.ratio-margin*menu.ratio, @@ -99,7 +99,7 @@ func (s *sceneDialog) render() { a, fw/2+width/2*menu.ratio-150*menu.ratio-margin*menu.ratio, fh/2+height/2*menu.ratio-70*menu.ratio-margin*menu.ratio, - 70*menu.ratio, 70*menu.ratio, 1.0, c) + 70*menu.ratio, 70*menu.ratio, 1.0, 0, c) vid.Font.Printf( fw/2+width/2*menu.ratio-150*menu.ratio-margin*menu.ratio+70*menu.ratio, fh/2+height/2*menu.ratio-23*menu.ratio-margin*menu.ratio, diff --git a/menu/scene_history.go b/menu/scene_history.go index 1b7eb987..a00d4379 100644 --- a/menu/scene_history.go +++ b/menu/scene_history.go @@ -152,7 +152,7 @@ func (s *sceneHistory) render() { 680*menu.ratio-25*e.scale*menu.ratio, float32(h)*e.yp-14*menu.ratio-25*e.scale*menu.ratio+fontOffset, 50*menu.ratio, 50*menu.ratio, - e.scale, video.Color{R: 1, G: 1, B: 1, A: e.iconAlpha}) + e.scale, 0, video.Color{R: 1, G: 1, B: 1, A: e.iconAlpha}) } // Offset on Y to vertically center label + sublabel if there is a sublabel @@ -176,7 +176,7 @@ func (s *sceneHistory) render() { vid.DrawImage( menu.icons[tag], stack, float32(h)*e.yp-22*menu.ratio-slOffset, - 60*menu.ratio, 44*menu.ratio, 1.0, video.Color{R: 1, G: 1, B: 1, A: e.tagAlpha}) + 60*menu.ratio, 44*menu.ratio, 1.0, 0, video.Color{R: 1, G: 1, B: 1, A: e.tagAlpha}) vid.DrawBorder(stack, float32(h)*e.yp-22*menu.ratio-slOffset, 60*menu.ratio, 44*menu.ratio, 0.05/menu.ratio, video.Color{R: 0, G: 0, B: 0, A: e.tagAlpha / 4}) stack += 60 * menu.ratio @@ -202,7 +202,7 @@ func (s *sceneHistory) drawHintBar() { _, upDown, _, a, b, _, _, _, _, guide := hintIcons() lstack := float32(75) * menu.ratio - rstack := float32(w-96) * menu.ratio + rstack := float32(w) - 96*menu.ratio stackHintLeft(&lstack, upDown, "Navigate", h) stackHintRight(&rstack, a, "Run", h) stackHintRight(&rstack, b, "Back", h) diff --git a/menu/scene_keyboard.go b/menu/scene_keyboard.go index 4ce37ada..b134b942 100644 --- a/menu/scene_keyboard.go +++ b/menu/scene_keyboard.go @@ -212,7 +212,7 @@ func (s *sceneKeyboard) drawHintBar() { arrows, _, _, a, b, x, y, start, _, _ := hintIcons() lstack := float32(75) * menu.ratio - rstack := float32(w-96) * menu.ratio + rstack := float32(w) - 96*menu.ratio stackHintLeft(&lstack, arrows, "Select", h) stackHintRight(&rstack, start, "Done", h) stackHintRight(&rstack, a, "Insert", h) diff --git a/menu/scene_playlist.go b/menu/scene_playlist.go index 6b6299c2..24493b3f 100644 --- a/menu/scene_playlist.go +++ b/menu/scene_playlist.go @@ -185,7 +185,7 @@ func (s *scenePlaylist) render() { 680*menu.ratio-25*e.scale*menu.ratio, float32(h)*e.yp-14*menu.ratio-25*e.scale*menu.ratio+fontOffset, 50*menu.ratio, 50*menu.ratio, - e.scale, video.Color{R: 1, G: 1, B: 1, A: e.iconAlpha}) + e.scale, 0, video.Color{R: 1, G: 1, B: 1, A: e.iconAlpha}) } vid.Font.SetColor(color.R, color.G, color.B, e.labelAlpha) @@ -203,7 +203,7 @@ func (s *scenePlaylist) render() { vid.DrawImage( menu.icons[tag], stack, float32(h)*e.yp-22*menu.ratio, - 60*menu.ratio, 44*menu.ratio, 1.0, video.Color{R: 1, G: 1, B: 1, A: e.tagAlpha}) + 60*menu.ratio, 44*menu.ratio, 1.0, 0, video.Color{R: 1, G: 1, B: 1, A: e.tagAlpha}) vid.DrawBorder(stack, float32(h)*e.yp-22*menu.ratio, 60*menu.ratio, 44*menu.ratio, 0.05/menu.ratio, video.Color{R: 0, G: 0, B: 0, A: e.tagAlpha / 4}) stack += 60 * menu.ratio diff --git a/menu/scene_savestates.go b/menu/scene_savestates.go index 4fcd49ae..d703b681 100644 --- a/menu/scene_savestates.go +++ b/menu/scene_savestates.go @@ -128,7 +128,7 @@ func (s *sceneSavestates) render() { 680*menu.ratio-25*e.scale*menu.ratio, float32(h)*e.yp-14*menu.ratio-25*e.scale*menu.ratio+fontOffset, 50*menu.ratio, 50*menu.ratio, - e.scale, video.Color{R: 1, G: 1, B: 1, A: e.iconAlpha}) + e.scale, 0, video.Color{R: 1, G: 1, B: 1, A: e.iconAlpha}) } vid.Font.SetColor(color.R, color.G, color.B, e.labelAlpha) @@ -150,7 +150,7 @@ func (s *sceneSavestates) drawHintBar() { _, upDown, _, a, b, _, _, _, _, guide := hintIcons() lstack := float32(75) * menu.ratio - rstack := float32(w-96) * menu.ratio + rstack := float32(w) - 96*menu.ratio stackHintLeft(&lstack, upDown, "Navigate", h) if ptr == 0 { stackHintRight(&rstack, a, "Save", h) diff --git a/menu/scene_settings.go b/menu/scene_settings.go index 3331eac2..77d71f65 100644 --- a/menu/scene_settings.go +++ b/menu/scene_settings.go @@ -143,7 +143,7 @@ var widgets = map[string]func(*entry){ float32(w)-128*menu.ratio-128*menu.ratio, float32(h)*e.yp-64*1.25*menu.ratio, 128*menu.ratio, 128*menu.ratio, - 1.25, color) + 1.25, 0, color) }, // Range widget for audio volume and similat float settings @@ -276,7 +276,7 @@ func (s *sceneSettings) drawHintBar() { _, upDown, leftRight, a, b, _, _, _, _, guide := hintIcons() lstack := float32(75) * menu.ratio - rstack := float32(w-96) * menu.ratio + rstack := float32(w) - 96*menu.ratio list := menu.stack[len(menu.stack)-1].Entry() stackHintLeft(&lstack, upDown, "Navigate", h) if list.children[list.ptr].callbackOK != nil { diff --git a/menu/scene_tabs.go b/menu/scene_tabs.go index 513a5bbd..5edea38d 100644 --- a/menu/scene_tabs.go +++ b/menu/scene_tabs.go @@ -305,7 +305,7 @@ func (s sceneTabs) render() { x*menu.ratio-8*menu.ratio, y*menu.ratio-8*menu.ratio, 320*e.scale*menu.ratio+16*menu.ratio, 240*e.scale*menu.ratio+16*menu.ratio, - 1, video.Color{R: 1, G: 1, B: 1, A: (e.borderAlpha - blink) * s.alpha}) + 1, 0.1, video.Color{R: 1, G: 1, B: 1, A: (e.borderAlpha - blink) * s.alpha}) drawThumbnail( &ve, i, @@ -320,7 +320,7 @@ func (s sceneTabs) render() { x*menu.ratio, y*menu.ratio, 320*e.scale*menu.ratio, 240*e.scale*menu.ratio, - 1, video.Color{R: 1, G: 1, B: 1, A: e.iconAlpha * s.alpha * 0.25}) + 1, 0.07, video.Color{R: 1, G: 1, B: 1, A: e.iconAlpha * s.alpha}) vid.BoldFont.SetColor(0, 0, 0, e.labelAlpha*s.alpha) vid.BoldFont.Printf( @@ -345,7 +345,7 @@ func (s sceneTabs) drawHintBar() { arrows, _, _, a, _, _, _, _, _, guide := hintIcons() lstack := float32(75) * menu.ratio - rstack := float32(w-96) * menu.ratio + rstack := float32(w) - 96*menu.ratio stackHintLeft(&lstack, arrows, "Navigate", h) stackHintRight(&rstack, a, "Open", h) if state.Global.CoreRunning { diff --git a/menu/scene_wifi.go b/menu/scene_wifi.go index fd528033..ce3f321e 100644 --- a/menu/scene_wifi.go +++ b/menu/scene_wifi.go @@ -93,7 +93,7 @@ func (s *sceneWiFi) drawHintBar() { _, upDown, _, a, b, _, _, _, _, _ := hintIcons() lstack := float32(75) * menu.ratio - rstack := float32(w-96) * menu.ratio + rstack := float32(w) - 96*menu.ratio stackHintLeft(&lstack, upDown, "Navigate", h) if s.children[0].callbackOK != nil { stackHintRight(&rstack, a, "Connect", h) diff --git a/menu/thumbnail.go b/menu/thumbnail.go index 2eee5631..0328177d 100644 --- a/menu/thumbnail.go +++ b/menu/thumbnail.go @@ -81,7 +81,7 @@ func drawThumbnail(list *entry, i int, system, gameName string, x, y, w, h, scal vid.DrawImage( list.children[i].thumbnail, - x, y, w, h, scale, + x, y, w, h, scale, 0.07, color, ) } @@ -96,7 +96,7 @@ func drawSavestateThumbnail(list *entry, i int, path string, x, y, w, h, scale f vid.DrawImage( list.children[i].thumbnail, - x, y, w, h, scale, + x, y, w, h, scale, 0, color, ) } diff --git a/video/gfx.go b/video/gfx.go index a42d5332..7de2aeda 100644 --- a/video/gfx.go +++ b/video/gfx.go @@ -60,17 +60,21 @@ func rotateUV(va []float32, rot uint) []float32 { } // DrawImage draws an image with x, y, w, h -func (video *Video) DrawImage(image uint32, x, y, w, h float32, scale float32, c Color) { +func (video *Video) DrawImage(image uint32, x, y, w, h, scale, r float32, c Color) { va := video.vertexArray(x, y, w, h, scale) - gl.UseProgram(video.demulProgram) - gl.Uniform4f(gl.GetUniformLocation(video.demulProgram, gl.Str("color\x00")), c.R, c.G, c.B, c.A) + gl.UseProgram(video.roundedProgram) + gl.Uniform4f(gl.GetUniformLocation(video.roundedProgram, gl.Str("color\x00")), c.R, c.G, c.B, c.A) + gl.Uniform1f(gl.GetUniformLocation(video.roundedProgram, gl.Str("radius\x00")), r) + gl.Uniform2f(gl.GetUniformLocation(video.roundedProgram, gl.Str("size\x00")), w, h) gl.Enable(gl.BLEND) gl.BlendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA) bindVertexArray(video.vao) gl.ActiveTexture(gl.TEXTURE0) gl.BindTexture(gl.TEXTURE_2D, image) + gl.TexParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST) + gl.TexParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST) gl.BindBuffer(gl.ARRAY_BUFFER, video.vbo) gl.BufferData(gl.ARRAY_BUFFER, len(va)*4, gl.Ptr(va), gl.STATIC_DRAW) gl.DrawArrays(gl.TRIANGLE_STRIP, 0, 4) @@ -142,10 +146,13 @@ func (video *Video) DrawRect(x, y, w, h, r float32, c Color) { gl.Enable(gl.BLEND) gl.BlendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA) bindVertexArray(video.vao) + gl.ActiveTexture(gl.TEXTURE0) + gl.BindTexture(gl.TEXTURE_2D, video.white) gl.BindBuffer(gl.ARRAY_BUFFER, video.vbo) gl.BufferData(gl.ARRAY_BUFFER, len(va)*4, gl.Ptr(va), gl.STATIC_DRAW) gl.DrawArrays(gl.TRIANGLE_STRIP, 0, 4) bindVertexArray(0) + gl.BindTexture(gl.TEXTURE_2D, 0) gl.UseProgram(0) gl.Disable(gl.BLEND) } @@ -213,3 +220,9 @@ func NewImage(file string) uint32 { return textureLoad(rgba) } + +func newWhite() uint32 { + rgba := image.NewRGBA(image.Rect(0, 0, 8, 8)) + draw.Draw(rgba, rgba.Bounds(), image.White, image.Point{0, 0}, draw.Src) + return textureLoad(rgba) +} diff --git a/video/rounded_frag_shader.go b/video/rounded_frag_shader.go index d9717cd5..d5455282 100644 --- a/video/rounded_frag_shader.go +++ b/video/rounded_frag_shader.go @@ -14,6 +14,7 @@ out vec4 COMPAT_FRAGCOLOR; #define COMPAT_FRAGCOLOR gl_FragColor #endif +uniform sampler2D Texture; uniform vec4 color; uniform float radius; uniform vec2 size; @@ -24,11 +25,15 @@ float udRoundBox(vec2 p, vec2 b, float r) { return length(max(abs(p)-b+r,0.0))-r; } +vec4 demultiply(vec4 c) { + return vec4(c.rgb/c.a, c.a); +} + void main() { float ratio = size.x / size.y; vec2 halfRes = vec2(0.5*ratio, 0.5); float b = udRoundBox(fragTexCoord*vec2(ratio,1.0) - halfRes, halfRes, min(halfRes.x,halfRes.y)*radius); vec4 c = min(color, vec4(1.0, 1.0, 1.0, 1.0)); - COMPAT_FRAGCOLOR = vec4(c.r, c.g, c.b, c.a * (1.0-smoothstep(0.00002,0.0001,b))); + COMPAT_FRAGCOLOR = demultiply(COMPAT_TEXTURE(Texture, fragTexCoord)) * vec4(c.r, c.g, c.b, c.a * (1.0-smoothstep(0.0001,0.001,b))); } ` + "\x00" diff --git a/video/video.go b/video/video.go index ef0a6e21..24c38246 100644 --- a/video/video.go +++ b/video/video.go @@ -36,6 +36,7 @@ type Video struct { Font *Font BoldFont *Font + white uint32 // white texture for sampler2D program uint32 // current program used for the game quad defaultProgram uint32 // default program used for the game quad sharpBilinearProgram uint32 // sharp bilinear program used for the game quad @@ -194,6 +195,8 @@ func (video *Video) Configure(fullscreen bool) { video.coreRatioViewport(fbw, fbh) + video.white = newWhite() + if e := gl.GetError(); e != gl.NO_ERROR { log.Printf("[Video] OpenGL error: %d\n", e) } From ba40c5454452a1acc603998c3e7101f1544f4bd6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Andr=C3=A9=20Santoni?= Date: Mon, 3 Aug 2020 22:48:40 +0700 Subject: [PATCH 07/52] Tweaks --- menu/scene_tabs.go | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/menu/scene_tabs.go b/menu/scene_tabs.go index 5edea38d..091c81f6 100644 --- a/menu/scene_tabs.go +++ b/menu/scene_tabs.go @@ -110,14 +110,14 @@ func (s *sceneTabs) segueMount() { ve := &s.children[j] ve.labelAlpha = 0 ve.height = 504 + 136 - if j == s.yptr { - ve.height = 240 + 136 - } + //if j == s.yptr { + ve.height = 240 + 136 + //} for i := range ve.children { e := &s.children[j].children[i] - if j == s.yptr && i == s.xptrs[j] { + if i == s.xptrs[j] { e.labelAlpha = 0 e.iconAlpha = 0 e.scale = 2.1 @@ -153,16 +153,16 @@ func (s *sceneTabs) animate() { } menu.tweens[&ve.labelAlpha] = gween.New(ve.labelAlpha, labelAlpha, 0.15, ease.OutSine) height := float32(240 + 136) - if j == s.yptr { - height = 504 + 136 - } + //if j == s.yptr { + height = 504 + 136 + //} menu.tweens[&ve.height] = gween.New(ve.height, height, 0.15, ease.OutSine) for i := range ve.children { e := &s.children[j].children[i] var labelAlpha, iconAlpha, scale, borderAlpha float32 - if j == s.yptr && i == s.xptrs[j] { + if i == s.xptrs[j] { labelAlpha = 1 iconAlpha = 1 scale = 2.1 @@ -195,7 +195,7 @@ func (s *sceneTabs) animate() { if j == s.yptr { break } - vst += 240 + 136 + vst += 504 + 136 } menu.tweens[&s.yscroll] = gween.New(s.yscroll, vst, 0.15, ease.OutSine) @@ -271,7 +271,7 @@ func (s sceneTabs) render() { for j, ve := range s.children { ve := ve - vid.BoldFont.SetColor(0.129, 0.443, 0.686, ve.labelAlpha*s.alpha) + vid.BoldFont.SetColor(0.129, 0.441, 0.684, ve.labelAlpha*s.alpha) vid.BoldFont.Printf( 96*menu.ratio, 230*menu.ratio+vst*menu.ratio-s.yscroll*menu.ratio, From 3cf76e948a1190a544e7822421c529ac0fe4a27a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Andr=C3=A9=20Santoni?= Date: Tue, 4 Aug 2020 11:08:58 +0700 Subject: [PATCH 08/52] Code cleaning --- go.mod | 1 - go.sum | 7 ------- menu/menu.go | 4 ++-- menu/{scene_tabs.go => scene_home.go} | 22 +++++++++++----------- 4 files changed, 13 insertions(+), 21 deletions(-) rename menu/{scene_tabs.go => scene_home.go} (95%) diff --git a/go.mod b/go.mod index 8ab3ea5b..37e9e77f 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,6 @@ require ( github.com/fatih/structs v1.1.0 github.com/go-gl/gl v0.0.0-20190320180904-bf2b1f2f34d7 github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200707082815-5321531c36a2 - github.com/go-gl/mathgl v0.0.0-20190713194549-592312d8590a // indirect github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 github.com/lucasb-eyer/go-colorful v1.0.2 github.com/pelletier/go-toml v1.6.0 diff --git a/go.sum b/go.sum index 99834a5d..44591e20 100644 --- a/go.sum +++ b/go.sum @@ -14,14 +14,8 @@ github.com/fatih/structs v1.1.0 h1:Q7juDM0QtcnhCpeyLGQKyg4TOIghuNXrkL32pHAUMxo= github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M= github.com/go-gl/gl v0.0.0-20190320180904-bf2b1f2f34d7 h1:SCYMcCJ89LjRGwEa0tRluNRiMjZHalQZrVrvTbPh+qw= github.com/go-gl/gl v0.0.0-20190320180904-bf2b1f2f34d7/go.mod h1:482civXOzJJCPzJ4ZOX/pwvXBWSnzD4OKMdH4ClKGbk= -github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72 h1:b+9H1GAsx5RsjvDFLoS5zkNBzIQMuVKUYQDmxU3N5XE= -github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= -github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4 h1:WtGNWLvXpe6ZudgnXrq0barxBImvnnJoMEhXAzcbM0I= -github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200707082815-5321531c36a2 h1:Ac1OEHHkbAZ6EUnJahF0GKcU0FjPc/V8F1DvjhKngFE= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200707082815-5321531c36a2/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= -github.com/go-gl/mathgl v0.0.0-20190713194549-592312d8590a h1:yoAEv7yeWqfL/l9A/J5QOndXIJCldv+uuQB1DSNQbS0= -github.com/go-gl/mathgl v0.0.0-20190713194549-592312d8590a/go.mod h1:yhpkQzEiH9yPyxDUGzkmgScbaBVlhC06qodikEM0ZwQ= github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 h1:DACJavvAHhabrF08vX0COfcOBJRhZ8lUbR+ZWIs0Y5g= github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGwJL78qG/PmXZO1EjYhfJinVAhrmmHX6Z8B9k= github.com/lucasb-eyer/go-colorful v1.0.2 h1:mCMFu6PgSozg9tDNMMK3g18oJBX7oYGrC09mS6CXfO4= @@ -43,7 +37,6 @@ golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL golang.org/x/image v0.0.0-20180708004352-c73c2afc3b81/go.mod h1:ux5Hcp/YLpHSI86hEcLt0YII63i6oz57MZXIpbrjZUs= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067 h1:KYGJGHOQy8oSi1fDlSpcZF0+juKwk/hEMv5SiwHogR0= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= -golang.org/x/image v0.0.0-20190321063152-3fc05d484e9f/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20191009234506-e7c1f5e7dbb8 h1:hVwzHzIUGRjiF7EcUjqNxk3NCfkPxbDKRdnNE1Rpg0U= golang.org/x/image v0.0.0-20191009234506-e7c1f5e7dbb8/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/mobile v0.0.0-20190607214518-6fa95d984e88 h1:H6DkDrMSuEE2MQR7DgGwkzbXSY1lvMpEN5MDE1bo/5U= diff --git a/menu/menu.go b/menu/menu.go index 49a9495a..901416b2 100644 --- a/menu/menu.go +++ b/menu/menu.go @@ -39,7 +39,7 @@ func Init(v *video.Video) *Menu { menu.ratio = float32(w) / 1920 menu.icons = map[string]uint32{} - menu.Push(buildTabs()) + menu.Push(buildHome()) menu.ContextReset() @@ -114,7 +114,7 @@ func (m *Menu) ContextReset() { func (m *Menu) WarpToQuickMenu() { m.scroll = 0 m.stack = []Scene{} - m.Push(buildTabs()) + m.Push(buildHome()) m.stack[0].segueNext() m.Push(buildMainMenu()) m.stack[1].segueNext() diff --git a/menu/scene_tabs.go b/menu/scene_home.go similarity index 95% rename from menu/scene_tabs.go rename to menu/scene_home.go index 091c81f6..2499fc89 100644 --- a/menu/scene_tabs.go +++ b/menu/scene_home.go @@ -17,7 +17,7 @@ import ( "github.com/tanema/gween/ease" ) -type sceneTabs struct { +type sceneHome struct { entry yptr int yscroll float32 @@ -25,8 +25,8 @@ type sceneTabs struct { xptrs []int } -func buildTabs() Scene { - var list sceneTabs +func buildHome() Scene { + var list sceneHome list.label = "Home" cat := 0 @@ -95,11 +95,11 @@ func buildTabs() Scene { return &list } -func (s *sceneTabs) Entry() *entry { +func (s *sceneHome) Entry() *entry { return &s.entry } -func (s *sceneTabs) segueMount() { +func (s *sceneHome) segueMount() { s.alpha = 0 for j := range s.children { s.xscrolls[j] = 0 @@ -139,11 +139,11 @@ func (s *sceneTabs) segueMount() { s.animate() } -func (s *sceneTabs) segueBack() { +func (s *sceneHome) segueBack() { s.animate() } -func (s *sceneTabs) animate() { +func (s *sceneHome) animate() { for j := range s.children { ve := &s.children[j] @@ -202,7 +202,7 @@ func (s *sceneTabs) animate() { menu.tweens[&s.alpha] = gween.New(s.alpha, 1, 0.15, ease.OutSine) } -func (s *sceneTabs) segueNext() { +func (s *sceneHome) segueNext() { menu.tweens[&s.alpha] = gween.New(s.alpha, 0, 0.15, ease.OutSine) menu.tweens[&s.yscroll] = gween.New(s.yscroll, s.yscroll+300, 0.15, ease.OutSine) @@ -215,7 +215,7 @@ func (s *sceneTabs) segueNext() { } } -func (s *sceneTabs) update(dt float32) { +func (s *sceneHome) update(dt float32) { // Right repeatRight(dt, input.NewState[0][libretro.DeviceIDJoypadRight], func() { if s.xptrs[s.yptr] < len(s.children[s.yptr].children)-1 { @@ -266,7 +266,7 @@ func (s *sceneTabs) update(dt float32) { } } -func (s sceneTabs) render() { +func (s sceneHome) render() { vst := float32(0) for j, ve := range s.children { ve := ve @@ -337,7 +337,7 @@ func (s sceneTabs) render() { } } -func (s sceneTabs) drawHintBar() { +func (s sceneHome) drawHintBar() { w, h := vid.Window.GetFramebufferSize() vid.DrawRect(0, float32(h)-88*menu.ratio, float32(w), 88*menu.ratio, 0, video.Color{R: 1, G: 1, B: 1, A: 1}) vid.DrawRect(0, float32(h)-88*menu.ratio, float32(w), 2*menu.ratio, 0, video.Color{R: 0.85, G: 0.85, B: 0.85, A: 1}) From cab234a1ff5d8a33e14823ff3d70062b7a5d8a37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Andr=C3=A9=20Santoni?= Date: Tue, 4 Aug 2020 11:45:15 +0700 Subject: [PATCH 09/52] Display tabs --- menu/menu.go | 2 + menu/scene_home.go | 4 +- menu/scene_keyboard.go | 6 +- menu/scene_tabs.go | 218 +++++++++++++++++++++++++++++++++++++++++ 4 files changed, 225 insertions(+), 5 deletions(-) create mode 100644 menu/scene_tabs.go diff --git a/menu/menu.go b/menu/menu.go index 901416b2..9ed2fbb6 100644 --- a/menu/menu.go +++ b/menu/menu.go @@ -17,6 +17,7 @@ var menu *Menu // Menu is a type holding the menu state, the stack of scenes, tweens, etc type Menu struct { + focus int // this is a hack to switch focus between top tabs and the other scenes stack []Scene icons map[string]uint32 tweens Tweens @@ -39,6 +40,7 @@ func Init(v *video.Video) *Menu { menu.ratio = float32(w) / 1920 menu.icons = map[string]uint32{} + menu.Push(buildTabs()) menu.Push(buildHome()) menu.ContextReset() diff --git a/menu/scene_home.go b/menu/scene_home.go index 2499fc89..cfe9cb4e 100644 --- a/menu/scene_home.go +++ b/menu/scene_home.go @@ -117,7 +117,7 @@ func (s *sceneHome) segueMount() { for i := range ve.children { e := &s.children[j].children[i] - if i == s.xptrs[j] { + if i == s.xptrs[j] && j >= s.yptr { e.labelAlpha = 0 e.iconAlpha = 0 e.scale = 2.1 @@ -162,7 +162,7 @@ func (s *sceneHome) animate() { e := &s.children[j].children[i] var labelAlpha, iconAlpha, scale, borderAlpha float32 - if i == s.xptrs[j] { + if i == s.xptrs[j] && j >= s.yptr { labelAlpha = 1 iconAlpha = 1 scale = 2.1 diff --git a/menu/scene_keyboard.go b/menu/scene_keyboard.go index b134b942..c302d62b 100644 --- a/menu/scene_keyboard.go +++ b/menu/scene_keyboard.go @@ -20,19 +20,19 @@ type sceneKeyboard struct { } var layouts = [][]string{ - []string{ + { "1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "q", "w", "e", "r", "t", "y", "u", "i", "o", "p", "a", "s", "d", "f", "g", "h", "j", "k", "l", "@", "z", "x", "c", "v", "b", "n", "m", " ", "-", ".", }, - []string{ + { "1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "Q", "W", "E", "R", "T", "Y", "U", "I", "O", "P", "A", "S", "D", "F", "G", "H", "J", "K", "L", "+", "Z", "X", "C", "V", "B", "N", "M", " ", "_", "/", }, - []string{ + { "1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "!", "\"", "#", "$", "%%", "&", "'", "*", "(", ")", "+", ",", "-", "~", "/", ":", ";", "=", "<", ">", diff --git a/menu/scene_tabs.go b/menu/scene_tabs.go new file mode 100644 index 00000000..cefab37f --- /dev/null +++ b/menu/scene_tabs.go @@ -0,0 +1,218 @@ +package menu + +import ( + "github.com/tanema/gween" + "github.com/tanema/gween/ease" + + "github.com/libretro/ludo/audio" + "github.com/libretro/ludo/input" + "github.com/libretro/ludo/libretro" + "github.com/libretro/ludo/state" + "github.com/libretro/ludo/video" +) + +type sceneTabs struct { + entry +} + +func buildTabs() Scene { + var list sceneTabs + list.label = "Tabs" + + list.children = append(list.children, entry{ + icon: "tab-collection", + callbackOK: func() { + menu.stack = menu.stack[:len(menu.stack)-1] + menu.Push(buildHome()) + menu.focus-- + }, + }) + + list.children = append(list.children, entry{ + icon: "tab-settings", + callbackOK: func() { + menu.stack = menu.stack[:len(menu.stack)-1] + menu.Push(buildSettings()) + menu.focus-- + }, + }) + + if state.Global.LudOS { + list.children = append(list.children, entry{ + icon: "updater", + callbackOK: func() { + list.segueNext() + menu.Push(buildUpdater()) + }, + }) + + list.children = append(list.children, entry{ + icon: "reboot", + callbackOK: func() { + askConfirmation(func() { cleanReboot() }) + }, + }) + + list.children = append(list.children, entry{ + icon: "tab-quit", + callbackOK: func() { + askConfirmation(func() { cleanShutdown() }) + }, + }) + } else { + list.children = append(list.children, entry{ + icon: "tab-quit", + callbackOK: func() { + askConfirmation(func() { + vid.Window.SetShouldClose(true) + }) + }, + }) + } + + list.segueMount() + + return &list +} + +func (s *sceneTabs) Entry() *entry { + return &s.entry +} + +func (s *sceneTabs) segueMount() { + for i := range s.children { + e := &s.children[i] + + e.iconAlpha = 0.25 + if i == s.ptr { + e.iconAlpha = 1 + } + } + + s.animate() +} + +func (s *sceneTabs) segueBack() { + s.animate() + s.winFocus() +} + +func (s *sceneTabs) winFocus() { + for i := range s.children { + e := &s.children[i] + + labelAlpha := float32(0.5) + if i == s.ptr { + labelAlpha = 1 + } + + menu.tweens[&e.labelAlpha] = gween.New(e.labelAlpha, labelAlpha, 0.15, ease.OutSine) + } + + menu.tweens[&s.alpha] = gween.New(s.alpha, 1, 0.15, ease.OutSine) + menu.tweens[&s.width] = gween.New(s.width, 450, 0.15, ease.OutSine) +} + +func (s *sceneTabs) loseFocus() { + for i := range s.children { + e := &s.children[i] + menu.tweens[&e.labelAlpha] = gween.New(e.labelAlpha, 0, 0.15, ease.OutSine) + } + + menu.tweens[&s.alpha] = gween.New(s.alpha, 0, 0.15, ease.OutSine) + menu.tweens[&s.width] = gween.New(s.width, 150, 0.15, ease.OutSine) +} + +func (s *sceneTabs) animate() { + for i := range s.children { + e := &s.children[i] + + var iconAlpha, labelAlpha float32 + if i == s.ptr { + iconAlpha = 1 + labelAlpha = 1 + } else if i < s.ptr { + iconAlpha = 0.5 + labelAlpha = 0.5 + } else if i > s.ptr { + iconAlpha = 0.5 + labelAlpha = 0.5 + } + if menu.focus != 1 { + labelAlpha = 0 + } + + menu.tweens[&e.iconAlpha] = gween.New(e.iconAlpha, iconAlpha, 0.15, ease.OutSine) + menu.tweens[&e.labelAlpha] = gween.New(e.labelAlpha, labelAlpha, 0.15, ease.OutSine) + } +} + +// left tabs are never removed, we don't need to implement this callback +func (s *sceneTabs) segueNext() { +} + +func (s *sceneTabs) update(dt float32) { + // Down + repeatDown(dt, input.NewState[0][libretro.DeviceIDJoypadDown], func() { + s.ptr++ + if s.ptr >= len(s.children) { + s.ptr = len(s.children) - 1 + } else { + audio.PlayEffect(audio.Effects["down"]) + menu.t = 0 + s.animate() + s.children[s.ptr].callbackOK() + } + }) + + // Up + repeatUp(dt, input.NewState[0][libretro.DeviceIDJoypadUp], func() { + s.ptr-- + if s.ptr < 0 { + s.ptr = 0 + } else { + audio.PlayEffect(audio.Effects["up"]) + menu.t = 0 + s.animate() + s.children[s.ptr].callbackOK() + } + }) + + // Right + repeatRight(dt, input.NewState[0][libretro.DeviceIDJoypadRight], func() { + audio.PlayEffect(audio.Effects["ok"]) + menu.t = 0 + menu.focus++ + s.loseFocus() + }) + + // OK + if input.Released[0][libretro.DeviceIDJoypadA] { + audio.PlayEffect(audio.Effects["ok"]) + menu.t = 0 + menu.focus++ + s.loseFocus() + } +} + +func (s sceneTabs) render() { + w, _ := vid.Window.GetFramebufferSize() + + spacing := float32(96 + 32) + totalWidth := spacing * float32(len(s.children)) * menu.ratio + + for i, tab := range s.children { + c := video.Color{R: 1, G: 1, B: 1, A: tab.iconAlpha} + vid.DrawImage(menu.icons["circle"], + float32(w)/2-totalWidth/2+float32(i)*spacing*menu.ratio+96*menu.ratio/2, + 32*menu.ratio, + 96*menu.ratio, 96*menu.ratio, 1, 0, c) + vid.DrawImage(menu.icons[tab.icon], + float32(w)/2-totalWidth/2+float32(i)*spacing*menu.ratio+96*menu.ratio/2+24*menu.ratio, + 56*menu.ratio, + 48*menu.ratio, 48*menu.ratio, 1, 0, c) + } +} + +func (s *sceneTabs) drawHintBar() { +} From 8087e65cd70c19a207a6449528eccf44ab31c58b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Andr=C3=A9=20Santoni?= Date: Tue, 4 Aug 2020 12:29:56 +0700 Subject: [PATCH 10/52] Make tabs work --- menu/input.go | 3 +- menu/menu.go | 1 + menu/scene_home.go | 23 +++++---- menu/scene_tabs.go | 126 +++++++++++++++++---------------------------- scanner/scanner.go | 4 +- 5 files changed, 65 insertions(+), 92 deletions(-) diff --git a/menu/input.go b/menu/input.go index 9e92560f..de7a8403 100644 --- a/menu/input.go +++ b/menu/input.go @@ -20,7 +20,7 @@ var ( // Update takes care of calling the update method of the current scene. // Each scene has it's own input logic to allow a variety of navigation systems. func (m *Menu) Update(dt float32) { - currentScene := m.stack[len(m.stack)-1] + currentScene := m.stack[m.focus-1] currentScene.update(dt) } @@ -115,6 +115,7 @@ func genericInput(list *entry, dt float32) { audio.PlayEffect(audio.Effects["cancel"]) menu.stack[len(menu.stack)-2].segueBack() menu.stack = menu.stack[:len(menu.stack)-1] + menu.focus-- } } diff --git a/menu/menu.go b/menu/menu.go index 9ed2fbb6..5747456d 100644 --- a/menu/menu.go +++ b/menu/menu.go @@ -52,6 +52,7 @@ func Init(v *video.Video) *Menu { // OK on a menu entry. func (m *Menu) Push(s Scene) { m.stack = append(m.stack, s) + m.focus++ } // Render takes care of rendering the menu diff --git a/menu/scene_home.go b/menu/scene_home.go index cfe9cb4e..c8649c7c 100644 --- a/menu/scene_home.go +++ b/menu/scene_home.go @@ -253,6 +253,11 @@ func (s *sceneHome) update(dt float32) { audio.PlayEffect(audio.Effects["up"]) menu.t = 0 s.animate() + } else if s.yptr == 0 && len(menu.stack) > 1 { + audio.PlayEffect(audio.Effects["cancel"]) + menu.stack[len(menu.stack)-2].segueBack() + menu.focus-- + menu.t = 0 } }) @@ -295,18 +300,16 @@ func (s sceneHome) render() { continue } - blink := float32(1) - if j == s.yptr && i == s.xptrs[s.yptr] { - blink = float32(math.Cos(menu.t)) + if menu.focus == 2 && j == s.yptr && i == s.xptrs[s.yptr] { + blink := float32(math.Cos(menu.t)) + vid.DrawImage( + menu.icons["selection"], + x*menu.ratio-8*menu.ratio, + y*menu.ratio-8*menu.ratio, + 320*e.scale*menu.ratio+16*menu.ratio, 240*e.scale*menu.ratio+16*menu.ratio, + 1, 0.1, video.Color{R: 1, G: 1, B: 1, A: (e.borderAlpha - blink) * s.alpha}) } - vid.DrawImage( - menu.icons["selection"], - x*menu.ratio-8*menu.ratio, - y*menu.ratio-8*menu.ratio, - 320*e.scale*menu.ratio+16*menu.ratio, 240*e.scale*menu.ratio+16*menu.ratio, - 1, 0.1, video.Color{R: 1, G: 1, B: 1, A: (e.borderAlpha - blink) * s.alpha}) - drawThumbnail( &ve, i, e.system, e.gameName, diff --git a/menu/scene_tabs.go b/menu/scene_tabs.go index cefab37f..407c577d 100644 --- a/menu/scene_tabs.go +++ b/menu/scene_tabs.go @@ -1,12 +1,13 @@ package menu import ( - "github.com/tanema/gween" - "github.com/tanema/gween/ease" + "math" + "os/user" "github.com/libretro/ludo/audio" "github.com/libretro/ludo/input" "github.com/libretro/ludo/libretro" + "github.com/libretro/ludo/scanner" "github.com/libretro/ludo/state" "github.com/libretro/ludo/video" ) @@ -37,6 +38,21 @@ func buildTabs() Scene { }, }) + list.children = append(list.children, entry{ + icon: "tab-scan", + callbackOK: func() { + usr, _ := user.Current() + menu.stack = menu.stack[:len(menu.stack)-1] + menu.Push(buildExplorer(usr.HomeDir, nil, + func(path string) { scanner.ScanDir(path, nil) }, + &entry{ + label: "", + icon: "scan", + })) + menu.focus-- + }, + }) + if state.Global.LudOS { list.children = append(list.children, entry{ icon: "updater", @@ -80,71 +96,14 @@ func (s *sceneTabs) Entry() *entry { } func (s *sceneTabs) segueMount() { - for i := range s.children { - e := &s.children[i] - - e.iconAlpha = 0.25 - if i == s.ptr { - e.iconAlpha = 1 - } - } - s.animate() } func (s *sceneTabs) segueBack() { s.animate() - s.winFocus() -} - -func (s *sceneTabs) winFocus() { - for i := range s.children { - e := &s.children[i] - - labelAlpha := float32(0.5) - if i == s.ptr { - labelAlpha = 1 - } - - menu.tweens[&e.labelAlpha] = gween.New(e.labelAlpha, labelAlpha, 0.15, ease.OutSine) - } - - menu.tweens[&s.alpha] = gween.New(s.alpha, 1, 0.15, ease.OutSine) - menu.tweens[&s.width] = gween.New(s.width, 450, 0.15, ease.OutSine) -} - -func (s *sceneTabs) loseFocus() { - for i := range s.children { - e := &s.children[i] - menu.tweens[&e.labelAlpha] = gween.New(e.labelAlpha, 0, 0.15, ease.OutSine) - } - - menu.tweens[&s.alpha] = gween.New(s.alpha, 0, 0.15, ease.OutSine) - menu.tweens[&s.width] = gween.New(s.width, 150, 0.15, ease.OutSine) } func (s *sceneTabs) animate() { - for i := range s.children { - e := &s.children[i] - - var iconAlpha, labelAlpha float32 - if i == s.ptr { - iconAlpha = 1 - labelAlpha = 1 - } else if i < s.ptr { - iconAlpha = 0.5 - labelAlpha = 0.5 - } else if i > s.ptr { - iconAlpha = 0.5 - labelAlpha = 0.5 - } - if menu.focus != 1 { - labelAlpha = 0 - } - - menu.tweens[&e.iconAlpha] = gween.New(e.iconAlpha, iconAlpha, 0.15, ease.OutSine) - menu.tweens[&e.labelAlpha] = gween.New(e.labelAlpha, labelAlpha, 0.15, ease.OutSine) - } } // left tabs are never removed, we don't need to implement this callback @@ -152,21 +111,8 @@ func (s *sceneTabs) segueNext() { } func (s *sceneTabs) update(dt float32) { - // Down - repeatDown(dt, input.NewState[0][libretro.DeviceIDJoypadDown], func() { - s.ptr++ - if s.ptr >= len(s.children) { - s.ptr = len(s.children) - 1 - } else { - audio.PlayEffect(audio.Effects["down"]) - menu.t = 0 - s.animate() - s.children[s.ptr].callbackOK() - } - }) - - // Up - repeatUp(dt, input.NewState[0][libretro.DeviceIDJoypadUp], func() { + // Left + repeatLeft(dt, input.NewState[0][libretro.DeviceIDJoypadLeft], func() { s.ptr-- if s.ptr < 0 { s.ptr = 0 @@ -174,24 +120,36 @@ func (s *sceneTabs) update(dt float32) { audio.PlayEffect(audio.Effects["up"]) menu.t = 0 s.animate() - s.children[s.ptr].callbackOK() } }) // Right repeatRight(dt, input.NewState[0][libretro.DeviceIDJoypadRight], func() { + s.ptr++ + if s.ptr >= len(s.children) { + s.ptr = len(s.children) - 1 + } else { + audio.PlayEffect(audio.Effects["down"]) + menu.t = 0 + s.animate() + } + }) + + // Down + repeatDown(dt, input.NewState[0][libretro.DeviceIDJoypadDown], func() { audio.PlayEffect(audio.Effects["ok"]) menu.t = 0 menu.focus++ - s.loseFocus() + s.animate() }) // OK if input.Released[0][libretro.DeviceIDJoypadA] { audio.PlayEffect(audio.Effects["ok"]) + s.children[s.ptr].callbackOK() menu.t = 0 menu.focus++ - s.loseFocus() + s.animate() } } @@ -201,13 +159,21 @@ func (s sceneTabs) render() { spacing := float32(96 + 32) totalWidth := spacing * float32(len(s.children)) * menu.ratio - for i, tab := range s.children { - c := video.Color{R: 1, G: 1, B: 1, A: tab.iconAlpha} + for i, e := range s.children { + if i == s.ptr && menu.focus == 1 { + blink := float32(math.Cos(menu.t)) + vid.DrawImage(menu.icons["circle-selection"], + float32(w)/2-totalWidth/2+float32(i)*spacing*menu.ratio+96*menu.ratio/2-8*menu.ratio, + 32*menu.ratio-8*menu.ratio, + 96*menu.ratio+16*menu.ratio, 96*menu.ratio+16*menu.ratio, 1, 0, + video.Color{R: 1, G: 1, B: 1, A: 1 - blink}) + } + c := video.Color{R: 1, G: 1, B: 1, A: 1} vid.DrawImage(menu.icons["circle"], float32(w)/2-totalWidth/2+float32(i)*spacing*menu.ratio+96*menu.ratio/2, 32*menu.ratio, 96*menu.ratio, 96*menu.ratio, 1, 0, c) - vid.DrawImage(menu.icons[tab.icon], + vid.DrawImage(menu.icons[e.icon], float32(w)/2-totalWidth/2+float32(i)*spacing*menu.ratio+96*menu.ratio/2+24*menu.ratio, 56*menu.ratio, 48*menu.ratio, 48*menu.ratio, 1, 0, c) diff --git a/scanner/scanner.go b/scanner/scanner.go index d8a1dd6c..01cfad45 100644 --- a/scanner/scanner.go +++ b/scanner/scanner.go @@ -67,7 +67,9 @@ func ScanDir(dir string, doneCb func()) { f.Close() i++ } - doneCb() + if doneCb != nil { + doneCb() + } n.Update(ntf.Success, "Done scanning. %d new games found.", i) }() } From c3b23e756a1ffb860367725e1103ef7cb99d291e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Andr=C3=A9=20Santoni?= Date: Tue, 4 Aug 2020 12:55:56 +0700 Subject: [PATCH 11/52] Recenter generic lists --- menu/input.go | 4 +++- menu/scene.go | 37 +++++++++---------------------------- menu/scene_home.go | 10 ++++++++++ menu/scene_settings.go | 14 ++++---------- 4 files changed, 26 insertions(+), 39 deletions(-) diff --git a/menu/input.go b/menu/input.go index de7a8403..5c496484 100644 --- a/menu/input.go +++ b/menu/input.go @@ -114,7 +114,9 @@ func genericInput(list *entry, dt float32) { if len(menu.stack) > 1 { audio.PlayEffect(audio.Effects["cancel"]) menu.stack[len(menu.stack)-2].segueBack() - menu.stack = menu.stack[:len(menu.stack)-1] + if len(menu.stack) > 2 { + menu.stack = menu.stack[:len(menu.stack)-1] + } menu.focus-- } } diff --git a/menu/scene.go b/menu/scene.go index b5817eff..e9bce5e7 100644 --- a/menu/scene.go +++ b/menu/scene.go @@ -154,32 +154,20 @@ func genericSegueNext(list *entry) { // menu entry func genericDrawCursor(list *entry) { w, h := vid.Window.GetFramebufferSize() - c := video.Color{R: 0.8784, G: 1, B: 1, A: list.cursor.alpha} - // if state.Global.CoreRunning { - // c = video.Color{R: 0.1, G: 0.1, B: 0.4, A: list.cursor.alpha} - // } - vid.DrawImage(menu.icons["arrow"], - 530*menu.ratio, float32(h)*list.cursor.yp-35*menu.ratio, - 70*menu.ratio, 70*menu.ratio, 1, 0, c) + c := video.Color{R: 1, G: 1, B: 1, A: list.cursor.alpha} vid.DrawRect( - 550*menu.ratio, float32(h)*list.cursor.yp-50*menu.ratio, - float32(w)-630*menu.ratio, 100*menu.ratio, 1, c) + 360*menu.ratio, float32(h)*list.cursor.yp-50*menu.ratio, + float32(w)-720*menu.ratio, 100*menu.ratio, 0.8, c) } // thumbnailDrawCursor draws the blinking rectangular background of the active // menu entry when there is a thumbnail func thumbnailDrawCursor(list *entry) { w, h := vid.Window.GetFramebufferSize() - c := video.Color{R: 0.8784, G: 1, B: 1, A: list.cursor.alpha} - // if state.Global.CoreRunning { - // c = video.Color{R: 0.1, G: 0.1, B: 0.4, A: list.cursor.alpha} - // } - vid.DrawImage(menu.icons["arrow"], - 500*menu.ratio, float32(h)*list.cursor.yp-50*menu.ratio, - 100*menu.ratio, 100*menu.ratio, 1, 0, c) + c := video.Color{R: 1, G: 1, B: 1, A: list.cursor.alpha} vid.DrawRect( - 530*menu.ratio, float32(h)*list.cursor.yp-120*menu.ratio, - float32(w)-630*menu.ratio, 240*menu.ratio, 0.2, c) + 360*menu.ratio, float32(h)*list.cursor.yp-120*menu.ratio, + float32(w)-720*menu.ratio, 240*menu.ratio, 0.2, c) } // genericRender renders a vertical list of menu entries @@ -189,8 +177,6 @@ func genericRender(list *entry) { genericDrawCursor(list) - vid.ScissorStart(int32(530*menu.ratio), 0, int32(1310*menu.ratio), int32(h)) - for _, e := range list.children { if e.yp < -0.1 || e.yp > 1.1 { continue @@ -199,12 +185,9 @@ func genericRender(list *entry) { fontOffset := 64 * 0.7 * menu.ratio * 0.3 color := video.Color{R: 0, G: 0, B: 0, A: e.iconAlpha} - // if state.Global.CoreRunning { - // color = video.Color{R: 1, G: 1, B: 1, A: e.iconAlpha} - // } vid.DrawImage(menu.icons[e.icon], - 610*menu.ratio-64*0.5*menu.ratio, + 420*menu.ratio-64*0.5*menu.ratio, float32(h)*e.yp-14*menu.ratio-64*0.5*menu.ratio+fontOffset, 128*menu.ratio, 128*menu.ratio, 0.5, 0, color) @@ -212,7 +195,7 @@ func genericRender(list *entry) { if e.labelAlpha > 0 { vid.Font.SetColor(color.R, color.G, color.B, e.labelAlpha) vid.Font.Printf( - 670*menu.ratio, + 480*menu.ratio, float32(h)*e.yp+fontOffset, 0.5*menu.ratio, e.label) @@ -221,14 +204,12 @@ func genericRender(list *entry) { } else if e.stringValue != nil { lw := vid.Font.Width(0.5*menu.ratio, e.stringValue()) vid.Font.Printf( - float32(w)-lw-128*menu.ratio, + float32(w)-lw-400*menu.ratio, float32(h)*e.yp+fontOffset, 0.5*menu.ratio, e.stringValue()) } } } - - vid.ScissorEnd() } func genericDrawHintBar() { diff --git a/menu/scene_home.go b/menu/scene_home.go index c8649c7c..cae3da98 100644 --- a/menu/scene_home.go +++ b/menu/scene_home.go @@ -269,6 +269,16 @@ func (s *sceneHome) update(dt float32) { s.children[s.yptr].children[s.xptrs[s.yptr]].callbackOK() } } + + // Cancel + if input.Released[0][libretro.DeviceIDJoypadB] { + if len(menu.stack) > 1 { + audio.PlayEffect(audio.Effects["cancel"]) + menu.stack[len(menu.stack)-2].segueBack() + menu.focus-- + menu.t = 0 + } + } } func (s sceneHome) render() { diff --git a/menu/scene_settings.go b/menu/scene_settings.go index 77d71f65..9617b898 100644 --- a/menu/scene_settings.go +++ b/menu/scene_settings.go @@ -135,28 +135,22 @@ var widgets = map[string]func(*entry){ icon = "on" } w, h := vid.Window.GetFramebufferSize() - color := video.Color{R: 0, G: 0, B: 0, A: e.iconAlpha} - // if state.Global.CoreRunning { - // color = video.Color{R: 1, G: 1, B: 1, A: e.iconAlpha} - // } + c := video.Color{R: 0, G: 0, B: 0, A: e.iconAlpha} vid.DrawImage(menu.icons[icon], - float32(w)-128*menu.ratio-128*menu.ratio, + float32(w)-400*menu.ratio-128*menu.ratio, float32(h)*e.yp-64*1.25*menu.ratio, 128*menu.ratio, 128*menu.ratio, - 1.25, 0, color) + 1.25, 0, c) }, // Range widget for audio volume and similat float settings "range": func(e *entry) { fbw, fbh := vid.Window.GetFramebufferSize() - x := float32(fbw) - 128*menu.ratio - 175*menu.ratio + x := float32(fbw) - 400*menu.ratio - 175*menu.ratio y := float32(fbh)*e.yp - 4*menu.ratio w := 175 * menu.ratio h := 8 * menu.ratio c := video.Color{R: 0, G: 0, B: 0, A: e.iconAlpha} - // if state.Global.CoreRunning { - // c = video.Color{R: 1, G: 1, B: 1, A: e.iconAlpha} - // } vid.DrawRect(x, y, w, h, 0.9, video.Color{R: c.R, G: c.G, B: c.B, A: e.iconAlpha / 4}) w = 175 * menu.ratio * e.value().(float32) vid.DrawRect(x, y, w, h, 0.9, c) From 117417f9d58bc930bcef03cae7d37979f4be3657 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Andr=C3=A9=20Santoni?= Date: Tue, 4 Aug 2020 14:17:08 +0700 Subject: [PATCH 12/52] Fixes --- menu/scene_home.go | 20 ++++++++++---------- menu/thumbnail.go | 4 ++-- video/gfx.go | 27 +++++++++++++++++++++++++-- 3 files changed, 37 insertions(+), 14 deletions(-) diff --git a/menu/scene_home.go b/menu/scene_home.go index cae3da98..91aa2bd9 100644 --- a/menu/scene_home.go +++ b/menu/scene_home.go @@ -117,9 +117,9 @@ func (s *sceneHome) segueMount() { for i := range ve.children { e := &s.children[j].children[i] - if i == s.xptrs[j] && j >= s.yptr { - e.labelAlpha = 0 - e.iconAlpha = 0 + if i == s.xptrs[j] { + e.labelAlpha = 1 + e.iconAlpha = 1 e.scale = 2.1 e.borderAlpha = 0 } else if i < s.xptrs[j] { @@ -129,7 +129,7 @@ func (s *sceneHome) segueMount() { e.borderAlpha = 0 } else { e.labelAlpha = 0 - e.iconAlpha = 0 + e.iconAlpha = 1 e.scale = 1 e.borderAlpha = 0 } @@ -162,22 +162,22 @@ func (s *sceneHome) animate() { e := &s.children[j].children[i] var labelAlpha, iconAlpha, scale, borderAlpha float32 - if i == s.xptrs[j] && j >= s.yptr { + if i == s.xptrs[j] { labelAlpha = 1 iconAlpha = 1 scale = 2.1 borderAlpha = 1 - } else if j < s.yptr { - labelAlpha = 0 - iconAlpha = 0 - scale = 1 - borderAlpha = 0 } else { labelAlpha = 0 iconAlpha = 1 scale = 1 borderAlpha = 0 } + if j < s.yptr { + labelAlpha = 0 + iconAlpha = 0 + borderAlpha = 0 + } menu.tweens[&e.labelAlpha] = gween.New(e.labelAlpha, labelAlpha, 0.15, ease.OutSine) menu.tweens[&e.iconAlpha] = gween.New(e.iconAlpha, iconAlpha, 0.15, ease.OutSine) diff --git a/menu/thumbnail.go b/menu/thumbnail.go index 0328177d..137e61c1 100644 --- a/menu/thumbnail.go +++ b/menu/thumbnail.go @@ -79,7 +79,7 @@ func drawThumbnail(list *entry, i int, system, gameName string, x, y, w, h, scal } } - vid.DrawImage( + vid.DrawThumbnail( list.children[i].thumbnail, x, y, w, h, scale, 0.07, color, @@ -94,7 +94,7 @@ func drawSavestateThumbnail(list *entry, i int, path string, x, y, w, h, scale f } } - vid.DrawImage( + vid.DrawThumbnail( list.children[i].thumbnail, x, y, w, h, scale, 0, color, diff --git a/video/gfx.go b/video/gfx.go index 7de2aeda..ac24d8f7 100644 --- a/video/gfx.go +++ b/video/gfx.go @@ -64,6 +64,29 @@ func (video *Video) DrawImage(image uint32, x, y, w, h, scale, r float32, c Colo va := video.vertexArray(x, y, w, h, scale) + gl.UseProgram(video.roundedProgram) + gl.Uniform4f(gl.GetUniformLocation(video.roundedProgram, gl.Str("color\x00")), c.R, c.G, c.B, c.A) + gl.Uniform1f(gl.GetUniformLocation(video.roundedProgram, gl.Str("radius\x00")), r) + gl.Uniform2f(gl.GetUniformLocation(video.roundedProgram, gl.Str("size\x00")), w, h) + gl.Enable(gl.BLEND) + gl.BlendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA) + bindVertexArray(video.vao) + gl.ActiveTexture(gl.TEXTURE0) + gl.BindTexture(gl.TEXTURE_2D, image) + gl.BindBuffer(gl.ARRAY_BUFFER, video.vbo) + gl.BufferData(gl.ARRAY_BUFFER, len(va)*4, gl.Ptr(va), gl.STATIC_DRAW) + gl.DrawArrays(gl.TRIANGLE_STRIP, 0, 4) + bindVertexArray(0) + gl.BindTexture(gl.TEXTURE_2D, 0) + gl.UseProgram(0) + gl.Disable(gl.BLEND) +} + +// DrawThumbnail draws an image with x, y, w, h +func (video *Video) DrawThumbnail(image uint32, x, y, w, h, scale, r float32, c Color) { + + va := video.vertexArray(x, y, w, h, scale) + gl.UseProgram(video.roundedProgram) gl.Uniform4f(gl.GetUniformLocation(video.roundedProgram, gl.Str("color\x00")), c.R, c.G, c.B, c.A) gl.Uniform1f(gl.GetUniformLocation(video.roundedProgram, gl.Str("radius\x00")), r) @@ -181,8 +204,8 @@ func textureLoad(rgba *image.RGBA) uint32 { gl.GenTextures(1, &texture) gl.ActiveTexture(gl.TEXTURE1) gl.BindTexture(gl.TEXTURE_2D, texture) - gl.TexParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST_MIPMAP_NEAREST) - gl.TexParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST) + gl.TexParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR_MIPMAP_LINEAR) + gl.TexParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR) gl.TexParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE) gl.TexParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE) gl.PixelStorei(gl.UNPACK_ROW_LENGTH, 0) From c2945fa6e035181d29977b9ff35f2c0c1f1540a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Andr=C3=A9=20Santoni?= Date: Tue, 4 Aug 2020 14:32:13 +0700 Subject: [PATCH 13/52] Improve generic cursor --- menu/scene.go | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/menu/scene.go b/menu/scene.go index e9bce5e7..b2d08cd0 100644 --- a/menu/scene.go +++ b/menu/scene.go @@ -1,6 +1,8 @@ package menu import ( + "math" + "github.com/libretro/ludo/state" "github.com/libretro/ludo/video" "github.com/tanema/gween" @@ -154,10 +156,20 @@ func genericSegueNext(list *entry) { // menu entry func genericDrawCursor(list *entry) { w, h := vid.Window.GetFramebufferSize() - c := video.Color{R: 1, G: 1, B: 1, A: list.cursor.alpha} + if menu.focus > 1 { + blink := float32(math.Cos(menu.t)) + vid.DrawImage( + menu.icons["selection"], + 360*menu.ratio-8*menu.ratio, + float32(h)*list.cursor.yp-50*menu.ratio-8*menu.ratio, + float32(w)-720*menu.ratio+16*menu.ratio, + 100*menu.ratio+16*menu.ratio, + 1, 0.15, video.Color{R: 1, G: 1, B: 1, A: list.cursor.alpha - list.cursor.alpha*blink}) + } vid.DrawRect( 360*menu.ratio, float32(h)*list.cursor.yp-50*menu.ratio, - float32(w)-720*menu.ratio, 100*menu.ratio, 0.8, c) + float32(w)-720*menu.ratio, 100*menu.ratio, 0.1, + video.Color{R: 1, G: 1, B: 1, A: list.cursor.alpha}) } // thumbnailDrawCursor draws the blinking rectangular background of the active From aa419657117e69d3c0bfa9b5e36894aaf7db118b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Andr=C3=A9=20Santoni?= Date: Tue, 4 Aug 2020 15:42:57 +0700 Subject: [PATCH 14/52] Fix savestates scene --- menu/scene.go | 20 +++++++++++++++----- menu/scene_quick.go | 2 +- menu/scene_savestates.go | 18 +++++------------- menu/scene_tabs.go | 6 +++--- 4 files changed, 24 insertions(+), 22 deletions(-) diff --git a/menu/scene.go b/menu/scene.go index b2d08cd0..fe0b2b87 100644 --- a/menu/scene.go +++ b/menu/scene.go @@ -176,10 +176,20 @@ func genericDrawCursor(list *entry) { // menu entry when there is a thumbnail func thumbnailDrawCursor(list *entry) { w, h := vid.Window.GetFramebufferSize() - c := video.Color{R: 1, G: 1, B: 1, A: list.cursor.alpha} + if menu.focus > 1 { + blink := float32(math.Cos(menu.t)) + vid.DrawImage( + menu.icons["selection"], + 360*menu.ratio-8*menu.ratio, + float32(h)*list.cursor.yp-120*menu.ratio-8*menu.ratio, + float32(w)-720*menu.ratio+16*menu.ratio, + 240*menu.ratio+16*menu.ratio, + 1, 0.15, video.Color{R: 1, G: 1, B: 1, A: list.cursor.alpha - list.cursor.alpha*blink}) + } vid.DrawRect( 360*menu.ratio, float32(h)*list.cursor.yp-120*menu.ratio, - float32(w)-720*menu.ratio, 240*menu.ratio, 0.2, c) + float32(w)-720*menu.ratio, 240*menu.ratio, 0.1, + video.Color{R: 1, G: 1, B: 1, A: list.cursor.alpha}) } // genericRender renders a vertical list of menu entries @@ -199,10 +209,10 @@ func genericRender(list *entry) { color := video.Color{R: 0, G: 0, B: 0, A: e.iconAlpha} vid.DrawImage(menu.icons[e.icon], - 420*menu.ratio-64*0.5*menu.ratio, - float32(h)*e.yp-14*menu.ratio-64*0.5*menu.ratio+fontOffset, + 420*menu.ratio-64*0.35*menu.ratio, + float32(h)*e.yp-14*menu.ratio-64*0.35*menu.ratio+fontOffset, 128*menu.ratio, 128*menu.ratio, - 0.5, 0, color) + 0.35, 0, color) if e.labelAlpha > 0 { vid.Font.SetColor(color.R, color.G, color.B, e.labelAlpha) diff --git a/menu/scene_quick.go b/menu/scene_quick.go index 5263e5af..a27562f3 100644 --- a/menu/scene_quick.go +++ b/menu/scene_quick.go @@ -58,7 +58,7 @@ func buildQuickMenu() Scene { list.children = append(list.children, entry{ label: "Options", - icon: "subsetting", + icon: "options", callbackOK: func() { list.segueNext() menu.Push(buildCoreOptions()) diff --git a/menu/scene_savestates.go b/menu/scene_savestates.go index d703b681..4bbae9f3 100644 --- a/menu/scene_savestates.go +++ b/menu/scene_savestates.go @@ -104,36 +104,28 @@ func (s *sceneSavestates) render() { fontOffset := 64 * 0.7 * menu.ratio * 0.3 - color := video.Color{R: 0, G: 0, B: 0, A: e.iconAlpha} - // if state.Global.CoreRunning { - // color = video.Color{R: 1, G: 1, B: 1, A: e.iconAlpha} - // } + c := video.Color{R: 0, G: 0, B: 0, A: e.iconAlpha} if e.labelAlpha > 0 { drawSavestateThumbnail( list, i, filepath.Join(settings.Current.ScreenshotsDirectory, utils.FileName(e.path)+".png"), - 680*menu.ratio-85*e.scale*menu.ratio, + 510*menu.ratio-85*e.scale*menu.ratio, float32(h)*e.yp-14*menu.ratio-64*e.scale*menu.ratio+fontOffset, 170*menu.ratio, 128*menu.ratio, e.scale, video.Color{R: 1, G: 1, B: 1, A: e.iconAlpha}, ) - vid.DrawBorder( - 680*menu.ratio-85*e.scale*menu.ratio, - float32(h)*e.yp-14*menu.ratio-64*e.scale*menu.ratio+fontOffset, - 170*menu.ratio*e.scale, 128*menu.ratio*e.scale, 0.02/e.scale, - video.Color{R: color.R, G: color.G, B: color.B, A: e.iconAlpha}) if i == 0 { vid.DrawImage(menu.icons["savestate"], - 680*menu.ratio-25*e.scale*menu.ratio, + 510*menu.ratio-25*e.scale*menu.ratio, float32(h)*e.yp-14*menu.ratio-25*e.scale*menu.ratio+fontOffset, 50*menu.ratio, 50*menu.ratio, e.scale, 0, video.Color{R: 1, G: 1, B: 1, A: e.iconAlpha}) } - vid.Font.SetColor(color.R, color.G, color.B, e.labelAlpha) + vid.Font.SetColor(c.R, c.G, c.B, e.labelAlpha) vid.Font.Printf( - 840*menu.ratio, + 670*menu.ratio, float32(h)*e.yp+fontOffset, 0.5*menu.ratio, e.label) } diff --git a/menu/scene_tabs.go b/menu/scene_tabs.go index 407c577d..710eb759 100644 --- a/menu/scene_tabs.go +++ b/menu/scene_tabs.go @@ -70,7 +70,7 @@ func buildTabs() Scene { }) list.children = append(list.children, entry{ - icon: "tab-quit", + icon: "tab-shutdown", callbackOK: func() { askConfirmation(func() { cleanShutdown() }) }, @@ -162,10 +162,10 @@ func (s sceneTabs) render() { for i, e := range s.children { if i == s.ptr && menu.focus == 1 { blink := float32(math.Cos(menu.t)) - vid.DrawImage(menu.icons["circle-selection"], + vid.DrawImage(menu.icons["selection"], float32(w)/2-totalWidth/2+float32(i)*spacing*menu.ratio+96*menu.ratio/2-8*menu.ratio, 32*menu.ratio-8*menu.ratio, - 96*menu.ratio+16*menu.ratio, 96*menu.ratio+16*menu.ratio, 1, 0, + 96*menu.ratio+16*menu.ratio, 96*menu.ratio+16*menu.ratio, 1, 1, video.Color{R: 1, G: 1, B: 1, A: 1 - blink}) } c := video.Color{R: 1, G: 1, B: 1, A: 1} From 6f1655e5f5d271dcd0c19714fc1f54bfd4e1694a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Andr=C3=A9=20Santoni?= Date: Tue, 4 Aug 2020 16:06:56 +0700 Subject: [PATCH 15/52] Display time --- menu/scene_tabs.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/menu/scene_tabs.go b/menu/scene_tabs.go index 710eb759..52a86a91 100644 --- a/menu/scene_tabs.go +++ b/menu/scene_tabs.go @@ -3,6 +3,7 @@ package menu import ( "math" "os/user" + "time" "github.com/libretro/ludo/audio" "github.com/libretro/ludo/input" @@ -159,6 +160,13 @@ func (s sceneTabs) render() { spacing := float32(96 + 32) totalWidth := spacing * float32(len(s.children)) * menu.ratio + now := time.Now().Format("3:04PM") + nowWidth := vid.BoldFont.Width(0.5*menu.ratio, now) + vid.BoldFont.SetColor(0, 0, 0, 1) + vid.BoldFont.Printf( + float32(w)-96*menu.ratio-nowWidth, + 90*menu.ratio, 0.5*menu.ratio, now) + for i, e := range s.children { if i == s.ptr && menu.focus == 1 { blink := float32(math.Cos(menu.t)) From 2a07b39372785ebda99fb6f28efc53cbeb15bf6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Andr=C3=A9=20Santoni?= Date: Wed, 5 Aug 2020 13:28:13 +0700 Subject: [PATCH 16/52] Display list title --- input/input.go | 2 +- menu/scene.go | 20 ++++++++++++++++++++ menu/scene_explorer.go | 2 +- 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/input/input.go b/input/input.go index 405f6767..e7bc2fbd 100644 --- a/input/input.go +++ b/input/input.go @@ -135,7 +135,7 @@ func Poll() { // State is a callback passed to core.SetInputState // It returns 1 if the button corresponding to the parameters is pressed func State(port uint, device uint32, index uint, id uint) int16 { - if id >= 255 || index > 0 || device != libretro.DeviceJoypad { + if id >= 255 || index > 0 || device != libretro.DeviceJoypad || port >= MaxPlayers { return 0 } diff --git a/menu/scene.go b/menu/scene.go index fe0b2b87..5e8faf0b 100644 --- a/menu/scene.go +++ b/menu/scene.go @@ -197,6 +197,24 @@ func thumbnailDrawCursor(list *entry) { func genericRender(list *entry) { w, h := vid.Window.GetFramebufferSize() + vid.BoldFont.SetColor(0.129, 0.441, 0.684, list.cursor.alpha) + vid.BoldFont.Printf( + 360*menu.ratio, + 230*menu.ratio, + 0.5*menu.ratio, list.label) + + vid.DrawRect( + 360*menu.ratio, + 270*menu.ratio, + float32(w)-720*menu.ratio, + 2*menu.ratio, + 0, video.Color{R: 0.85, G: 0.85, B: 0.85, A: 1}, + ) + + vid.ScissorStart( + int32(360*menu.ratio-8*menu.ratio), 0, + int32(float32(w)-720*menu.ratio+16*menu.ratio), int32(h)-int32(270*menu.ratio)) + genericDrawCursor(list) for _, e := range list.children { @@ -232,6 +250,8 @@ func genericRender(list *entry) { } } } + + vid.ScissorEnd() } func genericDrawHintBar() { diff --git a/menu/scene_explorer.go b/menu/scene_explorer.go index 05208cd6..a9a1d61c 100644 --- a/menu/scene_explorer.go +++ b/menu/scene_explorer.go @@ -100,7 +100,7 @@ func appendNode(list *sceneExplorer, fullPath string, name string, f os.FileInfo func buildExplorer(path string, exts []string, cb func(string), dirAction *entry) Scene { var list sceneExplorer - list.label = "Explorer" + list.label = path // Display the special directory action entry. if dirAction != nil && dirAction.label != "" { From fce5b93d2cd82aec99804b345491617f0db0f6af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Andr=C3=A9=20Santoni?= Date: Wed, 5 Aug 2020 13:42:29 +0700 Subject: [PATCH 17/52] Update icons for LudOS --- menu/scene_tabs.go | 7 ++++--- menu/scene_updater.go | 10 +++++----- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/menu/scene_tabs.go b/menu/scene_tabs.go index 52a86a91..34f1f59f 100644 --- a/menu/scene_tabs.go +++ b/menu/scene_tabs.go @@ -56,15 +56,16 @@ func buildTabs() Scene { if state.Global.LudOS { list.children = append(list.children, entry{ - icon: "updater", + icon: "tab-updater", callbackOK: func() { - list.segueNext() + menu.stack = menu.stack[:len(menu.stack)-1] menu.Push(buildUpdater()) + menu.focus-- }, }) list.children = append(list.children, entry{ - icon: "reboot", + icon: "tab-reboot", callbackOK: func() { askConfirmation(func() { cleanReboot() }) }, diff --git a/menu/scene_updater.go b/menu/scene_updater.go index 519789e4..31b517a5 100644 --- a/menu/scene_updater.go +++ b/menu/scene_updater.go @@ -16,11 +16,11 @@ type sceneUpdater struct { func buildUpdater() Scene { var list sceneUpdater - list.label = "Updater Menu" + list.label = "Update LudOS" list.children = append(list.children, entry{ label: "Checking updates", - icon: "reload", + icon: "reset", }) list.segueMount() @@ -35,7 +35,7 @@ func buildUpdater() Scene { if len(*rels) > 0 { rel := (*rels)[0] list.children[0].label = "Upgrade to " + rel.Name - list.children[0].icon = "menu_saving" + list.children[0].icon = "savestate" list.children[0].callbackOK = func() { asset := ludos.FilterAssets(rel.Assets) if asset == nil { @@ -76,11 +76,11 @@ func (s *sceneUpdater) update(dt float32) { if ludos.IsDownloading() { s.children[0].label = fmt.Sprintf( "Downloading update %.0f%%%%", ludos.GetProgress()*100) - s.children[0].icon = "reload" + s.children[0].icon = "reset" s.children[0].callbackOK = nil } else if ludos.IsDone() { s.children[0].label = "Reboot and upgrade" - s.children[0].icon = "reload" + s.children[0].icon = "reset" s.children[0].callbackOK = func() { cmd := exec.Command("/usr/sbin/shutdown", "-r", "now") core.UnloadGame() From 75582663c37cdb51cd98e6b2a0b38b2c9a607533 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Andr=C3=A9=20Santoni?= Date: Wed, 5 Aug 2020 13:49:43 +0700 Subject: [PATCH 18/52] Fixes --- menu/scene_updater.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/menu/scene_updater.go b/menu/scene_updater.go index 31b517a5..2ed75de0 100644 --- a/menu/scene_updater.go +++ b/menu/scene_updater.go @@ -34,7 +34,7 @@ func buildUpdater() Scene { if len(*rels) > 0 { rel := (*rels)[0] - list.children[0].label = "Upgrade to " + rel.Name + list.children[0].label = "Update to " + rel.Name list.children[0].icon = "savestate" list.children[0].callbackOK = func() { asset := ludos.FilterAssets(rel.Assets) @@ -79,7 +79,7 @@ func (s *sceneUpdater) update(dt float32) { s.children[0].icon = "reset" s.children[0].callbackOK = nil } else if ludos.IsDone() { - s.children[0].label = "Reboot and upgrade" + s.children[0].label = "Reboot and update" s.children[0].icon = "reset" s.children[0].callbackOK = func() { cmd := exec.Command("/usr/sbin/shutdown", "-r", "now") From 784c76bf104b5f7563b95216007c3d7bf74f21a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Andr=C3=A9=20Santoni?= Date: Wed, 5 Aug 2020 14:06:52 +0700 Subject: [PATCH 19/52] Fix savestates and hide tabs --- menu/scene_savestates.go | 21 ++++++++++++++++++++- menu/scene_tabs.go | 10 +++++++--- 2 files changed, 27 insertions(+), 4 deletions(-) diff --git a/menu/scene_savestates.go b/menu/scene_savestates.go index 4bbae9f3..934f04a1 100644 --- a/menu/scene_savestates.go +++ b/menu/scene_savestates.go @@ -92,8 +92,25 @@ func (s *sceneSavestates) update(dt float32) { // Override rendering func (s *sceneSavestates) render() { list := &s.entry + w, h := vid.Window.GetFramebufferSize() + + vid.BoldFont.SetColor(0.129, 0.441, 0.684, list.cursor.alpha) + vid.BoldFont.Printf( + 360*menu.ratio, + 230*menu.ratio, + 0.5*menu.ratio, list.label) - _, h := vid.Window.GetFramebufferSize() + vid.DrawRect( + 360*menu.ratio, + 270*menu.ratio, + float32(w)-720*menu.ratio, + 2*menu.ratio, + 0, video.Color{R: 0.85, G: 0.85, B: 0.85, A: 1}, + ) + + vid.ScissorStart( + int32(360*menu.ratio-8*menu.ratio), 0, + int32(float32(w)-720*menu.ratio+16*menu.ratio), int32(h)-int32(270*menu.ratio)) thumbnailDrawCursor(list) @@ -130,6 +147,8 @@ func (s *sceneSavestates) render() { 0.5*menu.ratio, e.label) } } + + vid.ScissorEnd() } func (s *sceneSavestates) drawHintBar() { diff --git a/menu/scene_tabs.go b/menu/scene_tabs.go index 34f1f59f..6c74ae00 100644 --- a/menu/scene_tabs.go +++ b/menu/scene_tabs.go @@ -158,9 +158,6 @@ func (s *sceneTabs) update(dt float32) { func (s sceneTabs) render() { w, _ := vid.Window.GetFramebufferSize() - spacing := float32(96 + 32) - totalWidth := spacing * float32(len(s.children)) * menu.ratio - now := time.Now().Format("3:04PM") nowWidth := vid.BoldFont.Width(0.5*menu.ratio, now) vid.BoldFont.SetColor(0, 0, 0, 1) @@ -168,6 +165,13 @@ func (s sceneTabs) render() { float32(w)-96*menu.ratio-nowWidth, 90*menu.ratio, 0.5*menu.ratio, now) + if menu.focus > 2 { + return + } + + spacing := float32(96 + 32) + totalWidth := spacing * float32(len(s.children)) * menu.ratio + for i, e := range s.children { if i == s.ptr && menu.focus == 1 { blink := float32(math.Cos(menu.t)) From 4551641c87b9810d6cda5e3056e7b54e6a702ad6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Andr=C3=A9=20Santoni?= Date: Wed, 5 Aug 2020 23:35:18 +0700 Subject: [PATCH 20/52] Make background transparent only on quick menu --- menu/menu.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/menu/menu.go b/menu/menu.go index 5747456d..c0e431e7 100644 --- a/menu/menu.go +++ b/menu/menu.go @@ -67,7 +67,10 @@ func (m *Menu) Render(dt float32) { w, h := vid.Window.GetFramebufferSize() m.ratio = float32(w) / 1920 - if state.Global.CoreRunning { + currentScreenIndex := len(m.stack) - 1 + title := menu.stack[currentScreenIndex].Entry().label + + if state.Global.CoreRunning && title == "Quick Menu" || title == "Savestates" || title == "Core Options" { vid.DrawImage(menu.icons["bg"], 0, 0, float32(w), float32(h), 1, 0, video.Color{1, 1, 1, 0.85}) } else { vid.DrawImage(menu.icons["bg"], 0, 0, float32(w), float32(h), 1, 0, video.Color{1, 1, 1, 1}) @@ -75,7 +78,6 @@ func (m *Menu) Render(dt float32) { m.tweens.Update(dt) - currentScreenIndex := len(m.stack) - 1 for i := 0; i <= currentScreenIndex+1; i++ { if i < 0 || i > currentScreenIndex { continue From d0c2786900857905252f771b2538d04d190c8d8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Andr=C3=A9=20Santoni?= Date: Thu, 6 Aug 2020 21:51:52 +0700 Subject: [PATCH 21/52] Display flags --- menu/scene_home.go | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/menu/scene_home.go b/menu/scene_home.go index 91aa2bd9..5da78390 100644 --- a/menu/scene_home.go +++ b/menu/scene_home.go @@ -40,10 +40,11 @@ func buildHome() Scene { for _, game := range history.List { game := game - strippedName, _ := extractTags(game.Name) + strippedName, tags := extractTags(game.Name) list.children[cat].children = append(list.children[cat].children, entry{ label: strippedName, gameName: game.Name, + tags: tags, subLabel: game.System, system: game.System, callbackOK: func() { @@ -346,6 +347,22 @@ func (s sceneHome) render() { (x+672+32)*menu.ratio, (y+430)*menu.ratio, 0.5*menu.ratio, e.subLabel) + + stack := (x + 672 + 32) * menu.ratio + for _, tag := range e.tags { + if _, ok := menu.icons[tag]; ok { + vid.DrawRect(stack-1*menu.ratio, (y+500-35)*menu.ratio-1*menu.ratio, + 48*menu.ratio+2*menu.ratio, 35*menu.ratio+2*menu.ratio, 0.22, + video.Color{R: 0, G: 0, B: 0, A: e.labelAlpha * s.alpha * 0.5}) + vid.DrawImage( + menu.icons[tag], + stack, (y+500-35)*menu.ratio, + 48*menu.ratio, 35*menu.ratio, 1.0, 0.2, + video.Color{R: 1, G: 1, B: 1, A: e.labelAlpha * s.alpha}) + stack += 48 * menu.ratio + stack += 24 * menu.ratio + } + } } } } From 3742fc21cfe7ea638d5a83350e7bc70aa6563d45 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Andr=C3=A9=20Santoni?= Date: Fri, 7 Aug 2020 10:58:14 +0700 Subject: [PATCH 22/52] Fix modals --- menu/scene_dialog.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/menu/scene_dialog.go b/menu/scene_dialog.go index 4cef9018..47d746d2 100644 --- a/menu/scene_dialog.go +++ b/menu/scene_dialog.go @@ -42,8 +42,8 @@ func (s *sceneDialog) update(dt float32) { // Cancel if input.Released[0][libretro.DeviceIDJoypadB] { audio.PlayEffect(audio.Effects["cancel"]) - menu.stack[len(menu.stack)-2].segueBack() menu.stack = menu.stack[:len(menu.stack)-1] + menu.focus-- } } From 20dc029003e5c2e288ce3aecdbdce1148e597a61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Andr=C3=A9=20Santoni?= Date: Fri, 7 Aug 2020 15:14:28 +0700 Subject: [PATCH 23/52] New scrolling mode --- menu/menu.go | 21 +++-- menu/scene.go | 145 ++++++++++++++++------------------- menu/scene_history.go | 162 --------------------------------------- menu/scene_home.go | 1 - menu/scene_playlist.go | 143 ---------------------------------- menu/scene_quick.go | 9 +++ menu/scene_savestates.go | 42 ++++++---- menu/scene_settings.go | 16 ++-- 8 files changed, 122 insertions(+), 417 deletions(-) diff --git a/menu/menu.go b/menu/menu.go index c0e431e7..364808bd 100644 --- a/menu/menu.go +++ b/menu/menu.go @@ -55,6 +55,15 @@ func (m *Menu) Push(s Scene) { m.focus++ } +func haveTransparentBackground() bool { + for i := 0; i <= len(menu.stack)-1; i++ { + if menu.stack[i].Entry().label == "Quick Menu" { + return true + } + } + return false +} + // Render takes care of rendering the menu func (m *Menu) Render(dt float32) { // Early return to not render the menu, in case MenuActive is set to false @@ -67,17 +76,15 @@ func (m *Menu) Render(dt float32) { w, h := vid.Window.GetFramebufferSize() m.ratio = float32(w) / 1920 - currentScreenIndex := len(m.stack) - 1 - title := menu.stack[currentScreenIndex].Entry().label - - if state.Global.CoreRunning && title == "Quick Menu" || title == "Savestates" || title == "Core Options" { - vid.DrawImage(menu.icons["bg"], 0, 0, float32(w), float32(h), 1, 0, video.Color{1, 1, 1, 0.85}) - } else { - vid.DrawImage(menu.icons["bg"], 0, 0, float32(w), float32(h), 1, 0, video.Color{1, 1, 1, 1}) + c := video.Color{R: 1, G: 1, B: 1, A: 1} + if haveTransparentBackground() { + c = video.Color{R: 1, G: 1, B: 1, A: 0.85} } + vid.DrawImage(menu.icons["bg"], 0, 0, float32(w), float32(h), 1, 0, c) m.tweens.Update(dt) + currentScreenIndex := len(m.stack) - 1 for i := 0; i <= currentScreenIndex+1; i++ { if i < 0 || i > currentScreenIndex { continue diff --git a/menu/scene.go b/menu/scene.go index 5e8faf0b..33fcf33b 100644 --- a/menu/scene.go +++ b/menu/scene.go @@ -14,6 +14,8 @@ import ( type entry struct { alpha float32 yp, scale float32 + scroll float32 + entryHeight float32 width, height float32 margin float32 label, subLabel string @@ -28,14 +30,13 @@ type entry struct { callbackOK func() // callback executed when user presses OK value func() interface{} stringValue func() string - widget func(*entry) // widget draw callback used in settings - incr func(int) // increment callback used in settings - tags []string // flags extracted from game title - thumbnail uint32 // thumbnail texture id - gameName string // title of the game in db, used for thumbnails + widget func(*entry, *entry, int) // widget draw callback used in settings + incr func(int) // increment callback used in settings + tags []string // flags extracted from game title + thumbnail uint32 // thumbnail texture id + gameName string // title of the game in db, used for thumbnails cursor struct { alpha float32 - yp float32 } children []entry // children entries ptr int // index of the active child @@ -60,26 +61,19 @@ type Scene interface { // genericSegueMount is the smooth transition of the menu entries first appearance func genericSegueMount(list *entry) { + if list.entryHeight == 0 { + list.entryHeight = 100 + } + for i := range list.children { e := &list.children[i] - - if i == list.ptr { - e.yp = 0.5 + 0.3 - e.scale = 1.5 - } else if i < list.ptr { - e.yp = 0.4 + 0.3 + 0.08*float32(i-list.ptr) - e.scale = 0.5 - } else if i > list.ptr { - e.yp = 0.6 + 0.3 + 0.08*float32(i-list.ptr) - e.scale = 0.5 - } e.labelAlpha = 0 e.iconAlpha = 0 e.tagAlpha = 0 e.subLabelAlpha = 0 } list.cursor.alpha = 0 - list.cursor.yp = 0.5 + 0.3 + list.scroll = -float32(list.ptr) * list.entryHeight genericAnimate(list) } @@ -96,20 +90,14 @@ func genericAnimate(list *entry) { var yp, tagAlpha, subLabelAlpha, scale float32 if i == list.ptr { - yp = 0.5 tagAlpha = 1 subLabelAlpha = 1 - scale = 1.5 } else if i < list.ptr { - yp = 0.4 + 0.08*float32(i-list.ptr) tagAlpha = 0 subLabelAlpha = 0 - scale = 0.5 } else if i > list.ptr { - yp = 0.6 + 0.08*float32(i-list.ptr) tagAlpha = 0 subLabelAlpha = 0 - scale = 0.5 } menu.tweens[&e.yp] = gween.New(e.yp, yp, 0.15, ease.OutSine) @@ -120,7 +108,24 @@ func genericAnimate(list *entry) { menu.tweens[&e.scale] = gween.New(e.scale, scale, 0.15, ease.OutSine) } menu.tweens[&list.cursor.alpha] = gween.New(list.cursor.alpha, 1, 0.15, ease.OutSine) - menu.tweens[&list.cursor.yp] = gween.New(list.cursor.yp, 0.5, 0.15, ease.OutSine) + + containerHeight := float32(1080 - 88 - 270 - 32 - 32) + contentHeight := float32(len(list.children)) * list.entryHeight + + scroll := float32(0) + if list.ptr >= 3 { + scroll = -float32(list.ptr-3) * list.entryHeight + } + + if -scroll > contentHeight-containerHeight { + scroll = -(contentHeight - containerHeight) + } + + if contentHeight < containerHeight { + scroll = 0 + } + + menu.tweens[&list.scroll] = gween.New(list.scroll, scroll, 0.15, ease.OutSine) } // genericSegueNext is a smooth transition that fades out the current list @@ -128,67 +133,34 @@ func genericAnimate(list *entry) { func genericSegueNext(list *entry) { for i := range list.children { e := &list.children[i] - - var yp, scale float32 - if i == list.ptr { - yp = 0.5 - 0.3 - scale = 1.5 - } else if i < list.ptr { - yp = 0.4 - 0.3 + 0.08*float32(i-list.ptr) - scale = 0.5 - } else if i > list.ptr { - yp = 0.6 - 0.3 + 0.08*float32(i-list.ptr) - scale = 0.5 - } - - menu.tweens[&e.yp] = gween.New(e.yp, yp, 0.15, ease.OutSine) menu.tweens[&e.labelAlpha] = gween.New(e.labelAlpha, 0, 0.15, ease.OutSine) menu.tweens[&e.iconAlpha] = gween.New(e.iconAlpha, 0, 0.15, ease.OutSine) menu.tweens[&e.tagAlpha] = gween.New(e.tagAlpha, 0, 0.15, ease.OutSine) menu.tweens[&e.subLabelAlpha] = gween.New(e.subLabelAlpha, 0, 0.15, ease.OutSine) - menu.tweens[&e.scale] = gween.New(e.scale, scale, 0.15, ease.OutSine) } menu.tweens[&list.cursor.alpha] = gween.New(list.cursor.alpha, 0, 0.15, ease.OutSine) - menu.tweens[&list.cursor.yp] = gween.New(list.cursor.yp, 0.5-0.3, 0.15, ease.OutSine) } // genericDrawCursor draws the blinking rectangular background of the active // menu entry -func genericDrawCursor(list *entry) { - w, h := vid.Window.GetFramebufferSize() +func genericDrawCursor(list *entry, i int) { + w, _ := vid.Window.GetFramebufferSize() + y := (270+32)*menu.ratio + list.scroll*menu.ratio + list.entryHeight*float32(i)*menu.ratio if menu.focus > 1 { blink := float32(math.Cos(menu.t)) vid.DrawImage( menu.icons["selection"], 360*menu.ratio-8*menu.ratio, - float32(h)*list.cursor.yp-50*menu.ratio-8*menu.ratio, + y-8*menu.ratio, float32(w)-720*menu.ratio+16*menu.ratio, - 100*menu.ratio+16*menu.ratio, + list.entryHeight*menu.ratio+16*menu.ratio, 1, 0.15, video.Color{R: 1, G: 1, B: 1, A: list.cursor.alpha - list.cursor.alpha*blink}) } vid.DrawRect( - 360*menu.ratio, float32(h)*list.cursor.yp-50*menu.ratio, - float32(w)-720*menu.ratio, 100*menu.ratio, 0.1, - video.Color{R: 1, G: 1, B: 1, A: list.cursor.alpha}) -} - -// thumbnailDrawCursor draws the blinking rectangular background of the active -// menu entry when there is a thumbnail -func thumbnailDrawCursor(list *entry) { - w, h := vid.Window.GetFramebufferSize() - if menu.focus > 1 { - blink := float32(math.Cos(menu.t)) - vid.DrawImage( - menu.icons["selection"], - 360*menu.ratio-8*menu.ratio, - float32(h)*list.cursor.yp-120*menu.ratio-8*menu.ratio, - float32(w)-720*menu.ratio+16*menu.ratio, - 240*menu.ratio+16*menu.ratio, - 1, 0.15, video.Color{R: 1, G: 1, B: 1, A: list.cursor.alpha - list.cursor.alpha*blink}) - } - vid.DrawRect( - 360*menu.ratio, float32(h)*list.cursor.yp-120*menu.ratio, - float32(w)-720*menu.ratio, 240*menu.ratio, 0.1, + 360*menu.ratio, + y, + float32(w)-720*menu.ratio, + list.entryHeight*menu.ratio, 0.1, video.Color{R: 1, G: 1, B: 1, A: list.cursor.alpha}) } @@ -213,39 +185,50 @@ func genericRender(list *entry) { vid.ScissorStart( int32(360*menu.ratio-8*menu.ratio), 0, - int32(float32(w)-720*menu.ratio+16*menu.ratio), int32(h)-int32(270*menu.ratio)) + int32(float32(w)-720*menu.ratio+16*menu.ratio), int32(h)-int32(272*menu.ratio)) - genericDrawCursor(list) + fontOffset := 12 * menu.ratio - for _, e := range list.children { - if e.yp < -0.1 || e.yp > 1.1 { - continue - } + for i, e := range list.children { + c := video.Color{R: 0, G: 0, B: 0, A: e.iconAlpha} + + vid.DrawRect( + 360*menu.ratio, + (270+32-1)*menu.ratio+list.scroll*menu.ratio+list.entryHeight*float32(i)*menu.ratio+list.entryHeight*menu.ratio, + float32(w)-720*menu.ratio, + 2*menu.ratio, + 0, video.Color{R: 0.85, G: 0.85, B: 0.85, A: e.iconAlpha}, + ) - fontOffset := 64 * 0.7 * menu.ratio * 0.3 + if i == list.ptr { + genericDrawCursor(list, i) + } - color := video.Color{R: 0, G: 0, B: 0, A: e.iconAlpha} + y := (270+32)*menu.ratio + + list.scroll*menu.ratio + + list.entryHeight*float32(i)*menu.ratio + + list.entryHeight/2*menu.ratio vid.DrawImage(menu.icons[e.icon], 420*menu.ratio-64*0.35*menu.ratio, - float32(h)*e.yp-14*menu.ratio-64*0.35*menu.ratio+fontOffset, + y-64*0.35*menu.ratio, 128*menu.ratio, 128*menu.ratio, - 0.35, 0, color) + 0.35, 0, c) if e.labelAlpha > 0 { - vid.Font.SetColor(color.R, color.G, color.B, e.labelAlpha) + vid.Font.SetColor(c.R, c.G, c.B, e.labelAlpha) vid.Font.Printf( 480*menu.ratio, - float32(h)*e.yp+fontOffset, + y+fontOffset, 0.5*menu.ratio, e.label) if e.widget != nil { - e.widget(&e) + e.widget(list, &e, i) } else if e.stringValue != nil { lw := vid.Font.Width(0.5*menu.ratio, e.stringValue()) vid.Font.Printf( float32(w)-lw-400*menu.ratio, - float32(h)*e.yp+fontOffset, + y+fontOffset, 0.5*menu.ratio, e.stringValue()) } } diff --git a/menu/scene_history.go b/menu/scene_history.go index a00d4379..3441fa26 100644 --- a/menu/scene_history.go +++ b/menu/scene_history.go @@ -8,43 +8,8 @@ import ( "github.com/libretro/ludo/history" ntf "github.com/libretro/ludo/notifications" "github.com/libretro/ludo/state" - "github.com/libretro/ludo/video" ) -type sceneHistory struct { - entry -} - -func buildHistory() Scene { - var list sceneHistory - list.label = "History" - - history.Load() - for _, game := range history.List { - game := game // needed for callbackOK - strippedName, tags := extractTags(game.Name) - list.children = append(list.children, entry{ - label: strippedName, - subLabel: game.System, - gameName: game.Name, - path: game.Path, - system: game.System, - tags: tags, - callbackOK: func() { loadHistoryEntry(&list, game) }, - }) - } - - if len(history.List) == 0 { - list.children = append(list.children, entry{ - label: "Empty history", - icon: "subsetting", - }) - } - - list.segueMount() - return &list -} - func loadHistoryEntry(list Scene, game history.Game) { if _, err := os.Stat(game.Path); os.IsNotExist(err) { ntf.DisplayAndLog(ntf.Error, "Menu", "Game not found.") @@ -83,130 +48,3 @@ func loadHistoryEntry(list Scene, game history.Game) { menu.Push(buildQuickMenu()) } } - -// Generic stuff -func (s *sceneHistory) Entry() *entry { - return &s.entry -} - -func (s *sceneHistory) segueMount() { - genericSegueMount(&s.entry) -} - -func (s *sceneHistory) segueNext() { - genericSegueNext(&s.entry) -} - -func (s *sceneHistory) segueBack() { - genericAnimate(&s.entry) -} - -func (s *sceneHistory) update(dt float32) { - genericInput(&s.entry, dt) -} - -// Override rendering -func (s *sceneHistory) render() { - list := &s.entry - - _, h := vid.Window.GetFramebufferSize() - - thumbnailDrawCursor(list) - - vid.ScissorStart(int32(510*menu.ratio), 0, int32(1310*menu.ratio), int32(h)) - - for i, e := range list.children { - if e.yp < -0.1 || e.yp > 1.1 { - freeThumbnail(list, i) - continue - } - - fontOffset := 64 * 0.7 * menu.ratio * 0.3 - - color := video.Color{R: 0, G: 0, B: 0, A: e.iconAlpha} - // if state.Global.CoreRunning { - // color = video.Color{R: 1, G: 1, B: 1, A: e.iconAlpha} - // } - - if e.labelAlpha > 0 { - drawThumbnail( - list, i, - e.system, e.gameName, - 680*menu.ratio-85*e.scale*menu.ratio, - float32(h)*e.yp-14*menu.ratio-64*e.scale*menu.ratio+fontOffset, - 170*menu.ratio, 128*menu.ratio, - e.scale, video.Color{R: 1, G: 1, B: 1, A: e.iconAlpha}, - ) - vid.DrawBorder( - 680*menu.ratio-85*e.scale*menu.ratio, - float32(h)*e.yp-14*menu.ratio-64*e.scale*menu.ratio+fontOffset, - 170*menu.ratio*e.scale, 128*menu.ratio*e.scale, 0.02/e.scale, - video.Color{R: color.R, G: color.G, B: color.B, A: e.iconAlpha}) - if e.path == state.Global.GamePath && e.path != "" { - vid.DrawCircle( - 680*menu.ratio, - float32(h)*e.yp-14*menu.ratio+fontOffset, - 90*menu.ratio*e.scale, - video.Color{R: 0, G: 0, B: 0, A: e.iconAlpha}) - vid.DrawImage(menu.icons["resume"], - 680*menu.ratio-25*e.scale*menu.ratio, - float32(h)*e.yp-14*menu.ratio-25*e.scale*menu.ratio+fontOffset, - 50*menu.ratio, 50*menu.ratio, - e.scale, 0, video.Color{R: 1, G: 1, B: 1, A: e.iconAlpha}) - } - - // Offset on Y to vertically center label + sublabel if there is a sublabel - slOffset := float32(0) - if e.subLabel != "" { - slOffset = 30 * menu.ratio * e.subLabelAlpha - } - - vid.Font.SetColor(color.R, color.G, color.B, e.labelAlpha) - stack := 840 * menu.ratio - vid.Font.Printf( - 840*menu.ratio, - float32(h)*e.yp+fontOffset-slOffset, - 0.5*menu.ratio, e.label) - stack += float32(int(vid.Font.Width(0.5*menu.ratio, e.label))) - stack += 10 - - for _, tag := range e.tags { - if _, ok := menu.icons[tag]; ok { - stack += 20 - vid.DrawImage( - menu.icons[tag], - stack, float32(h)*e.yp-22*menu.ratio-slOffset, - 60*menu.ratio, 44*menu.ratio, 1.0, 0, video.Color{R: 1, G: 1, B: 1, A: e.tagAlpha}) - vid.DrawBorder(stack, float32(h)*e.yp-22*menu.ratio-slOffset, - 60*menu.ratio, 44*menu.ratio, 0.05/menu.ratio, video.Color{R: 0, G: 0, B: 0, A: e.tagAlpha / 4}) - stack += 60 * menu.ratio - } - } - - vid.Font.SetColor(0.5, 0.5, 0.5, e.subLabelAlpha) - vid.Font.Printf( - 840*menu.ratio, - float32(h)*e.yp+fontOffset+60*menu.ratio-slOffset, - 0.5*menu.ratio, e.subLabel) - } - } - - vid.ScissorEnd() -} - -func (s *sceneHistory) drawHintBar() { - w, h := vid.Window.GetFramebufferSize() - vid.DrawRect(0, float32(h)-88*menu.ratio, float32(w), 88*menu.ratio, 0, video.Color{R: 1, G: 1, B: 1, A: 1}) - vid.DrawRect(0, float32(h)-88*menu.ratio, float32(w), 2*menu.ratio, 0, video.Color{R: 0.85, G: 0.85, B: 0.85, A: 1}) - - _, upDown, _, a, b, _, _, _, _, guide := hintIcons() - - lstack := float32(75) * menu.ratio - rstack := float32(w) - 96*menu.ratio - stackHintLeft(&lstack, upDown, "Navigate", h) - stackHintRight(&rstack, a, "Run", h) - stackHintRight(&rstack, b, "Back", h) - if state.Global.CoreRunning { - stackHintRight(&rstack, guide, "Resume", h) - } -} diff --git a/menu/scene_home.go b/menu/scene_home.go index 5da78390..feed5cd6 100644 --- a/menu/scene_home.go +++ b/menu/scene_home.go @@ -277,7 +277,6 @@ func (s *sceneHome) update(dt float32) { audio.PlayEffect(audio.Effects["cancel"]) menu.stack[len(menu.stack)-2].segueBack() menu.focus-- - menu.t = 0 } } } diff --git a/menu/scene_playlist.go b/menu/scene_playlist.go index 24493b3f..1157bef5 100644 --- a/menu/scene_playlist.go +++ b/menu/scene_playlist.go @@ -12,37 +12,8 @@ import ( "github.com/libretro/ludo/playlists" "github.com/libretro/ludo/settings" "github.com/libretro/ludo/state" - "github.com/libretro/ludo/utils" - "github.com/libretro/ludo/video" ) -type scenePlaylist struct { - entry -} - -func buildPlaylist(path string) Scene { - var list scenePlaylist - list.label = utils.FileName(path) - - for _, game := range playlists.Playlists[path] { - game := game // needed for callbackOK - strippedName, tags := extractTags(game.Name) - list.children = append(list.children, entry{ - label: strippedName, - gameName: game.Name, - path: game.Path, - tags: tags, - icon: utils.FileName(path) + "-content", - callbackOK: func() { loadPlaylistEntry(&list, list.label, game) }, - }) - } - - buildIndexes(&list.entry) - - list.segueMount() - return &list -} - // Index first letters of entries to allow quick jump to the next or previous // letter func buildIndexes(list *entry) { @@ -116,117 +87,3 @@ func loadPlaylistEntry(list Scene, playlist string, game playlists.Game) { menu.Push(buildQuickMenu()) } } - -// Generic stuff -func (s *scenePlaylist) Entry() *entry { - return &s.entry -} - -func (s *scenePlaylist) segueMount() { - genericSegueMount(&s.entry) -} - -func (s *scenePlaylist) segueNext() { - genericSegueNext(&s.entry) -} - -func (s *scenePlaylist) segueBack() { - genericAnimate(&s.entry) -} - -func (s *scenePlaylist) update(dt float32) { - genericInput(&s.entry, dt) -} - -// Override rendering -func (s *scenePlaylist) render() { - list := &s.entry - - _, h := vid.Window.GetFramebufferSize() - - thumbnailDrawCursor(list) - - vid.ScissorStart(int32(510*menu.ratio), 0, int32(1310*menu.ratio), int32(h)) - - for i, e := range list.children { - if e.yp < -0.1 || e.yp > 1.1 { - freeThumbnail(list, i) - continue - } - - fontOffset := 64 * 0.7 * menu.ratio * 0.3 - - color := video.Color{R: 0, G: 0, B: 0, A: e.iconAlpha} - // if state.Global.CoreRunning { - // color = video.Color{R: 1, G: 1, B: 1, A: e.iconAlpha} - // } - - if e.labelAlpha > 0 { - drawThumbnail( - list, i, - list.label, e.gameName, - 680*menu.ratio-85*e.scale*menu.ratio, - float32(h)*e.yp-14*menu.ratio-64*e.scale*menu.ratio+fontOffset, - 170*menu.ratio, 128*menu.ratio, - e.scale, video.Color{R: 1, G: 1, B: 1, A: e.iconAlpha}, - ) - vid.DrawBorder( - 680*menu.ratio-85*e.scale*menu.ratio, - float32(h)*e.yp-14*menu.ratio-64*e.scale*menu.ratio+fontOffset, - 170*menu.ratio*e.scale, 128*menu.ratio*e.scale, 0.02/e.scale, - video.Color{R: color.R, G: color.G, B: color.B, A: e.iconAlpha}) - if e.path == state.Global.GamePath && e.path != "" { - vid.DrawCircle( - 680*menu.ratio, - float32(h)*e.yp-14*menu.ratio+fontOffset, - 90*menu.ratio*e.scale, - video.Color{R: 0, G: 0, B: 0, A: e.iconAlpha}) - vid.DrawImage(menu.icons["resume"], - 680*menu.ratio-25*e.scale*menu.ratio, - float32(h)*e.yp-14*menu.ratio-25*e.scale*menu.ratio+fontOffset, - 50*menu.ratio, 50*menu.ratio, - e.scale, 0, video.Color{R: 1, G: 1, B: 1, A: e.iconAlpha}) - } - - vid.Font.SetColor(color.R, color.G, color.B, e.labelAlpha) - stack := 840 * menu.ratio - vid.Font.Printf( - 840*menu.ratio, - float32(h)*e.yp+fontOffset, - 0.5*menu.ratio, e.label) - stack += float32(int(vid.Font.Width(0.5*menu.ratio, e.label))) - stack += 10 - - for _, tag := range e.tags { - if _, ok := menu.icons[tag]; ok { - stack += 20 - vid.DrawImage( - menu.icons[tag], - stack, float32(h)*e.yp-22*menu.ratio, - 60*menu.ratio, 44*menu.ratio, 1.0, 0, video.Color{R: 1, G: 1, B: 1, A: e.tagAlpha}) - vid.DrawBorder(stack, float32(h)*e.yp-22*menu.ratio, - 60*menu.ratio, 44*menu.ratio, 0.05/menu.ratio, video.Color{R: 0, G: 0, B: 0, A: e.tagAlpha / 4}) - stack += 60 * menu.ratio - } - } - } - } - - vid.ScissorEnd() -} - -func (s *scenePlaylist) drawHintBar() { - w, h := vid.Window.GetFramebufferSize() - vid.DrawRect(0, float32(h)-88*menu.ratio, float32(w), 88*menu.ratio, 0, video.Color{R: 1, G: 1, B: 1, A: 1}) - vid.DrawRect(0, float32(h)-88*menu.ratio, float32(w), 2*menu.ratio, 0, video.Color{R: 0.85, G: 0.85, B: 0.85, A: 1}) - - _, upDown, _, a, b, _, _, _, _, guide := hintIcons() - - stack := float32(75) * menu.ratio - if state.Global.CoreRunning { - stackHintLeft(&stack, guide, "Resume", h) - } - stackHintLeft(&stack, upDown, "Navigate", h) - stackHintLeft(&stack, b, "Back", h) - stackHintLeft(&stack, a, "Run", h) -} diff --git a/menu/scene_quick.go b/menu/scene_quick.go index a27562f3..d432bf3a 100644 --- a/menu/scene_quick.go +++ b/menu/scene_quick.go @@ -65,6 +65,15 @@ func buildQuickMenu() Scene { }, }) + list.children = append(list.children, entry{ + label: "Settings", + icon: "subsetting", + callbackOK: func() { + list.segueNext() + menu.Push(buildSettings()) + }, + }) + list.segueMount() return &list diff --git a/menu/scene_savestates.go b/menu/scene_savestates.go index 934f04a1..86ed89cd 100644 --- a/menu/scene_savestates.go +++ b/menu/scene_savestates.go @@ -20,6 +20,7 @@ type sceneSavestates struct { func buildSavestates() Scene { var list sceneSavestates list.label = "Savestates" + list.entryHeight = 160 list.children = append(list.children, entry{ label: "Save State", @@ -110,40 +111,51 @@ func (s *sceneSavestates) render() { vid.ScissorStart( int32(360*menu.ratio-8*menu.ratio), 0, - int32(float32(w)-720*menu.ratio+16*menu.ratio), int32(h)-int32(270*menu.ratio)) + int32(float32(w)-720*menu.ratio+16*menu.ratio), int32(h)-int32(272*menu.ratio)) - thumbnailDrawCursor(list) + fontOffset := 12 * menu.ratio for i, e := range list.children { - if e.yp < -0.1 || e.yp > 1.1 { - continue - } + c := video.Color{R: 0, G: 0, B: 0, A: e.iconAlpha} - fontOffset := 64 * 0.7 * menu.ratio * 0.3 + vid.DrawRect( + 360*menu.ratio, + (270+32-1)*menu.ratio+list.scroll*menu.ratio+list.entryHeight*float32(i)*menu.ratio+list.entryHeight*menu.ratio, + float32(w)-720*menu.ratio, + 2*menu.ratio, + 0, video.Color{R: 0.85, G: 0.85, B: 0.85, A: 1}, + ) - c := video.Color{R: 0, G: 0, B: 0, A: e.iconAlpha} + if i == list.ptr { + genericDrawCursor(list, i) + } + + y := (270+32)*menu.ratio + + list.scroll*menu.ratio + + list.entryHeight*float32(i)*menu.ratio + + list.entryHeight/2*menu.ratio if e.labelAlpha > 0 { drawSavestateThumbnail( list, i, filepath.Join(settings.Current.ScreenshotsDirectory, utils.FileName(e.path)+".png"), - 510*menu.ratio-85*e.scale*menu.ratio, - float32(h)*e.yp-14*menu.ratio-64*e.scale*menu.ratio+fontOffset, + 480*menu.ratio-85*1*menu.ratio, + y-64*menu.ratio, 170*menu.ratio, 128*menu.ratio, - e.scale, video.Color{R: 1, G: 1, B: 1, A: e.iconAlpha}, + 1, video.Color{R: 1, G: 1, B: 1, A: e.iconAlpha}, ) if i == 0 { vid.DrawImage(menu.icons["savestate"], - 510*menu.ratio-25*e.scale*menu.ratio, - float32(h)*e.yp-14*menu.ratio-25*e.scale*menu.ratio+fontOffset, + 480*menu.ratio-25*1*menu.ratio, + y-64*menu.ratio, 50*menu.ratio, 50*menu.ratio, - e.scale, 0, video.Color{R: 1, G: 1, B: 1, A: e.iconAlpha}) + 1, 0, video.Color{R: 1, G: 1, B: 1, A: e.iconAlpha}) } vid.Font.SetColor(c.R, c.G, c.B, e.labelAlpha) vid.Font.Printf( - 670*menu.ratio, - float32(h)*e.yp+fontOffset, + 600*menu.ratio, + y+fontOffset, 0.5*menu.ratio, e.label) } } diff --git a/menu/scene_settings.go b/menu/scene_settings.go index 9617b898..c41a28e3 100644 --- a/menu/scene_settings.go +++ b/menu/scene_settings.go @@ -126,28 +126,28 @@ func dirExplorerCb(path string, f *structs.Field) { } // Widgets to display settings values -var widgets = map[string]func(*entry){ +var widgets = map[string]func(*entry, *entry, int){ // On/Off switch for boolean settings - "switch": func(e *entry) { + "switch": func(list, e *entry, i int) { icon := "off" if e.value().(bool) { icon = "on" } - w, h := vid.Window.GetFramebufferSize() + fbw, _ := vid.Window.GetFramebufferSize() c := video.Color{R: 0, G: 0, B: 0, A: e.iconAlpha} vid.DrawImage(menu.icons[icon], - float32(w)-400*menu.ratio-128*menu.ratio, - float32(h)*e.yp-64*1.25*menu.ratio, + float32(fbw)-400*menu.ratio-128*menu.ratio, + (270+32)*menu.ratio+list.scroll*menu.ratio+100*float32(i)*menu.ratio+50*menu.ratio-64*1.25*menu.ratio, 128*menu.ratio, 128*menu.ratio, 1.25, 0, c) }, // Range widget for audio volume and similat float settings - "range": func(e *entry) { - fbw, fbh := vid.Window.GetFramebufferSize() + "range": func(list, e *entry, i int) { + fbw, _ := vid.Window.GetFramebufferSize() x := float32(fbw) - 400*menu.ratio - 175*menu.ratio - y := float32(fbh)*e.yp - 4*menu.ratio + y := (270+32)*menu.ratio + list.scroll*menu.ratio + 100*float32(i)*menu.ratio + 50*menu.ratio - 4*menu.ratio w := 175 * menu.ratio h := 8 * menu.ratio c := video.Color{R: 0, G: 0, B: 0, A: e.iconAlpha} From 55040f528d8c42950f7a2005290cfb79b5782d05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Andr=C3=A9=20Santoni?= Date: Fri, 7 Aug 2020 16:40:57 +0700 Subject: [PATCH 24/52] Use a color palette --- menu/hints.go | 11 ++++------- menu/menu.go | 4 ++-- menu/notifications.go | 2 +- menu/palette.go | 10 ++++++++++ menu/scene.go | 21 +++++++++------------ menu/scene_core_options.go | 5 ++--- menu/scene_dialog.go | 16 +++++++--------- menu/scene_home.go | 21 ++++++++++----------- menu/scene_keyboard.go | 16 +++++++--------- menu/scene_savestates.go | 19 ++++++++----------- menu/scene_settings.go | 15 ++++++--------- menu/scene_tabs.go | 10 ++++------ menu/scene_wifi.go | 5 ++--- menu/thumbnail.go | 16 ++++------------ video/font.go | 11 ++++------- video/gfx.go | 5 +++++ 16 files changed, 85 insertions(+), 102 deletions(-) create mode 100644 menu/palette.go diff --git a/menu/hints.go b/menu/hints.go index e5dec3fc..6fbfcb29 100644 --- a/menu/hints.go +++ b/menu/hints.go @@ -3,14 +3,12 @@ package menu import ( "github.com/go-gl/glfw/v3.3/glfw" "github.com/libretro/ludo/input" - "github.com/libretro/ludo/video" ) // Used to easily compose different hint bars based on the context. func stackHintLeft(stack *float32, icon uint32, label string, h int) { - c := video.Color{R: 0.28, G: 0.28, B: 0.28, A: 1} - vid.Font.SetColor(0.28, 0.28, 0.28, 1.0) - vid.DrawImage(icon, *stack, float32(h)-79*menu.ratio, 70*menu.ratio, 70*menu.ratio, 1.0, 0, c) + vid.Font.SetColor(darkGrey) + vid.DrawImage(icon, *stack, float32(h)-79*menu.ratio, 70*menu.ratio, 70*menu.ratio, 1.0, 0, darkGrey) *stack += 70 * menu.ratio vid.Font.Printf(*stack, float32(h)-30*menu.ratio, 0.5*menu.ratio, label) *stack += vid.Font.Width(0.5*menu.ratio, label) @@ -19,12 +17,11 @@ func stackHintLeft(stack *float32, icon uint32, label string, h int) { // Used to easily compose different hint bars based on the context. func stackHintRight(stack *float32, icon uint32, label string, h int) { - c := video.Color{R: 0.28, G: 0.28, B: 0.28, A: 1} *stack -= vid.Font.Width(0.5*menu.ratio, label) - vid.Font.SetColor(0.28, 0.28, 0.28, 1.0) + vid.Font.SetColor(darkGrey) vid.Font.Printf(*stack, float32(h)-30*menu.ratio, 0.5*menu.ratio, label) *stack -= 70 * menu.ratio - vid.DrawImage(icon, *stack, float32(h)-79*menu.ratio, 70*menu.ratio, 70*menu.ratio, 1.0, 0, c) + vid.DrawImage(icon, *stack, float32(h)-79*menu.ratio, 70*menu.ratio, 70*menu.ratio, 1.0, 0, darkGrey) *stack -= 32 * menu.ratio } diff --git a/menu/menu.go b/menu/menu.go index 364808bd..bdf366e6 100644 --- a/menu/menu.go +++ b/menu/menu.go @@ -76,9 +76,9 @@ func (m *Menu) Render(dt float32) { w, h := vid.Window.GetFramebufferSize() m.ratio = float32(w) / 1920 - c := video.Color{R: 1, G: 1, B: 1, A: 1} + c := white if haveTransparentBackground() { - c = video.Color{R: 1, G: 1, B: 1, A: 0.85} + c = white.Alpha(0.85) } vid.DrawImage(menu.icons["bg"], 0, 0, float32(w), float32(h), 1, 0, c) diff --git a/menu/notifications.go b/menu/notifications.go index 90f4ab14..cb99219f 100644 --- a/menu/notifications.go +++ b/menu/notifications.go @@ -41,7 +41,7 @@ func (m *Menu) RenderNotifications() { 0.25, video.Color{R: float32(bg.R), G: float32(bg.G), B: float32(bg.B), A: fading}, ) - vid.Font.SetColor(float32(fg.R), float32(fg.G), float32(fg.B), fading) + vid.Font.SetColor(video.Color{R: float32(fg.R), G: float32(fg.G), B: float32(fg.B), A: fading}) vid.Font.Printf( 45*m.ratio, (stack+offset)*m.ratio, diff --git a/menu/palette.go b/menu/palette.go new file mode 100644 index 00000000..2d85158d --- /dev/null +++ b/menu/palette.go @@ -0,0 +1,10 @@ +package menu + +import "github.com/libretro/ludo/video" + +var white = video.Color{R: 1, G: 1, B: 1, A: 1} +var black = video.Color{R: 0, G: 0, B: 0, A: 1} +var blue = video.Color{R: 0.129, G: 0.441, B: 0.684, A: 1} +var lightGrey = video.Color{R: 0.85, G: 0.85, B: 0.85, A: 1} +var mediumGrey = video.Color{R: 0.56, G: 0.56, B: 0.56, A: 1} +var darkGrey = video.Color{R: 0.28, G: 0.28, B: 0.28, A: 1} diff --git a/menu/scene.go b/menu/scene.go index 33fcf33b..ecdbdefd 100644 --- a/menu/scene.go +++ b/menu/scene.go @@ -4,7 +4,6 @@ import ( "math" "github.com/libretro/ludo/state" - "github.com/libretro/ludo/video" "github.com/tanema/gween" "github.com/tanema/gween/ease" ) @@ -154,14 +153,14 @@ func genericDrawCursor(list *entry, i int) { y-8*menu.ratio, float32(w)-720*menu.ratio+16*menu.ratio, list.entryHeight*menu.ratio+16*menu.ratio, - 1, 0.15, video.Color{R: 1, G: 1, B: 1, A: list.cursor.alpha - list.cursor.alpha*blink}) + 1, 0.15, white.Alpha(list.cursor.alpha-list.cursor.alpha*blink)) } vid.DrawRect( 360*menu.ratio, y, float32(w)-720*menu.ratio, list.entryHeight*menu.ratio, 0.1, - video.Color{R: 1, G: 1, B: 1, A: list.cursor.alpha}) + white.Alpha(list.cursor.alpha)) } // genericRender renders a vertical list of menu entries @@ -169,7 +168,7 @@ func genericDrawCursor(list *entry, i int) { func genericRender(list *entry) { w, h := vid.Window.GetFramebufferSize() - vid.BoldFont.SetColor(0.129, 0.441, 0.684, list.cursor.alpha) + vid.BoldFont.SetColor(blue.Alpha(list.cursor.alpha)) vid.BoldFont.Printf( 360*menu.ratio, 230*menu.ratio, @@ -180,7 +179,7 @@ func genericRender(list *entry) { 270*menu.ratio, float32(w)-720*menu.ratio, 2*menu.ratio, - 0, video.Color{R: 0.85, G: 0.85, B: 0.85, A: 1}, + 0, lightGrey, ) vid.ScissorStart( @@ -190,14 +189,12 @@ func genericRender(list *entry) { fontOffset := 12 * menu.ratio for i, e := range list.children { - c := video.Color{R: 0, G: 0, B: 0, A: e.iconAlpha} - vid.DrawRect( 360*menu.ratio, (270+32-1)*menu.ratio+list.scroll*menu.ratio+list.entryHeight*float32(i)*menu.ratio+list.entryHeight*menu.ratio, float32(w)-720*menu.ratio, 2*menu.ratio, - 0, video.Color{R: 0.85, G: 0.85, B: 0.85, A: e.iconAlpha}, + 0, lightGrey.Alpha(e.iconAlpha), ) if i == list.ptr { @@ -213,10 +210,10 @@ func genericRender(list *entry) { 420*menu.ratio-64*0.35*menu.ratio, y-64*0.35*menu.ratio, 128*menu.ratio, 128*menu.ratio, - 0.35, 0, c) + 0.35, 0, black.Alpha(e.iconAlpha)) if e.labelAlpha > 0 { - vid.Font.SetColor(c.R, c.G, c.B, e.labelAlpha) + vid.Font.SetColor(black.Alpha(e.labelAlpha)) vid.Font.Printf( 480*menu.ratio, y+fontOffset, @@ -239,8 +236,8 @@ func genericRender(list *entry) { func genericDrawHintBar() { w, h := vid.Window.GetFramebufferSize() - vid.DrawRect(0, float32(h)-88*menu.ratio, float32(w), 88*menu.ratio, 0, video.Color{R: 1, G: 1, B: 1, A: 1}) - vid.DrawRect(0, float32(h)-88*menu.ratio, float32(w), 2*menu.ratio, 0, video.Color{R: 0.85, G: 0.85, B: 0.85, A: 1}) + vid.DrawRect(0, float32(h)-88*menu.ratio, float32(w), 88*menu.ratio, 0, white) + vid.DrawRect(0, float32(h)-88*menu.ratio, float32(w), 2*menu.ratio, 0, lightGrey) _, upDown, _, a, b, _, _, _, _, guide := hintIcons() diff --git a/menu/scene_core_options.go b/menu/scene_core_options.go index c4e9aabb..47b70f22 100644 --- a/menu/scene_core_options.go +++ b/menu/scene_core_options.go @@ -6,7 +6,6 @@ import ( "github.com/libretro/ludo/core" ntf "github.com/libretro/ludo/notifications" "github.com/libretro/ludo/state" - "github.com/libretro/ludo/video" ) type sceneCoreOptions struct { @@ -82,8 +81,8 @@ func (s *sceneCoreOptions) render() { func (s *sceneCoreOptions) drawHintBar() { w, h := vid.Window.GetFramebufferSize() - vid.DrawRect(0, float32(h)-88*menu.ratio, float32(w), 88*menu.ratio, 0, video.Color{R: 1, G: 1, B: 1, A: 1}) - vid.DrawRect(0, float32(h)-88*menu.ratio, float32(w), 2*menu.ratio, 0, video.Color{R: 0.85, G: 0.85, B: 0.85, A: 1}) + vid.DrawRect(0, float32(h)-88*menu.ratio, float32(w), 88*menu.ratio, 0, white) + vid.DrawRect(0, float32(h)-88*menu.ratio, float32(w), 2*menu.ratio, 0, lightGrey) _, upDown, leftRight, _, b, _, _, _, _, guide := hintIcons() diff --git a/menu/scene_dialog.go b/menu/scene_dialog.go index 47d746d2..827b116d 100644 --- a/menu/scene_dialog.go +++ b/menu/scene_dialog.go @@ -4,7 +4,6 @@ import ( "github.com/libretro/ludo/audio" "github.com/libretro/ludo/input" "github.com/libretro/ludo/libretro" - "github.com/libretro/ludo/video" ) type sceneDialog struct { @@ -51,7 +50,7 @@ func (s *sceneDialog) render() { w, h := vid.Window.GetFramebufferSize() fw := float32(w) fh := float32(h) - vid.DrawRect(0, 0, fw, fh, 0, video.Color{R: 0, G: 0, B: 0, A: 0.85}) + vid.DrawRect(0, 0, fw, fh, 0, black.Alpha(0.85)) var width float32 = 1000 var height float32 = 400 @@ -62,14 +61,14 @@ func (s *sceneDialog) render() { width*menu.ratio, height*menu.ratio, 0.05, - video.Color{R: 1, G: 1, B: 1, A: 1}, + white, ) - vid.Font.SetColor(0.8, 0.4, 0.1, 1) + vid.Font.SetColor(blue) msg1 := "A game is currently running." lw1 := vid.Font.Width(0.7*menu.ratio, msg1) vid.Font.Printf(fw/2-lw1/2, fh/2-120*menu.ratio+20*menu.ratio, 0.7*menu.ratio, msg1) - vid.Font.SetColor(0, 0, 0, 1) + vid.Font.SetColor(black) msg2 := "If you have not saved yet, your progress will be lost." lw2 := vid.Font.Width(0.5*menu.ratio, msg2) vid.Font.Printf(fw/2-lw2/2, fh/2-30*menu.ratio+20*menu.ratio, 0.5*menu.ratio, msg2) @@ -77,8 +76,7 @@ func (s *sceneDialog) render() { lw3 := vid.Font.Width(0.5*menu.ratio, msg3) vid.Font.Printf(fw/2-lw3/2, fh/2+30*menu.ratio+20*menu.ratio, 0.5*menu.ratio, msg3) - c := video.Color{R: 0.25, G: 0.25, B: 0.25, A: 1} - vid.Font.SetColor(0.25, 0.25, 0.25, 1.0) + vid.Font.SetColor(darkGrey) var margin float32 = 15 @@ -88,7 +86,7 @@ func (s *sceneDialog) render() { b, fw/2-width/2*menu.ratio+margin*menu.ratio, fh/2+height/2*menu.ratio-70*menu.ratio-margin*menu.ratio, - 70*menu.ratio, 70*menu.ratio, 1.0, 0, c) + 70*menu.ratio, 70*menu.ratio, 1.0, 0, darkGrey) vid.Font.Printf( fw/2-width/2*menu.ratio+margin*menu.ratio+70*menu.ratio, fh/2+height/2*menu.ratio-23*menu.ratio-margin*menu.ratio, @@ -99,7 +97,7 @@ func (s *sceneDialog) render() { a, fw/2+width/2*menu.ratio-150*menu.ratio-margin*menu.ratio, fh/2+height/2*menu.ratio-70*menu.ratio-margin*menu.ratio, - 70*menu.ratio, 70*menu.ratio, 1.0, 0, c) + 70*menu.ratio, 70*menu.ratio, 1.0, 0, darkGrey) vid.Font.Printf( fw/2+width/2*menu.ratio-150*menu.ratio-margin*menu.ratio+70*menu.ratio, fh/2+height/2*menu.ratio-23*menu.ratio-margin*menu.ratio, diff --git a/menu/scene_home.go b/menu/scene_home.go index feed5cd6..3974d020 100644 --- a/menu/scene_home.go +++ b/menu/scene_home.go @@ -11,7 +11,6 @@ import ( "github.com/libretro/ludo/playlists" "github.com/libretro/ludo/state" "github.com/libretro/ludo/utils" - "github.com/libretro/ludo/video" "github.com/tanema/gween" "github.com/tanema/gween/ease" @@ -286,7 +285,7 @@ func (s sceneHome) render() { for j, ve := range s.children { ve := ve - vid.BoldFont.SetColor(0.129, 0.441, 0.684, ve.labelAlpha*s.alpha) + vid.BoldFont.SetColor(blue.Alpha(ve.labelAlpha * s.alpha)) vid.BoldFont.Printf( 96*menu.ratio, 230*menu.ratio+vst*menu.ratio-s.yscroll*menu.ratio, @@ -317,7 +316,7 @@ func (s sceneHome) render() { x*menu.ratio-8*menu.ratio, y*menu.ratio-8*menu.ratio, 320*e.scale*menu.ratio+16*menu.ratio, 240*e.scale*menu.ratio+16*menu.ratio, - 1, 0.1, video.Color{R: 1, G: 1, B: 1, A: (e.borderAlpha - blink) * s.alpha}) + 1, 0.1, white.Alpha((e.borderAlpha-blink)*s.alpha)) } drawThumbnail( @@ -326,22 +325,22 @@ func (s sceneHome) render() { x*menu.ratio, y*menu.ratio, 320*e.scale*menu.ratio, 240*e.scale*menu.ratio, - 1, video.Color{R: 1, G: 1, B: 1, A: e.iconAlpha * s.alpha}) + 1, white.Alpha(e.iconAlpha*s.alpha)) vid.DrawImage( menu.icons["border"], x*menu.ratio, y*menu.ratio, 320*e.scale*menu.ratio, 240*e.scale*menu.ratio, - 1, 0.07, video.Color{R: 1, G: 1, B: 1, A: e.iconAlpha * s.alpha}) + 1, 0.07, white.Alpha(e.iconAlpha*s.alpha)) - vid.BoldFont.SetColor(0, 0, 0, e.labelAlpha*s.alpha) + vid.BoldFont.SetColor(black.Alpha(e.labelAlpha * s.alpha)) vid.BoldFont.Printf( (x+672+32)*menu.ratio, (y+360)*menu.ratio, 0.7*menu.ratio, e.label) - vid.BoldFont.SetColor(0.56, 0.56, 0.56, e.labelAlpha*s.alpha) + vid.BoldFont.SetColor(mediumGrey.Alpha(e.labelAlpha * s.alpha)) vid.BoldFont.Printf( (x+672+32)*menu.ratio, (y+430)*menu.ratio, @@ -352,12 +351,12 @@ func (s sceneHome) render() { if _, ok := menu.icons[tag]; ok { vid.DrawRect(stack-1*menu.ratio, (y+500-35)*menu.ratio-1*menu.ratio, 48*menu.ratio+2*menu.ratio, 35*menu.ratio+2*menu.ratio, 0.22, - video.Color{R: 0, G: 0, B: 0, A: e.labelAlpha * s.alpha * 0.5}) + black.Alpha(e.labelAlpha*s.alpha*0.5)) vid.DrawImage( menu.icons[tag], stack, (y+500-35)*menu.ratio, 48*menu.ratio, 35*menu.ratio, 1.0, 0.2, - video.Color{R: 1, G: 1, B: 1, A: e.labelAlpha * s.alpha}) + white.Alpha(e.labelAlpha*s.alpha)) stack += 48 * menu.ratio stack += 24 * menu.ratio } @@ -368,8 +367,8 @@ func (s sceneHome) render() { func (s sceneHome) drawHintBar() { w, h := vid.Window.GetFramebufferSize() - vid.DrawRect(0, float32(h)-88*menu.ratio, float32(w), 88*menu.ratio, 0, video.Color{R: 1, G: 1, B: 1, A: 1}) - vid.DrawRect(0, float32(h)-88*menu.ratio, float32(w), 2*menu.ratio, 0, video.Color{R: 0.85, G: 0.85, B: 0.85, A: 1}) + vid.DrawRect(0, float32(h)-88*menu.ratio, float32(w), 88*menu.ratio, 0, white) + vid.DrawRect(0, float32(h)-88*menu.ratio, float32(w), 2*menu.ratio, 0, lightGrey) arrows, _, _, a, _, _, _, _, _, guide := hintIcons() diff --git a/menu/scene_keyboard.go b/menu/scene_keyboard.go index c302d62b..2bac871b 100644 --- a/menu/scene_keyboard.go +++ b/menu/scene_keyboard.go @@ -157,11 +157,10 @@ func (s *sceneKeyboard) render() { ttw := 10 * ksp // Background - vid.DrawRect(0, 0, float32(w), float32(h), 0, - video.Color{R: 1, G: 1, B: 1, A: s.alpha}) + vid.DrawRect(0, 0, float32(w), float32(h), 0, white.Alpha(s.alpha)) // Label - vid.Font.SetColor(0, 0, 0, 1) + vid.Font.SetColor(black) vid.Font.Printf( float32(w)/2-ttw/2, s.y+float32(h)*0.15-ksz/2+ksz*0.6, @@ -169,7 +168,7 @@ func (s *sceneKeyboard) render() { // Value vid.DrawRect(float32(w)/2-ttw/2, s.y+float32(h)*0.25-ksz/2, ttw, ksz, 0, - video.Color{R: 0.95, G: 0.95, B: 0.95, A: 1}) + lightGrey) vid.Font.Printf( float32(w)/2-ttw/2+ksz/4, s.y+float32(h)*0.25-ksz/2+ksz*0.62, @@ -177,10 +176,9 @@ func (s *sceneKeyboard) render() { // Keyboard - vid.DrawRect(0, s.y+float32(h)-kbh, float32(w), kbh, 0, - video.Color{R: 0, G: 0, B: 0, A: 1}) + vid.DrawRect(0, s.y+float32(h)-kbh, float32(w), kbh, 0, black) - vid.Font.SetColor(1, 1, 1, 1) + vid.Font.SetColor(white) for i, key := range layouts[s.layout] { x := float32(i%10)*ksp - ttw/2 + float32(w)/2 @@ -206,8 +204,8 @@ func (s *sceneKeyboard) render() { func (s *sceneKeyboard) drawHintBar() { w, h := vid.Window.GetFramebufferSize() - vid.DrawRect(0, float32(h)-88*menu.ratio, float32(w), 88*menu.ratio, 0, video.Color{R: 1, G: 1, B: 1, A: 1}) - vid.DrawRect(0, float32(h)-88*menu.ratio, float32(w), 2*menu.ratio, 0, video.Color{R: 0.85, G: 0.85, B: 0.85, A: 1}) + vid.DrawRect(0, float32(h)-88*menu.ratio, float32(w), 88*menu.ratio, 0, white) + vid.DrawRect(0, float32(h)-88*menu.ratio, float32(w), 2*menu.ratio, 0, lightGrey) arrows, _, _, a, b, x, y, start, _, _ := hintIcons() diff --git a/menu/scene_savestates.go b/menu/scene_savestates.go index 86ed89cd..33eb2457 100644 --- a/menu/scene_savestates.go +++ b/menu/scene_savestates.go @@ -10,7 +10,6 @@ import ( "github.com/libretro/ludo/settings" "github.com/libretro/ludo/state" "github.com/libretro/ludo/utils" - "github.com/libretro/ludo/video" ) type sceneSavestates struct { @@ -95,7 +94,7 @@ func (s *sceneSavestates) render() { list := &s.entry w, h := vid.Window.GetFramebufferSize() - vid.BoldFont.SetColor(0.129, 0.441, 0.684, list.cursor.alpha) + vid.BoldFont.SetColor(blue.Alpha(list.cursor.alpha)) vid.BoldFont.Printf( 360*menu.ratio, 230*menu.ratio, @@ -106,7 +105,7 @@ func (s *sceneSavestates) render() { 270*menu.ratio, float32(w)-720*menu.ratio, 2*menu.ratio, - 0, video.Color{R: 0.85, G: 0.85, B: 0.85, A: 1}, + 0, lightGrey, ) vid.ScissorStart( @@ -116,14 +115,12 @@ func (s *sceneSavestates) render() { fontOffset := 12 * menu.ratio for i, e := range list.children { - c := video.Color{R: 0, G: 0, B: 0, A: e.iconAlpha} - vid.DrawRect( 360*menu.ratio, (270+32-1)*menu.ratio+list.scroll*menu.ratio+list.entryHeight*float32(i)*menu.ratio+list.entryHeight*menu.ratio, float32(w)-720*menu.ratio, 2*menu.ratio, - 0, video.Color{R: 0.85, G: 0.85, B: 0.85, A: 1}, + 0, lightGrey, ) if i == list.ptr { @@ -142,17 +139,17 @@ func (s *sceneSavestates) render() { 480*menu.ratio-85*1*menu.ratio, y-64*menu.ratio, 170*menu.ratio, 128*menu.ratio, - 1, video.Color{R: 1, G: 1, B: 1, A: e.iconAlpha}, + 1, white.Alpha(e.iconAlpha), ) if i == 0 { vid.DrawImage(menu.icons["savestate"], 480*menu.ratio-25*1*menu.ratio, y-64*menu.ratio, 50*menu.ratio, 50*menu.ratio, - 1, 0, video.Color{R: 1, G: 1, B: 1, A: e.iconAlpha}) + 1, 0, white.Alpha(e.iconAlpha)) } - vid.Font.SetColor(c.R, c.G, c.B, e.labelAlpha) + vid.Font.SetColor(black.Alpha(e.labelAlpha)) vid.Font.Printf( 600*menu.ratio, y+fontOffset, @@ -165,8 +162,8 @@ func (s *sceneSavestates) render() { func (s *sceneSavestates) drawHintBar() { w, h := vid.Window.GetFramebufferSize() - vid.DrawRect(0, float32(h)-88*menu.ratio, float32(w), 88*menu.ratio, 0, video.Color{R: 1, G: 1, B: 1, A: 1}) - vid.DrawRect(0, float32(h)-88*menu.ratio, float32(w), 2*menu.ratio, 0, video.Color{R: 0.85, G: 0.85, B: 0.85, A: 1}) + vid.DrawRect(0, float32(h)-88*menu.ratio, float32(w), 88*menu.ratio, 0, white) + vid.DrawRect(0, float32(h)-88*menu.ratio, float32(w), 2*menu.ratio, 0, lightGrey) ptr := menu.stack[len(menu.stack)-1].Entry().ptr diff --git a/menu/scene_settings.go b/menu/scene_settings.go index c41a28e3..b4816ba8 100644 --- a/menu/scene_settings.go +++ b/menu/scene_settings.go @@ -14,7 +14,6 @@ import ( "github.com/libretro/ludo/settings" "github.com/libretro/ludo/state" "github.com/libretro/ludo/utils" - "github.com/libretro/ludo/video" ) type sceneSettings struct { @@ -135,12 +134,11 @@ var widgets = map[string]func(*entry, *entry, int){ icon = "on" } fbw, _ := vid.Window.GetFramebufferSize() - c := video.Color{R: 0, G: 0, B: 0, A: e.iconAlpha} vid.DrawImage(menu.icons[icon], float32(fbw)-400*menu.ratio-128*menu.ratio, (270+32)*menu.ratio+list.scroll*menu.ratio+100*float32(i)*menu.ratio+50*menu.ratio-64*1.25*menu.ratio, 128*menu.ratio, 128*menu.ratio, - 1.25, 0, c) + 1.25, 0, black.Alpha(e.iconAlpha)) }, // Range widget for audio volume and similat float settings @@ -150,11 +148,10 @@ var widgets = map[string]func(*entry, *entry, int){ y := (270+32)*menu.ratio + list.scroll*menu.ratio + 100*float32(i)*menu.ratio + 50*menu.ratio - 4*menu.ratio w := 175 * menu.ratio h := 8 * menu.ratio - c := video.Color{R: 0, G: 0, B: 0, A: e.iconAlpha} - vid.DrawRect(x, y, w, h, 0.9, video.Color{R: c.R, G: c.G, B: c.B, A: e.iconAlpha / 4}) + vid.DrawRect(x, y, w, h, 0.9, black.Alpha(e.iconAlpha/4)) w = 175 * menu.ratio * e.value().(float32) - vid.DrawRect(x, y, w, h, 0.9, c) - vid.DrawCircle(x+w, y+4*menu.ratio, 38*menu.ratio, c) + vid.DrawRect(x, y, w, h, 0.9, black.Alpha(e.iconAlpha)) + vid.DrawCircle(x+w, y+4*menu.ratio, 38*menu.ratio, black.Alpha(e.iconAlpha)) }, } @@ -264,8 +261,8 @@ func (s *sceneSettings) render() { func (s *sceneSettings) drawHintBar() { w, h := vid.Window.GetFramebufferSize() - vid.DrawRect(0, float32(h)-88*menu.ratio, float32(w), 88*menu.ratio, 0, video.Color{R: 1, G: 1, B: 1, A: 1}) - vid.DrawRect(0, float32(h)-88*menu.ratio, float32(w), 2*menu.ratio, 0, video.Color{R: 0.85, G: 0.85, B: 0.85, A: 1}) + vid.DrawRect(0, float32(h)-88*menu.ratio, float32(w), 88*menu.ratio, 0, white) + vid.DrawRect(0, float32(h)-88*menu.ratio, float32(w), 2*menu.ratio, 0, lightGrey) _, upDown, leftRight, a, b, _, _, _, _, guide := hintIcons() diff --git a/menu/scene_tabs.go b/menu/scene_tabs.go index 6c74ae00..61df944a 100644 --- a/menu/scene_tabs.go +++ b/menu/scene_tabs.go @@ -10,7 +10,6 @@ import ( "github.com/libretro/ludo/libretro" "github.com/libretro/ludo/scanner" "github.com/libretro/ludo/state" - "github.com/libretro/ludo/video" ) type sceneTabs struct { @@ -160,7 +159,7 @@ func (s sceneTabs) render() { now := time.Now().Format("3:04PM") nowWidth := vid.BoldFont.Width(0.5*menu.ratio, now) - vid.BoldFont.SetColor(0, 0, 0, 1) + vid.BoldFont.SetColor(black) vid.BoldFont.Printf( float32(w)-96*menu.ratio-nowWidth, 90*menu.ratio, 0.5*menu.ratio, now) @@ -179,17 +178,16 @@ func (s sceneTabs) render() { float32(w)/2-totalWidth/2+float32(i)*spacing*menu.ratio+96*menu.ratio/2-8*menu.ratio, 32*menu.ratio-8*menu.ratio, 96*menu.ratio+16*menu.ratio, 96*menu.ratio+16*menu.ratio, 1, 1, - video.Color{R: 1, G: 1, B: 1, A: 1 - blink}) + white.Alpha(1-blink)) } - c := video.Color{R: 1, G: 1, B: 1, A: 1} vid.DrawImage(menu.icons["circle"], float32(w)/2-totalWidth/2+float32(i)*spacing*menu.ratio+96*menu.ratio/2, 32*menu.ratio, - 96*menu.ratio, 96*menu.ratio, 1, 0, c) + 96*menu.ratio, 96*menu.ratio, 1, 0, white) vid.DrawImage(menu.icons[e.icon], float32(w)/2-totalWidth/2+float32(i)*spacing*menu.ratio+96*menu.ratio/2+24*menu.ratio, 56*menu.ratio, - 48*menu.ratio, 48*menu.ratio, 1, 0, c) + 48*menu.ratio, 48*menu.ratio, 1, 0, white) } } diff --git a/menu/scene_wifi.go b/menu/scene_wifi.go index ce3f321e..c028db50 100644 --- a/menu/scene_wifi.go +++ b/menu/scene_wifi.go @@ -3,7 +3,6 @@ package menu import ( "github.com/libretro/ludo/ludos" ntf "github.com/libretro/ludo/notifications" - "github.com/libretro/ludo/video" ) type sceneWiFi struct { @@ -87,8 +86,8 @@ func (s *sceneWiFi) render() { func (s *sceneWiFi) drawHintBar() { w, h := vid.Window.GetFramebufferSize() - vid.DrawRect(0, float32(h)-88*menu.ratio, float32(w), 88*menu.ratio, 0, video.Color{R: 1, G: 1, B: 1, A: 1}) - vid.DrawRect(0, float32(h)-88*menu.ratio, float32(w), 2*menu.ratio, 0, video.Color{R: 0.85, G: 0.85, B: 0.85, A: 1}) + vid.DrawRect(0, float32(h)-88*menu.ratio, float32(w), 88*menu.ratio, 0, white) + vid.DrawRect(0, float32(h)-88*menu.ratio, float32(w), 2*menu.ratio, 0, lightGrey) _, upDown, _, a, b, _, _, _, _, _ := hintIcons() diff --git a/menu/thumbnail.go b/menu/thumbnail.go index 137e61c1..7c998f6e 100644 --- a/menu/thumbnail.go +++ b/menu/thumbnail.go @@ -64,7 +64,7 @@ func scrubIllegalChars(str string) string { } // Draws a thumbnail in the playlist scene. -func drawThumbnail(list *entry, i int, system, gameName string, x, y, w, h, scale float32, color video.Color) { +func drawThumbnail(list *entry, i int, system, gameName string, x, y, w, h, scale float32, c video.Color) { folderPath := filepath.Join(settings.Current.ThumbnailsDirectory, system, "Named_Snaps") legalName := scrubIllegalChars(gameName) path := filepath.Join(folderPath, legalName+".png") @@ -79,26 +79,18 @@ func drawThumbnail(list *entry, i int, system, gameName string, x, y, w, h, scal } } - vid.DrawThumbnail( - list.children[i].thumbnail, - x, y, w, h, scale, 0.07, - color, - ) + vid.DrawThumbnail(list.children[i].thumbnail, x, y, w, h, scale, 0.07, c) } // Draws a thumbnail in the savestates scene. -func drawSavestateThumbnail(list *entry, i int, path string, x, y, w, h, scale float32, color video.Color) { +func drawSavestateThumbnail(list *entry, i int, path string, x, y, w, h, scale float32, c video.Color) { if list.children[i].thumbnail == 0 { if _, err := os.Stat(path); !os.IsNotExist(err) { list.children[i].thumbnail = video.NewImage(path) } } - vid.DrawThumbnail( - list.children[i].thumbnail, - x, y, w, h, scale, 0, - color, - ) + vid.DrawThumbnail(list.children[i].thumbnail, x, y, w, h, scale, 0, c) } func freeThumbnail(list *entry, i int) { diff --git a/video/font.go b/video/font.go index baf4eee9..bdfcb484 100644 --- a/video/font.go +++ b/video/font.go @@ -71,8 +71,8 @@ func LoadTrueTypeFont(program uint32, r io.Reader, scale int32, low, high rune, // Make Font stuct type f := new(Font) f.fontChar = make([]*character, 0, high-low+1) - f.program = program // Set shader program - f.SetColor(1, 1, 1, 1) // Set default white + f.program = program // Set shader program + f.SetColor(Color{1, 1, 1, 1}) // Set default white // Create new face ttfFace := truetype.NewFace(ttf, &truetype.Options{ @@ -231,11 +231,8 @@ func LoadFont(file string, scale int32, windowWidth int, windowHeight int) (*Fon } // SetColor allows you to set the text color to be used when you draw the text -func (f *Font) SetColor(red float32, green float32, blue float32, alpha float32) { - f.color.R = red - f.color.G = green - f.color.B = blue - f.color.A = alpha +func (f *Font) SetColor(c Color) { + f.color = c } // UpdateResolution passes the new framebuffer size to the font shader diff --git a/video/gfx.go b/video/gfx.go index ac24d8f7..1fb75159 100644 --- a/video/gfx.go +++ b/video/gfx.go @@ -13,6 +13,11 @@ type Color struct { R, G, B, A float32 } +// Alpha returns the same color with altered alpha +func (c Color) Alpha(a float32) Color { + return Color{c.R, c.G, c.B, a} +} + // XYWHTo4points converts coordinates from (x, y, width, height) to (x1, y1, x2, y2, x3, y3, x4, y4) func XYWHTo4points(x, y, w, h, fbh float32) (x1, y1, x2, y2, x3, y3, x4, y4 float32) { x1 = x From 669da8fa40004d59db181000e1dab5122850d1f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Andr=C3=A9=20Santoni?= Date: Fri, 7 Aug 2020 17:41:36 +0700 Subject: [PATCH 25/52] Fixes --- menu/input.go | 18 ++++++++---------- menu/menu.go | 2 +- menu/scene.go | 9 ++++----- menu/scene_home.go | 7 ++++--- menu/scene_savestates.go | 2 +- menu/scene_settings.go | 2 +- menu/scene_tabs.go | 13 +++++++++++++ 7 files changed, 32 insertions(+), 21 deletions(-) diff --git a/menu/input.go b/menu/input.go index 5c496484..6687f2c5 100644 --- a/menu/input.go +++ b/menu/input.go @@ -67,22 +67,20 @@ func withRepeat() func(dt float32, pressed bool, f func()) { func genericInput(list *entry, dt float32) { // Down repeatDown(dt, input.NewState[0][libretro.DeviceIDJoypadDown], func() { - list.ptr++ - if list.ptr >= len(list.children) { - list.ptr = 0 + if list.ptr < len(list.children)-1 { + list.ptr++ + audio.PlayEffect(audio.Effects["down"]) + genericAnimate(list) } - audio.PlayEffect(audio.Effects["down"]) - genericAnimate(list) }) // Up repeatUp(dt, input.NewState[0][libretro.DeviceIDJoypadUp], func() { - list.ptr-- - if list.ptr < 0 { - list.ptr = len(list.children) - 1 + if list.ptr > 0 { + list.ptr-- + audio.PlayEffect(audio.Effects["up"]) + genericAnimate(list) } - audio.PlayEffect(audio.Effects["up"]) - genericAnimate(list) }) // OK diff --git a/menu/menu.go b/menu/menu.go index bdf366e6..926b1bd2 100644 --- a/menu/menu.go +++ b/menu/menu.go @@ -92,7 +92,7 @@ func (m *Menu) Render(dt float32) { m.stack[i].render() } - m.stack[currentScreenIndex].drawHintBar() + m.stack[m.focus-1].drawHintBar() } // ContextReset uploads the UI images to the GPU. diff --git a/menu/scene.go b/menu/scene.go index ecdbdefd..1ec48f7a 100644 --- a/menu/scene.go +++ b/menu/scene.go @@ -12,7 +12,7 @@ import ( // The menu data is a tree of entries. type entry struct { alpha float32 - yp, scale float32 + scale float32 scroll float32 entryHeight float32 width, height float32 @@ -87,7 +87,7 @@ func genericAnimate(list *entry) { // continue // } - var yp, tagAlpha, subLabelAlpha, scale float32 + var tagAlpha, subLabelAlpha float32 if i == list.ptr { tagAlpha = 1 subLabelAlpha = 1 @@ -99,16 +99,15 @@ func genericAnimate(list *entry) { subLabelAlpha = 0 } - menu.tweens[&e.yp] = gween.New(e.yp, yp, 0.15, ease.OutSine) menu.tweens[&e.labelAlpha] = gween.New(e.labelAlpha, 1, 0.15, ease.OutSine) menu.tweens[&e.iconAlpha] = gween.New(e.iconAlpha, 1, 0.15, ease.OutSine) menu.tweens[&e.tagAlpha] = gween.New(e.tagAlpha, tagAlpha, 0.15, ease.OutSine) menu.tweens[&e.subLabelAlpha] = gween.New(e.subLabelAlpha, subLabelAlpha, 0.15, ease.OutSine) - menu.tweens[&e.scale] = gween.New(e.scale, scale, 0.15, ease.OutSine) } menu.tweens[&list.cursor.alpha] = gween.New(list.cursor.alpha, 1, 0.15, ease.OutSine) - containerHeight := float32(1080 - 88 - 270 - 32 - 32) + margin := 32 + containerHeight := float32(1080 - 88 - 270 - margin*2) contentHeight := float32(len(list.children)) * list.entryHeight scroll := float32(0) diff --git a/menu/scene_home.go b/menu/scene_home.go index 3974d020..e33c03b6 100644 --- a/menu/scene_home.go +++ b/menu/scene_home.go @@ -351,7 +351,7 @@ func (s sceneHome) render() { if _, ok := menu.icons[tag]; ok { vid.DrawRect(stack-1*menu.ratio, (y+500-35)*menu.ratio-1*menu.ratio, 48*menu.ratio+2*menu.ratio, 35*menu.ratio+2*menu.ratio, 0.22, - black.Alpha(e.labelAlpha*s.alpha*0.5)) + mediumGrey.Alpha(e.labelAlpha*s.alpha)) vid.DrawImage( menu.icons[tag], stack, (y+500-35)*menu.ratio, @@ -370,12 +370,13 @@ func (s sceneHome) drawHintBar() { vid.DrawRect(0, float32(h)-88*menu.ratio, float32(w), 88*menu.ratio, 0, white) vid.DrawRect(0, float32(h)-88*menu.ratio, float32(w), 2*menu.ratio, 0, lightGrey) - arrows, _, _, a, _, _, _, _, _, guide := hintIcons() + arrows, _, _, a, b, _, _, _, _, guide := hintIcons() lstack := float32(75) * menu.ratio rstack := float32(w) - 96*menu.ratio stackHintLeft(&lstack, arrows, "Navigate", h) - stackHintRight(&rstack, a, "Open", h) + stackHintRight(&rstack, a, "Run", h) + stackHintRight(&rstack, b, "Back", h) if state.Global.CoreRunning { stackHintRight(&rstack, guide, "Resume", h) } diff --git a/menu/scene_savestates.go b/menu/scene_savestates.go index 33eb2457..41da637b 100644 --- a/menu/scene_savestates.go +++ b/menu/scene_savestates.go @@ -144,7 +144,7 @@ func (s *sceneSavestates) render() { if i == 0 { vid.DrawImage(menu.icons["savestate"], 480*menu.ratio-25*1*menu.ratio, - y-64*menu.ratio, + y-50/2*menu.ratio, 50*menu.ratio, 50*menu.ratio, 1, 0, white.Alpha(e.iconAlpha)) } diff --git a/menu/scene_settings.go b/menu/scene_settings.go index b4816ba8..203b54fa 100644 --- a/menu/scene_settings.go +++ b/menu/scene_settings.go @@ -273,7 +273,7 @@ func (s *sceneSettings) drawHintBar() { if list.children[list.ptr].callbackOK != nil { stackHintRight(&rstack, a, "Set", h) } else { - stackHintRight(&rstack, leftRight, "Set", h) + stackHintLeft(&lstack, leftRight, "Set", h) } stackHintRight(&rstack, b, "Back", h) if state.Global.CoreRunning { diff --git a/menu/scene_tabs.go b/menu/scene_tabs.go index 61df944a..f20e0be6 100644 --- a/menu/scene_tabs.go +++ b/menu/scene_tabs.go @@ -192,4 +192,17 @@ func (s sceneTabs) render() { } func (s *sceneTabs) drawHintBar() { + w, h := vid.Window.GetFramebufferSize() + vid.DrawRect(0, float32(h)-88*menu.ratio, float32(w), 88*menu.ratio, 0, white) + vid.DrawRect(0, float32(h)-88*menu.ratio, float32(w), 2*menu.ratio, 0, lightGrey) + + _, _, leftRight, a, _, _, _, _, _, guide := hintIcons() + + lstack := float32(75) * menu.ratio + rstack := float32(w) - 96*menu.ratio + stackHintLeft(&lstack, leftRight, "Navigate", h) + stackHintRight(&rstack, a, "Ok", h) + if state.Global.CoreRunning { + stackHintRight(&rstack, guide, "Resume", h) + } } From df3d86e92f3efc67351074a8f0d1e49d56c8c243 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Andr=C3=A9=20Santoni?= Date: Fri, 7 Aug 2020 18:00:37 +0700 Subject: [PATCH 26/52] Performance improvement --- menu/scene.go | 21 ++++++++++++++++++--- menu/scene_home.go | 6 ++++-- menu/scene_savestates.go | 6 ++++++ 3 files changed, 28 insertions(+), 5 deletions(-) diff --git a/menu/scene.go b/menu/scene.go index 1ec48f7a..76c02c8c 100644 --- a/menu/scene.go +++ b/menu/scene.go @@ -65,6 +65,11 @@ func genericSegueMount(list *entry) { } for i := range list.children { + // performance improvement + if math.Abs(float64(i-list.ptr)) > 8 { + continue + } + e := &list.children[i] e.labelAlpha = 0 e.iconAlpha = 0 @@ -83,9 +88,9 @@ func genericAnimate(list *entry) { e := &list.children[i] // performance improvement - // if math.Abs(float64(i-list.ptr)) > 6 && i > 6 && i < len(list.children)-6 { - // continue - // } + if math.Abs(float64(i-list.ptr)) > 8 { + continue + } var tagAlpha, subLabelAlpha float32 if i == list.ptr { @@ -130,6 +135,11 @@ func genericAnimate(list *entry) { // to leave room for the next list to appear func genericSegueNext(list *entry) { for i := range list.children { + // performance improvement + if math.Abs(float64(i-list.ptr)) > 8 { + continue + } + e := &list.children[i] menu.tweens[&e.labelAlpha] = gween.New(e.labelAlpha, 0, 0.15, ease.OutSine) menu.tweens[&e.iconAlpha] = gween.New(e.iconAlpha, 0, 0.15, ease.OutSine) @@ -188,6 +198,11 @@ func genericRender(list *entry) { fontOffset := 12 * menu.ratio for i, e := range list.children { + // performance improvement + if math.Abs(float64(i-list.ptr)) > 8 { + continue + } + vid.DrawRect( 360*menu.ratio, (270+32-1)*menu.ratio+list.scroll*menu.ratio+list.entryHeight*float32(i)*menu.ratio+list.entryHeight*menu.ratio, diff --git a/menu/scene_home.go b/menu/scene_home.go index e33c03b6..06bfea0e 100644 --- a/menu/scene_home.go +++ b/menu/scene_home.go @@ -295,7 +295,8 @@ func (s sceneHome) render() { vst += ve.height - if y < -400 || y > 1080 { + // performance improvement + if math.Abs(float64(j-s.yptr)) > 1 { continue } @@ -305,7 +306,8 @@ func (s sceneHome) render() { stackWidth += 320*e.scale + e.margin + 32 - if x < -400 || x > 1920 { + // performance improvement + if math.Abs(float64(i-s.xptrs[j])) > 4 { continue } diff --git a/menu/scene_savestates.go b/menu/scene_savestates.go index 41da637b..f634cdd3 100644 --- a/menu/scene_savestates.go +++ b/menu/scene_savestates.go @@ -1,6 +1,7 @@ package menu import ( + "math" "path/filepath" "sort" "strings" @@ -115,6 +116,11 @@ func (s *sceneSavestates) render() { fontOffset := 12 * menu.ratio for i, e := range list.children { + // performance improvement + if math.Abs(float64(i-list.ptr)) > 8 { + continue + } + vid.DrawRect( 360*menu.ratio, (270+32-1)*menu.ratio+list.scroll*menu.ratio+list.entryHeight*float32(i)*menu.ratio+list.entryHeight*menu.ratio, From be6314546008d42fb5ef76500f04ec74e6c88bc4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Andr=C3=A9=20Santoni?= Date: Fri, 7 Aug 2020 18:12:54 +0700 Subject: [PATCH 27/52] Fix wifi icons --- menu/scene_wifi.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/menu/scene_wifi.go b/menu/scene_wifi.go index c028db50..4ef50645 100644 --- a/menu/scene_wifi.go +++ b/menu/scene_wifi.go @@ -15,7 +15,7 @@ func buildWiFi() Scene { list.children = append(list.children, entry{ label: "Looking for networks", - icon: "reload", + icon: "reset", }) list.segueMount() @@ -32,7 +32,7 @@ func buildWiFi() Scene { network := network list.children = append(list.children, entry{ label: network.SSID, - icon: "menu_network", + icon: "wifi", stringValue: func() string { return ludos.NetworkStatus(network) }, callbackOK: func() { list.segueNext() From b3a5cfcb3898292074324170cf28ce3d82415fb3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Andr=C3=A9=20Santoni?= Date: Sat, 8 Aug 2020 14:09:43 +0700 Subject: [PATCH 28/52] Fix icons coloring --- assets | 2 +- menu/scene_tabs.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/assets b/assets index efa223c8..997f8fd5 160000 --- a/assets +++ b/assets @@ -1 +1 @@ -Subproject commit efa223c8d9dd17492f22b1f5bc8c01c7d92a4990 +Subproject commit 997f8fd592e0e0761a5fa151c72eed1f760b1d66 diff --git a/menu/scene_tabs.go b/menu/scene_tabs.go index f20e0be6..723ebe0e 100644 --- a/menu/scene_tabs.go +++ b/menu/scene_tabs.go @@ -187,7 +187,7 @@ func (s sceneTabs) render() { vid.DrawImage(menu.icons[e.icon], float32(w)/2-totalWidth/2+float32(i)*spacing*menu.ratio+96*menu.ratio/2+24*menu.ratio, 56*menu.ratio, - 48*menu.ratio, 48*menu.ratio, 1, 0, white) + 48*menu.ratio, 48*menu.ratio, 1, 0, blue) } } From 013da42c8142ebe5f60d61a81f7094f31e165979 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Andr=C3=A9=20Santoni?= Date: Tue, 11 Aug 2020 19:58:20 +0700 Subject: [PATCH 29/52] Fix loading a game from cli --- main.go | 21 ++++++++++++++++++++- menu/menu.go | 5 +++-- menu/menu_test.go | 6 +++--- scanner/scanner.go | 30 ++++++++++++++++++++++++++---- 4 files changed, 52 insertions(+), 10 deletions(-) diff --git a/main.go b/main.go index 76d5e7da..5431c2b2 100644 --- a/main.go +++ b/main.go @@ -15,9 +15,11 @@ import ( "github.com/libretro/ludo/menu" ntf "github.com/libretro/ludo/notifications" "github.com/libretro/ludo/playlists" + "github.com/libretro/ludo/rdb" "github.com/libretro/ludo/scanner" "github.com/libretro/ludo/settings" "github.com/libretro/ludo/state" + "github.com/libretro/ludo/utils" "github.com/libretro/ludo/video" ) @@ -121,7 +123,24 @@ func main() { if err != nil { ntf.DisplayAndLog(ntf.Error, "Menu", err.Error()) } else { - m.WarpToQuickMenu() + scanner.ScanFile(gamePath, func(game rdb.Game) { + if game.Name == "" { + history.Push(history.Game{ + Path: gamePath, + Name: utils.FileName(gamePath), + CorePath: state.Global.CorePath, + }) + } else { + history.Push(history.Game{ + Path: gamePath, + Name: game.Name, + System: game.System, + CorePath: state.Global.CorePath, + }) + } + history.Load() + m.WarpToQuickMenu() + }) } } diff --git a/menu/menu.go b/menu/menu.go index 926b1bd2..7516910d 100644 --- a/menu/menu.go +++ b/menu/menu.go @@ -126,10 +126,11 @@ func (m *Menu) ContextReset() { func (m *Menu) WarpToQuickMenu() { m.scroll = 0 m.stack = []Scene{} - m.Push(buildHome()) + m.Push(buildTabs()) m.stack[0].segueNext() - m.Push(buildMainMenu()) + m.Push(buildHome()) m.stack[1].segueNext() m.Push(buildQuickMenu()) m.tweens.FastForward() + menu.focus = len(menu.stack) } diff --git a/menu/menu_test.go b/menu/menu_test.go index 25129ae5..d01516ee 100644 --- a/menu/menu_test.go +++ b/menu/menu_test.go @@ -35,9 +35,9 @@ func Test_WarpToQuickMenu(t *testing.T) { m := Init(vid) - t.Run("Starts with a single scene if no game is running", func(t *testing.T) { + t.Run("Starts with 2 scenes if no game is running", func(t *testing.T) { got := len(menu.stack) - want := 1 + want := 2 if !reflect.DeepEqual(got, want) { t.Errorf("got = %v, want %v", got, want) } @@ -45,7 +45,7 @@ func Test_WarpToQuickMenu(t *testing.T) { t.Run("Starts on the tabs scene if no game is running", func(t *testing.T) { got := menu.stack[0].Entry().label - want := "Ludo" + want := "Tabs" if !reflect.DeepEqual(got, want) { t.Errorf("got = %v, want %v", got, want) } diff --git a/scanner/scanner.go b/scanner/scanner.go index 01cfad45..72a124f9 100644 --- a/scanner/scanner.go +++ b/scanner/scanner.go @@ -74,6 +74,20 @@ func ScanDir(dir string, doneCb func()) { }() } +// ScanFile scans a single file +func ScanFile(path string, doneCb func(rdb.Game)) { + dir := filepath.Dir(path) + roms := []string{path} + games := make(chan (rdb.Game)) + go Scan(dir, roms, games, nil) + go func() { + game := <-games + if doneCb != nil { + doneCb(game) + } + }() +} + // Scan scans a list of roms against the database func Scan(dir string, roms []string, games chan (rdb.Game), n *ntf.Notification) { for i, f := range roms { @@ -83,21 +97,27 @@ func Scan(dir string, roms []string, games chan (rdb.Game), n *ntf.Notification) // Open the ZIP archive z, err := zip.OpenReader(f) if err != nil { - n.Update(ntf.Error, err.Error()) + if n != nil { + n.Update(ntf.Error, err.Error()) + } continue } for _, rom := range z.File { if rom.CRC32 > 0 { // Look for a matching game entry in the database state.Global.DB.FindByCRC(f, rom.Name, rom.CRC32, games) - n.Update(ntf.Info, strconv.Itoa(i)+"/"+strconv.Itoa(len(roms))+" "+f) + if n != nil { + n.Update(ntf.Info, strconv.Itoa(i)+"/"+strconv.Itoa(len(roms))+" "+f) + } } } z.Close() case ".cue": // Look for a matching game entry in the database state.Global.DB.FindByROMName(f, filepath.Base(f), 0, games) - n.Update(ntf.Info, strconv.Itoa(i)+"/"+strconv.Itoa(len(roms))+" "+f) + if n != nil { + n.Update(ntf.Info, strconv.Itoa(i)+"/"+strconv.Itoa(len(roms))+" "+f) + } case ".32x", "a52", ".a78", ".col", ".crt", ".d64", ".pce", ".fds", ".gb", ".gba", ".gbc", ".gen", ".gg", ".ipf", ".j64", ".jag", ".lnx", ".md", ".n64", ".nes", ".ngc", ".nds", ".rom", ".sfc", ".sg", ".smc", ".smd", ".sms", ".ws", ".wsc": bytes, err := ioutil.ReadFile(f) if err != nil { @@ -106,7 +126,9 @@ func Scan(dir string, roms []string, games chan (rdb.Game), n *ntf.Notification) } CRC32 := crc32.ChecksumIEEE(bytes) state.Global.DB.FindByCRC(f, utils.FileName(f), CRC32, games) - n.Update(ntf.Info, strconv.Itoa(i)+"/"+strconv.Itoa(len(roms))+" "+f) + if n != nil { + n.Update(ntf.Info, strconv.Itoa(i)+"/"+strconv.Itoa(len(roms))+" "+f) + } } } close(games) From a0a36d55e71acc68fd5cf8399e91fd3af3a31123 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Andr=C3=A9=20Santoni?= Date: Tue, 11 Aug 2020 22:43:59 +0700 Subject: [PATCH 30/52] Improve transitions --- main.go | 22 ++++++--------- menu/scene.go | 59 ++++++++++++++++------------------------ menu/scene_home.go | 18 ++++-------- menu/scene_savestates.go | 21 +++++++------- menu/scene_settings.go | 4 +-- 5 files changed, 52 insertions(+), 72 deletions(-) diff --git a/main.go b/main.go index 5431c2b2..ff11d0da 100644 --- a/main.go +++ b/main.go @@ -124,20 +124,16 @@ func main() { ntf.DisplayAndLog(ntf.Error, "Menu", err.Error()) } else { scanner.ScanFile(gamePath, func(game rdb.Game) { - if game.Name == "" { - history.Push(history.Game{ - Path: gamePath, - Name: utils.FileName(gamePath), - CorePath: state.Global.CorePath, - }) - } else { - history.Push(history.Game{ - Path: gamePath, - Name: game.Name, - System: game.System, - CorePath: state.Global.CorePath, - }) + name := game.Name + if name == "" { + name = utils.FileName(gamePath) } + history.Push(history.Game{ + Path: gamePath, + Name: name, + System: game.System, + CorePath: state.Global.CorePath, + }) history.Load() m.WarpToQuickMenu() }) diff --git a/menu/scene.go b/menu/scene.go index 76c02c8c..fcd2415e 100644 --- a/menu/scene.go +++ b/menu/scene.go @@ -15,6 +15,7 @@ type entry struct { scale float32 scroll float32 entryHeight float32 + x, y float32 width, height float32 margin float32 label, subLabel string @@ -34,12 +35,9 @@ type entry struct { tags []string // flags extracted from game title thumbnail uint32 // thumbnail texture id gameName string // title of the game in db, used for thumbnails - cursor struct { - alpha float32 - } - children []entry // children entries - ptr int // index of the active child - indexes []struct { + children []entry // children entries + ptr int // index of the active child + indexes []struct { Char byte Index int } @@ -64,20 +62,8 @@ func genericSegueMount(list *entry) { list.entryHeight = 100 } - for i := range list.children { - // performance improvement - if math.Abs(float64(i-list.ptr)) > 8 { - continue - } - - e := &list.children[i] - e.labelAlpha = 0 - e.iconAlpha = 0 - e.tagAlpha = 0 - e.subLabelAlpha = 0 - } - list.cursor.alpha = 0 list.scroll = -float32(list.ptr) * list.entryHeight + list.y = 300 genericAnimate(list) } @@ -109,7 +95,6 @@ func genericAnimate(list *entry) { menu.tweens[&e.tagAlpha] = gween.New(e.tagAlpha, tagAlpha, 0.15, ease.OutSine) menu.tweens[&e.subLabelAlpha] = gween.New(e.subLabelAlpha, subLabelAlpha, 0.15, ease.OutSine) } - menu.tweens[&list.cursor.alpha] = gween.New(list.cursor.alpha, 1, 0.15, ease.OutSine) margin := 32 containerHeight := float32(1080 - 88 - 270 - margin*2) @@ -129,6 +114,8 @@ func genericAnimate(list *entry) { } menu.tweens[&list.scroll] = gween.New(list.scroll, scroll, 0.15, ease.OutSine) + menu.tweens[&list.y] = gween.New(list.y, 0, 0.15, ease.OutSine) + menu.tweens[&list.alpha] = gween.New(list.alpha, 1, 0.15, ease.OutSine) } // genericSegueNext is a smooth transition that fades out the current list @@ -146,14 +133,15 @@ func genericSegueNext(list *entry) { menu.tweens[&e.tagAlpha] = gween.New(e.tagAlpha, 0, 0.15, ease.OutSine) menu.tweens[&e.subLabelAlpha] = gween.New(e.subLabelAlpha, 0, 0.15, ease.OutSine) } - menu.tweens[&list.cursor.alpha] = gween.New(list.cursor.alpha, 0, 0.15, ease.OutSine) + menu.tweens[&list.alpha] = gween.New(list.alpha, 0, 0.15, ease.OutSine) + menu.tweens[&list.y] = gween.New(list.y, -300, 0.15, ease.OutSine) } // genericDrawCursor draws the blinking rectangular background of the active // menu entry func genericDrawCursor(list *entry, i int) { w, _ := vid.Window.GetFramebufferSize() - y := (270+32)*menu.ratio + list.scroll*menu.ratio + list.entryHeight*float32(i)*menu.ratio + y := list.y + (270+32)*menu.ratio + list.scroll*menu.ratio + list.entryHeight*float32(i)*menu.ratio if menu.focus > 1 { blink := float32(math.Cos(menu.t)) vid.DrawImage( @@ -162,14 +150,14 @@ func genericDrawCursor(list *entry, i int) { y-8*menu.ratio, float32(w)-720*menu.ratio+16*menu.ratio, list.entryHeight*menu.ratio+16*menu.ratio, - 1, 0.15, white.Alpha(list.cursor.alpha-list.cursor.alpha*blink)) + 1, 0.15, white.Alpha(list.alpha-list.alpha*blink)) } vid.DrawRect( 360*menu.ratio, y, float32(w)-720*menu.ratio, list.entryHeight*menu.ratio, 0.1, - white.Alpha(list.cursor.alpha)) + white.Alpha(list.alpha)) } // genericRender renders a vertical list of menu entries @@ -177,23 +165,23 @@ func genericDrawCursor(list *entry, i int) { func genericRender(list *entry) { w, h := vid.Window.GetFramebufferSize() - vid.BoldFont.SetColor(blue.Alpha(list.cursor.alpha)) + vid.BoldFont.SetColor(blue.Alpha(list.alpha)) vid.BoldFont.Printf( 360*menu.ratio, - 230*menu.ratio, + list.y*menu.ratio+230*menu.ratio, 0.5*menu.ratio, list.label) vid.DrawRect( 360*menu.ratio, - 270*menu.ratio, + list.y*menu.ratio+270*menu.ratio, float32(w)-720*menu.ratio, 2*menu.ratio, - 0, lightGrey, + 0, lightGrey.Alpha(list.alpha), ) vid.ScissorStart( int32(360*menu.ratio-8*menu.ratio), 0, - int32(float32(w)-720*menu.ratio+16*menu.ratio), int32(h)-int32(272*menu.ratio)) + int32(float32(w)-720*menu.ratio+16*menu.ratio), int32(h)-int32(272*menu.ratio+list.y*menu.ratio)) fontOffset := 12 * menu.ratio @@ -203,9 +191,15 @@ func genericRender(list *entry) { continue } + y := list.y*menu.ratio + + (270+32)*menu.ratio + + list.scroll*menu.ratio + + list.entryHeight*float32(i)*menu.ratio + + list.entryHeight/2*menu.ratio + vid.DrawRect( 360*menu.ratio, - (270+32-1)*menu.ratio+list.scroll*menu.ratio+list.entryHeight*float32(i)*menu.ratio+list.entryHeight*menu.ratio, + y-1*menu.ratio+list.entryHeight/2*menu.ratio, float32(w)-720*menu.ratio, 2*menu.ratio, 0, lightGrey.Alpha(e.iconAlpha), @@ -215,11 +209,6 @@ func genericRender(list *entry) { genericDrawCursor(list, i) } - y := (270+32)*menu.ratio + - list.scroll*menu.ratio + - list.entryHeight*float32(i)*menu.ratio + - list.entryHeight/2*menu.ratio - vid.DrawImage(menu.icons[e.icon], 420*menu.ratio-64*0.35*menu.ratio, y-64*0.35*menu.ratio, diff --git a/menu/scene_home.go b/menu/scene_home.go index 06bfea0e..14dc6b37 100644 --- a/menu/scene_home.go +++ b/menu/scene_home.go @@ -104,15 +104,12 @@ func (s *sceneHome) segueMount() { for j := range s.children { s.xscrolls[j] = 0 } - s.yscroll = -500 + s.y = 300 for j := range s.children { ve := &s.children[j] ve.labelAlpha = 0 ve.height = 504 + 136 - //if j == s.yptr { - ve.height = 240 + 136 - //} for i := range ve.children { e := &s.children[j].children[i] @@ -152,11 +149,7 @@ func (s *sceneHome) animate() { labelAlpha = 0 } menu.tweens[&ve.labelAlpha] = gween.New(ve.labelAlpha, labelAlpha, 0.15, ease.OutSine) - height := float32(240 + 136) - //if j == s.yptr { - height = 504 + 136 - //} - menu.tweens[&ve.height] = gween.New(ve.height, height, 0.15, ease.OutSine) + menu.tweens[&ve.height] = gween.New(ve.height, 504+136, 0.15, ease.OutSine) for i := range ve.children { e := &s.children[j].children[i] @@ -200,11 +193,12 @@ func (s *sceneHome) animate() { menu.tweens[&s.yscroll] = gween.New(s.yscroll, vst, 0.15, ease.OutSine) menu.tweens[&s.alpha] = gween.New(s.alpha, 1, 0.15, ease.OutSine) + menu.tweens[&s.y] = gween.New(s.y, 0, 0.15, ease.OutSine) } func (s *sceneHome) segueNext() { menu.tweens[&s.alpha] = gween.New(s.alpha, 0, 0.15, ease.OutSine) - menu.tweens[&s.yscroll] = gween.New(s.yscroll, s.yscroll+300, 0.15, ease.OutSine) + menu.tweens[&s.y] = gween.New(s.y, -300, 0.15, ease.OutSine) for j := range s.children { ve := &s.children[j] @@ -288,10 +282,10 @@ func (s sceneHome) render() { vid.BoldFont.SetColor(blue.Alpha(ve.labelAlpha * s.alpha)) vid.BoldFont.Printf( 96*menu.ratio, - 230*menu.ratio+vst*menu.ratio-s.yscroll*menu.ratio, + s.y*menu.ratio+230*menu.ratio+vst*menu.ratio-s.yscroll*menu.ratio, 0.5*menu.ratio, ve.label) - y := 272 + vst - s.yscroll + y := s.y + 272 + vst - s.yscroll vst += ve.height diff --git a/menu/scene_savestates.go b/menu/scene_savestates.go index f634cdd3..4d5815d0 100644 --- a/menu/scene_savestates.go +++ b/menu/scene_savestates.go @@ -95,15 +95,15 @@ func (s *sceneSavestates) render() { list := &s.entry w, h := vid.Window.GetFramebufferSize() - vid.BoldFont.SetColor(blue.Alpha(list.cursor.alpha)) + vid.BoldFont.SetColor(blue.Alpha(list.alpha)) vid.BoldFont.Printf( 360*menu.ratio, - 230*menu.ratio, + list.y*menu.ratio+230*menu.ratio, 0.5*menu.ratio, list.label) vid.DrawRect( 360*menu.ratio, - 270*menu.ratio, + list.y*menu.ratio+270*menu.ratio, float32(w)-720*menu.ratio, 2*menu.ratio, 0, lightGrey, @@ -111,7 +111,7 @@ func (s *sceneSavestates) render() { vid.ScissorStart( int32(360*menu.ratio-8*menu.ratio), 0, - int32(float32(w)-720*menu.ratio+16*menu.ratio), int32(h)-int32(272*menu.ratio)) + int32(float32(w)-720*menu.ratio+16*menu.ratio), int32(h)-int32(272*menu.ratio+list.y*menu.ratio)) fontOffset := 12 * menu.ratio @@ -121,9 +121,15 @@ func (s *sceneSavestates) render() { continue } + y := list.y*menu.ratio + + (270+32)*menu.ratio + + list.scroll*menu.ratio + + list.entryHeight*float32(i)*menu.ratio + + list.entryHeight/2*menu.ratio + vid.DrawRect( 360*menu.ratio, - (270+32-1)*menu.ratio+list.scroll*menu.ratio+list.entryHeight*float32(i)*menu.ratio+list.entryHeight*menu.ratio, + y-1*menu.ratio+list.entryHeight/2*menu.ratio, float32(w)-720*menu.ratio, 2*menu.ratio, 0, lightGrey, @@ -133,11 +139,6 @@ func (s *sceneSavestates) render() { genericDrawCursor(list, i) } - y := (270+32)*menu.ratio + - list.scroll*menu.ratio + - list.entryHeight*float32(i)*menu.ratio + - list.entryHeight/2*menu.ratio - if e.labelAlpha > 0 { drawSavestateThumbnail( list, i, diff --git a/menu/scene_settings.go b/menu/scene_settings.go index 203b54fa..5e7f9a49 100644 --- a/menu/scene_settings.go +++ b/menu/scene_settings.go @@ -136,7 +136,7 @@ var widgets = map[string]func(*entry, *entry, int){ fbw, _ := vid.Window.GetFramebufferSize() vid.DrawImage(menu.icons[icon], float32(fbw)-400*menu.ratio-128*menu.ratio, - (270+32)*menu.ratio+list.scroll*menu.ratio+100*float32(i)*menu.ratio+50*menu.ratio-64*1.25*menu.ratio, + list.y+(270+32)*menu.ratio+list.scroll*menu.ratio+100*float32(i)*menu.ratio+50*menu.ratio-64*1.25*menu.ratio, 128*menu.ratio, 128*menu.ratio, 1.25, 0, black.Alpha(e.iconAlpha)) }, @@ -145,7 +145,7 @@ var widgets = map[string]func(*entry, *entry, int){ "range": func(list, e *entry, i int) { fbw, _ := vid.Window.GetFramebufferSize() x := float32(fbw) - 400*menu.ratio - 175*menu.ratio - y := (270+32)*menu.ratio + list.scroll*menu.ratio + 100*float32(i)*menu.ratio + 50*menu.ratio - 4*menu.ratio + y := list.y + (270+32)*menu.ratio + list.scroll*menu.ratio + 100*float32(i)*menu.ratio + 50*menu.ratio - 4*menu.ratio w := 175 * menu.ratio h := 8 * menu.ratio vid.DrawRect(x, y, w, h, 0.9, black.Alpha(e.iconAlpha/4)) From bf471493926c22ff705f32f6a9aba5fff69b157f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Andr=C3=A9=20Santoni?= Date: Sat, 15 Aug 2020 11:10:41 +0700 Subject: [PATCH 31/52] Get rid of go-colorful --- go.mod | 1 - go.sum | 4 ---- menu/notifications.go | 25 ++++++++++++------------- menu/palette.go | 12 ++++++++++++ 4 files changed, 24 insertions(+), 18 deletions(-) diff --git a/go.mod b/go.mod index 37e9e77f..29729bec 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,6 @@ require ( github.com/go-gl/gl v0.0.0-20190320180904-bf2b1f2f34d7 github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200707082815-5321531c36a2 github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 - github.com/lucasb-eyer/go-colorful v1.0.2 github.com/pelletier/go-toml v1.6.0 github.com/stretchr/testify v1.3.0 // indirect github.com/tanema/gween v0.0.0-20190613150852-fbc00f26ef8f diff --git a/go.sum b/go.sum index 44591e20..4f2c87a2 100644 --- a/go.sum +++ b/go.sum @@ -1,7 +1,5 @@ github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/DATA-DOG/go-sqlmock v1.3.3 h1:CWUqKXe0s8A2z6qCgkP4Kru7wC11YoAnoupUKFDnH08= -github.com/DATA-DOG/go-sqlmock v1.3.3/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM= github.com/cavaliercoder/grab v2.0.0+incompatible h1:wZHbBQx56+Yxjx2TCGDcenhh3cJn7cCLMfkEPmySTSE= github.com/cavaliercoder/grab v2.0.0+incompatible/go.mod h1:tTBkfNqSBfuMmMBFaO2phgyhdYhiZQ/+iXCZDzcDsMI= github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= @@ -18,8 +16,6 @@ github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200707082815-5321531c36a2 h1:Ac1OEHHkbA github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200707082815-5321531c36a2/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 h1:DACJavvAHhabrF08vX0COfcOBJRhZ8lUbR+ZWIs0Y5g= github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGwJL78qG/PmXZO1EjYhfJinVAhrmmHX6Z8B9k= -github.com/lucasb-eyer/go-colorful v1.0.2 h1:mCMFu6PgSozg9tDNMMK3g18oJBX7oYGrC09mS6CXfO4= -github.com/lucasb-eyer/go-colorful v1.0.2/go.mod h1:0MS4r+7BZKSJ5mw4/S5MPN+qHFF1fYclkSPilDOKW0s= github.com/pelletier/go-toml v1.6.0 h1:aetoXYr0Tv7xRU/V4B4IZJ2QcbtMUFoNb3ORp7TzIK4= github.com/pelletier/go-toml v1.6.0/go.mod h1:5N711Q9dKgbdkxHL+MEfF31hpT7l0S0s/t2kKREewys= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= diff --git a/menu/notifications.go b/menu/notifications.go index cb99219f..82617de6 100644 --- a/menu/notifications.go +++ b/menu/notifications.go @@ -3,21 +3,20 @@ package menu import ( ntf "github.com/libretro/ludo/notifications" "github.com/libretro/ludo/video" - colorful "github.com/lucasb-eyer/go-colorful" ) -var severityFgColor = map[ntf.Severity]colorful.Color{ - ntf.Error: colorful.Hcl(40, 0.75, 0.85), - ntf.Warning: colorful.Hcl(90, 0.75, 0.85), - ntf.Success: colorful.Hcl(120, 0.75, 0.85), - ntf.Info: colorful.Hcl(230, 0.75, 0.85), +var severityFgColor = map[ntf.Severity]video.Color{ + ntf.Error: lightDanger, + ntf.Warning: lightWarning, + ntf.Success: lightSuccess, + ntf.Info: lightInfo, } -var severityBgColor = map[ntf.Severity]colorful.Color{ - ntf.Error: colorful.Hcl(40, 0.65, 0.1), - ntf.Warning: colorful.Hcl(90, 0.65, 0.1), - ntf.Success: colorful.Hcl(120, 0.65, 0.1), - ntf.Info: colorful.Hcl(230, 0.65, 0.1), +var severityBgColor = map[ntf.Severity]video.Color{ + ntf.Error: darkDanger, + ntf.Warning: darkWarning, + ntf.Success: darkSuccess, + ntf.Info: darkInfo, } // RenderNotifications draws the list of notification messages on the viewport @@ -39,9 +38,9 @@ func (m *Menu) RenderNotifications() { lw+40*m.ratio, 70*m.ratio, 0.25, - video.Color{R: float32(bg.R), G: float32(bg.G), B: float32(bg.B), A: fading}, + bg.Alpha(fading), ) - vid.Font.SetColor(video.Color{R: float32(fg.R), G: float32(fg.G), B: float32(fg.B), A: fading}) + vid.Font.SetColor(fg.Alpha(fading)) vid.Font.Printf( 45*m.ratio, (stack+offset)*m.ratio, diff --git a/menu/palette.go b/menu/palette.go index 2d85158d..e17f4941 100644 --- a/menu/palette.go +++ b/menu/palette.go @@ -8,3 +8,15 @@ var blue = video.Color{R: 0.129, G: 0.441, B: 0.684, A: 1} var lightGrey = video.Color{R: 0.85, G: 0.85, B: 0.85, A: 1} var mediumGrey = video.Color{R: 0.56, G: 0.56, B: 0.56, A: 1} var darkGrey = video.Color{R: 0.28, G: 0.28, B: 0.28, A: 1} + +var darkInfo = video.Color{R: 0.04, G: 0.36, B: 0.46, A: 1} +var lightInfo = video.Color{R: 0.53, G: 0.89, B: 1.00, A: 1} + +var darkSuccess = video.Color{R: 0.15, G: 0.46, B: 0.04, A: 1} +var lightSuccess = video.Color{R: 0.65, G: 1.00, B: 0.53, A: 1} + +var darkDanger = video.Color{R: 0.46, G: 0.04, B: 0.04, A: 1} +var lightDanger = video.Color{R: 1.00, G: 0.53, B: 0.53, A: 1} + +var darkWarning = video.Color{R: 0.47, G: 0.40, B: 0.04, A: 1} +var lightWarning = video.Color{R: 1.00, G: 0.92, B: 0.53, A: 1} From 58f9aeef6b8974fcf6f1057b9f327408836d2944 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Andr=C3=A9=20Santoni?= Date: Sat, 15 Aug 2020 15:29:04 +0700 Subject: [PATCH 32/52] Fix some linter messages --- menu/scene.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/menu/scene.go b/menu/scene.go index fcd2415e..ea4bfa6b 100644 --- a/menu/scene.go +++ b/menu/scene.go @@ -14,9 +14,9 @@ type entry struct { alpha float32 scale float32 scroll float32 + y float32 entryHeight float32 - x, y float32 - width, height float32 + height float32 margin float32 label, subLabel string path string // full path of the rom linked to the entry From 465ec1729fd2a8d2f076df39174925ef90289660 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Andr=C3=A9=20Santoni?= Date: Sat, 15 Aug 2020 15:44:09 +0700 Subject: [PATCH 33/52] Add a way to manually load cores and games --- menu/scene_main.go | 76 ++++++++++++---------------------------------- menu/scene_tabs.go | 9 ++++++ 2 files changed, 28 insertions(+), 57 deletions(-) diff --git a/menu/scene_main.go b/menu/scene_main.go index e3182eaf..e5e7fd37 100644 --- a/menu/scene_main.go +++ b/menu/scene_main.go @@ -8,6 +8,8 @@ import ( "github.com/libretro/ludo/core" "github.com/libretro/ludo/history" ntf "github.com/libretro/ludo/notifications" + "github.com/libretro/ludo/rdb" + "github.com/libretro/ludo/scanner" "github.com/libretro/ludo/settings" "github.com/libretro/ludo/state" "github.com/libretro/ludo/utils" @@ -19,21 +21,10 @@ type sceneMain struct { func buildMainMenu() Scene { var list sceneMain - list.label = "Main Menu" + list.label = "Manual Menu" usr, _ := user.Current() - if state.Global.CoreRunning { - list.children = append(list.children, entry{ - label: "Quick Menu", - icon: "subsetting", - callbackOK: func() { - list.segueNext() - menu.Push(buildQuickMenu()) - }, - }) - } - list.children = append(list.children, entry{ label: "Load Core", icon: "subsetting", @@ -66,43 +57,6 @@ func buildMainMenu() Scene { }, }) - if state.Global.LudOS { - list.children = append(list.children, entry{ - label: "Updater", - icon: "subsetting", - callbackOK: func() { - list.segueNext() - menu.Push(buildUpdater()) - }, - }) - - list.children = append(list.children, entry{ - label: "Reboot", - icon: "subsetting", - callbackOK: func() { - askConfirmation(func() { cleanReboot() }) - }, - }) - - list.children = append(list.children, entry{ - label: "Shutdown", - icon: "subsetting", - callbackOK: func() { - askConfirmation(func() { cleanShutdown() }) - }, - }) - } else { - list.children = append(list.children, entry{ - label: "Quit", - icon: "subsetting", - callbackOK: func() { - askConfirmation(func() { - vid.Window.SetShouldClose(true) - }) - }, - }) - } - list.segueMount() return &list @@ -121,15 +75,23 @@ func coreExplorerCb(path string) { func gameExplorerCb(path string) { if err := core.LoadGame(path); err != nil { ntf.DisplayAndLog(ntf.Error, "Core", err.Error()) - return + } else { + scanner.ScanFile(path, func(game rdb.Game) { + name := game.Name + if name == "" { + name = utils.FileName(path) + } + history.Push(history.Game{ + Path: path, + Name: name, + System: game.System, + CorePath: state.Global.CorePath, + }) + history.Load() + menu.WarpToQuickMenu() + }) + state.Global.MenuActive = false } - history.Push(history.Game{ - Path: path, - Name: utils.FileName(path), - CorePath: state.Global.CorePath, - }) - menu.WarpToQuickMenu() - state.Global.MenuActive = false } // Shutdown the operating system diff --git a/menu/scene_tabs.go b/menu/scene_tabs.go index 723ebe0e..f9a954b9 100644 --- a/menu/scene_tabs.go +++ b/menu/scene_tabs.go @@ -29,6 +29,15 @@ func buildTabs() Scene { }, }) + list.children = append(list.children, entry{ + icon: "file", + callbackOK: func() { + menu.stack = menu.stack[:len(menu.stack)-1] + menu.Push(buildMainMenu()) + menu.focus-- + }, + }) + list.children = append(list.children, entry{ icon: "tab-settings", callbackOK: func() { From dcb50a2c4765b1b51bbb7afe91cf873aa8b12c37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Andr=C3=A9=20Santoni?= Date: Sat, 15 Aug 2020 15:57:52 +0700 Subject: [PATCH 34/52] Free thumbnails --- menu/scene_home.go | 1 + menu/scene_savestates.go | 1 + 2 files changed, 2 insertions(+) diff --git a/menu/scene_home.go b/menu/scene_home.go index 14dc6b37..30bfff62 100644 --- a/menu/scene_home.go +++ b/menu/scene_home.go @@ -302,6 +302,7 @@ func (s sceneHome) render() { // performance improvement if math.Abs(float64(i-s.xptrs[j])) > 4 { + freeThumbnail(&ve, i) continue } diff --git a/menu/scene_savestates.go b/menu/scene_savestates.go index 4d5815d0..8f138c61 100644 --- a/menu/scene_savestates.go +++ b/menu/scene_savestates.go @@ -118,6 +118,7 @@ func (s *sceneSavestates) render() { for i, e := range list.children { // performance improvement if math.Abs(float64(i-list.ptr)) > 8 { + freeThumbnail(list, i) continue } From 654bc37bd6cae10eb7dd4c1083bbe61b2d108f50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Andr=C3=A9=20Santoni?= Date: Sun, 23 May 2021 14:37:12 +0700 Subject: [PATCH 35/52] Update dependencies --- go.mod | 9 +++++---- go.sum | 16 ++++++++-------- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/go.mod b/go.mod index 12759358..7e81b108 100644 --- a/go.mod +++ b/go.mod @@ -2,19 +2,20 @@ module github.com/libretro/ludo require ( github.com/cavaliercoder/grab v2.0.0+incompatible + github.com/davecgh/go-spew v1.1.1 // indirect github.com/disintegration/imaging v1.6.2 github.com/fatih/structs v1.1.0 - github.com/go-gl/gl v0.0.0-20190320180904-bf2b1f2f34d7 + github.com/go-gl/gl v0.0.0-20210501111010-69f74958bac0 github.com/go-gl/glfw/v3.3/glfw v0.0.0-20210410170116-ea3d685f79fb github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 github.com/kr/text v0.2.0 // indirect github.com/lucasb-eyer/go-colorful v1.2.0 - github.com/pelletier/go-toml v1.8.1 + github.com/pelletier/go-toml v1.9.1 github.com/stretchr/testify v1.7.0 // indirect github.com/tanema/gween v0.0.0-20200427131925-c89ae23cc63c github.com/youpy/go-wav v0.1.0 - golang.org/x/image v0.0.0-20201208152932-35266b937fa6 - golang.org/x/mobile v0.0.0-20201217150744-e6ae53a27f4f + golang.org/x/image v0.0.0-20210504121937-7319ad40d33e + golang.org/x/mobile v0.0.0-20210220033013-bdb1ca9a1e08 gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect ) diff --git a/go.sum b/go.sum index 459b1a6a..e7d4cc38 100644 --- a/go.sum +++ b/go.sum @@ -9,8 +9,8 @@ github.com/disintegration/imaging v1.6.2 h1:w1LecBlG2Lnp8B3jk5zSuNqd7b4DXhcjwek1 github.com/disintegration/imaging v1.6.2/go.mod h1:44/5580QXChDfwIclfc/PCwrr44amcmDAg8hxG0Ewe4= github.com/fatih/structs v1.1.0 h1:Q7juDM0QtcnhCpeyLGQKyg4TOIghuNXrkL32pHAUMxo= github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M= -github.com/go-gl/gl v0.0.0-20190320180904-bf2b1f2f34d7 h1:SCYMcCJ89LjRGwEa0tRluNRiMjZHalQZrVrvTbPh+qw= -github.com/go-gl/gl v0.0.0-20190320180904-bf2b1f2f34d7/go.mod h1:482civXOzJJCPzJ4ZOX/pwvXBWSnzD4OKMdH4ClKGbk= +github.com/go-gl/gl v0.0.0-20210501111010-69f74958bac0 h1:7xNa69TzlTrKtlBtE4yyNRFP9oqAneXAs9oKJkVOECs= +github.com/go-gl/gl v0.0.0-20210501111010-69f74958bac0/go.mod h1:wjpnOv6ONl2SuJSxqCPVaPZibGFdSci9HFocT9qtVYM= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20210410170116-ea3d685f79fb h1:T6gaWBvRzJjuOrdCtg8fXXjKai2xSDqWTcKFUPuw8Tw= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20210410170116-ea3d685f79fb/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 h1:DACJavvAHhabrF08vX0COfcOBJRhZ8lUbR+ZWIs0Y5g= @@ -23,8 +23,8 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/lucasb-eyer/go-colorful v1.2.0 h1:1nnpGOrhyZZuNyfu1QjKiUICQ74+3FNCN69Aj6K7nkY= github.com/lucasb-eyer/go-colorful v1.2.0/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0= -github.com/pelletier/go-toml v1.8.1 h1:1Nf83orprkJyknT6h7zbuEGUEjcyVlCxSUGTENmNCRM= -github.com/pelletier/go-toml v1.8.1/go.mod h1:T2/BmBdy8dvIRq1a/8aqjN41wvWlN4lrapLU/GW4pbc= +github.com/pelletier/go-toml v1.9.1 h1:a6qW1EVNZWH9WGI6CsYdD8WAylkoXBS5yv0XHlh17Tc= +github.com/pelletier/go-toml v1.9.1/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= @@ -45,11 +45,11 @@ golang.org/x/exp v0.0.0-20190731235908-ec7cb31e5a56/go.mod h1:JhuoJpWY28nO4Vef9t golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/image v0.0.0-20191009234506-e7c1f5e7dbb8/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= -golang.org/x/image v0.0.0-20201208152932-35266b937fa6 h1:nfeHNc1nAqecKCy2FCy4HY+soOOe5sDLJ/gZLbx6GYI= -golang.org/x/image v0.0.0-20201208152932-35266b937fa6/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= +golang.org/x/image v0.0.0-20210504121937-7319ad40d33e h1:PzJMNfFQx+QO9hrC1GwZ4BoPGeNGhfeQEgcQFArEjPk= +golang.org/x/image v0.0.0-20210504121937-7319ad40d33e/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= -golang.org/x/mobile v0.0.0-20201217150744-e6ae53a27f4f h1:kgfVkAEEQXXQ0qc6dH7n6y37NAYmTFmz0YRwrRjgxKw= -golang.org/x/mobile v0.0.0-20201217150744-e6ae53a27f4f/go.mod h1:skQtrUTUwhdJvXM/2KKJzY8pDgNr9I/FOMqDVRPBUS4= +golang.org/x/mobile v0.0.0-20210220033013-bdb1ca9a1e08 h1:h+GZ3ubjuWaQjGe8owMGcmMVCqs0xYJtRG5y2bpHaqU= +golang.org/x/mobile v0.0.0-20210220033013-bdb1ca9a1e08/go.mod h1:skQtrUTUwhdJvXM/2KKJzY8pDgNr9I/FOMqDVRPBUS4= golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= golang.org/x/mod v0.1.1-0.20191209134235-331c550502dd/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= From 1483700d449c36ae44ac8a6f89511550e577c4ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Andr=C3=A9=20Santoni?= Date: Sun, 23 May 2021 17:49:15 +0700 Subject: [PATCH 36/52] N64 on Windows (#424) * N64 on Windows * Fix --- Makefile | 4 ++++ input/input.go | 19 ++++++++----------- settings/defaults.go | 1 + 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/Makefile b/Makefile index c459fc4c..f1f8a9d9 100644 --- a/Makefile +++ b/Makefile @@ -12,6 +12,10 @@ ifeq ($(ARCH), arm) CORES := $(filter-out melonds,$(CORES)) endif +ifeq ($(OS), Windows) + CORES += mupen64plus_next +endif + DYLIBS = $(addprefix cores/, $(addsuffix _libretro.dylib,$(CORES))) DLLS = $(addprefix cores/, $(addsuffix _libretro.dll,$(CORES))) SOBJS = $(addprefix cores/, $(addsuffix _libretro.so,$(CORES))) diff --git a/input/input.go b/input/input.go index 4c10ac82..b0e4f1de 100644 --- a/input/input.go +++ b/input/input.go @@ -30,7 +30,7 @@ type bind struct { type States [MaxPlayers][ActionLast]int16 // AnalogStates can store the state of analog inputs for all players -type AnalogStates [MaxPlayers][2]int16 +type AnalogStates [MaxPlayers][2][2]int16 // Input state for all the players var ( @@ -124,9 +124,11 @@ func pollJoypads(state States, analogState AnalogStates) (States, AnalogStates) for p := range analogState { axisState := glfw.Joystick.GetAxes(glfw.Joystick(p)) - if len(axisState) > 1 { - analogState[p][0] = floatToAnalog(axisState[0]) - analogState[p][1] = floatToAnalog(axisState[1]) + if len(axisState) > 3 { + analogState[p][0][0] = floatToAnalog(axisState[0]) + analogState[p][0][1] = floatToAnalog(axisState[1]) + analogState[p][1][0] = floatToAnalog(axisState[2]) + analogState[p][1][1] = floatToAnalog(axisState[3]) } } @@ -187,17 +189,12 @@ func State(port uint, device uint32, index uint, id uint) int16 { return NewState[port][id] } if device == libretro.DeviceAnalog { - if id > uint(libretro.DeviceIDAnalogY) { + if id > 1 || index > 1 { // invalid return 0 } - switch uint32(index) { - case libretro.DeviceIndexAnalogLeft: - return NewAnalogState[port][id] - case libretro.DeviceIndexAnalogRight: - return NewAnalogState[port][id] - } + return NewAnalogState[port][index][id] } return 0 diff --git a/settings/defaults.go b/settings/defaults.go index 59509050..ec5fbf01 100644 --- a/settings/defaults.go +++ b/settings/defaults.go @@ -60,6 +60,7 @@ func defaultSettings() Settings { "Nintendo - Game Boy Advance": "mgba_libretro", "Nintendo - Game Boy Color": "gambatte_libretro", "Nintendo - Game Boy": "gambatte_libretro", + "Nintendo - Nintendo 64": "mupen64plus_next_libretro", "Nintendo - Nintendo Entertainment System": "fceumm_libretro", "Nintendo - Nintendo DS": "melonds_libretro", "Nintendo - Pokemon Mini": "pokemini_libretro", From 1e98126d081a6576a9a3e08d77c5e739e5b941a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Andr=C3=A9=20Santoni?= Date: Mon, 24 May 2021 10:10:22 +0700 Subject: [PATCH 37/52] Adapt disk control interface --- menu/scene_core_disc_control.go | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/menu/scene_core_disc_control.go b/menu/scene_core_disc_control.go index 6bfc6226..db1d2928 100644 --- a/menu/scene_core_disc_control.go +++ b/menu/scene_core_disc_control.go @@ -70,15 +70,22 @@ func (s *sceneCoreDiscControl) render() { func (s *sceneCoreDiscControl) drawHintBar() { w, h := menu.GetFramebufferSize() - menu.DrawRect(0, float32(h)-70*menu.ratio, float32(w), 70*menu.ratio, 0, lightGrey) - - _, upDown, leftRight, _, b, _, _, _, _, guide := hintIcons() - - var stack float32 + menu.DrawRect(0, float32(h)-88*menu.ratio, float32(w), 88*menu.ratio, 0, white) + menu.DrawRect(0, float32(h)-88*menu.ratio, float32(w), 2*menu.ratio, 0, lightGrey) + + _, upDown, leftRight, a, b, _, _, _, _, guide := hintIcons() + + lstack := float32(75) * menu.ratio + rstack := float32(w) - 96*menu.ratio + list := menu.stack[len(menu.stack)-1].Entry() + stackHintLeft(&lstack, upDown, "Navigate", h) + if list.children[list.ptr].callbackOK != nil { + stackHintRight(&rstack, a, "Set", h) + } else { + stackHintLeft(&lstack, leftRight, "Set", h) + } + stackHintRight(&rstack, b, "Back", h) if state.CoreRunning { - stackHint(&stack, guide, "RESUME", h) + stackHintRight(&rstack, guide, "Resume", h) } - stackHint(&stack, upDown, "NAVIGATE", h) - stackHint(&stack, b, "BACK", h) - stackHint(&stack, leftRight, "SET", h) } From 61f399ed684c5c6cb6469e2018f5f1a063295c52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Andr=C3=A9=20Santoni?= Date: Mon, 24 May 2021 10:21:30 +0700 Subject: [PATCH 38/52] Add core disc options --- assets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets b/assets index 997f8fd5..98b3c0a0 160000 --- a/assets +++ b/assets @@ -1 +1 @@ -Subproject commit 997f8fd592e0e0761a5fa151c72eed1f760b1d66 +Subproject commit 98b3c0a088856b37dcd78f9a82df7a37ce968051 From 189c56d00846250bb28dcb17d061b7a1ffb4abd3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Andr=C3=A9=20Santoni?= Date: Mon, 23 Aug 2021 13:54:10 +0700 Subject: [PATCH 39/52] Menu focus fixes --- menu/menu.go | 4 +++- menu/scene_history.go | 9 ++++----- menu/scene_playlist.go | 8 ++++---- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/menu/menu.go b/menu/menu.go index 72c4f7cf..7da16eaa 100644 --- a/menu/menu.go +++ b/menu/menu.go @@ -92,7 +92,9 @@ func (m *Menu) Render(dt float32) { m.stack[i].render() } - m.stack[m.focus-1].drawHintBar() + if m.focus-1 < len(m.stack) { + m.stack[m.focus-1].drawHintBar() + } } // ContextReset uploads the UI images to the GPU. diff --git a/menu/scene_history.go b/menu/scene_history.go index d0fa4920..63b3c587 100644 --- a/menu/scene_history.go +++ b/menu/scene_history.go @@ -39,12 +39,11 @@ func loadHistoryEntry(list Scene, game history.Game) { System: game.System, CorePath: corePath, }) - list.segueNext() - menu.Push(buildQuickMenu()) - menu.tweens.FastForward() // position the elements without animating + history.Load() + menu.WarpToQuickMenu() state.MenuActive = false } else { - list.segueNext() - menu.Push(buildQuickMenu()) + menu.WarpToQuickMenu() + state.MenuActive = false } } diff --git a/menu/scene_playlist.go b/menu/scene_playlist.go index 432176ae..43c02776 100644 --- a/menu/scene_playlist.go +++ b/menu/scene_playlist.go @@ -78,12 +78,12 @@ func loadPlaylistEntry(list Scene, playlist string, game playlists.Game) { System: playlist, CorePath: corePath, }) - list.segueNext() - menu.Push(buildQuickMenu()) - menu.tweens.FastForward() // position the elements without animating + history.Load() + menu.WarpToQuickMenu() state.MenuActive = false } else { list.segueNext() - menu.Push(buildQuickMenu()) + menu.WarpToQuickMenu() + state.MenuActive = false } } From bca097e333ccf20dbe3543a46cc1f098ace119dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Andr=C3=A9=20Santoni?= Date: Tue, 24 Aug 2021 12:19:50 +0700 Subject: [PATCH 40/52] Fix empty start --- menu/scene_home.go | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/menu/scene_home.go b/menu/scene_home.go index 1c97844e..a17af391 100644 --- a/menu/scene_home.go +++ b/menu/scene_home.go @@ -90,6 +90,10 @@ func buildHome() Scene { cat++ } + if len(list.children) == 0 { + menu.focus-- + } + list.segueMount() return &list @@ -257,7 +261,7 @@ func (s *sceneHome) update(dt float32) { // OK if input.Released[0][libretro.DeviceIDJoypadA] == 1 { - if s.children[s.yptr].children[s.xptrs[s.yptr]].callbackOK != nil { + if len(s.children) > 0 && s.children[s.yptr].children[s.xptrs[s.yptr]].callbackOK != nil { audio.PlayEffect(audio.Effects["ok"]) s.segueNext() s.children[s.yptr].children[s.xptrs[s.yptr]].callbackOK() @@ -360,6 +364,17 @@ func (s sceneHome) render() { } } } + + if len(s.children) == 0 { + w, h := menu.Window.GetFramebufferSize() + menu.BoldFont.SetColor(black) + msg := "Welcome to Ludo, please scan your collection." + msgw := menu.BoldFont.Width(0.5*menu.ratio, msg) + menu.BoldFont.Printf( + float32(w)/2-msgw/2, + float32(h)/2, + 0.5*menu.ratio, msg) + } } func (s sceneHome) drawHintBar() { From 8ad96111238c2b49e4b91ec6f42b84292a403184 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Andr=C3=A9=20Santoni?= Date: Tue, 24 Aug 2021 12:23:01 +0700 Subject: [PATCH 41/52] More fixes --- menu/scene_home.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/menu/scene_home.go b/menu/scene_home.go index a17af391..d95a7865 100644 --- a/menu/scene_home.go +++ b/menu/scene_home.go @@ -214,6 +214,12 @@ func (s *sceneHome) segueNext() { } func (s *sceneHome) update(dt float32) { + // Empty state + if len(s.children) == 0 { + menu.focus-- + return + } + // Right repeatRight(dt, input.NewState[0][libretro.DeviceIDJoypadRight] == 1, func() { if s.xptrs[s.yptr] < len(s.children[s.yptr].children)-1 { From 1aa10fb1d43c3872be4ce096d109198fbceb60c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Andr=C3=A9=20Santoni?= Date: Thu, 2 Sep 2021 17:40:50 +0700 Subject: [PATCH 42/52] Add dark theme support --- menu/hints.go | 8 ++++---- menu/menu.go | 4 ++-- menu/palette.go | 28 ++++++++++++++++++++++++---- menu/scene.go | 16 ++++++++-------- menu/scene_core_disk_control.go | 4 ++-- menu/scene_core_options.go | 4 ++-- menu/scene_dialog.go | 2 +- menu/scene_home.go | 8 ++++---- menu/scene_keyboard.go | 6 +++--- menu/scene_savestates.go | 12 ++++++------ menu/scene_settings.go | 12 ++++++------ menu/scene_tabs.go | 10 +++++----- menu/scene_wifi.go | 4 ++-- 13 files changed, 69 insertions(+), 49 deletions(-) diff --git a/menu/hints.go b/menu/hints.go index 16a1c32a..e3d06f90 100644 --- a/menu/hints.go +++ b/menu/hints.go @@ -6,8 +6,8 @@ import ( // Used to easily compose different hint bars based on the context. func stackHintLeft(stack *float32, icon uint32, label string, h int) { - menu.Font.SetColor(darkGrey) - menu.DrawImage(icon, *stack, float32(h)-79*menu.ratio, 70*menu.ratio, 70*menu.ratio, 1.0, 0, darkGrey) + menu.Font.SetColor(hintTextColor) + menu.DrawImage(icon, *stack, float32(h)-79*menu.ratio, 70*menu.ratio, 70*menu.ratio, 1.0, 0, hintTextColor) *stack += 70 * menu.ratio menu.Font.Printf(*stack, float32(h)-30*menu.ratio, 0.5*menu.ratio, label) *stack += menu.Font.Width(0.5*menu.ratio, label) @@ -17,10 +17,10 @@ func stackHintLeft(stack *float32, icon uint32, label string, h int) { // Used to easily compose different hint bars based on the context. func stackHintRight(stack *float32, icon uint32, label string, h int) { *stack -= menu.Font.Width(0.5*menu.ratio, label) - menu.Font.SetColor(darkGrey) + menu.Font.SetColor(hintTextColor) menu.Font.Printf(*stack, float32(h)-30*menu.ratio, 0.5*menu.ratio, label) *stack -= 70 * menu.ratio - menu.DrawImage(icon, *stack, float32(h)-79*menu.ratio, 70*menu.ratio, 70*menu.ratio, 1.0, 0, darkGrey) + menu.DrawImage(icon, *stack, float32(h)-79*menu.ratio, 70*menu.ratio, 70*menu.ratio, 1.0, 0, hintTextColor) *stack -= 32 * menu.ratio } diff --git a/menu/menu.go b/menu/menu.go index 7da16eaa..ee0d7169 100644 --- a/menu/menu.go +++ b/menu/menu.go @@ -76,9 +76,9 @@ func (m *Menu) Render(dt float32) { w, h := m.GetFramebufferSize() m.ratio = float32(w) / 1920 - c := white + c := bgColor if haveTransparentBackground() { - c = white.Alpha(0.85) + c = bgColor.Alpha(0.85) } m.DrawImage(menu.icons["bg"], 0, 0, float32(w), float32(h), 1, 0, c) diff --git a/menu/palette.go b/menu/palette.go index e20494a5..76ccb711 100644 --- a/menu/palette.go +++ b/menu/palette.go @@ -13,11 +13,13 @@ var blue = video.Color{R: 0.129, G: 0.441, B: 0.684, A: 1} var orange = video.Color{R: 0.8, G: 0.4, B: 0.1, A: 1} var cyan = video.Color{R: 0.8784, G: 1, B: 1, A: 1} var darkBlue = video.Color{R: 0.1, G: 0.1, B: 0.4, A: 1} +var lightBlue = video.Color{R: 0.329, G: 0.641, B: 0.884, A: 1} var lightGrey = video.Color{R: 0.75, G: 0.75, B: 0.75, A: 1} var mediumGrey = video.Color{R: 0.5, G: 0.5, B: 0.5, A: 1} var darkGrey = video.Color{R: 0.25, G: 0.25, B: 0.25, A: 1} var darkerGrey = video.Color{R: 0.10, G: 0.10, B: 0.10, A: 1} +var ultraDarkerGrey = video.Color{R: 0.05, G: 0.05, B: 0.05, A: 1} var darkInfo = video.Color{R: 0.04, G: 0.36, B: 0.46, A: 1} var lightInfo = video.Color{R: 0.53, G: 0.89, B: 1.00, A: 1} @@ -32,18 +34,36 @@ var darkWarning = video.Color{R: 0.47, G: 0.40, B: 0.04, A: 1} var lightWarning = video.Color{R: 1.00, G: 0.92, B: 0.53, A: 1} var bgColor = white -var cursorBg = cyan +var cursorBg = white var textColor = black +var sepColor = lightGrey +var hintTextColor = darkGrey +var hintBgColor = white +var tabTextColor = blue +var tabBgColor = white +var titleColor = darkBlue // UpdatePalette updates the color palette to honor the dark theme func (m *Menu) UpdatePalette() { bgColor = white - cursorBg = cyan + cursorBg = white textColor = black + sepColor = lightGrey + hintTextColor = darkGrey + hintBgColor = white + tabTextColor = blue + tabBgColor = white + titleColor = darkBlue if state.CoreRunning || settings.Current.VideoDarkMode { - bgColor = darkerGrey - cursorBg = darkBlue + bgColor = ultraDarkerGrey + cursorBg = darkGrey textColor = white + sepColor = darkGrey + hintTextColor = lightGrey + hintBgColor = darkGrey + tabTextColor = lightBlue + tabBgColor = darkGrey + titleColor = lightBlue } } diff --git a/menu/scene.go b/menu/scene.go index 3d4464d4..1e568fd5 100644 --- a/menu/scene.go +++ b/menu/scene.go @@ -158,7 +158,7 @@ func genericDrawCursor(list *entry, i int) { y, float32(w)-720*menu.ratio, list.entryHeight*menu.ratio, 0.1, - white.Alpha(list.alpha)) + cursorBg.Alpha(list.alpha)) } // genericRender renders a vertical list of menu entries @@ -166,7 +166,7 @@ func genericDrawCursor(list *entry, i int) { func genericRender(list *entry) { w, h := menu.GetFramebufferSize() - menu.BoldFont.SetColor(blue.Alpha(list.alpha)) + menu.BoldFont.SetColor(titleColor.Alpha(list.alpha)) menu.BoldFont.Printf( 360*menu.ratio, list.y*menu.ratio+230*menu.ratio, @@ -177,7 +177,7 @@ func genericRender(list *entry) { list.y*menu.ratio+270*menu.ratio, float32(w)-720*menu.ratio, 2*menu.ratio, - 0, lightGrey.Alpha(list.alpha), + 0, sepColor.Alpha(list.alpha), ) menu.ScissorStart( @@ -203,7 +203,7 @@ func genericRender(list *entry) { y-1*menu.ratio+list.entryHeight/2*menu.ratio, float32(w)-720*menu.ratio, 2*menu.ratio, - 0, lightGrey.Alpha(e.iconAlpha), + 0, sepColor.Alpha(e.iconAlpha), ) if i == list.ptr { @@ -214,10 +214,10 @@ func genericRender(list *entry) { 420*menu.ratio-64*0.35*menu.ratio, y-64*0.35*menu.ratio, 128*menu.ratio, 128*menu.ratio, - 0.35, 0, black.Alpha(e.iconAlpha)) + 0.35, 0, textColor.Alpha(e.iconAlpha)) if e.labelAlpha > 0 { - menu.Font.SetColor(black.Alpha(e.labelAlpha)) + menu.Font.SetColor(textColor.Alpha(e.labelAlpha)) menu.Font.Printf( 480*menu.ratio, y+fontOffset, @@ -287,8 +287,8 @@ func askDeleteSavestateConfirmation(cb func()) { func genericDrawHintBar() { w, h := menu.Window.GetFramebufferSize() - menu.DrawRect(0, float32(h)-88*menu.ratio, float32(w), 88*menu.ratio, 0, white) - menu.DrawRect(0, float32(h)-88*menu.ratio, float32(w), 2*menu.ratio, 0, lightGrey) + menu.DrawRect(0, float32(h)-88*menu.ratio, float32(w), 88*menu.ratio, 0, hintBgColor) + menu.DrawRect(0, float32(h)-88*menu.ratio, float32(w), 2*menu.ratio, 0, sepColor) _, upDown, _, a, b, _, _, _, _, guide := hintIcons() diff --git a/menu/scene_core_disk_control.go b/menu/scene_core_disk_control.go index ab8a844d..22883997 100644 --- a/menu/scene_core_disk_control.go +++ b/menu/scene_core_disk_control.go @@ -77,8 +77,8 @@ func (s *sceneCoreDiskControl) render() { func (s *sceneCoreDiskControl) drawHintBar() { w, h := menu.GetFramebufferSize() - menu.DrawRect(0, float32(h)-88*menu.ratio, float32(w), 88*menu.ratio, 0, white) - menu.DrawRect(0, float32(h)-88*menu.ratio, float32(w), 2*menu.ratio, 0, lightGrey) + menu.DrawRect(0, float32(h)-88*menu.ratio, float32(w), 88*menu.ratio, 0, hintBgColor) + menu.DrawRect(0, float32(h)-88*menu.ratio, float32(w), 2*menu.ratio, 0, sepColor) _, upDown, leftRight, a, b, _, _, _, _, guide := hintIcons() diff --git a/menu/scene_core_options.go b/menu/scene_core_options.go index bb17669f..97215112 100644 --- a/menu/scene_core_options.go +++ b/menu/scene_core_options.go @@ -81,8 +81,8 @@ func (s *sceneCoreOptions) render() { func (s *sceneCoreOptions) drawHintBar() { w, h := menu.GetFramebufferSize() - menu.DrawRect(0, float32(h)-88*menu.ratio, float32(w), 88*menu.ratio, 0, white) - menu.DrawRect(0, float32(h)-88*menu.ratio, float32(w), 2*menu.ratio, 0, lightGrey) + menu.DrawRect(0, float32(h)-88*menu.ratio, float32(w), 88*menu.ratio, 0, hintBgColor) + menu.DrawRect(0, float32(h)-88*menu.ratio, float32(w), 2*menu.ratio, 0, sepColor) _, upDown, leftRight, _, b, _, _, _, _, guide := hintIcons() diff --git a/menu/scene_dialog.go b/menu/scene_dialog.go index 9fd8de03..921c727e 100644 --- a/menu/scene_dialog.go +++ b/menu/scene_dialog.go @@ -70,7 +70,7 @@ func (s *sceneDialog) render() { white, ) - menu.Font.SetColor(blue) + menu.Font.SetColor(titleColor) lw1 := menu.Font.Width(0.7*menu.ratio, s.title) menu.Font.Printf(fw/2-lw1/2, fh/2-120*menu.ratio+20*menu.ratio, 0.7*menu.ratio, s.title) menu.Font.SetColor(black) diff --git a/menu/scene_home.go b/menu/scene_home.go index d95a7865..502535fb 100644 --- a/menu/scene_home.go +++ b/menu/scene_home.go @@ -289,7 +289,7 @@ func (s sceneHome) render() { for j, ve := range s.children { ve := ve - menu.BoldFont.SetColor(blue.Alpha(ve.labelAlpha * s.alpha)) + menu.BoldFont.SetColor(titleColor.Alpha(ve.labelAlpha * s.alpha)) menu.BoldFont.Printf( 96*menu.ratio, s.y*menu.ratio+230*menu.ratio+vst*menu.ratio-s.yscroll*menu.ratio, @@ -341,7 +341,7 @@ func (s sceneHome) render() { 320*e.scale*menu.ratio, 240*e.scale*menu.ratio, 1, 0.07, white.Alpha(e.iconAlpha*s.alpha)) - menu.BoldFont.SetColor(black.Alpha(e.labelAlpha * s.alpha)) + menu.BoldFont.SetColor(textColor.Alpha(e.labelAlpha * s.alpha)) menu.BoldFont.Printf( (x+672+32)*menu.ratio, (y+360)*menu.ratio, @@ -385,8 +385,8 @@ func (s sceneHome) render() { func (s sceneHome) drawHintBar() { w, h := menu.Window.GetFramebufferSize() - menu.DrawRect(0, float32(h)-88*menu.ratio, float32(w), 88*menu.ratio, 0, white) - menu.DrawRect(0, float32(h)-88*menu.ratio, float32(w), 2*menu.ratio, 0, lightGrey) + menu.DrawRect(0, float32(h)-88*menu.ratio, float32(w), 88*menu.ratio, 0, hintBgColor) + menu.DrawRect(0, float32(h)-88*menu.ratio, float32(w), 2*menu.ratio, 0, sepColor) arrows, _, _, a, b, _, _, _, _, guide := hintIcons() diff --git a/menu/scene_keyboard.go b/menu/scene_keyboard.go index 87be5350..1152e53c 100644 --- a/menu/scene_keyboard.go +++ b/menu/scene_keyboard.go @@ -157,7 +157,7 @@ func (s *sceneKeyboard) render() { ttw := 10 * ksp // Background - menu.DrawRect(0, 0, float32(w), float32(h), 0, white.Alpha(s.alpha)) + menu.DrawRect(0, 0, float32(w), float32(h), 0, bgColor.Alpha(s.alpha)) // Label menu.Font.SetColor(black) @@ -204,8 +204,8 @@ func (s *sceneKeyboard) render() { func (s *sceneKeyboard) drawHintBar() { w, h := menu.GetFramebufferSize() - menu.DrawRect(0, float32(h)-88*menu.ratio, float32(w), 88*menu.ratio, 0, white) - menu.DrawRect(0, float32(h)-88*menu.ratio, float32(w), 2*menu.ratio, 0, lightGrey) + menu.DrawRect(0, float32(h)-88*menu.ratio, float32(w), 88*menu.ratio, 0, hintBgColor) + menu.DrawRect(0, float32(h)-88*menu.ratio, float32(w), 2*menu.ratio, 0, sepColor) arrows, _, _, a, b, x, y, start, _, _ := hintIcons() diff --git a/menu/scene_savestates.go b/menu/scene_savestates.go index 17252463..6d0c083e 100644 --- a/menu/scene_savestates.go +++ b/menu/scene_savestates.go @@ -121,7 +121,7 @@ func (s *sceneSavestates) render() { list := &s.entry w, h := menu.GetFramebufferSize() - menu.BoldFont.SetColor(blue.Alpha(list.alpha)) + menu.BoldFont.SetColor(titleColor.Alpha(list.alpha)) menu.BoldFont.Printf( 360*menu.ratio, list.y*menu.ratio+230*menu.ratio, @@ -132,7 +132,7 @@ func (s *sceneSavestates) render() { list.y*menu.ratio+270*menu.ratio, float32(w)-720*menu.ratio, 2*menu.ratio, - 0, lightGrey, + 0, sepColor, ) menu.ScissorStart( @@ -159,7 +159,7 @@ func (s *sceneSavestates) render() { y-1*menu.ratio+list.entryHeight/2*menu.ratio, float32(w)-720*menu.ratio, 2*menu.ratio, - 0, lightGrey, + 0, sepColor, ) if i == list.ptr { @@ -183,7 +183,7 @@ func (s *sceneSavestates) render() { 1, 0, white.Alpha(e.iconAlpha)) } - menu.Font.SetColor(black.Alpha(e.labelAlpha)) + menu.Font.SetColor(textColor.Alpha(e.labelAlpha)) menu.Font.Printf( 600*menu.ratio, y+fontOffset, @@ -196,8 +196,8 @@ func (s *sceneSavestates) render() { func (s *sceneSavestates) drawHintBar() { w, h := menu.GetFramebufferSize() - menu.DrawRect(0, float32(h)-88*menu.ratio, float32(w), 88*menu.ratio, 0, white) - menu.DrawRect(0, float32(h)-88*menu.ratio, float32(w), 2*menu.ratio, 0, lightGrey) + menu.DrawRect(0, float32(h)-88*menu.ratio, float32(w), 88*menu.ratio, 0, hintBgColor) + menu.DrawRect(0, float32(h)-88*menu.ratio, float32(w), 2*menu.ratio, 0, sepColor) ptr := menu.stack[len(menu.stack)-1].Entry().ptr diff --git a/menu/scene_settings.go b/menu/scene_settings.go index 02656850..1a74cb13 100644 --- a/menu/scene_settings.go +++ b/menu/scene_settings.go @@ -139,7 +139,7 @@ var widgets = map[string]func(*entry, *entry, int){ float32(fbw)-400*menu.ratio-128*menu.ratio, list.y+(270+32)*menu.ratio+list.scroll*menu.ratio+100*float32(i)*menu.ratio+50*menu.ratio-64*1.25*menu.ratio, 128*menu.ratio, 128*menu.ratio, - 1.25, 0, black.Alpha(e.iconAlpha)) + 1.25, 0, textColor.Alpha(e.iconAlpha)) }, // Range widget for audio volume and similat float settings @@ -149,10 +149,10 @@ var widgets = map[string]func(*entry, *entry, int){ y := list.y + (270+32)*menu.ratio + list.scroll*menu.ratio + 100*float32(i)*menu.ratio + 50*menu.ratio - 4*menu.ratio w := 175 * menu.ratio h := 8 * menu.ratio - menu.DrawRect(x, y, w, h, 0.9, black.Alpha(e.iconAlpha/4)) + menu.DrawRect(x, y, w, h, 0.9, textColor.Alpha(e.iconAlpha/4)) w = 175 * menu.ratio * e.value().(float32) - menu.DrawRect(x, y, w, h, 0.9, black.Alpha(e.iconAlpha)) - menu.DrawCircle(x+w, y+4*menu.ratio, 38*menu.ratio, black.Alpha(e.iconAlpha)) + menu.DrawRect(x, y, w, h, 0.9, textColor.Alpha(e.iconAlpha)) + menu.DrawCircle(x+w, y+4*menu.ratio, 38*menu.ratio, textColor.Alpha(e.iconAlpha)) }, } @@ -274,8 +274,8 @@ func (s *sceneSettings) render() { func (s *sceneSettings) drawHintBar() { w, h := menu.GetFramebufferSize() - menu.DrawRect(0, float32(h)-88*menu.ratio, float32(w), 88*menu.ratio, 0, white) - menu.DrawRect(0, float32(h)-88*menu.ratio, float32(w), 2*menu.ratio, 0, lightGrey) + menu.DrawRect(0, float32(h)-88*menu.ratio, float32(w), 88*menu.ratio, 0, hintBgColor) + menu.DrawRect(0, float32(h)-88*menu.ratio, float32(w), 2*menu.ratio, 0, sepColor) _, upDown, leftRight, a, b, _, _, _, _, guide := hintIcons() diff --git a/menu/scene_tabs.go b/menu/scene_tabs.go index d291589e..27c7d770 100644 --- a/menu/scene_tabs.go +++ b/menu/scene_tabs.go @@ -170,7 +170,7 @@ func (s sceneTabs) render() { now := time.Now().Format("3:04PM") nowWidth := menu.BoldFont.Width(0.5*menu.ratio, now) - menu.BoldFont.SetColor(black) + menu.BoldFont.SetColor(textColor) menu.BoldFont.Printf( float32(w)-96*menu.ratio-nowWidth, 90*menu.ratio, 0.5*menu.ratio, now) @@ -194,18 +194,18 @@ func (s sceneTabs) render() { menu.DrawImage(menu.icons["circle"], float32(w)/2-totalWidth/2+float32(i)*spacing*menu.ratio+96*menu.ratio/2, 32*menu.ratio, - 96*menu.ratio, 96*menu.ratio, 1, 0, white) + 96*menu.ratio, 96*menu.ratio, 1, 0, tabBgColor) menu.DrawImage(menu.icons[e.icon], float32(w)/2-totalWidth/2+float32(i)*spacing*menu.ratio+96*menu.ratio/2+24*menu.ratio, 56*menu.ratio, - 48*menu.ratio, 48*menu.ratio, 1, 0, blue) + 48*menu.ratio, 48*menu.ratio, 1, 0, tabTextColor) } } func (s *sceneTabs) drawHintBar() { w, h := menu.Window.GetFramebufferSize() - menu.DrawRect(0, float32(h)-88*menu.ratio, float32(w), 88*menu.ratio, 0, white) - menu.DrawRect(0, float32(h)-88*menu.ratio, float32(w), 2*menu.ratio, 0, lightGrey) + menu.DrawRect(0, float32(h)-88*menu.ratio, float32(w), 88*menu.ratio, 0, hintBgColor) + menu.DrawRect(0, float32(h)-88*menu.ratio, float32(w), 2*menu.ratio, 0, sepColor) _, _, leftRight, a, _, _, _, _, _, guide := hintIcons() diff --git a/menu/scene_wifi.go b/menu/scene_wifi.go index 82ab3e83..7e9b6765 100644 --- a/menu/scene_wifi.go +++ b/menu/scene_wifi.go @@ -86,8 +86,8 @@ func (s *sceneWiFi) render() { func (s *sceneWiFi) drawHintBar() { w, h := menu.Window.GetFramebufferSize() - menu.DrawRect(0, float32(h)-88*menu.ratio, float32(w), 88*menu.ratio, 0, white) - menu.DrawRect(0, float32(h)-88*menu.ratio, float32(w), 2*menu.ratio, 0, lightGrey) + menu.DrawRect(0, float32(h)-88*menu.ratio, float32(w), 88*menu.ratio, 0, hintBgColor) + menu.DrawRect(0, float32(h)-88*menu.ratio, float32(w), 2*menu.ratio, 0, sepColor) _, upDown, _, a, b, _, _, _, _, _ := hintIcons() From ddef23e02e35cbd8193d7f6d16039ddb8fd94992 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Andr=C3=A9=20Santoni?= Date: Thu, 2 Sep 2021 18:33:39 +0700 Subject: [PATCH 43/52] Fix dialogs again --- menu/menu.go | 15 ++++++++------- menu/scene.go | 8 ++++++++ menu/scene_dialog.go | 3 ++- 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/menu/menu.go b/menu/menu.go index ee0d7169..14de734b 100644 --- a/menu/menu.go +++ b/menu/menu.go @@ -16,13 +16,14 @@ var menu *Menu // Menu is a type holding the menu state, the stack of scenes, tweens, etc type Menu struct { - focus int // this is a hack to switch focus between top tabs and the other scenes - stack []Scene - icons map[string]uint32 - tweens Tweens - scroll float32 - ratio float32 - t float64 + focus int // this is a hack to switch focus between top tabs and the other scenes + oldFocus int // this is used to come back to the previous focus when a dialog is canceled + stack []Scene + icons map[string]uint32 + tweens Tweens + scroll float32 + ratio float32 + t float64 *video.Video // we embbed video here to have direct access to drawing functions } diff --git a/menu/scene.go b/menu/scene.go index 1e568fd5..b91f8cfd 100644 --- a/menu/scene.go +++ b/menu/scene.go @@ -244,12 +244,14 @@ func askQuitConfirmation(cb func()) { if !state.MenuActive { state.MenuActive = true } + menu.oldFocus = menu.focus menu.Push(buildYesNoDialog( "Confirm before quitting", "If you have not saved yet, your progress will be lost.", "Do you want to exit Ludo anyway?", func() { cb() })) + menu.focus = len(menu.stack) } else { cb() } @@ -257,32 +259,38 @@ func askQuitConfirmation(cb func()) { // Displays a confirmation dialog before deleting a playlist game entry func askDeleteGameConfirmation(cb func()) { + menu.oldFocus = menu.focus menu.Push(buildYesNoDialog( "Confirm before deleting", "You are about to delete a game entry.", "Games and game data won't be removed.", func() { cb() })) + menu.focus = len(menu.stack) } // Displays a confirmation dialog before deleting a playlist func askDeletePlaylistConfirmation(cb func()) { + menu.oldFocus = menu.focus menu.Push(buildYesNoDialog( "Confirm before deleting", "You are about to delete a playlist.", "Games and game data won't be removed.", func() { cb() })) + menu.focus = len(menu.stack) } // Displays a confirmation dialog before deleting a savestate func askDeleteSavestateConfirmation(cb func()) { + menu.oldFocus = menu.focus menu.Push(buildYesNoDialog( "Confirm before deleting", "You are about to delete a savestate.", "This action is irreversible.", func() { cb() })) + menu.focus = len(menu.stack) } func genericDrawHintBar() { diff --git a/menu/scene_dialog.go b/menu/scene_dialog.go index 921c727e..2ba9e011 100644 --- a/menu/scene_dialog.go +++ b/menu/scene_dialog.go @@ -47,8 +47,9 @@ func (s *sceneDialog) update(dt float32) { // Cancel if input.Released[0][libretro.DeviceIDJoypadB] == 1 { audio.PlayEffect(audio.Effects["cancel"]) + menu.stack[len(menu.stack)-2].segueBack() menu.stack = menu.stack[:len(menu.stack)-1] - menu.focus-- + menu.focus = menu.oldFocus } } From 0d61c281ad587caf6d3ff426c4313a10cfbecb6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Andr=C3=A9=20Santoni?= Date: Thu, 2 Sep 2021 21:39:18 +0700 Subject: [PATCH 44/52] Improve dark theme --- menu/palette.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/menu/palette.go b/menu/palette.go index 76ccb711..9dfc9f9d 100644 --- a/menu/palette.go +++ b/menu/palette.go @@ -59,9 +59,9 @@ func (m *Menu) UpdatePalette() { bgColor = ultraDarkerGrey cursorBg = darkGrey textColor = white - sepColor = darkGrey + sepColor = darkerGrey hintTextColor = lightGrey - hintBgColor = darkGrey + hintBgColor = ultraDarkerGrey tabTextColor = lightBlue tabBgColor = darkGrey titleColor = lightBlue From 0aa96cda6d4ce5b224577c78b31d1b91829f0db7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Andr=C3=A9=20Santoni?= Date: Sun, 19 Sep 2021 17:58:37 +0700 Subject: [PATCH 45/52] Dark blue theme --- menu/palette.go | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/menu/palette.go b/menu/palette.go index 9dfc9f9d..76911474 100644 --- a/menu/palette.go +++ b/menu/palette.go @@ -12,7 +12,7 @@ var black = video.Color{R: 0, G: 0, B: 0, A: 1} var blue = video.Color{R: 0.129, G: 0.441, B: 0.684, A: 1} var orange = video.Color{R: 0.8, G: 0.4, B: 0.1, A: 1} var cyan = video.Color{R: 0.8784, G: 1, B: 1, A: 1} -var darkBlue = video.Color{R: 0.1, G: 0.1, B: 0.4, A: 1} +var darkBlue = video.Color{R: 0.1, G: 0.15, B: 0.4, A: 1} var lightBlue = video.Color{R: 0.329, G: 0.641, B: 0.884, A: 1} var lightGrey = video.Color{R: 0.75, G: 0.75, B: 0.75, A: 1} @@ -20,6 +20,7 @@ var mediumGrey = video.Color{R: 0.5, G: 0.5, B: 0.5, A: 1} var darkGrey = video.Color{R: 0.25, G: 0.25, B: 0.25, A: 1} var darkerGrey = video.Color{R: 0.10, G: 0.10, B: 0.10, A: 1} var ultraDarkerGrey = video.Color{R: 0.05, G: 0.05, B: 0.05, A: 1} +var ultraDarkerBlue = video.Color{R: 0, G: 0.05, B: 0.15, A: 1} var darkInfo = video.Color{R: 0.04, G: 0.36, B: 0.46, A: 1} var lightInfo = video.Color{R: 0.53, G: 0.89, B: 1.00, A: 1} @@ -56,14 +57,14 @@ func (m *Menu) UpdatePalette() { titleColor = darkBlue if state.CoreRunning || settings.Current.VideoDarkMode { - bgColor = ultraDarkerGrey - cursorBg = darkGrey + bgColor = ultraDarkerBlue + cursorBg = darkBlue textColor = white - sepColor = darkerGrey - hintTextColor = lightGrey - hintBgColor = ultraDarkerGrey + sepColor = darkBlue + hintTextColor = lightBlue + hintBgColor = ultraDarkerBlue tabTextColor = lightBlue - tabBgColor = darkGrey + tabBgColor = darkBlue titleColor = lightBlue } } From 943559b42613fd73ca42cd75608023e3c91db498 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Andr=C3=A9=20Santoni?= Date: Fri, 22 Oct 2021 19:45:45 +0700 Subject: [PATCH 46/52] Fix CI --- menu/scene.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/menu/scene.go b/menu/scene.go index b91f8cfd..de4fe1bd 100644 --- a/menu/scene.go +++ b/menu/scene.go @@ -258,7 +258,7 @@ func askQuitConfirmation(cb func()) { } // Displays a confirmation dialog before deleting a playlist game entry -func askDeleteGameConfirmation(cb func()) { +/*func askDeleteGameConfirmation(cb func()) { menu.oldFocus = menu.focus menu.Push(buildYesNoDialog( "Confirm before deleting", @@ -279,7 +279,7 @@ func askDeletePlaylistConfirmation(cb func()) { cb() })) menu.focus = len(menu.stack) -} +}*/ // Displays a confirmation dialog before deleting a savestate func askDeleteSavestateConfirmation(cb func()) { From 02b860974308dc7d7b8e8fe82e29a3586c77b582 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Andr=C3=A9=20Santoni?= Date: Thu, 10 Aug 2023 09:38:00 +0200 Subject: [PATCH 47/52] Fix context reset --- menu/menu.go | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/menu/menu.go b/menu/menu.go index 14de734b..dab826ef 100644 --- a/menu/menu.go +++ b/menu/menu.go @@ -117,10 +117,14 @@ func (m *Menu) ContextReset() { m.icons[filename] = video.NewImage(path) } - currentScreenIndex := len(m.stack) - 1 - curList := m.stack[currentScreenIndex].Entry() - for i := range curList.children { - curList.children[i].thumbnail = 0 + for h := 0; h < len(m.stack); h++ { + list := m.stack[h].Entry() + for i := range list.children { + list.children[i].thumbnail = 0 + for j := range list.children[i].children { + list.children[i].children[j].thumbnail = 0 + } + } } } From 912fca82a2b7d01931dacfee64d0258a2a817a5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Andr=C3=A9=20Santoni?= Date: Tue, 12 Sep 2023 10:09:23 +0200 Subject: [PATCH 48/52] Unused vars --- menu/palette.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/menu/palette.go b/menu/palette.go index 76911474..d0c5fc21 100644 --- a/menu/palette.go +++ b/menu/palette.go @@ -10,16 +10,16 @@ var white = video.Color{R: 1, G: 1, B: 1, A: 1} var black = video.Color{R: 0, G: 0, B: 0, A: 1} var blue = video.Color{R: 0.129, G: 0.441, B: 0.684, A: 1} -var orange = video.Color{R: 0.8, G: 0.4, B: 0.1, A: 1} -var cyan = video.Color{R: 0.8784, G: 1, B: 1, A: 1} +// var orange = video.Color{R: 0.8, G: 0.4, B: 0.1, A: 1} +// var cyan = video.Color{R: 0.8784, G: 1, B: 1, A: 1} var darkBlue = video.Color{R: 0.1, G: 0.15, B: 0.4, A: 1} var lightBlue = video.Color{R: 0.329, G: 0.641, B: 0.884, A: 1} var lightGrey = video.Color{R: 0.75, G: 0.75, B: 0.75, A: 1} var mediumGrey = video.Color{R: 0.5, G: 0.5, B: 0.5, A: 1} -var darkGrey = video.Color{R: 0.25, G: 0.25, B: 0.25, A: 1} +// var darkGrey = video.Color{R: 0.25, G: 0.25, B: 0.25, A: 1} var darkerGrey = video.Color{R: 0.10, G: 0.10, B: 0.10, A: 1} -var ultraDarkerGrey = video.Color{R: 0.05, G: 0.05, B: 0.05, A: 1} +// var ultraDarkerGrey = video.Color{R: 0.05, G: 0.05, B: 0.05, A: 1} var ultraDarkerBlue = video.Color{R: 0, G: 0.05, B: 0.15, A: 1} var darkInfo = video.Color{R: 0.04, G: 0.36, B: 0.46, A: 1} @@ -68,3 +68,4 @@ func (m *Menu) UpdatePalette() { titleColor = lightBlue } } + From 4300666e7c79390056819223e2c2fdf79fe63aa5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Andr=C3=A9=20Santoni?= Date: Tue, 12 Sep 2023 10:27:03 +0200 Subject: [PATCH 49/52] Fix --- menu/palette.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/menu/palette.go b/menu/palette.go index d0c5fc21..7a7c1e0f 100644 --- a/menu/palette.go +++ b/menu/palette.go @@ -17,8 +17,8 @@ var lightBlue = video.Color{R: 0.329, G: 0.641, B: 0.884, A: 1} var lightGrey = video.Color{R: 0.75, G: 0.75, B: 0.75, A: 1} var mediumGrey = video.Color{R: 0.5, G: 0.5, B: 0.5, A: 1} -// var darkGrey = video.Color{R: 0.25, G: 0.25, B: 0.25, A: 1} -var darkerGrey = video.Color{R: 0.10, G: 0.10, B: 0.10, A: 1} +var darkGrey = video.Color{R: 0.25, G: 0.25, B: 0.25, A: 1} +// var darkerGrey = video.Color{R: 0.10, G: 0.10, B: 0.10, A: 1} // var ultraDarkerGrey = video.Color{R: 0.05, G: 0.05, B: 0.05, A: 1} var ultraDarkerBlue = video.Color{R: 0, G: 0.05, B: 0.15, A: 1} From c92951936fc87650a4bbf7cdd582f05aee47072e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Andr=C3=A9=20Santoni?= Date: Sun, 16 Mar 2025 14:31:36 +0100 Subject: [PATCH 50/52] Update dependencies --- go.mod | 76 +++++++++++++++++++++++++++++++++++++++++++--------------- go.sum | 52 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 109 insertions(+), 19 deletions(-) diff --git a/go.mod b/go.mod index ae5ce2a6..71e114cf 100644 --- a/go.mod +++ b/go.mod @@ -1,31 +1,69 @@ module github.com/libretro/ludo require ( - github.com/adrg/xdg v0.4.0 - github.com/andybalholm/brotli v1.0.4 // indirect + github.com/adrg/xdg v0.5.3 github.com/cavaliercoder/grab v2.0.0+incompatible - github.com/davecgh/go-spew v1.1.1 // indirect github.com/disintegration/imaging v1.6.2 github.com/fatih/structs v1.1.0 - github.com/go-gl/gl v0.0.0-20211210172815-726fda9656d6 - github.com/go-gl/glfw/v3.3/glfw v0.0.0-20221017161538-93cebf72946b + github.com/go-gl/gl v0.0.0-20231021071112-07e5d0ea2e71 + github.com/go-gl/glfw/v3.3/glfw v0.0.0-20250301202403-da16c1255728 github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 - github.com/golang/snappy v0.0.4 // indirect - github.com/klauspost/compress v1.13.6 // indirect - github.com/kr/text v0.2.0 // indirect github.com/lucasb-eyer/go-colorful v1.2.0 github.com/mholt/archiver/v3 v3.5.1 - github.com/nwaples/rardecode v1.1.2 // indirect - github.com/pelletier/go-toml v1.9.4 - github.com/pierrec/lz4/v4 v4.1.12 // indirect - github.com/tanema/gween v0.0.0-20200427131925-c89ae23cc63c - github.com/ulikunitz/xz v0.5.10 // indirect - github.com/youpy/go-wav v0.3.0 - golang.org/x/image v0.5.0 - golang.org/x/mobile v0.0.0-20211207041440-4e6c2922fdee - golang.org/x/sys v0.1.0 // indirect + github.com/pelletier/go-toml v1.9.5 + github.com/tanema/gween v0.0.0-20221212145351-621cc8a459d1 + github.com/youpy/go-wav v0.3.2 + golang.org/x/image v0.25.0 + golang.org/x/mobile v0.0.0-20250305212854-3a7bc9f8a4de +) + +require ( + dmitri.shuralyov.com/gpu/mtl v0.0.0-20221208032759-85de2813cf6b // indirect + github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802 // indirect + github.com/andybalholm/brotli v1.1.1 // indirect + github.com/creack/pty v1.1.9 // indirect + github.com/davecgh/go-spew v1.1.1 // indirect + github.com/dsnet/compress v0.0.2-0.20210315054119-f66993602bf5 // indirect + github.com/dsnet/golib v0.0.0-20171103203638-1ea166775780 // indirect + github.com/golang/snappy v1.0.0 // indirect + github.com/google/go-cmp v0.6.0 // indirect + github.com/jezek/xgb v1.0.0 // indirect + github.com/klauspost/compress v1.18.0 // indirect + github.com/klauspost/cpuid v1.2.0 // indirect + github.com/klauspost/pgzip v1.2.6 // indirect + github.com/kr/pretty v0.2.1 // indirect + github.com/kr/pty v1.1.1 // indirect + github.com/kr/text v0.2.0 // indirect + github.com/nwaples/rardecode v1.1.3 // indirect + github.com/pierrec/lz4/v4 v4.1.22 // indirect + github.com/pkg/errors v0.9.1 // indirect + github.com/pmezard/go-difflib v1.0.0 // indirect + github.com/stretchr/objx v0.5.2 // indirect + github.com/stretchr/testify v1.9.0 // indirect + github.com/ulikunitz/xz v0.5.12 // indirect + github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8 // indirect + github.com/xyproto/randomstring v1.0.5 // indirect + github.com/youpy/go-riff v0.1.0 // indirect + github.com/yuin/goldmark v1.4.13 // indirect + github.com/zaf/g711 v1.4.0 // indirect + golang.org/x/crypto v0.36.0 // indirect + golang.org/x/exp v0.0.0-20190731235908-ec7cb31e5a56 // indirect + golang.org/x/exp/shiny v0.0.0-20230817173708-d852ddb80c63 // indirect + golang.org/x/mod v0.24.0 // indirect + golang.org/x/net v0.37.0 // indirect + golang.org/x/sync v0.12.0 // indirect + golang.org/x/sys v0.31.0 // indirect + golang.org/x/telemetry v0.0.0-20240521205824-bda55230c457 // indirect + golang.org/x/term v0.30.0 // indirect + golang.org/x/text v0.23.0 // indirect + golang.org/x/tools v0.31.0 // indirect + golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect - gopkg.in/yaml.v3 v3.0.0 // indirect + gopkg.in/yaml.v2 v2.2.2 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect + gotest.tools v2.2.0+incompatible // indirect ) -go 1.13 +go 1.23.0 + +toolchain go1.24.0 diff --git a/go.sum b/go.sum index ac5eb59f..373c4eda 100644 --- a/go.sum +++ b/go.sum @@ -1,9 +1,14 @@ +dmitri.shuralyov.com/gpu/mtl v0.0.0-20221208032759-85de2813cf6b/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/adrg/xdg v0.4.0 h1:RzRqFcjH4nE5C6oTAxhBtoE2IRyjBSa62SCbyPidvls= github.com/adrg/xdg v0.4.0/go.mod h1:N6ag73EX4wyxeaoeHctc1mas01KZgsj5tYiAIwqJE/E= +github.com/adrg/xdg v0.5.3 h1:xRnxJXne7+oWDatRhR1JLnvuccuIeCoBu2rtuLqQB78= +github.com/adrg/xdg v0.5.3/go.mod h1:nlTsY+NNiCBGCK2tpm09vRqfVzrc2fLmXGpBLF0zlTQ= github.com/andybalholm/brotli v1.0.1/go.mod h1:loMXtMfwqflxFJPmdbJO0a3KNoPuLBgiu3qAvBg8x/Y= github.com/andybalholm/brotli v1.0.4 h1:V7DdXeJtZscaqfNuAdSRuRFzuiKlHSC/Zh3zl9qY3JY= github.com/andybalholm/brotli v1.0.4/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHGRSepvi9Eig= +github.com/andybalholm/brotli v1.1.1 h1:PR2pgnyFznKEugtsUo0xLdDop5SKXd5Qf5ysW+7XdTA= +github.com/andybalholm/brotli v1.1.1/go.mod h1:05ib4cKhjx3OQYUY22hTVd34Bc8upXjOLL2rKwwZBoA= github.com/cavaliercoder/grab v2.0.0+incompatible h1:wZHbBQx56+Yxjx2TCGDcenhh3cJn7cCLMfkEPmySTSE= github.com/cavaliercoder/grab v2.0.0+incompatible/go.mod h1:tTBkfNqSBfuMmMBFaO2phgyhdYhiZQ/+iXCZDzcDsMI= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= @@ -19,23 +24,35 @@ github.com/fatih/structs v1.1.0 h1:Q7juDM0QtcnhCpeyLGQKyg4TOIghuNXrkL32pHAUMxo= github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M= github.com/go-gl/gl v0.0.0-20211210172815-726fda9656d6 h1:zDw5v7qm4yH7N8C8uWd+8Ii9rROdgWxQuGoJ9WDXxfk= github.com/go-gl/gl v0.0.0-20211210172815-726fda9656d6/go.mod h1:9YTyiznxEY1fVinfM7RvRcjRHbw2xLBJ3AAGIT0I4Nw= +github.com/go-gl/gl v0.0.0-20231021071112-07e5d0ea2e71 h1:5BVwOaUSBTlVZowGO6VZGw2H/zl9nrd3eCZfYV+NfQA= +github.com/go-gl/gl v0.0.0-20231021071112-07e5d0ea2e71/go.mod h1:9YTyiznxEY1fVinfM7RvRcjRHbw2xLBJ3AAGIT0I4Nw= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20221017161538-93cebf72946b h1:GgabKamyOYguHqHjSkDACcgoPIz3w0Dis/zJ1wyHHHU= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20221017161538-93cebf72946b/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= +github.com/go-gl/glfw/v3.3/glfw v0.0.0-20250301202403-da16c1255728 h1:RkGhqHxEVAvPM0/R+8g7XRwQnHatO0KAuVcwHo8q9W8= +github.com/go-gl/glfw/v3.3/glfw v0.0.0-20250301202403-da16c1255728/go.mod h1:SyRD8YfuKk+ZXlDqYiqe1qMSqjNgtHzBTG810KUagMc= github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 h1:DACJavvAHhabrF08vX0COfcOBJRhZ8lUbR+ZWIs0Y5g= github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGwJL78qG/PmXZO1EjYhfJinVAhrmmHX6Z8B9k= github.com/golang/snappy v0.0.2/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/golang/snappy v1.0.0 h1:Oy607GVXHs7RtbggtPBnr2RmDArIsAefDwvrdWvRhGs= +github.com/golang/snappy v1.0.0/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/jezek/xgb v1.0.0/go.mod h1:nrhwO0FX/enq75I7Y7G8iN1ubpSGZEiA3v9e9GyRFlk= github.com/klauspost/compress v1.4.1/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= github.com/klauspost/compress v1.11.4/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= github.com/klauspost/compress v1.13.6 h1:P76CopJELS0TiO2mebmnzgWaajssP/EszplttgQxcgc= github.com/klauspost/compress v1.13.6/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= +github.com/klauspost/compress v1.18.0 h1:c/Cqfb0r+Yi+JtIEq73FWXVkRonBlf0CRNYc8Zttxdo= +github.com/klauspost/compress v1.18.0/go.mod h1:2Pp+KzxcywXVXMr50+X0Q/Lsb43OQHYWRCY2AiWywWQ= github.com/klauspost/cpuid v1.2.0/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek= github.com/klauspost/pgzip v1.2.5 h1:qnWYvvKqedOF2ulHpMG72XQol4ILEJ8k2wwRl/Km8oE= github.com/klauspost/pgzip v1.2.5/go.mod h1:Ch1tH69qFZu15pkjo5kYi6mth2Zzwzt50oCQKQE9RUs= +github.com/klauspost/pgzip v1.2.6 h1:8RXeL5crjEUFnR2/Sn6GJNWtSQ3Dk8pq4CL3jvdDyjU= +github.com/klauspost/pgzip v1.2.6/go.mod h1:Ch1tH69qFZu15pkjo5kYi6mth2Zzwzt50oCQKQE9RUs= github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI= github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= @@ -49,61 +66,89 @@ github.com/mholt/archiver/v3 v3.5.1/go.mod h1:e3dqJ7H78uzsRSEACH1joayhuSyhnonssn github.com/nwaples/rardecode v1.1.0/go.mod h1:5DzqNKiOdpKKBH87u8VlvAnPZMXcGRhxWkRpHbbfGS0= github.com/nwaples/rardecode v1.1.2 h1:Cj0yZY6T1Zx1R7AhTbyGSALm44/Mmq+BAPc4B/p/d3M= github.com/nwaples/rardecode v1.1.2/go.mod h1:5DzqNKiOdpKKBH87u8VlvAnPZMXcGRhxWkRpHbbfGS0= +github.com/nwaples/rardecode v1.1.3 h1:cWCaZwfM5H7nAD6PyEdcVnczzV8i/JtotnyW/dD9lEc= +github.com/nwaples/rardecode v1.1.3/go.mod h1:5DzqNKiOdpKKBH87u8VlvAnPZMXcGRhxWkRpHbbfGS0= github.com/pelletier/go-toml v1.9.4 h1:tjENF6MfZAg8e4ZmZTeWaWiT2vXtsoO6+iuOjFhECwM= github.com/pelletier/go-toml v1.9.4/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= +github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8= +github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= github.com/pierrec/lz4/v4 v4.1.2/go.mod h1:gZWDp/Ze/IJXGXf23ltt2EXimqmTUXEy0GFuRQyBid4= github.com/pierrec/lz4/v4 v4.1.12 h1:44l88ehTZAUGW4VlO1QC4zkilL99M6Y9MXNwEs0uzP8= github.com/pierrec/lz4/v4 v4.1.12/go.mod h1:gZWDp/Ze/IJXGXf23ltt2EXimqmTUXEy0GFuRQyBid4= +github.com/pierrec/lz4/v4 v4.1.22 h1:cKFw6uJDK+/gfw5BcDL0JL5aBsAFdsIT18eRtLj7VIU= +github.com/pierrec/lz4/v4 v4.1.22/go.mod h1:gZWDp/Ze/IJXGXf23ltt2EXimqmTUXEy0GFuRQyBid4= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/tanema/gween v0.0.0-20200427131925-c89ae23cc63c h1:rZz/p7IbahA51/dieoBBfzTgkTX9C8QFrTgkMh64Khg= github.com/tanema/gween v0.0.0-20200427131925-c89ae23cc63c/go.mod h1:XXpz+9IVhUY5vTC5gXRNSjLDVwQWa5KM43NrH1GJa4M= +github.com/tanema/gween v0.0.0-20221212145351-621cc8a459d1 h1:s2Tn3G6rP4VljC5XDN6hARqXogkhr3k/jAsTqawSN5U= +github.com/tanema/gween v0.0.0-20221212145351-621cc8a459d1/go.mod h1:XXpz+9IVhUY5vTC5gXRNSjLDVwQWa5KM43NrH1GJa4M= github.com/ulikunitz/xz v0.5.8/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14= github.com/ulikunitz/xz v0.5.9/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14= github.com/ulikunitz/xz v0.5.10 h1:t92gobL9l3HE202wg3rlk19F6X+JOxl9BBrCCMYEYd8= github.com/ulikunitz/xz v0.5.10/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14= +github.com/ulikunitz/xz v0.5.12 h1:37Nm15o69RwBkXM0J6A5OlE67RZTfzUxTj8fB3dfcsc= +github.com/ulikunitz/xz v0.5.12/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14= github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8 h1:nIPpBwaJSVYIxUFsDv3M8ofmx9yWTog9BfvIu0q41lo= github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8/go.mod h1:HUYIGzjTL3rfEspMxjDjgmT5uz5wzYJKVo23qUhYTos= +github.com/xyproto/randomstring v1.0.5/go.mod h1:rgmS5DeNXLivK7YprL0pY+lTuhNQW3iGxZ18UQApw/E= github.com/youpy/go-riff v0.0.0-20131220112943-557d78c11efb h1:RDh7U5Di6o7fblIBe7rVi9KnrcOXUbLwvvLLdP2InSI= github.com/youpy/go-riff v0.0.0-20131220112943-557d78c11efb/go.mod h1:83nxdDV4Z9RzrTut9losK7ve4hUnxUR8ASSz4BsKXwQ= +github.com/youpy/go-riff v0.1.0 h1:vZO/37nI4tIET8tQI0Qn0Y79qQh99aEpponTPiPut7k= +github.com/youpy/go-riff v0.1.0/go.mod h1:83nxdDV4Z9RzrTut9losK7ve4hUnxUR8ASSz4BsKXwQ= github.com/youpy/go-wav v0.3.0 h1:ma20lCWmR/Y2P8tMpsRkbuawQ6d8+ckWaoOncEvMe0A= github.com/youpy/go-wav v0.3.0/go.mod h1:RqzyxsQMqUl31ygGi4W8YIQl5gbTXB4Al6slg/Zn2Ro= +github.com/youpy/go-wav v0.3.2 h1:NLM8L/7yZ0Bntadw/0h95OyUsen+DQIVf9gay+SUsMU= +github.com/youpy/go-wav v0.3.2/go.mod h1:0FCieAXAeSdcxFfwLpRuEo0PFmAoc+8NU34h7TUvk50= github.com/yuin/goldmark v1.4.0/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= github.com/zaf/g711 v0.0.0-20190814101024-76a4a538f52b h1:QqixIpc5WFIqTLxB3Hq8qs0qImAgBdq0p6rq2Qdl634= github.com/zaf/g711 v0.0.0-20190814101024-76a4a538f52b/go.mod h1:T2h1zV50R/q0CVYnsQOQ6L7P4a2ZxH47ixWcMXFGyx8= +github.com/zaf/g711 v1.4.0 h1:XZYkjjiAg9QTBnHqEg37m2I9q3IIDv5JRYXs2N8ma7c= +github.com/zaf/g711 v1.4.0/go.mod h1:eCDXt3dSp/kYYAoooba7ukD/Q75jvAaS4WOMr0l1Roo= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.36.0/go.mod h1:Y4J0ReaxCR1IMaabaSMugxJES1EpwhBHhv2bDHklZvc= golang.org/x/exp v0.0.0-20190731235908-ec7cb31e5a56/go.mod h1:JhuoJpWY28nO4Vef9tZUw9qufEGTyX1+7lmHxV5q5G4= +golang.org/x/exp/shiny v0.0.0-20230817173708-d852ddb80c63/go.mod h1:UH99kUObWAZkDnWqppdQe5ZhPYESUw8I0zVV1uWBR+0= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/image v0.0.0-20191009234506-e7c1f5e7dbb8/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/image v0.5.0 h1:5JMiNunQeQw++mMOz48/ISeNu3Iweh/JaZU8ZLqHRrI= golang.org/x/image v0.5.0/go.mod h1:FVC7BI/5Ym8R25iw5OLsgshdUBbT1h5jZTpA+mvAdZ4= +golang.org/x/image v0.25.0 h1:Y6uW6rH1y5y/LK1J8BPWZtr6yZ7hrsy6hFrXjgsc2fQ= +golang.org/x/image v0.25.0/go.mod h1:tCAmOEGthTtkalusGp1g3xa2gke8J6c2N565dTyl9Rs= golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= golang.org/x/mobile v0.0.0-20211207041440-4e6c2922fdee h1:/tShaw8UTf0XzI8DOZwQHzC7d6Vi3EtrBnftiZ4vAvU= golang.org/x/mobile v0.0.0-20211207041440-4e6c2922fdee/go.mod h1:pe2sM7Uk+2Su1y7u/6Z8KJ24D7lepUjFZbhFOrmDfuQ= +golang.org/x/mobile v0.0.0-20250305212854-3a7bc9f8a4de h1:WuckfUoaRGJfaQTPZvlmcaQwg4Xj9oS2cvvh3dUqpDo= +golang.org/x/mobile v0.0.0-20250305212854-3a7bc9f8a4de/go.mod h1:/IZuixag1ELW37+FftdmIt59/3esqpAWM/QqWtf7HUI= golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= +golang.org/x/mod v0.24.0/go.mod h1:IXM97Txy2VM4PJ3gI61r1YEk/gAj6zAHN3AdZt6S9Ww= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= +golang.org/x/net v0.37.0/go.mod h1:ivrbrMbzFq5J41QOQh0siUuly180yBYtLp+CKbEaFx8= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.12.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -115,18 +160,24 @@ golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.1.0 h1:kunALQeHf1/185U1i0GOB/fy1IPRDDpuoOOqRReG57U= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.31.0 h1:ioabZlmFYtWhL+TRYpcnNlLwhyxaM9kWTDEmfnprqik= +golang.org/x/sys v0.31.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= +golang.org/x/telemetry v0.0.0-20240521205824-bda55230c457/go.mod h1:pRgIJT+bRLFKnoM1ldnzKoxTIn14Yxz928LQRYYgIN0= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/term v0.30.0/go.mod h1:NYYFdzHoI5wRh/h5tDMdMqCqPJZEuNqVR5xJLd/n67g= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.23.0/go.mod h1:/BLNzu4aZCJ1+kcD0DNRotWKage4q2rGVAg4o22unh4= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.1.8-0.20211022200916-316ba0b74098/go.mod h1:LGqMHiF4EqQNHR1JncWGqT5BVaXmza+X+BDGol+dOxo= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= +golang.org/x/tools v0.31.0/go.mod h1:naFTU+Cev749tSJRXJlna0T3WxKvb1kWEx15xA4SdmQ= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -139,5 +190,6 @@ gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0 h1:hjy8E9ON/egN1tAYqKb61G10WtihqetD4sz2H+8nIeA= gopkg.in/yaml.v3 v3.0.0/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gotest.tools v2.2.0+incompatible h1:VsBPFP1AI068pPrMxtb/S8Zkgf9xEmTLJjfM+P5UIEo= gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw= From 9178f90a41e0d3b06bfe2a35933e90031863570a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Andr=C3=A9=20Santoni?= Date: Sun, 16 Mar 2025 14:44:44 +0100 Subject: [PATCH 51/52] Update go mod --- go.mod | 32 ----------------- go.sum | 106 +++------------------------------------------------------ 2 files changed, 4 insertions(+), 134 deletions(-) diff --git a/go.mod b/go.mod index 71e114cf..8ade5c63 100644 --- a/go.mod +++ b/go.mod @@ -8,7 +8,6 @@ require ( github.com/go-gl/gl v0.0.0-20231021071112-07e5d0ea2e71 github.com/go-gl/glfw/v3.3/glfw v0.0.0-20250301202403-da16c1255728 github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 - github.com/lucasb-eyer/go-colorful v1.2.0 github.com/mholt/archiver/v3 v3.5.1 github.com/pelletier/go-toml v1.9.5 github.com/tanema/gween v0.0.0-20221212145351-621cc8a459d1 @@ -18,50 +17,19 @@ require ( ) require ( - dmitri.shuralyov.com/gpu/mtl v0.0.0-20221208032759-85de2813cf6b // indirect - github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802 // indirect github.com/andybalholm/brotli v1.1.1 // indirect - github.com/creack/pty v1.1.9 // indirect - github.com/davecgh/go-spew v1.1.1 // indirect github.com/dsnet/compress v0.0.2-0.20210315054119-f66993602bf5 // indirect - github.com/dsnet/golib v0.0.0-20171103203638-1ea166775780 // indirect github.com/golang/snappy v1.0.0 // indirect github.com/google/go-cmp v0.6.0 // indirect - github.com/jezek/xgb v1.0.0 // indirect github.com/klauspost/compress v1.18.0 // indirect - github.com/klauspost/cpuid v1.2.0 // indirect github.com/klauspost/pgzip v1.2.6 // indirect - github.com/kr/pretty v0.2.1 // indirect - github.com/kr/pty v1.1.1 // indirect - github.com/kr/text v0.2.0 // indirect github.com/nwaples/rardecode v1.1.3 // indirect github.com/pierrec/lz4/v4 v4.1.22 // indirect - github.com/pkg/errors v0.9.1 // indirect - github.com/pmezard/go-difflib v1.0.0 // indirect - github.com/stretchr/objx v0.5.2 // indirect - github.com/stretchr/testify v1.9.0 // indirect github.com/ulikunitz/xz v0.5.12 // indirect github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8 // indirect - github.com/xyproto/randomstring v1.0.5 // indirect github.com/youpy/go-riff v0.1.0 // indirect - github.com/yuin/goldmark v1.4.13 // indirect github.com/zaf/g711 v1.4.0 // indirect - golang.org/x/crypto v0.36.0 // indirect - golang.org/x/exp v0.0.0-20190731235908-ec7cb31e5a56 // indirect - golang.org/x/exp/shiny v0.0.0-20230817173708-d852ddb80c63 // indirect - golang.org/x/mod v0.24.0 // indirect - golang.org/x/net v0.37.0 // indirect - golang.org/x/sync v0.12.0 // indirect golang.org/x/sys v0.31.0 // indirect - golang.org/x/telemetry v0.0.0-20240521205824-bda55230c457 // indirect - golang.org/x/term v0.30.0 // indirect - golang.org/x/text v0.23.0 // indirect - golang.org/x/tools v0.31.0 // indirect - golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect - gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect - gopkg.in/yaml.v2 v2.2.2 // indirect - gopkg.in/yaml.v3 v3.0.1 // indirect - gotest.tools v2.2.0+incompatible // indirect ) go 1.23.0 diff --git a/go.sum b/go.sum index 07b644fd..a440379d 100644 --- a/go.sum +++ b/go.sum @@ -1,12 +1,6 @@ -dmitri.shuralyov.com/gpu/mtl v0.0.0-20221208032759-85de2813cf6b/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= -github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= -github.com/adrg/xdg v0.4.0 h1:RzRqFcjH4nE5C6oTAxhBtoE2IRyjBSa62SCbyPidvls= -github.com/adrg/xdg v0.4.0/go.mod h1:N6ag73EX4wyxeaoeHctc1mas01KZgsj5tYiAIwqJE/E= github.com/adrg/xdg v0.5.3 h1:xRnxJXne7+oWDatRhR1JLnvuccuIeCoBu2rtuLqQB78= github.com/adrg/xdg v0.5.3/go.mod h1:nlTsY+NNiCBGCK2tpm09vRqfVzrc2fLmXGpBLF0zlTQ= github.com/andybalholm/brotli v1.0.1/go.mod h1:loMXtMfwqflxFJPmdbJO0a3KNoPuLBgiu3qAvBg8x/Y= -github.com/andybalholm/brotli v1.0.4 h1:V7DdXeJtZscaqfNuAdSRuRFzuiKlHSC/Zh3zl9qY3JY= -github.com/andybalholm/brotli v1.0.4/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHGRSepvi9Eig= github.com/andybalholm/brotli v1.1.1 h1:PR2pgnyFznKEugtsUo0xLdDop5SKXd5Qf5ysW+7XdTA= github.com/andybalholm/brotli v1.1.1/go.mod h1:05ib4cKhjx3OQYUY22hTVd34Bc8upXjOLL2rKwwZBoA= github.com/cavaliercoder/grab v2.0.0+incompatible h1:wZHbBQx56+Yxjx2TCGDcenhh3cJn7cCLMfkEPmySTSE= @@ -21,57 +15,35 @@ github.com/dsnet/compress v0.0.2-0.20210315054119-f66993602bf5/go.mod h1:qssHWj6 github.com/dsnet/golib v0.0.0-20171103203638-1ea166775780/go.mod h1:Lj+Z9rebOhdfkVLjJ8T6VcRQv3SXugXy999NBtR9aFY= github.com/fatih/structs v1.1.0 h1:Q7juDM0QtcnhCpeyLGQKyg4TOIghuNXrkL32pHAUMxo= github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M= -github.com/go-gl/gl v0.0.0-20211210172815-726fda9656d6 h1:zDw5v7qm4yH7N8C8uWd+8Ii9rROdgWxQuGoJ9WDXxfk= -github.com/go-gl/gl v0.0.0-20211210172815-726fda9656d6/go.mod h1:9YTyiznxEY1fVinfM7RvRcjRHbw2xLBJ3AAGIT0I4Nw= github.com/go-gl/gl v0.0.0-20231021071112-07e5d0ea2e71 h1:5BVwOaUSBTlVZowGO6VZGw2H/zl9nrd3eCZfYV+NfQA= github.com/go-gl/gl v0.0.0-20231021071112-07e5d0ea2e71/go.mod h1:9YTyiznxEY1fVinfM7RvRcjRHbw2xLBJ3AAGIT0I4Nw= -github.com/go-gl/glfw/v3.3/glfw v0.0.0-20221017161538-93cebf72946b h1:GgabKamyOYguHqHjSkDACcgoPIz3w0Dis/zJ1wyHHHU= -github.com/go-gl/glfw/v3.3/glfw v0.0.0-20221017161538-93cebf72946b/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20250301202403-da16c1255728 h1:RkGhqHxEVAvPM0/R+8g7XRwQnHatO0KAuVcwHo8q9W8= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20250301202403-da16c1255728/go.mod h1:SyRD8YfuKk+ZXlDqYiqe1qMSqjNgtHzBTG810KUagMc= github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 h1:DACJavvAHhabrF08vX0COfcOBJRhZ8lUbR+ZWIs0Y5g= github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGwJL78qG/PmXZO1EjYhfJinVAhrmmHX6Z8B9k= github.com/golang/snappy v0.0.2/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= -github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v1.0.0 h1:Oy607GVXHs7RtbggtPBnr2RmDArIsAefDwvrdWvRhGs= github.com/golang/snappy v1.0.0/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -github.com/jezek/xgb v1.0.0/go.mod h1:nrhwO0FX/enq75I7Y7G8iN1ubpSGZEiA3v9e9GyRFlk= github.com/klauspost/compress v1.4.1/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= github.com/klauspost/compress v1.11.4/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= -github.com/klauspost/compress v1.13.6 h1:P76CopJELS0TiO2mebmnzgWaajssP/EszplttgQxcgc= -github.com/klauspost/compress v1.13.6/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= github.com/klauspost/compress v1.18.0 h1:c/Cqfb0r+Yi+JtIEq73FWXVkRonBlf0CRNYc8Zttxdo= github.com/klauspost/compress v1.18.0/go.mod h1:2Pp+KzxcywXVXMr50+X0Q/Lsb43OQHYWRCY2AiWywWQ= github.com/klauspost/cpuid v1.2.0/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek= github.com/klauspost/pgzip v1.2.5/go.mod h1:Ch1tH69qFZu15pkjo5kYi6mth2Zzwzt50oCQKQE9RUs= github.com/klauspost/pgzip v1.2.6 h1:8RXeL5crjEUFnR2/Sn6GJNWtSQ3Dk8pq4CL3jvdDyjU= github.com/klauspost/pgzip v1.2.6/go.mod h1:Ch1tH69qFZu15pkjo5kYi6mth2Zzwzt50oCQKQE9RUs= -github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI= -github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= -github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/lucasb-eyer/go-colorful v1.2.0 h1:1nnpGOrhyZZuNyfu1QjKiUICQ74+3FNCN69Aj6K7nkY= -github.com/lucasb-eyer/go-colorful v1.2.0/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0= github.com/mholt/archiver/v3 v3.5.1 h1:rDjOBX9JSF5BvoJGvjqK479aL70qh9DIpZCl+k7Clwo= github.com/mholt/archiver/v3 v3.5.1/go.mod h1:e3dqJ7H78uzsRSEACH1joayhuSyhnonssnDhppzS1L4= github.com/nwaples/rardecode v1.1.0/go.mod h1:5DzqNKiOdpKKBH87u8VlvAnPZMXcGRhxWkRpHbbfGS0= -github.com/nwaples/rardecode v1.1.2 h1:Cj0yZY6T1Zx1R7AhTbyGSALm44/Mmq+BAPc4B/p/d3M= -github.com/nwaples/rardecode v1.1.2/go.mod h1:5DzqNKiOdpKKBH87u8VlvAnPZMXcGRhxWkRpHbbfGS0= github.com/nwaples/rardecode v1.1.3 h1:cWCaZwfM5H7nAD6PyEdcVnczzV8i/JtotnyW/dD9lEc= github.com/nwaples/rardecode v1.1.3/go.mod h1:5DzqNKiOdpKKBH87u8VlvAnPZMXcGRhxWkRpHbbfGS0= -github.com/pelletier/go-toml v1.9.4 h1:tjENF6MfZAg8e4ZmZTeWaWiT2vXtsoO6+iuOjFhECwM= -github.com/pelletier/go-toml v1.9.4/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8= github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= github.com/pierrec/lz4/v4 v4.1.2/go.mod h1:gZWDp/Ze/IJXGXf23ltt2EXimqmTUXEy0GFuRQyBid4= -github.com/pierrec/lz4/v4 v4.1.12 h1:44l88ehTZAUGW4VlO1QC4zkilL99M6Y9MXNwEs0uzP8= -github.com/pierrec/lz4/v4 v4.1.12/go.mod h1:gZWDp/Ze/IJXGXf23ltt2EXimqmTUXEy0GFuRQyBid4= github.com/pierrec/lz4/v4 v4.1.22 h1:cKFw6uJDK+/gfw5BcDL0JL5aBsAFdsIT18eRtLj7VIU= github.com/pierrec/lz4/v4 v4.1.22/go.mod h1:gZWDp/Ze/IJXGXf23ltt2EXimqmTUXEy0GFuRQyBid4= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= @@ -79,110 +51,40 @@ github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= -github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= -github.com/tanema/gween v0.0.0-20200427131925-c89ae23cc63c h1:rZz/p7IbahA51/dieoBBfzTgkTX9C8QFrTgkMh64Khg= -github.com/tanema/gween v0.0.0-20200427131925-c89ae23cc63c/go.mod h1:XXpz+9IVhUY5vTC5gXRNSjLDVwQWa5KM43NrH1GJa4M= github.com/tanema/gween v0.0.0-20221212145351-621cc8a459d1 h1:s2Tn3G6rP4VljC5XDN6hARqXogkhr3k/jAsTqawSN5U= github.com/tanema/gween v0.0.0-20221212145351-621cc8a459d1/go.mod h1:XXpz+9IVhUY5vTC5gXRNSjLDVwQWa5KM43NrH1GJa4M= github.com/ulikunitz/xz v0.5.8/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14= github.com/ulikunitz/xz v0.5.9/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14= -github.com/ulikunitz/xz v0.5.10 h1:t92gobL9l3HE202wg3rlk19F6X+JOxl9BBrCCMYEYd8= -github.com/ulikunitz/xz v0.5.10/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14= github.com/ulikunitz/xz v0.5.12 h1:37Nm15o69RwBkXM0J6A5OlE67RZTfzUxTj8fB3dfcsc= github.com/ulikunitz/xz v0.5.12/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14= github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8 h1:nIPpBwaJSVYIxUFsDv3M8ofmx9yWTog9BfvIu0q41lo= github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8/go.mod h1:HUYIGzjTL3rfEspMxjDjgmT5uz5wzYJKVo23qUhYTos= +github.com/xyproto/randomstring v1.0.5 h1:YtlWPoRdgMu3NZtP45drfy1GKoojuR7hmRcnhZqKjWU= github.com/xyproto/randomstring v1.0.5/go.mod h1:rgmS5DeNXLivK7YprL0pY+lTuhNQW3iGxZ18UQApw/E= -github.com/youpy/go-riff v0.0.0-20131220112943-557d78c11efb h1:RDh7U5Di6o7fblIBe7rVi9KnrcOXUbLwvvLLdP2InSI= -github.com/youpy/go-riff v0.0.0-20131220112943-557d78c11efb/go.mod h1:83nxdDV4Z9RzrTut9losK7ve4hUnxUR8ASSz4BsKXwQ= github.com/youpy/go-riff v0.1.0 h1:vZO/37nI4tIET8tQI0Qn0Y79qQh99aEpponTPiPut7k= github.com/youpy/go-riff v0.1.0/go.mod h1:83nxdDV4Z9RzrTut9losK7ve4hUnxUR8ASSz4BsKXwQ= -github.com/youpy/go-wav v0.3.0 h1:ma20lCWmR/Y2P8tMpsRkbuawQ6d8+ckWaoOncEvMe0A= -github.com/youpy/go-wav v0.3.0/go.mod h1:RqzyxsQMqUl31ygGi4W8YIQl5gbTXB4Al6slg/Zn2Ro= github.com/youpy/go-wav v0.3.2 h1:NLM8L/7yZ0Bntadw/0h95OyUsen+DQIVf9gay+SUsMU= github.com/youpy/go-wav v0.3.2/go.mod h1:0FCieAXAeSdcxFfwLpRuEo0PFmAoc+8NU34h7TUvk50= -github.com/yuin/goldmark v1.4.0/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= -github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= -github.com/zaf/g711 v0.0.0-20190814101024-76a4a538f52b h1:QqixIpc5WFIqTLxB3Hq8qs0qImAgBdq0p6rq2Qdl634= github.com/zaf/g711 v0.0.0-20190814101024-76a4a538f52b/go.mod h1:T2h1zV50R/q0CVYnsQOQ6L7P4a2ZxH47ixWcMXFGyx8= github.com/zaf/g711 v1.4.0 h1:XZYkjjiAg9QTBnHqEg37m2I9q3IIDv5JRYXs2N8ma7c= github.com/zaf/g711 v1.4.0/go.mod h1:eCDXt3dSp/kYYAoooba7ukD/Q75jvAaS4WOMr0l1Roo= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.36.0/go.mod h1:Y4J0ReaxCR1IMaabaSMugxJES1EpwhBHhv2bDHklZvc= -golang.org/x/exp v0.0.0-20190731235908-ec7cb31e5a56/go.mod h1:JhuoJpWY28nO4Vef9tZUw9qufEGTyX1+7lmHxV5q5G4= -golang.org/x/exp/shiny v0.0.0-20230817173708-d852ddb80c63/go.mod h1:UH99kUObWAZkDnWqppdQe5ZhPYESUw8I0zVV1uWBR+0= -golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= -golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/image v0.0.0-20191009234506-e7c1f5e7dbb8/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= -golang.org/x/image v0.5.0 h1:5JMiNunQeQw++mMOz48/ISeNu3Iweh/JaZU8ZLqHRrI= -golang.org/x/image v0.5.0/go.mod h1:FVC7BI/5Ym8R25iw5OLsgshdUBbT1h5jZTpA+mvAdZ4= golang.org/x/image v0.25.0 h1:Y6uW6rH1y5y/LK1J8BPWZtr6yZ7hrsy6hFrXjgsc2fQ= golang.org/x/image v0.25.0/go.mod h1:tCAmOEGthTtkalusGp1g3xa2gke8J6c2N565dTyl9Rs= -golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= -golang.org/x/mobile v0.0.0-20211207041440-4e6c2922fdee h1:/tShaw8UTf0XzI8DOZwQHzC7d6Vi3EtrBnftiZ4vAvU= -golang.org/x/mobile v0.0.0-20211207041440-4e6c2922fdee/go.mod h1:pe2sM7Uk+2Su1y7u/6Z8KJ24D7lepUjFZbhFOrmDfuQ= golang.org/x/mobile v0.0.0-20250305212854-3a7bc9f8a4de h1:WuckfUoaRGJfaQTPZvlmcaQwg4Xj9oS2cvvh3dUqpDo= golang.org/x/mobile v0.0.0-20250305212854-3a7bc9f8a4de/go.mod h1:/IZuixag1ELW37+FftdmIt59/3esqpAWM/QqWtf7HUI= -golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= -golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= -golang.org/x/mod v0.24.0/go.mod h1:IXM97Txy2VM4PJ3gI61r1YEk/gAj6zAHN3AdZt6S9Ww= -golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.37.0/go.mod h1:ivrbrMbzFq5J41QOQh0siUuly180yBYtLp+CKbEaFx8= -golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.12.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20211025201205-69cdffdb9359/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.1.0 h1:kunALQeHf1/185U1i0GOB/fy1IPRDDpuoOOqRReG57U= -golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.31.0 h1:ioabZlmFYtWhL+TRYpcnNlLwhyxaM9kWTDEmfnprqik= golang.org/x/sys v0.31.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= -golang.org/x/telemetry v0.0.0-20240521205824-bda55230c457/go.mod h1:pRgIJT+bRLFKnoM1ldnzKoxTIn14Yxz928LQRYYgIN0= -golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/term v0.30.0/go.mod h1:NYYFdzHoI5wRh/h5tDMdMqCqPJZEuNqVR5xJLd/n67g= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.23.0/go.mod h1:/BLNzu4aZCJ1+kcD0DNRotWKage4q2rGVAg4o22unh4= -golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.1.8-0.20211022200916-316ba0b74098/go.mod h1:LGqMHiF4EqQNHR1JncWGqT5BVaXmza+X+BDGol+dOxo= -golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= -golang.org/x/tools v0.31.0/go.mod h1:naFTU+Cev749tSJRXJlna0T3WxKvb1kWEx15xA4SdmQ= -golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0 h1:hjy8E9ON/egN1tAYqKb61G10WtihqetD4sz2H+8nIeA= -gopkg.in/yaml.v3 v3.0.0/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gotest.tools v2.2.0+incompatible h1:VsBPFP1AI068pPrMxtb/S8Zkgf9xEmTLJjfM+P5UIEo= gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw= From 5a80f6849af18399a01168545952943783a3255f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Andr=C3=A9=20Santoni?= Date: Sun, 16 Mar 2025 14:51:52 +0100 Subject: [PATCH 52/52] Clean --- menu/scene_playlist.go | 4 ---- 1 file changed, 4 deletions(-) diff --git a/menu/scene_playlist.go b/menu/scene_playlist.go index a6411cdb..0e17bb27 100644 --- a/menu/scene_playlist.go +++ b/menu/scene_playlist.go @@ -14,10 +14,6 @@ import ( "github.com/libretro/ludo/state" ) -type scenePlaylist struct { - entry -} - /* func buildPlaylist(path string) Scene { var list scenePlaylist