Author Topic: Q: a bought, adding favorites  (Read 2158 times)

jedione

  • Hero Member
  • *****
  • Posts: 1135
  • punktoe
    • View Profile
Q: a bought, adding favorites
« on: May 20, 2019, 09:38:54 AM »
looking for some direction, on the easiest way to add "favorites "   into a theme

i have never had them in a theme before...  where say like selecting and un-selecting
with an icon that shows up,,,  thanks anyone..

ok i see their is an "add/remove favorite" under controls  to assign to key or button
but how is this linked to an image to show or hide?
« Last Edit: May 20, 2019, 09:46:58 AM by jedione »
help a friend....

jedione

  • Hero Member
  • *****
  • Posts: 1135
  • punktoe
    • View Profile
Re: Q: a bought, adding favorites
« Reply #1 on: May 20, 2019, 09:58:40 AM »
well till,  some one can show an simpler method,  im going to be borring this code from

arcadebliss cab

Code: [Select]
</ label="Favorite Icon Type", help="Show which favorite icon should be should on non favorite filters", options="NONE,SOLID,WIREFRAME", order=10 />
favicon="SOLID";

local favIconType="images/favorites/favorite-solid.png";
switch (my_config["favicon"])
{
case "NONE":
favIconType="images/favorites/favorite-none.png";
break;
case "SOLID":
favIconType="images/favorites/favorite-solid.png"
break;
case "WIREFRAME":
favIconType="images/favorites/favorite-wireframe.png"
break;

}
local fav = sur.add_image(favIconType,fi[0],fi[1],fi[2],fi[3]);
//local fav = sur.add_image(favIconType,GAMEITEMWIDTH-19,GAMEITEMHEIGHT-20,16,16);
fav.visible = false;


help a friend....

keilmillerjr

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1167
    • View Profile
Re: Q: a bought, adding favorites
« Reply #2 on: May 20, 2019, 12:37:08 PM »
Favorites is like a tag that can be used in/as a filter.

You can use a magic token or magic token custom function to change a text object’s msg. You can also use a magic token custom function to change an image’s name. Empty string will show no image.

You can also use a callback for crazier stuff.

jedione

  • Hero Member
  • *****
  • Posts: 1135
  • punktoe
    • View Profile
Re: Q: a bought, adding favorites
« Reply #3 on: May 21, 2019, 07:22:48 AM »

for anyone who wants,    this is the easiest code i could find,,,,  tested and working ;D

taken from,  theme "Dal1980 v1.0 Hello-Nintendo"  thanks

Code: [Select]
local favHolder = fe.add_image("parts/favourite-off.png", 430, 28, 60, 56);

function getFavs(index_offset) {
    if(fe.game_info( Info.Favourite, 0 ) == "1") return "parts/favourite-on.png";
    else return  "parts/favourite-off.png";
}

fe.add_transition_callback( "update_my_list" );
function update_my_list( ttype, var, ttime ) {
    favHolder.file_name = getFavs(0);
    if(ttype == Transition.StartLayout){
        drawNextPage(0);
        favHolder.file_name = getFavs(0);
    }
    else if(ttype == Transition.EndNavigation){
        if(resetDrawGrid) drawNextPage(0);
        favHolder.file_name = getFavs(0);
    }
    return false;
}

help a friend....