Author Topic: advanced progres bar  (Read 28951 times)

jedione

  • Hero Member
  • *****
  • Posts: 1135
  • punktoe
    • View Profile
advanced progres bar
« on: April 11, 2019, 07:19:29 PM »
retro fe ,,,,has it   

launch box has it...

apparently,  we have seen it in AM ,,,,  Oomek,s layout....that will never come to be..


would anyone like to give it a tackle....  i would love to try to help...

dont we deserve to on this level guys.... :D



thanks..
help a friend....

zpaolo11x

  • Hero Member
  • *****
  • Posts: 1245
    • View Profile
    • My deviantart page
Re: advanced progres bar
« Reply #1 on: April 11, 2019, 11:25:13 PM »
Hmm I never implemented it in Arcadeflow because I don't want it to look too much like Oomek's work, but considering that I already have code to extract first letter, or decade in case the sorting is by year, or genre if the sorting is by genre, I can try and craft some simple layout using this. Some ideas from the keyboard search plugin might be useful for laying out the letters and highlighting them...

I'm not sure I'll have the time, but I'll see if I can come up with something.

zpaolo11x

  • Hero Member
  • *****
  • Posts: 1245
    • View Profile
    • My deviantart page
Re: advanced progres bar
« Reply #2 on: April 12, 2019, 03:16:43 AM »
So this is the quick and dirty solution I built, based on my "gameletter" routine. Consider that my routine works for different sortings, but this layout only works if the sorting is not by category, manufacturer or year. If you want to expand it to work with all this sortings you should change the key array accordingly

Code: [Select]
function gameletter( offset ) {
   if (fe.filters.len() > 0){

      if (fe.filters[fe.list.filter_index].sort_by == Info.Year){
         local s = fe.game_info( Info.Year, offset )
         return s
      }
      else if (fe.filters[fe.list.filter_index].sort_by == Info.Manufacturer){
         local s = fe.game_info( Info.Manufacturer, offset )
         return s.slice(0,1)
      }
      else if (fe.filters[fe.list.filter_index].sort_by == Info.Category){
         local s = fe.game_info( Info.Category, offset )
         if (s == "") return "?"
         s = split( s, "/" )
         return strip(s[0])
         }
      else {
         local s = fe.game_info( Info.Title, offset )
         if (s.find("The ") == 0) s = s.slice(4,s.len())
         local s2 = s.slice(0,1)
         if ("1234567890".find (s2) != null ){
            s2="#"
         }
         return s2
      }
   }
}


local flw = fe.layout.width
local flh = fe.layout.height
local gamename = fe.add_text("[Title]",0,0,flw,flh/10)
gamename.charsize = gamename.height*0.5

local accent = fe.add_text ("[!gameletter]",0,flh*0.5,flw,flh*0.25)
accent.charsize = flh*0.25

local keys = null
keys = {}
local i = 0
local key_names = [ "#", "A", "B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"]
foreach (key, val in key_names){
   local key_obj = fe.add_text(val, i*flw/key_names.len(),flh*0.5,flw/key_names.len(),50)
   key_obj.charsize = 50
   key_obj.alpha = 128
   i++
   keys[val] <- key_obj
}

keys [gameletter(0)].alpha = 255

fe.add_transition_callback( this, "on_transition" )

function on_transition( ttype, var, ttime ) {

if (ttype == Transition.ToNewSelection){
   local l1 = gameletter(0)
   local l2 = gameletter(var)

   if (l1 != l2){
      keys [l1].alpha = 128
      keys [l2].alpha = 255
   }
}

}

jedione

  • Hero Member
  • *****
  • Posts: 1135
  • punktoe
    • View Profile
Re: advanced progres bar
« Reply #3 on: April 12, 2019, 06:01:05 AM »
ill give it a try.....after work today ,,,thanks
help a friend....

jedione

  • Hero Member
  • *****
  • Posts: 1135
  • punktoe
    • View Profile
