@@ -25,27 +25,30 @@ type entry struct {
2525 yp , scale float32
2626 width float32
2727 label , subLabel string
28- path string
28+ path string // full path of the rom linked to the entry
2929 labelAlpha float32
3030 icon string
3131 iconAlpha float32
3232 tagAlpha float32
33- ptr int
34- callbackOK func ()
33+ callbackOK func () // callback executed when user presses OK
3534 value func () interface {}
3635 stringValue func () string
37- widget func (* entry )
38- incr func (int )
39- tags []string
36+ widget func (* entry ) // widget draw callback used in settings
37+ incr func (int ) // increment callback used in settings
38+ tags []string // flags extracted from game title
39+ thumbnail uint32 // thumbnail texture id
40+ gameName string // title of the game in db, used for thumbnails
4041 cursor struct {
4142 alpha float32
4243 yp float32
4344 }
44- children []entry
45+ children []entry // children entries
46+ ptr int // index of the active child
4547}
4648
4749// Scene represents a page of the UI
48- // A Scene is typically an entry displaying its own children
50+ // A scene is typically an entry displaying its own children
51+ // A segue is a smooth transition between two scenes.
4952type Scene interface {
5053 segueMount ()
5154 segueNext ()
@@ -98,8 +101,8 @@ func Render() {
98101
99102 menu := menu .stack [i ]
100103 menu .render ()
101- menu .drawHintBar ()
102104 }
105+ menu .stack [currentScreenIndex ].drawHintBar ()
103106}
104107
105108func genericDrawHintBar () {
@@ -141,7 +144,7 @@ func genericSegueMount(list *entry) {
141144 e .labelAlpha = 0
142145 e .iconAlpha = 0
143146 e .tagAlpha = 1
144- e .scale = 0 .5
147+ e .scale = 1 .5
145148 } else if i < list .ptr {
146149 e .yp = 0.4 + 0.3 + 0.08 * float32 (i - list .ptr )
147150 e .labelAlpha = 0
@@ -173,7 +176,7 @@ func genericAnimate(list *entry) {
173176 labelAlpha = 1
174177 iconAlpha = 1
175178 tagAlpha = 1
176- scale = 0 .5
179+ scale = 1 .5
177180 } else if i < list .ptr {
178181 yp = 0.4 + 0.08 * float32 (i - list .ptr )
179182 labelAlpha = 0.75
@@ -204,32 +207,32 @@ func genericSegueNext(list *entry) {
204207 for i := range list .children {
205208 e := & list .children [i ]
206209
207- var yp , labelAlpha , iconAlpha , tagAlpha , s float32
210+ var yp , labelAlpha , iconAlpha , tagAlpha , scale float32
208211 if i == list .ptr {
209212 yp = 0.5 - 0.3
210213 labelAlpha = 0
211214 iconAlpha = 0
212215 tagAlpha = 1
213- s = 1.0
216+ scale = 1.5
214217 } else if i < list .ptr {
215218 yp = 0.4 - 0.3 + 0.08 * float32 (i - list .ptr )
216219 labelAlpha = 0
217220 iconAlpha = 0
218221 tagAlpha = 0
219- s = 0.5
222+ scale = 0.5
220223 } else if i > list .ptr {
221224 yp = 0.6 - 0.3 + 0.08 * float32 (i - list .ptr )
222225 labelAlpha = 0
223226 iconAlpha = 0
224227 tagAlpha = 0
225- s = 0.5
228+ scale = 0.5
226229 }
227230
228231 menu .tweens [& e .yp ] = gween .New (e .yp , yp , 0.15 , ease .OutSine )
229232 menu .tweens [& e .labelAlpha ] = gween .New (e .labelAlpha , labelAlpha , 0.15 , ease .OutSine )
230233 menu .tweens [& e .iconAlpha ] = gween .New (e .iconAlpha , iconAlpha , 0.15 , ease .OutSine )
231234 menu .tweens [& e .tagAlpha ] = gween .New (e .tagAlpha , tagAlpha , 0.15 , ease .OutSine )
232- menu .tweens [& e .scale ] = gween .New (e .scale , s , 0.15 , ease .OutSine )
235+ menu .tweens [& e .scale ] = gween .New (e .scale , scale , 0.15 , ease .OutSine )
233236 }
234237 menu .tweens [& list .cursor .alpha ] = gween .New (list .cursor .alpha , 0 , 0.15 , ease .OutSine )
235238 menu .tweens [& list .cursor .yp ] = gween .New (list .cursor .yp , 0.5 - 0.3 , 0.15 , ease .OutSine )
@@ -272,26 +275,26 @@ func genericRender(list *entry) {
272275 }
273276
274277 vid .DrawImage (menu .icons [e .icon ],
275- 610 * menu .ratio - 64 * e . scale * menu .ratio ,
276- float32 (h )* e .yp - 14 * menu .ratio - 64 * e . scale * menu .ratio + fontOffset ,
278+ 610 * menu .ratio - 64 * 0.5 * menu .ratio ,
279+ float32 (h )* e .yp - 14 * menu .ratio - 64 * 0.5 * menu .ratio + fontOffset ,
277280 128 * menu .ratio , 128 * menu .ratio ,
278- e . scale , color )
281+ 0.5 , color )
279282
280283 if e .labelAlpha > 0 {
281284 vid .Font .SetColor (color .R , color .G , color .B , e .labelAlpha )
282285 vid .Font .Printf (
283286 670 * menu .ratio ,
284287 float32 (h )* e .yp + fontOffset ,
285- 0.7 * menu .ratio , e .label )
288+ 0.6 * menu .ratio , e .label )
286289
287290 if e .widget != nil {
288291 e .widget (& e )
289292 } else if e .stringValue != nil {
290- lw := vid .Font .Width (0.7 * menu .ratio , e .stringValue ())
293+ lw := vid .Font .Width (0.6 * menu .ratio , e .stringValue ())
291294 vid .Font .Printf (
292295 float32 (w )- lw - 128 * menu .ratio ,
293296 float32 (h )* e .yp + fontOffset ,
294- 0.7 * menu .ratio , e .stringValue ())
297+ 0.6 * menu .ratio , e .stringValue ())
295298 }
296299 }
297300 }
@@ -313,6 +316,12 @@ func (menu *Menu) ContextReset() {
313316 filename := utils .Filename (path )
314317 menu .icons [filename ] = video .NewImage ("assets/flags/" + filename + ".png" )
315318 }
319+
320+ currentScreenIndex := len (menu .stack ) - 1
321+ curList := menu .stack [currentScreenIndex ].Entry ()
322+ for i := range curList .children {
323+ curList .children [i ].thumbnail = 0
324+ }
316325}
317326
318327// fastForwardTweens finishes all the current animations in the queue.
0 commit comments