Super minimal 8-bit feel list menu (if you use the same font, that is)
// Layout by cools / Arcade Otaku
// Layout User Options
class UserConfig {
</ label="Preview Image", help="Choose snap/video snap, title, flyer or none.", options="snap,video,title,flyer,none" /> preview_image = "snap";
</ label="Controls", help="Left & right selects the next/previous list or selects the filter?", options="list,filter,none" /> controls = "filter";
}
local my_config = fe.get_config();
// Colour cycle code from LukeNukem
cycleVTable <-{
"cnListPinch" : 0, "swListPinch" : 0, "wkListPinch" : 0,
"cnListRed" : 0, "swListRed" : 0, "wkListRed" : 0,
"cnListGreen" : 0, "swListGreen" : 0, "wkListGreen" : 0,
"cnListBlue" : 0, "swListBlue" : 0, "wkListBlue" : 0,
}
function cycleValue( ttime, counter, switcher, workValue, minV, maxV, BY, speed ) {
if (cycleVTable[counter] == 0)
cycleVTable[counter] = ttime;
////////////// 1000 = 1 second //////////////
if (ttime - cycleVTable[counter] > speed){
if (cycleVTable[switcher]==0){
cycleVTable[workValue] += BY;
if (cycleVTable[workValue] >= maxV)
cycleVTable[switcher] = 1;
}
else
if (cycleVTable[switcher]==1){
cycleVTable[workValue] -= BY;
if (cycleVTable[workValue] <= minV)
cycleVTable[switcher] = 0;
}
cycleVTable[counter] = 0;
}
return cycleVTable[workValue];
}
// Layout Constants
// Font found on 9031.com
fe.layout.font="Arcade-Regular"
local flw=fe.layout.width;
local flh=fe.layout.height;
local rot=(fe.layout.base_rotation+fe.layout.toggle_rotation)%4;
switch (rot) {
case RotateScreen.Right:
case RotateScreen.Left:
fe.layout.width=flh;
fe.layout.height=flw;
flw=fe.layout.width;
flh=fe.layout.height;
break;
}
// List
local lbx=flw*0.01; // Listbox X position
local lby=flh*0.6; // Listbox Y position
local lbw=flw*0.98; // Listbox width
local lbh=(flh-lby-(flh*0.1)); // Listbox height
local itn=12; // Listbox entries
local ith=lbh/itn; // Listbox entry height
lby+=(ith*(itn/2)); // Listbox draw point - do not change
local lbr=255; // Listbox red
local lbg=255; // Listbox green
local lbb=128; // Listbox blue
local lbf=0.96; // Listbox colour fade. Lower values = less fade.
local textsurface=fe.add_surface(flw,flh);
for (local i=(itn/2)*-1;i<=(itn/2);i+=1){
if (i==0) {
}
else {
local unselgame=textsurface.add_text("[Title]",lbx,lby+(ith*i),lbw,ith*0.7);
unselgame.index_offset=i;
if (i<0) {unselgame.alpha=255-((i*(255/(itn/2))*-1)*lbf);}
else {unselgame.alpha=255-(i*(255/(itn/2))*lbf);}
// Fades colour rather than alpha
//if (i<0) {unselgame.set_rgb( lbr-((i*(lbr/(itn/2))*-1)*lbf) , lbg-((i*(lbg/(itn/2))*-1)*lbf) , lbb-((i*(lbb/(itn/2))*-1)*lbf) );}
//else {unselgame.set_rgb( lbr-(i*(lbr/(itn/2))*lbf) , lbg-(i*(lbg/(itn/2))*lbf) , lbb-(i*(lbb/(itn/2))*lbf) );}
}
}
// Texts
local ary=0-flh;
switch (my_config["controls"]) {
case "list":
ary=flh*0.01;
break;
case "filter":
ary=flh*0.06;
}
local arrowleft=textsurface.add_text("<",flw*0.02,ary,flw*0.96,flh*0.04);
arrowleft.align=Align.Left;
local arrowright=textsurface.add_text(">",flw*0.02,ary,flw*0.96,flh*0.04);
arrowright.align=Align.Right;
local listtitle=fe.add_text("[ListTitle]",flw*0.02,flh*0.01,flw*0.96,flh*0.04);
local filtername=textsurface.add_text("[ListFilterName]",flw*0.02,flh*0.06,flw*0.96,flh*0.04);
local selgame=fe.add_text("[Title]",lbx,lby-((ith*1.2)/4),lbw,ith*1.2);
local manufacturer=fe.add_text("© [Manufacturer]",flw*0.02,flh*0.90,flw*0.96,flh*0.04);
local year=textsurface.add_text("[Year]",flw*0.02,flh*0.95,flw*0.96,flh*0.04);
// Preview image
local preview=fe.add_artwork(my_config["preview_image"],0,flh*0.125,flw,flh*0.5);
preview.preserve_aspect_ratio = true;
fe.add_ticks_callback( "textTickles" );
function textTickles( ttime ) {
local RED = cycleValue(ttime,"cnListRed","swListRed","wkListRed",100,254,1,1);
local GREEN = cycleValue(ttime,"cnListGreen","swListGreen","wkListGreen",100,254,1.5,1);
local BLUE = cycleValue(ttime,"cnListBlue","swListBlue","wkListBlue",100,254,2,1);
textsurface.set_rgb(RED, GREEN, BLUE);
}