Re: advanced progres bar
« Reply #4 on: April 12, 2019, 06:31:29 PM »
so i added your code ....thanks to... shuffle module...

and this is what i got....

for starters...it loops so it gets off letter if that makes sence....

if i can get shuffle module to just go from a to z that would be good...

also the sig used is next letter....so when you do next game it is now off to..

almost like it could be fixed with a new module by kyle....hmmm

here is a quick demo just using "next letter"  then at end i screw it up to show you how it is now off.

https://youtu.be/-CiiHgsHEdw


here is the theme....code...

Code: [Select]
local flx = fe.layout.width;
local fly = fe.layout.height;
local flw = fe.layout.width;
local flh = fe.layout.height;


function gameletter( offset ) {
   if (fe.filters.len() > 0){

      if (fe.filters[fe.list.filter_index].sort_by == Info.Year){
         local s = fe.game_info( Info.Year, offset )
         return s
      }
      else if (fe.filters[fe.list.filter_index].sort_by == Info.Manufacturer){
         local s = fe.game_info( Info.Manufacturer, offset )
         return s.slice(0,1)
      }
      else if (fe.filters[fe.list.filter_index].sort_by == Info.Category){
         local s = fe.game_info( Info.Category, offset )
         if (s == "") return "?"
         s = split( s, "/" )
         return strip(s[0])
         }
      else {
         local s = fe.game_info( Info.Title, offset )
         if (s.find("The ") == 0) s = s.slice(4,s.len())
         local s2 = s.slice(0,1)
         if ("1234567890".find (s2) != null ){
            s2="#"
         }
         return s2
      }
   }
}



local gamename = fe.add_text("[Title]",600,400,800,50);
gamename.charsize = 50

local white = fe.add_image ("white.png",232,150,50,980);
white.set_rgb ( 0, 0, 0 );

local snap = fe.add_artwork ("snap",400,400,400,400);


//local accent = fe.add_text ("[!gameletter]",233,400,50,50);
//accent.charsize = flh*0.20





local x = flx*0.122
##        fly*
local w = flw*0.260
local h = flh*0.060

local x1 = flx*0.051
##        fly*
local w1 = flw*0.000
local h1 = flh*-0.02



## call module
#######################################
fe.load_module("shuffle");


## Extend the Shuffle class
#######################################
class ShuffleList extends Shuffle {
function update() {
base.update();
}

## Overwrite the select function
#######################################
function select(slot) {
slot.font="RLU.ttf";
slot.align = Align.Left;
slot.charsize = 27;
slot.style = Style.Bold;
//slot.set_rgb ( 255, 255, 0 );
//slot.alpha = 200;
}

## Overwrite the deselect function
#######################################
function deselect(slot) {
slot.font="RLU.ttf";
slot.align = Align.Left;
slot.charsize = 27;
slot.style = Style.Bold;
slot.set_rgb (240, 240, 240);
//slot.alpha = 200;
}
}

##Shuffle Gamelist
#######################################
local list = [];
list.push(fe.add_text("A", x, fly*0.122, w, h));
list.push(fe.add_text("B", x, fly*0.177, w, h));
list.push(fe.add_text("C", x, fly*0.232, w, h));
list.push(fe.add_text("D", x, fly*0.287, w, h));
list.push(fe.add_text("E", x, fly*0.342, w, h));
list.push(fe.add_text("F", x, fly*0.397, w, h));
list.push(fe.add_text("G", x, fly*0.452, w, h));
list.push(fe.add_text("H", x, fly*0.507, w, h));
list.push(fe.add_text("I", x, fly*0.562, w, h));
list.push(fe.add_text("J", x, fly*0.617, w, h));
list.push(fe.add_text("K", x, fly*0.672, w, h));
list.push(fe.add_text("L", x, fly*0.727, w, h));
list.push(fe.add_text("M", x, fly*0.782, w, h));
list.push(fe.add_text("N", x, fly*0.837, w, h));
list.push(fe.add_text("O", x, fly*0.892, w, h));



