Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - calle81

Pages: [1] 2 3 ... 5
1
Scripting / Re: Controls module v1.0!
« on: Yesterday at 03:20:37 PM »
Ok, I tried it just now. I pasted your sample code at the end of the layout I'm working on. It shows when the layout starts but as soon as I exit the menu there's no way to return. I want it to listen to custom2 and be hidden by default until I press the button and not close until I press custom2 again or press a button on the display tied to custom2 which subsequently closes the menu.

https://youtu.be/aMUHq_jIAIc

//////////////////////
//Control Menu
///////////////////

//be sure to load the module!
fe.load_module("objects/controls");

local flw = fe.layout.width;
local flh = fe.layout.height;

//side menu
local menu = fe.add_surface(flw * 0.2, flh);
local menu_bg = menu.add_text("", 0, 0, flw * 0.2, flh);
menu_bg.set_bg_rgb(130, 130, 130);
//menu_bg.alpha = 150;

//create manager class (options are chainable if you prefer)
local manager = FeControls({
    selected = "lblDisplays"
});

function hide_menu() {
    menu.visible = false;
    manager.enabled = false;
    title.set_pos(0, 0, flw, flh * 0.1);
    art.set_pos(0, flh *0.1, flw, flh);
}

function show_menu() {
    menu.visible = true;
    manager.enabled = true;
    title.set_pos(flw * 0.2, 0, flw, flh * 0.1);
    art.set_pos(flw * 0.2, flh *0.1, flw, flh);
}

// ADD LABELS //
manager.add(FeLabel("lblDisplays", flw * 0.025, flh * 0.05, 200, 50, {
    surface = menu,
    up = "btnLaunch", down = "lblFilters", right = hide_menu,
    select = function() {
        ::fe.signal("displays_menu");
    },
    state_default = {
        msg = "Displays",
        charsize = 18
    }
}));

manager.add(FeLabel("lblFilters", flw * 0.025, flh * 0.12, 200, 50, {
    surface = menu,
    up = "lblDisplays", down = "lblPrev", right = hide_menu,
    select = function() {
        ::fe.signal("filters_menu");
    },
    state_default = {
        msg = "Filters",
        charsize = 18
    }
}))

manager.add(FeLabel("lblPrev", flw * 0.025, flh * 0.19, 200, 50, {
    surface = menu,
    up = "lblFilters", down = "lblNext", right = hide_menu,
    select = function() {
        ::fe.signal("prev_game");
    },
    state_default = {
        msg = "Previous",
        charsize = 18
    }
}));

manager.add(FeLabel("lblNext", flw * 0.025, flh * 0.26, 200, 50, {
    surface = menu,
    up = "lblPrev", down = "btnRandom", right = hide_menu,
    select = function() {
        ::fe.signal("next_game");
    },
    state_default = {
        msg = "Next",
        charsize = 18
    },
    // state_selected = {
    //     msg = "S"
    // }
}));

// ADD BUTTONS //
manager.add(FeButton("btnRandom", flw * 0.025, flh * 0.45, 200, 50, {
    surface = menu,
    up = "lblNext", down = "btnLaunch", right = hide_menu,
    select = function() {
        ::fe.signal("random_game");
    },
    state_default = {
        msg = "Random Game",
        charsize = 18,
        file_name = "button.png",
        rgb = [ 0, 0, 0],
    },
    state_selected = {
        file_name = "button_selected.png",
        rgb = [ 100, 0, 100],
    },
}));

manager.add(FeButton("btnLaunch", flw * 0.025, flh * 0.55, 200, 50, {
    surface = menu,
    up = "btnRandom", down = "lblDisplays", left = "btnRandom", right = hide_menu,
    state_default = {
        msg = "Launch",
        charsize = 18,
        file_name = "button.png",
        rgb = [ 0, 0, 0 ],
    },
    state_selected = {
        file_name = "button_selected.png",
        rgb = [ 0, 200, 0],
    }
}));

//Our own signal handler - control is handed over to the controls manager
//when 'left' is pressed. Control is passed back to our signal handler when 'right'
// is pressed on any of the label/buttons above
fe.add_signal_handler(this, "on_signal");
function on_signal(str) {
    if ( str == "Custom3" ) {
        // For debugging
        fe.signal("reload");
        return true;
    } else if ( str == "Custom2" ) {
        //return control to the controls manager
        show_menu();
        return true;
    } else if ( str == "right" ) {
        //do nothing for right to prevent confusing UI
        //hmm... we could do a show_right_menu() here with game info :)
        return true;
    }
    return false;
}

//initialize the controls manager
//we init if after our own signal handler here, just to make our signal handler get priority
manager.init();

2
Scripting / Re: Controls module v1.0!
« on: December 11, 2017, 06:01:24 AM »
Is it possible to make a sub-menu that popups when you press a specific button? Would be great to see a code snippet I can steal to incorporate into themes. :)
The layouts are already so crowded so I'm having a hard time imaging how to fit the buttons I want.

3
Scripting / Re: Controls module v1.0!
« on: December 11, 2017, 02:15:50 AM »
Wow, I thought I was done with my theme for HyperPie2... Amazing work as always!  :)

4
Themes / Re: MAGNUS theme with coverflow game selector [preview]
« on: November 26, 2017, 02:23:02 AM »
Wow! Looks incredible.  :) :) :)

