Attract-Mode Support > Scripting
System List possible?
dukpoki:
Quick question.
I know you can add a game list with fe.add_listbox() but is there a way to add a system list? Alternatively request the name of a previous system or next system with an offset value? I'm trying to create a theme where you use up and down to swap between games and then left and right to swap between systems i.e. a dual list.
here's an example of what i'm trying to do:
So in the pic, it will show the 2 prev systems and the 2 next systems on screen. Pressing right would shift "Saturn" to the center arrow cursor and the list will refresh with an updated 2 prev and 2 next systems.
kent79:
You may refer my theme. It is similar you want :)
http://forum.attractmode.org/index.php?topic=2211.0
qqplayer:
--- Quote from: kent79 on May 15, 2018, 10:24:29 AM ---You may refer my theme. It is similar you want :)
http://forum.attractmode.org/index.php?topic=2211.0
--- End quote ---
Awesome I was "trying" to make something like this.
Thank you so much for the code ;)
I have used the Mini nes theme code from BJose
--- Code: ---//Bjose MiniNES Code
local console = fe.list.name;
fe.add_transition_callback(this, "logo_settings");
function logo_settings(ttype, var, ttime) {
local last_console = console;
switch( ttype)
{
case Transition.ToNewList:
case Transition.StartLayout:
//case Transition.FromOldSelection:
console = fe.list.name;
if (last_console != console)
{
fe.signal("reload");
}
break;
default:
console = fe.list.name;
}
return false;
}
switch ( fe.list.name )
{
case "Super Nintendo Entertainment System":
//snestext
local snessystem = "SNES";
local snestext = fe.add_text( snessystem, flx*0.08, fly*0.053, flw*0.48, flh*0.028 );
snestext.alpha = 255;
snestext.align = Align.Left;
snestext.set_rgb( 255, 255, 255 );
snestext.font = "CODE";
snestext.charsize = 30;
snestext.style = Style.Bold;
local snesunderline_system_image = fe.add_image("images/underline_system.png", 122, 70, 70, 5);
break;
case "Nintendo Entertainment System":
//nestext
local nessystem = "NES";
local nestext = fe.add_text( nessystem, flx*0.08, fly*0.053, flw*0.48, flh*0.028 );
nestext.alpha = 255;
nestext.align = Align.Left;
nestext.set_rgb( 255, 255, 255 );
nestext.font = "CODE";
nestext.charsize = 30;
nestext.style = Style.Bold;
local nesunderline_system_image = fe.add_image("images/underline_system.png", 118, 70, 60, 5);
break;
}
/*local prevsystem = fe.add_text( "[DisplayName]", flx*0.18, fly*0.053, flw*0.48, flh*0.028 );
prevsystem.alpha = 255;
prevsystem.align = Align.Left;
prevsystem.set_rgb( 255, 255, 255 );
prevsystem.font = "CODE";
prevsystem.charsize = 30;
prevsystem.style = Style.Bold;
prevsystem.index_offset = -1;*/
--- End code ---
But I was stucked creating a systems list.
qqplayer:
@kent79 I want to make something like this "system underlined slector"
Can you help me with the code?
Just for the system selected underlined ,I mean ;)
kent79:
I have revised the script to make a sample. You may try it. :)
--- Code: ---local ui_filters=[];
local ui_underline=[];
// System
for ( local i = 0; i < fe.displays.len(); i++ ) {
local filter = fe.displays[i];
local shortname = filter.name.toupper();
local offset = 55 * i;
switch(filter.name) {
//prefer known abbreviations
case "Sega Model 2":
shortname = "SM2";
break;
case "Sega Model 3":
shortname = "SM3";
break;
case "Sega Naomi":
shortname = "NAO";
break;
//grab the first three letters as the short name
default:
if (shortname.len() > 3)
shortname = shortname.slice(0, 3);
break;
}
local newfilt = fe.add_text(shortname, -18 + offset, 1, 73, 18);
newfilt.set_rgb( 240, 240, 240 );
local underline = fe.add_image("white.png", -18 + offset, 20, 60, 3);
underline.set_rgb( 240, 0, 0 );
underline.visible = false ;
if (i == fe.list.display_index)
underline.visible = true;
ui_filters.push(newfilt);
ui_underline.push(underline);
}
fe.add_transition_callback( this, "on_transition" );
function on_transition( ttype, var, ttime )
{
//Update filter highlight
for ( local i = 0; i < ui_underline.len(); i++ )
ui_underline[i].visible = false;
ui_underline[fe.list.display_index].visible = true;
}
--- End code ---
Navigation
[0] Message Index
[#] Next page
Go to full version