## Shufffle Pow Extend the Shuffle class
#######################################
class ShufflePow extends Shuffle {
function update() {
base.update();
}

## Overwrite the select function
#######################################
function select(slot) {
slot.visible = true;
        slot.font="RLU.ttf";
slot.align = Align.Left;
slot.charsize = 27;
slot.style = Style.Bold;
slot.set_rgb ( 0, 255, 0 );
}

## Overwrite the select function
#######################################
function deselect(slot) {
slot.visible = false;
}
}

## extended image list
#######################################
local pow = [];
pow.push(fe.add_text("[!gameletter]", x, fly*0.122, w, h));
pow.push(fe.add_text("[!gameletter]", x, fly*0.177, w, h));
pow.push(fe.add_text("[!gameletter]", x, fly*0.232, w, h));
pow.push(fe.add_text("[!gameletter]", x, fly*0.287, w, h));
pow.push(fe.add_text("[!gameletter]", x, fly*0.342, w, h));
pow.push(fe.add_text("[!gameletter]", x, fly*0.397, w, h));
pow.push(fe.add_text("[!gameletter]", x, fly*0.452, w, h));
pow.push(fe.add_text("[!gameletter]", x, fly*0.507, w, h));
pow.push(fe.add_text("[!gameletter]", x, fly*0.562, w, h));
pow.push(fe.add_text("[!gameletter]", x, fly*0.617, w, h));
pow.push(fe.add_text("[!gameletter]", x, fly*0.672, w, h));
pow.push(fe.add_text("[!gameletter]", x, fly*0.727, w, h));
pow.push(fe.add_text("[!gameletter]", x, fly*0.782, w, h));
pow.push(fe.add_text("[!gameletter]", x, fly*0.837, w, h));
pow.push(fe.add_text("[!gameletter]", x, fly*0.892, w, h));






## Create an instance of the extended class
#########################################

local list = ShuffleList(list, "text");
local pow = ShufflePow(pow, "text");




 of coarse it need shuffle module
help a friend....

rand0m

  • Sr. Member
  • ****
  • Posts: 343
    • View Profile
Re: advanced progres bar
« Reply #5 on: April 12, 2019, 10:26:47 PM »
Good job Jedione. I also worked on indicator/ progress bar last week for RetroMania theme. Check it out > https://www.youtube.com/watch?v=bZ9CDi08Vec

zpaolo11x

  • Hero Member
  • *****
  • Posts: 1245
    • View Profile
    • My deviantart page
Re: advanced progres bar
« Reply #6 on: April 13, 2019, 12:39:16 AM »
I think that most of the problems you have with my code (which is very rude anyway) is that it's not built to work with shuffle, I have no idea how shuffle works. The code updates only the current and previous letters based on ToNewSelection transitions to be less resource heavy, alternatively you can clean up all the letters and "light up" the current one, but you need to find the proper trigger for that in shuffle mode.

Just to be sure, the routine detecting the current letter is working right?

jedione

  • Hero Member
  • *****
  • Posts: 1135
  • punktoe
    • View Profile
Re: advanced progres bar
« Reply #7 on: April 13, 2019, 07:09:00 AM »
at   rand0m

interesting that is exactley....like mine to   
it will be in the aura theme   
check it out...we must want some of the same things...

you tube...https://youtu.be/lg1gA9azSRs
« Last Edit: April 13, 2019, 07:10:52 AM by jedione »
help a friend....

keilmillerjr

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1167
    • View Profile
Re: advanced progres bar
« Reply #8 on: April 13, 2019, 07:21:22 AM »
@jedione Just the other day i made a small snippet of code for rand0m on discord to extract the letters and other characters using regex. This feature has nothing to do with shuffle, and should be implemented separately.

Code: [Select]
firstLetter(){
  local firstChar = rstrip(fe.game_info(Info.Title)).slice(0,1);
  local expression = regexp(“[a-zA-Z]”);
  expression.match(firstChar) ? return firstChar : return “#”;
}

