Attract-Mode Support Forum
Attract-Mode Support => Scripting => Topic started by: qqplayer on February 17, 2017, 02:47:06 AM
-
So , anyone can make me a little example on how to add a little "floating window" on an existent layout to show some extra info or wathever we want?
Is this posible?
Thanks.
-
You might need to be more specific on what you mean by floating window but likely you want to create a surface, then add the info on it - this way you can move the surface (aka your floating window) wherever you want on the screen, or animate it or whatever...
local window = fe.add_surface(640, 360)
local window_bg = window.add_image("images/bg.png", 0, 0, window.width, window.height)
local window_title = window.add_text("[Title]", 0, 0, window.width, 20)
local window_cat = window.add_text("[Category]", 0, 25, window.width, 20)
window.set_pos(100, 100)
-
Thanks liquid8d , let me try to explain what I´m trying to do.
On this post I was trying to find a way to show game descriptions like on emulationstation.
http://forum.attractmode.org/index.php?topic=1349.0
Is working fine now and what I would like to do is showing this "extra" info on a floating window.
I just add this line to my layout.nut
local textoverview =fe.add_text("[Overview]", 960,450,380,700)
So, it shows correctly.But now what I like to do is to show only when I press a button
Maybe with a little animation like a "help screen".
(http://i.imgur.com/GxwUjMp.jpg)
-
Thanks liquid8d , let me try to explain what I´m trying to do.
On this post I was trying to find a way to show game descriptions like on emulationstation.
http://forum.attractmode.org/index.php?topic=1349.0
Is working fine now and what I would like to do is showing this "extra" info on a floating window.
I just add this line to my layout.nut
local textoverview =fe.add_text("[Overview]", 960,450,380,700)
So, it shows correctly.But now what I like to do is to show only when I press a button
Maybe with a little animation like a "help screen".
(http://i.imgur.com/GxwUjMp.jpg)
Create a class that will add a transition callback and change the state of the class to and either show or hide your object. I might upload an example as i have an example that seems to help multiple threads.
-
here is what i was given by liquid8d
works great...under controls choose you buttom for custom1
and then you can toggle on and off.
also modify as needed for text of vid, pic
class PopUpImage
{
_my_image=null;
constructor()
{
_my_image = fe.add_text("[Title]", flx*0.230, fly*0.360, flw*0.360, flh*0.490 );
_my_image.visible=false;
_my_image.charsize = 20;
//_my_image.alpha= 100;
fe.add_signal_handler( this, "on_signal" )
}
function on_signal( signal )
{
if ( signal == "custom1" )
{
_my_image.visible=!_my_image.visible;
return true;
}
return false;
}
}
local blah = PopUpImage();
-
Thank you guys , Jedione your code is working perfectly.
This is what I made to show the "overview" extra info.
class PopUpImage
{
_my_image=null;
constructor()
{
_my_image = fe.add_text("[Overview]", flx*0.230, fly*0.360, flw*0.360, flh*0.490 );
_my_image.visible=false;
_my_image.charsize = 12;
_my_image.align = Align.Left;
_my_image.word_wrap = true;
_my_image.alpha = 255;
_my_image.style = Style.Bold;
//_my_image.alpha= 100;
fe.add_signal_handler( this, "on_signal" )
}
function on_signal( signal )
{
if ( signal == "custom1" )
{
_my_image.visible=!_my_image.visible;
return true;
}
return false;
}
}
local blah = PopUpImage();
-
Sorry for repost , I need more help.
Trying to add a custom background to the float text:
class PopUpBgImage
{
_my_image_bg=null;
constructor()
{
_my_image_bg = fe.add_image( "backgrounds/xbmc/bg_overview.png", 0, 0 ,640 ,480 );
_my_image_bg.visible=false;
_my_image_bg.alpha = 255;
fe.add_signal_handler( this, "on_signal" )
}
function on_signal( signal )
{
if ( signal == "custom1" )
{
_my_image_bg.visible=!_my_image_bg.visible;
return true;
}
return false;
}
}
local blah_bg = PopUpBgImage();
Works good individually but if I add to my layout.nut with the "overview text" function doesnt work.