5
Scripting / Re: A little performance boost for those using video snaps
« on: November 14, 2017, 09:26:53 AM »
This works great 8bit! I have one issue though. When adding preserve_aspect_ratio = true like below it only applies after i have jumped one item in the wheel, never on the initial video. Any ideas?

if ( my_config["videomode"] == "Center") {
local last_nav = 0;
local gtime = 0;
local art_flag = false;

local video = fe.add_image( fe.get_art("snap"),flx*0.035, fly*0.155, flw*0.65, flh*0.7 );  //Use add_image so the snap doesn't auto-update while navigating
video.preserve_aspect_ratio = true;
fe.add_transition_callback( "my_transition" );
function my_transition( ttype, var, ttime )
{
   if ( ttype == Transition.ToNewSelection )
   {
      last_nav = gtime;
      art_flag = true;
   }
}

fe.add_ticks_callback( this, "on_tick" );
function on_tick( ttime )
{
    gtime = ttime;
   if (art_flag && (ttime - last_nav > 800))  //800ms delay
   {
      video.file_name = fe.get_art("snap");
      art_flag = false;
      
   }
}

}

6
Themes / Re: PanAndScan module v1.2 release
« on: November 09, 2017, 12:18:57 PM »
Yeah, I figured this out earlier but thanks anyway :)

7
Scripting / Re: A little performance boost for those using video snaps
« on: November 07, 2017, 02:58:36 PM »
This could be really awesome. Especially on the raspberry pi even when using Transition.EndNavigation;. Would be great to get a custom snap delay. I tried to use your code snippet but failed. Can you explain what should be in ".... your normal up dowbn handling"

8
Scripting / Re: Cycle through random game snaps on Display Menu?
« on: November 04, 2017, 11:28:09 AM »
Here is a "workaround": Create a folder in your snaps dir named as the title. Put the snaps in that folder. AM will then pick one randomly

Eg. menu-art/snap/Nintendo Game Boy/1.mp4, 2.mp4 etc.

9
Scripting / Re: KeyboardSearch module
« on: October 29, 2017, 04:37:24 PM »
Wow, awesome! Works great! Thanks for this. :)

10
Themes / Re: PanAndScan module v1.2 release
« on: October 14, 2017, 05:29:50 PM »
This module doesn't seem to take the bgart.trigger = Transition.EndNavigation; option into consideration. When used on a pi this causes navigation performance issues because it loads the flyer for each game when moving through the wheel. Does anyone here know how to fix this issue?

local bgart = PanAndScanArt( "flyer", 0, 0, flw, flh);
bgart.preserve_aspect_ratio = false;
bgart.set_fit_or_fill("fill");
bgart.set_anchor(::Anchor.Center);
bgart.set_zoom(4.5, 0.00008);
bgart.set_animate(::AnimateType.Bounce, 0.50, 0.50)
bgart.set_randomize_on_transition(true);
bgart.set_start_scale(1.1);
bgart.trigger = Transition.EndNavigation;

11
Scripting / Re: Display-Specific Music?
« on: October 14, 2017, 12:13:08 PM »
Hi, awesome! Can I stop the sound from looping? I'd like to have an announcement only

12
General / Re: Forum is back up (hopefully)
« on: October 09, 2017, 12:19:18 AM »
Yay! GJ  :D

13
Mickelson has added support for nesting in the source. I haven't tried it myself

https://github.com/mickelson/attract/commit/b71b0e48c478a115a9648968701b6191f831e23e

14
Scripting / Game info text [Overview] causes pi to struggle
« on: September 12, 2017, 03:12:11 PM »
Hi,

Adding game info text like below causes performance issues on a pi when scrolling through a wheel. I was hoping that adding a transition state would solve the problem but it seems transitions and text don't work together. If you have any ideas pleas let me know.

local gtext = fe.add_text("[Overview]", flx*0.73, fly*0.25, flw*0.25, flh*0.45 );
gtext.set_rgb( 255, 255, 255 );
gtext.align = Align.Left;
gtext.charsize = 20;
gtext.rotation = 0;
gtext.word_wrap = true;
gtext.font = "MyriadPro-Bold.otf"
gtext.trigger = Transition.EndNavigation;

15
Themes / Need help with snap delay function
« on: September 11, 2017, 06:01:59 AM »
Hi, I need help finishing this snap delay function. Thanks for offering to help Kent79 :) I attached the nut file. It wont make much sense loaded in AM without Hurstys tiles and a bunch of other stuff. The code is at the bottom of the file. End goal is to have 1 or sec delay before the snap starts playing.

/////////////////////
//Snap playback with delay
////////////////////   
local snap_active = false;
local delay = 0;
local max_delay = 0;
snap.playing = snap_active;

max_delay=abs(("0"+my_config["dtime"]).tointeger())
max_delay=(max_delay>999 ? 100 : max_delay);

::fe.add_ticks_callback( this, "tick_fn" );

function tick_fn( ttime )
   {
      delay++;
      if ( delay > max_delay )
      {     
         if (snap_active == false){
         local snap = fe.add_artwork ( "snap", flx*0.183, fly*0.0376, flw*0.635, flh*0.56 );
//         snap.trigger = Transition.EndNavigation;
         snap.preserve_aspect_ratio = true;      
         snap_active = true;
         snap.playing = snap_active;
         }

      }
   }


Pages: [1] 2 3 ... 5