If you want to not display a whole alphabet, should probably white a separate function with similar logic to shuffle? Ill work on making shuffle not loop soon. Will connect computer tonight. Just moved and been busy.

jedione

  • Hero Member
  • *****
  • Posts: 1135
  • punktoe
    • View Profile
Re: advanced progres bar
« Reply #9 on: April 13, 2019, 07:24:51 AM »
at   rand0m

interesting that is exactley....like mine to   
it will be in the aura theme   
check it out...we must want some of the same things...

you tube...https://youtu.be/lg1gA9azSRs

Yes.   the code works, like a charm... 

that was a just off the cuff test thinking on how to do this, because i know no other,,,way

i will probley be stuck here on this for a wile...im by no means a coder,    just sometimes

try to be savvy with others codes to make things work... or revers engineer.

any way thanks for your input.   if ya have any moor ideas  or figure out how to do this,,

a big thanks bro... ;)         ill mess with it some more this weekend.
help a friend....

jedione

  • Hero Member
  • *****
  • Posts: 1135
  • punktoe
    • View Profile
Re: advanced progres bar
« Reply #10 on: April 13, 2019, 07:29:14 AM »
@jedione Just the other day i made a small snippet of code for rand0m on discord to extract the letters and other characters using regex. This feature has nothing to do with shuffle, and should be implemented separately.

Code: [Select]
firstLetter(){
  local firstChar = rstrip(fe.game_info(Info.Title)).slice(0,1);
  local expression = regexp(“[a-zA-Z]”);
  expression.match(firstChar) ? return firstChar : return “#”;
}

If you want to not display a whole alphabet, should probably white a separate function with similar logic to shuffle? Ill work on making shuffle not loop soon. Will connect computer tonight. Just moved and been busy.

i new you would show up,,before long...lol

always when i have to go to work...dam-it

ill look at your code also  later tonight...thanks

this could be made ...when done into a progress-bar module..hmm
help a friend....

zpaolo11x

  • Hero Member
  • *****
  • Posts: 1245
    • View Profile
    • My deviantart page
Re: advanced progres bar
« Reply #11 on: April 13, 2019, 11:03:08 AM »
This thread is giving me ideas... I like both Oomek and Rand0m implementation, but I'm thinking of something even more radical... I want to add markers on my scrollbar for the letters and space them according to the actual number of games of that letter. This will work also for years, genres etc... I'll start coding ASAP lol!

jedione

  • Hero Member
  • *****
  • Posts: 1135
  • punktoe
    • View Profile
Re: advanced progres bar
« Reply #12 on: April 14, 2019, 07:09:54 AM »
@kyle..

Code: [Select]
firstLetter(){
  local firstChar = rstrip(fe.game_info(Info.Title)).slice(0,1);
  local expression = regexp(“[a-zA-Z]”);
  expression.match(firstChar) ? return firstChar : return “#”;
}

how is this used?  in a theme it just breaks it..
help a friend....

keilmillerjr

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1167
    • View Profile
Re: advanced progres bar
« Reply #13 on: April 14, 2019, 12:58:10 PM »
@kyle..

Code: [Select]
firstLetter(){
  local firstChar = rstrip(fe.game_info(Info.Title)).slice(0,1);
  local expression = regexp(“[a-zA-Z]”);
  expression.match(firstChar) ? return firstChar : return “#”;
}

how is this used?  in a theme it just breaks it..

It returns the first character of the currently selected game, or the pound symbol for other non alphabetical characters.

Ill try to assemble a lightweight module similar to shuffle.

jedione

  • Hero Member
  • *****
  • Posts: 1135
  • punktoe
    • View Profile
Re: advanced progres bar
« Reply #14 on: April 14, 2019, 01:09:29 PM »
how does one use it in a theme, hard coded?

it just breaks the theme the way it is..thats all :D


but also thanks, for what you are doing to!.
help a friend....