Author Topic: Can I do this using arrays and surfaces?  (Read 2616 times)

markc74

  • Full Member
  • ***
  • Posts: 28
    • View Profile
Can I do this using arrays and surfaces?
« on: January 26, 2021, 04:09:11 AM »
Hope someone far cleverer than me can help!

I'm creating a new layout for use on my living room box (so widescreen and a little snazzier than my usual ones!)

I had an idea to create a cool filter select menu where you can press a button and move around a grid of available filters, grouped in rows - so my top row might be "all games','most played','favourites' and the next row might be arcade - 'mame','model 3','teknoparrot' etc

I can push the filters into an array fine:

Code: [Select]
local s_list = ["Top","Arcade"];
local f_list = [];
      f_list.append(["Top","All Games"]);
      f_list.append(["Top","Favourites"]);
      f_list.append(["Top","Most Played"]);
      f_list.append(["Arcade","Classics"]);
      f_list.append(["Arcade","Model 2"]);
etc

But what I would like to do, is generate surfaces on the fly based on the row that they appear in. I'd then like to reference those surfaces by their generated name so I can scroll them independently. So in the above example I would have a surface called "Top" and another surface called "Arcade"

So something like this:

Code: [Select]
foreach (s in s_list) {
      #Generate surface based on s value at posiition y
      foreach (f in f_list) {
            # Add items to above surface at position x
            # x=x+200
      }
      y=y+200
}

I could obviously hard code all the filters in, but this would be pretty long-winded and not very flexible.

Is there a way this can be done?

jedione

  • Hero Member
  • *****
  • Posts: 1135
  • punktoe
    • View Profile
Re: Can I do this using arrays and surfaces?
« Reply #1 on: January 28, 2021, 08:10:02 PM »
i would jump up on discord,,,good peeps...you are known im shure of it,

your skills are ...always needed
help a friend....

markc74

  • Full Member
  • ***
  • Posts: 28
    • View Profile
Re: Can I do this using arrays and surfaces?
« Reply #2 on: January 29, 2021, 06:50:55 AM »
i would jump up on discord,,,good peeps...you are known im shure of it,

your skills are ...always needed

Ah thanks! Is there a particular board? I don't use Discord very often so not really used to the layout

jedione

  • Hero Member
  • *****
  • Posts: 1135
  • punktoe
    • View Profile
Re: Can I do this using arrays and surfaces?
« Reply #3 on: January 29, 2021, 07:31:13 AM »
yaa,   here you go https://discord.gg/F7YFXnVj

i think you will like it...good people
help a friend....