diff --git a/Themes/HelloWorld/BGAnimations/ScreenTitleMenu cancel.lua b/Themes/HelloWorld/BGAnimations/ScreenTitleMenu cancel.lua index ca42b0f097..fd6687b63f 100644 --- a/Themes/HelloWorld/BGAnimations/ScreenTitleMenu cancel.lua +++ b/Themes/HelloWorld/BGAnimations/ScreenTitleMenu cancel.lua @@ -1,4 +1,10 @@ return Def.Quad{ - InitCommand=cmd(FullScreen;diffuse,color("#fffdf200")); - OnCommand=cmd(decelerate,1;diffusealpha,1); + InitCommand=function(self) + self:FullScreen(); + self:diffuse(color("#fffdf200")); + end; + OnCommand=function(self) + self:decelerate(1); + self:diffusealpha(1); + end; }; \ No newline at end of file diff --git a/Themes/HelloWorld/BGAnimations/ScreenTitleMenu out.lua b/Themes/HelloWorld/BGAnimations/ScreenTitleMenu out.lua index 00ce5b8edc..df6beac479 100644 --- a/Themes/HelloWorld/BGAnimations/ScreenTitleMenu out.lua +++ b/Themes/HelloWorld/BGAnimations/ScreenTitleMenu out.lua @@ -1,6 +1,13 @@ return Def.ActorFrame{ Def.Quad{ - InitCommand=cmd(FullScreen;diffuse,color("#fffdf200")); - OnCommand=cmd(sleep,1.125;decelerate,0.875;diffusealpha,1); + InitCommand=function(self) + self:FullScreen(); + self:diffuse(color("#fffdf200")); + end; + OnCommand=function(self) + self:sleep(1.125); + self:decelerate(0.875); + self:diffusealpha,(1); + end; }; } \ No newline at end of file diff --git a/Themes/HelloWorld/BGAnimations/ScreenTitleMenu underlay.lua b/Themes/HelloWorld/BGAnimations/ScreenTitleMenu underlay.lua index a057c0dd24..5dbc91cc78 100644 --- a/Themes/HelloWorld/BGAnimations/ScreenTitleMenu underlay.lua +++ b/Themes/HelloWorld/BGAnimations/ScreenTitleMenu underlay.lua @@ -1,72 +1,139 @@ --- This file returns an ActorFrame that holds a few objects. - --- Since I like to collapse similar code, here is a simple example: -local lineWidth = SCREEN_WIDTH*0.9; --- previously, I had this set to SCREEN_WIDTH*0.8 in each of the --- Def.Quad blocks below. Now I just use lineWidth and I get two advantages: --- 1) I can change it and it takes effect in multiple places. --- 2) I get a human readable name out of it. --- It makes your code easier to read and work with. - -local lineTime = 0.625; --- same with this code. - -return Def.ActorFrame { - Def.ActorFrame{ - Name="Flourishes"; - -- it has to be 0.05 since 0.9 uses up space on both sides. - InitCommand=cmd(x,SCREEN_LEFT+(SCREEN_WIDTH*0.05);y,SCREEN_CENTER_Y;); - - Def.Quad{ - Name="Red"; - InitCommand=cmd(horizalign,left;zoomto,0,4;diffuse,color("#DA8989");diffuserightedge,color("#FFBBBB")); - OnCommand=cmd(sleep,0.1;linear,lineTime;zoomx,lineWidth); - }; - - Def.Quad{ - Name="Yellow"; - InitCommand=cmd(y,4;horizalign,left;zoomto,0,4;diffuse,color("#DAD989");diffuserightedge,color("#FFFCBB")); - OnCommand=cmd(sleep,0.05;linear,lineTime;zoomx,lineWidth); - }; - - Def.Quad{ - Name="Blue"; - InitCommand=cmd(y,8;horizalign,left;zoomto,0,4;diffuse,color("#89C6DA");diffuserightedge,color("#BBEEFF")); - OnCommand=cmd(linear,lineTime;zoomx,lineWidth); - }; - }; - - -- LoadActor() is used to automatically load objects. - -- You'll be using it a lot. - - -- THEME:GetPathG() gets a file from the Graphics folder. - -- What graphic depends on the arguments. - -- There must always be two, and there usually is a space between the - -- first and second, unless you perform a trick like this: - LoadActor( THEME:GetPathG("","_common/_logo") ) .. { - -- the InitCommand puts the logo 44 pixels above vertical center - -- and moves it 60 pixels to the left of horizontal center. - -- diffusealpha,0 makes the object invisible, - -- which is handy for transitions... - InitCommand=cmd(x,SCREEN_CENTER_X*0.8125;y,SCREEN_CENTER_Y-44;diffusealpha,0;); - -- ...as we see in the OnCommand. linear means to perform the next - -- commands over a span of time (in seconds). - -- diffusealpha,1 makes the logo fade in when applied here. - OnCommand=cmd(linear,0.5;diffusealpha,1;); - }; - - -- Creative Commons logo, using a local file in the same directory: - LoadActor( "creativecommons" )..{ - InitCommand=cmd(x,SCREEN_LEFT+64;y,SCREEN_BOTTOM-43;Real); - OnCommand=cmd(addy,32;cropbottom,1;fadebottom,1;decelerate,0.8;cropbottom,0;fadebottom,0;addy,-32); - }; - -- Making a cheap reflection effect for the sake of showing off the fov and - -- vanishpoint commands on ActorFrames. - Def.ActorFrame{ - InitCommand=cmd(fov,45;vanishpoint,SCREEN_LEFT+64,SCREEN_BOTTOM-20;); - LoadActor( "creativecommons" )..{ - InitCommand=cmd(x,SCREEN_LEFT+64;y,SCREEN_BOTTOM-20;valign,0;zoomy,-0.6;rotationx,-60;diffusealpha,0.6;Real;); - OnCommand=cmd(croptop,1;fadetop,0;decelerate,0.8;croptop,0;fadetop,1;); - }; - }; +-- This file returns an ActorFrame that holds a few objects. + +-- Since I like to collapse similar code, here is a simple example: +local lineWidth = SCREEN_WIDTH*0.9; +-- previously, I had this set to SCREEN_WIDTH*0.8 in each of the +-- Def.Quad blocks below. Now I just use lineWidth and I get two advantages: +-- 1) I can change it and it takes effect in multiple places. +-- 2) I get a human readable name out of it. +-- It makes your code easier to read and work with. + +local lineTime = 0.625; +-- same with this code. + +return Def.ActorFrame { + Def.ActorFrame{ + Name="Flourishes"; + -- it has to be 0.05 since 0.9 uses up space on both sides. + InitCommand=function(self) + self:x(SCREEN_LEFT + (SCREEN_WIDTH * 0.05); + self:y(SCREEN_CENTER_Y); + end; + + Def.Quad{ + Name="Red"; + InitCommand=function(self) + self:horizalign(left); + self:zoomto(0, 4); + self:diffuse(color("#DA8989")); + self:diffuserightedge(color("#FFBBBB")); + end; + OnCommand=function(self) + self:sleep(0.1); + self:linear(lineTime); + self:zoomx(lineWidth); + end; + }; + + Def.Quad{ + Name="Yellow"; + InitCommand=function(self) + self:y(4); + self:horizalign(left); + self:zoomto(0, 4); + self:diffuse(color("#DAD989")); + self:diffuserightedge(color("#FFFCBB")); + end; + OnCommand=function(self) + self:sleep(0.05); + self:linear(lineTime); + self:zoomx(lineWidth); + end; + }; + + Def.Quad{ + Name="Blue"; + InitCommand=function(self) + self:y(8); + self:horizalign(left); + self:zoomto(0, 4); + self:diffuse(color("#89C6DA")); + self:diffuserightedge(color("#BBEEFF")); + end; + OnCommand=function(self) + self:linear(lineTime); + self:zoomx(lineWidth); + end; + }; + }; + + -- LoadActor() is used to automatically load objects. + -- You'll be using it a lot. + + -- THEME:GetPathG() gets a file from the Graphics folder. + -- What graphic depends on the arguments. + -- There must always be two, and there usually is a space between the + -- first and second, unless you perform a trick like this: + LoadActor( THEME:GetPathG("","_common/_logo") ) .. { + -- the InitCommand puts the logo 44 pixels above vertical center + -- and moves it 60 pixels to the left of horizontal center. + -- diffusealpha,0 makes the object invisible, + -- which is handy for transitions... + InitCommand=function(self) + self:x(SCREEN_CENTER_X * 0.8125); + self:y(SCREEN_CENTER_Y - 44); + self:diffusealpha(0); + end; + -- ...as we see in the OnCommand. linear means to perform the next + -- commands over a span of time (in seconds). + -- diffusealpha,1 makes the logo fade in when applied here. + OnCommand=function(self) + self:linear(0.5); + self:diffusealpha(1); + end; + }; + + -- Creative Commons logo, using a local file in the same directory: + LoadActor( "creativecommons" )..{ + InitCommand=function(self) + self:x(SCREEN_LEFT + 64); + self:y(SCREEN_BOTTOM - 43); + self:Real(); + end; + OnCommand=function(self) + self:addy(32); + self:cropbottom(1); + self:fadebottom(1); + self:decelerate(0.8); + self:cropbottom(0); + self:fadebottom(0); + self:addy(-32); + end; + }; + -- Making a cheap reflection effect for the sake of showing off the fov and + -- vanishpoint commands on ActorFrames. + Def.ActorFrame{ + InitCommand=function(self) + self:fov(45); + self:vanishpoint(SCREEN_LEFT + 64, SCREEN_BOTTOM - 20); + end; + LoadActor( "creativecommons" )..{ + InitCommand=function(self) + self:x(SCREEN_LEFT + 64); + self:y(SCREEN_BOTTOM - 20); + self:valign(0); + self:zoomy(-0.6); + self:rotationx(-60); + self:diffusealpha(0.6); + self:Real(); + end; + OnCommand=function(self) + self:croptop(1); + self:fadetop(0); + self:decelerate(0.8); + self:croptop(0); + self:fadetop(1); + end; + }; + }; }; \ No newline at end of file diff --git a/Themes/HelloWorld/BGAnimations/ScreenWithMenuElements background.lua b/Themes/HelloWorld/BGAnimations/ScreenWithMenuElements background.lua index 924506e9d8..7be508419c 100644 --- a/Themes/HelloWorld/BGAnimations/ScreenWithMenuElements background.lua +++ b/Themes/HelloWorld/BGAnimations/ScreenWithMenuElements background.lua @@ -4,5 +4,7 @@ return Def.Quad{ -- colors can either be entered as hex ("#FFFFFFFF") or 0..1 ("1.0,1.0,1.0,1.0") -- where the values are Red, Green, Blue, and Alpha (transparency). - InitCommand=cmd(FullScreen;diffuse,color("#fffdf2")); + InitCommand=function(self) + self:FullScreen(); + self:diffuse(color("#fffdf2")); }; \ No newline at end of file diff --git a/Themes/HelloWorld/BGAnimations/ScreenWithMenuElements in.lua b/Themes/HelloWorld/BGAnimations/ScreenWithMenuElements in.lua index dede3b5529..62f08fe149 100644 --- a/Themes/HelloWorld/BGAnimations/ScreenWithMenuElements in.lua +++ b/Themes/HelloWorld/BGAnimations/ScreenWithMenuElements in.lua @@ -1,6 +1,12 @@ return Def.ActorFrame{ Def.Quad{ - InitCommand=cmd(FullScreen;diffuse,color("#fffdf2FF")); - OnCommand=cmd(decelerate,0.75;diffusealpha,0); + InitCommand=function(self) + self:FullScreen(); + self:diffuse(color("#fffdf2FF")); + end; + OnCommand=function(self) + self:decelerate(0.75); + self:diffusealpha(0); + end; }; }; \ No newline at end of file diff --git a/Themes/HelloWorld/BGAnimations/ScreenWithMenuElements out.lua b/Themes/HelloWorld/BGAnimations/ScreenWithMenuElements out.lua index 2ab1bf156f..8a653d5ce7 100644 --- a/Themes/HelloWorld/BGAnimations/ScreenWithMenuElements out.lua +++ b/Themes/HelloWorld/BGAnimations/ScreenWithMenuElements out.lua @@ -1,6 +1,12 @@ return Def.ActorFrame{ Def.Quad{ - InitCommand=cmd(FullScreen;diffuse,color("#fffdf200")); - OnCommand=cmd(decelerate,0.875;diffusealpha,1); + InitCommand=function(self) + self:FullScreen(); + self:diffuse(color("#fffdf200")); + end; + OnCommand=function(self) + self:decelerate(0.875); + self:diffusealpha(1); + end; }; } \ No newline at end of file diff --git a/Themes/HelloWorld/BGAnimations/_wait.lua b/Themes/HelloWorld/BGAnimations/_wait.lua index d3a544b612..504d2899d6 100644 --- a/Themes/HelloWorld/BGAnimations/_wait.lua +++ b/Themes/HelloWorld/BGAnimations/_wait.lua @@ -1,4 +1,8 @@ local time = ... if not time then time = 1.0 end -return Def.Actor{ OnCommand=cmd(sleep,time); }; \ No newline at end of file +return Def.Actor{ + OnCommand=function(self) + self:sleep(time); + end; +}; \ No newline at end of file diff --git a/Themes/HelloWorld/Graphics/ReferenceBase header.lua b/Themes/HelloWorld/Graphics/ReferenceBase header.lua index 3491c5612f..4d056b8ff4 100644 --- a/Themes/HelloWorld/Graphics/ReferenceBase header.lua +++ b/Themes/HelloWorld/Graphics/ReferenceBase header.lua @@ -1,23 +1,52 @@ -local t = Def.ActorFrame{ - Def.Quad{ - InitCommand=cmd(zoomto,SCREEN_WIDTH,96;diffuse,color("#EEF4FFCC")); - }; - Def.ActorFrame{ - InitCommand=cmd(y,12); - LoadFont("_frutiger roman 24px")..{ - Name="Header"; - Text=ScreenString("Header"); - InitCommand=cmd(x,-312;y,-34;halign,0;diffuse,color("#111111FF");diffusetopedge,color("#11111188");shadowlength,-1;shadowcolor,color("#FFFFFF44")); - }; - Def.Quad{ - InitCommand=cmd(zoomto,SCREEN_WIDTH*0.975,2;y,-20;diffuse,color("#111111FF");diffusetopedge,color("#11111188");shadowlength,-1;shadowcolor,color("#FFFFFF44");fadeleft,0.1;faderight,0.625); - }; - LoadFont("_frutiger roman 24px")..{ - Name="Explanation"; - Text=ScreenString("Explanation"); - InitCommand=cmd(x,-312;y,-14;align,0,0;diffuse,color("#111111FF");zoom,0.65;wrapwidthpixels,(SCREEN_WIDTH)); - }; - }; -}; - +local t = Def.ActorFrame{ + Def.Quad{ + InitCommand=function(self) + self:zoomto(SCREEN_WIDTH, 96); + self:diffuse(color("#EEF4FFCC")); + end; + }; + Def.ActorFrame{ + InitCommand=function(self) + self:y(12); + end; + LoadFont("_frutiger roman 24px")..{ + Name="Header"; + Text=ScreenString("Header"); + InitCommand=function(self) + self:x(-312); + self:y(-34); + self:halign(0); + self:diffuse(color("#111111FF")); + self:diffusetopedge(color("#11111188")); + self:shadowlength(-1); + self:shadowcolor(color("#FFFFFF44")); + end; + }; + Def.Quad{ + InitCommand=function(self) + self:zoomto(SCREEN_WIDTH * 0.975, 2); + self:y(-20); + self:diffuse(color("#111111FF")); + self:diffusetopedge(color("#11111188")); + self:shadowlength(-1); + self:shadowcolor(color("#FFFFFF44")); + self:fadeleft(0.1); + self:faderight(0.625); + end; + }; + LoadFont("_frutiger roman 24px")..{ + Name="Explanation"; + Text=ScreenString("Explanation"); + InitCommand=function(self) + self:x(-312); + self:y(-14); + self:align(0, 0); + self:diffuse(color("#111111FF")); + self:zoom(0.65); + self:wrapwidthpixels(SCREEN_WIDTH); + end; + }; + }; +}; + return t; \ No newline at end of file diff --git a/Themes/HelloWorld/Graphics/ReferenceBase scroll.lua b/Themes/HelloWorld/Graphics/ReferenceBase scroll.lua index 0220f83753..06ff9638bf 100644 --- a/Themes/HelloWorld/Graphics/ReferenceBase scroll.lua +++ b/Themes/HelloWorld/Graphics/ReferenceBase scroll.lua @@ -1,34 +1,73 @@ -local gc = Var("GameCommand") -local itemName = gc:GetName() - -local t = Def.ActorFrame{ - -- focused frame - LoadActor( THEME:GetPathG("ReferenceBase","ItemFocused") )..{ - GainFocusCommand=cmd(decelerate,0.25;diffusealpha,1); - LoseFocusCommand=cmd(stoptweening;decelerate,0.25;diffusealpha,0); - }; - -- unfocused - LoadActor( THEME:GetPathG("SectionMenu","ItemUnfocused") )..{ - GainFocusCommand=cmd(decelerate,0.25;diffusealpha,0); - LoseFocusCommand=cmd(stoptweening;decelerate,0.25;diffusealpha,1); - }; - - Def.ActorFrame{ - LoadFont("_frutiger roman 24px")..{ - Name="SectionName"; - Text=ScreenString(itemName); - InitCommand=cmd(x,-250;y,-6;halign,0;diffuse,color("#222222FF")); - GainFocusCommand=cmd(decelerate,0.25;diffusealpha,1); - LoseFocusCommand=cmd(stoptweening;decelerate,0.25;diffusealpha,0.5); - }; - LoadFont("_frutiger roman 24px")..{ - Name="SectionDesc"; - Text=ScreenString(itemName.."Desc"); - InitCommand=cmd(x,-248;y,10;align,0,0;diffuse,color("#222222FF");zoom,0.5); - GainFocusCommand=cmd(decelerate,0.25;diffusealpha,1); - LoseFocusCommand=cmd(stoptweening;decelerate,0.25;diffusealpha,0.5); - }; - }; -}; - +local gc = Var("GameCommand") +local itemName = gc:GetName() + +local t = Def.ActorFrame{ + -- focused frame + LoadActor( THEME:GetPathG("ReferenceBase","ItemFocused") )..{ + GainFocusCommand=function(self) + self:decelerate(0.25); + self:diffusealpha(1); + end; + LoseFocusCommand=function(self) + self:stoptweening(); + self:decelerate(0.25); + self:diffusealpha(0); + end; + }; + -- unfocused + LoadActor( THEME:GetPathG("SectionMenu","ItemUnfocused") )..{ + GainFocusCommand=function(self) + self:decelerate(0.25); + self:diffusealpha(0); + end; + LoseFocusCommand=function(self) + self:stoptweening(); + self:decelerate(0.25); + self:diffusealpha(1); + end; + }; + + Def.ActorFrame{ + LoadFont("_frutiger roman 24px")..{ + Name="SectionName"; + Text=ScreenString(itemName); + InitCommand=function(self) + self:x(-250); + self:y(-6); + self:halign(0); + self:diffuse(color("#222222FF")); + end; + GainFocusCommand=function(self) + self:decelerate(0.25); + self:diffusealpha(1); + end; + LoseFocusCommand=function(self) + self:stoptweening(); + self:decelerate(0.25); + self:diffusealpha(0.5); + end; + }; + LoadFont("_frutiger roman 24px")..{ + Name="SectionDesc"; + Text=ScreenString(itemName.."Desc"); + InitCommand=function(self) + self:x(-248); + self:y(10); + self:align(0, 0); + self:diffuse(color("#222222FF")); + self:zoom(0.5); + end; + GainFocusCommand=function(self) + self:decelerate(0.25); + self:diffusealpha(1); + end; + LoseFocusCommand=function(self) + self:stoptweening(); + self:decelerate(0.25); + self:diffusealpha(0.5); + end; + }; + }; +}; + return t; \ No newline at end of file diff --git a/Themes/HelloWorld/Graphics/ScreenGuideMain header.lua b/Themes/HelloWorld/Graphics/ScreenGuideMain header.lua index f2abfa9b6a..9a29052a08 100644 --- a/Themes/HelloWorld/Graphics/ScreenGuideMain header.lua +++ b/Themes/HelloWorld/Graphics/ScreenGuideMain header.lua @@ -1,23 +1,52 @@ -local t = Def.ActorFrame{ - Def.Quad{ - InitCommand=cmd(zoomto,SCREEN_WIDTH,120;diffuse,color("#EEF4FFCC")); - }; - Def.ActorFrame{ - InitCommand=cmd(y,16); - LoadFont("_frutiger roman 24px")..{ - Name="Header"; - Text=THEME:GetString("ScreenGuideMain","Header"); - InitCommand=cmd(x,-312;y,-50;halign,0;diffuse,color("#111111FF");diffusetopedge,color("#11111188");shadowlength,-1;shadowcolor,color("#FFFFFF44")); - }; - Def.Quad{ - InitCommand=cmd(zoomto,SCREEN_WIDTH*0.975,2;y,-32;diffuse,color("#111111FF");diffusetopedge,color("#11111188");shadowlength,-1;shadowcolor,color("#FFFFFF44");fadeleft,0.1;faderight,0.625); - }; - LoadFont("_frutiger roman 24px")..{ - Name="Explanation"; - Text=THEME:GetString("ScreenGuideMain","Explanation"); - InitCommand=cmd(x,-312;y,-24;align,0,0;diffuse,color("#111111FF");zoom,0.65;wrapwidthpixels,(SCREEN_WIDTH)); - }; - }; -}; - +local t = Def.ActorFrame{ + Def.Quad{ + InitCommand=function(self) + self:zoomto(SCREEN_WIDTH, 120); + self:diffuse(color("#EEF4FFCC")); + end; + }; + Def.ActorFrame{ + InitCommand=function(self) + self:y(16); + end; + LoadFont("_frutiger roman 24px")..{ + Name="Header"; + Text=THEME:GetString("ScreenGuideMain","Header"); + InitCommand=function(self) + self:x(-312); + self:y(-50); + self:halign(0); + self:diffuse(color("#111111FF")); + self:diffusetopedge(color("#11111188")); + self:shadowlength(-1); + self:shadowcolor(color("#FFFFFF44")); + end; + }; + Def.Quad{ + InitCommand=function(self) + self:zoomto(SCREEN_WIDTH * 0.975, 2); + self:y(-32); + self:diffuse(color("#111111FF")); + self:diffusetopedge(color("#11111188")); + self:shadowlength(-1); + self:shadowcolor(color("#FFFFFF44")); + self:fadeleft(0.1); + self:faderight(0.625); + end; + }; + LoadFont("_frutiger roman 24px")..{ + Name="Explanation"; + Text=THEME:GetString("ScreenGuideMain","Explanation"); + InitCommand=function(self) + self:x(-312); + self:y(-24); + self:align(0, 0); + self:diffuse(color("#111111FF")); + self:zoom(0.65); + self:wrapwidthpixels(SCREEN_WIDTH); + end; + }; + }; +}; + return t; \ No newline at end of file diff --git a/Themes/HelloWorld/Graphics/ScreenGuideMain scroll.lua b/Themes/HelloWorld/Graphics/ScreenGuideMain scroll.lua index 342b39c369..704691011d 100644 --- a/Themes/HelloWorld/Graphics/ScreenGuideMain scroll.lua +++ b/Themes/HelloWorld/Graphics/ScreenGuideMain scroll.lua @@ -1,40 +1,91 @@ -local gc = Var("GameCommand") -local itemName = gc:GetName() - -local t = Def.ActorFrame{ - -- focused frame - LoadActor( THEME:GetPathG("SectionMenu","ItemFocused") )..{ - GainFocusCommand=cmd(decelerate,0.25;diffusealpha,1); - LoseFocusCommand=cmd(stoptweening;decelerate,0.25;diffusealpha,0); - }; - -- unfocused - LoadActor( THEME:GetPathG("SectionMenu","ItemUnfocused") )..{ - GainFocusCommand=cmd(decelerate,0.25;diffusealpha,0); - LoseFocusCommand=cmd(stoptweening;decelerate,0.25;diffusealpha,1); - }; - - LoadActor( THEME:GetPathG("_section", "Guide") )..{ - InitCommand=cmd(x,-240;y,-23;Real;halign,0); - GainFocusCommand=cmd(decelerate,0.25;diffusealpha,0.9); - LoseFocusCommand=cmd(stoptweening;decelerate,0.25;diffusealpha,0.45); - }; - - Def.ActorFrame{ - LoadFont("_frutiger roman 24px")..{ - Name="SectionName"; - Text=THEME:GetString("ScreenGuideMain",itemName); - InitCommand=cmd(x,-246;y,-6;halign,0;diffuse,color("#222222FF")); - GainFocusCommand=cmd(decelerate,0.25;diffusealpha,1); - LoseFocusCommand=cmd(stoptweening;decelerate,0.25;diffusealpha,0.5); - }; - LoadFont("_frutiger roman 24px")..{ - Name="SectionDesc"; - Text=THEME:GetString("ScreenGuideMain",itemName.."Desc"); - InitCommand=cmd(x,-244;y,10;align,0,0;diffuse,color("#222222FF");zoom,0.5); - GainFocusCommand=cmd(decelerate,0.25;diffusealpha,1); - LoseFocusCommand=cmd(stoptweening;decelerate,0.25;diffusealpha,0.5); - }; - }; -}; - +local gc = Var("GameCommand") +local itemName = gc:GetName() + +local t = Def.ActorFrame{ + -- focused frame + LoadActor( THEME:GetPathG("SectionMenu","ItemFocused") )..{ + GainFocusCommand=function(self) + self:decelerate(0.25); + self:diffusealpha(1); + end; + LoseFocusCommand=function(self) + self:stoptweening(); + self:decelerate(0.25); + self:diffusealpha(0); + end; + }; + -- unfocused + LoadActor( THEME:GetPathG("SectionMenu","ItemUnfocused") )..{ + GainFocusCommand=function(self) + self:decelerate(0.25); + self:diffusealpha(0); + end; + LoseFocusCommand=function(self) + self:stoptweening(); + self:decelerate(0.25); + self:diffusealpha(1); + end; + }; + + LoadActor( THEME:GetPathG("_section", "Guide") )..{ + InitCommand=function(self) + self:x(-240); + self:y(-23); + self:Real(); + self:halign,(0); + end; + GainFocusCommand=function(self) + self:decelerate(0.25); + self:diffusealpha(0.9); + end; + LoseFocusCommand=function(self) + self:stoptweening(); + self:decelerate(0.25); + self:diffusealpha(0.45); + end; + }; + + Def.ActorFrame{ + LoadFont("_frutiger roman 24px")..{ + Name="SectionName"; + Text=THEME:GetString("ScreenGuideMain",itemName); + InitCommand=function(self) + self:x(-246); + self:y(-6); + self:halign(0); + self:diffuse(color("#222222FF")); + end; + GainFocusCommand=function(self) + self:decelerate(0.25); + self:diffusealpha(1); + end; + LoseFocusCommand=function(self) + self:stoptweening(); + self:decelerate(0.25); + self:diffusealpha(0.5); + end; + }; + LoadFont("_frutiger roman 24px")..{ + Name="SectionDesc"; + Text=THEME:GetString("ScreenGuideMain",itemName.."Desc"); + InitCommand=function(self) + self:x(-244); + self:y(10); + self:align(0, 0); + self:diffuse(color("#222222FF")); + self:zoom(0.5); + end; + GainFocusCommand=function(self) + self:decelerate(0.25); + self:diffusealpha(1); + end; + LoseFocusCommand=function(self) + self:stoptweening(); + self:decelerate(0.25); + self:diffusealpha(0.5); + end; + }; + }; +}; + return t; \ No newline at end of file diff --git a/Themes/HelloWorld/Graphics/ScreenReferenceMain header.lua b/Themes/HelloWorld/Graphics/ScreenReferenceMain header.lua index 8eaf6439f7..dbabe3986b 100644 --- a/Themes/HelloWorld/Graphics/ScreenReferenceMain header.lua +++ b/Themes/HelloWorld/Graphics/ScreenReferenceMain header.lua @@ -1,23 +1,52 @@ -local t = Def.ActorFrame{ - Def.Quad{ - InitCommand=cmd(zoomto,SCREEN_WIDTH,96;diffuse,color("#EEF4FFCC")); - }; - Def.ActorFrame{ - InitCommand=cmd(y,12); - LoadFont("_frutiger roman 24px")..{ - Name="Header"; - Text=THEME:GetString("ScreenReferenceMain","Header"); - InitCommand=cmd(x,-312;y,-34;halign,0;diffuse,color("#111111FF");diffusetopedge,color("#11111188");shadowlength,-1;shadowcolor,color("#FFFFFF44")); - }; - Def.Quad{ - InitCommand=cmd(zoomto,SCREEN_WIDTH*0.975,2;y,-20;diffuse,color("#111111FF");diffusetopedge,color("#11111188");shadowlength,-1;shadowcolor,color("#FFFFFF44");fadeleft,0.1;faderight,0.625); - }; - LoadFont("_frutiger roman 24px")..{ - Name="Explanation"; - Text=THEME:GetString("ScreenReferenceMain","Explanation"); - InitCommand=cmd(x,-312;y,-14;align,0,0;diffuse,color("#111111FF");zoom,0.65;wrapwidthpixels,(SCREEN_WIDTH)); - }; - }; -}; - +local t = Def.ActorFrame{ + Def.Quad{ + InitCommand=function(self) + self:zoomto(SCREEN_WIDTH, 96); + self:diffuse(color("#EEF4FFCC")); + end; + }; + Def.ActorFrame{ + InitCommand=function(self) + self:y(12); + end; + LoadFont("_frutiger roman 24px")..{ + Name="Header"; + Text=THEME:GetString("ScreenReferenceMain","Header"); + InitCommand=function(self) + self:x(-312); + self:y(-34); + self:halign(0); + self:diffuse(color("#111111FF")); + self:diffusetopedge(color("#11111188")); + self:shadowlength(-1); + self:shadowcolor(color("#FFFFFF44")); + end; + }; + Def.Quad{ + InitCommand=function(self) + self:zoomto(SCREEN_WIDTH * 0.975, 2); + self:y(-20); + self:diffuse(color("#111111FF")); + self:diffusetopedge(color("#11111188")); + self:shadowlength(-1); + self:shadowcolor(color("#FFFFFF44")); + self:fadeleft(0.1); + self:faderight(0.625); + end; + }; + LoadFont("_frutiger roman 24px")..{ + Name="Explanation"; + Text=THEME:GetString("ScreenReferenceMain","Explanation"); + InitCommand=function(self) + self:x(-312); + self:y(-14); + self:align(0, 0); + self:diffuse(color("#111111FF")); + self:zoom(0.65); + self:wrapwidthpixels(SCREEN_WIDTH); + end; + }; + }; +}; + return t; \ No newline at end of file diff --git a/Themes/HelloWorld/Graphics/ScreenReferenceMain scroll.lua b/Themes/HelloWorld/Graphics/ScreenReferenceMain scroll.lua index d6317820a5..b8049f8e01 100644 --- a/Themes/HelloWorld/Graphics/ScreenReferenceMain scroll.lua +++ b/Themes/HelloWorld/Graphics/ScreenReferenceMain scroll.lua @@ -1,47 +1,110 @@ -local gc = Var("GameCommand") -local itemName = gc:GetName() -local url = gc:GetUrl() - -local t = Def.ActorFrame{ - -- focused frame - LoadActor( THEME:GetPathG("SectionMenu","ItemFocused") )..{ - GainFocusCommand=cmd(decelerate,0.25;diffusealpha,1); - LoseFocusCommand=cmd(stoptweening;decelerate,0.25;diffusealpha,0); - }; - -- unfocused - LoadActor( THEME:GetPathG("SectionMenu","ItemUnfocused") )..{ - GainFocusCommand=cmd(decelerate,0.25;diffusealpha,0); - LoseFocusCommand=cmd(stoptweening;decelerate,0.25;diffusealpha,1); - }; - - LoadActor( THEME:GetPathG("_section", "Reference") )..{ - InitCommand=cmd(x,-240;y,-23;Real;halign,0); - GainFocusCommand=cmd(decelerate,0.25;diffusealpha,0.9); - LoseFocusCommand=cmd(stoptweening;decelerate,0.25;diffusealpha,0.45); - }; - - Def.ActorFrame{ - LoadFont("_frutiger roman 24px")..{ - Name="SectionName"; - Text=THEME:GetString("ScreenReferenceMain",itemName); - InitCommand=cmd(x,-246;y,-6;halign,0;diffuse,color("#222222FF")); - GainFocusCommand=cmd(decelerate,0.25;diffusealpha,1); - LoseFocusCommand=cmd(stoptweening;decelerate,0.25;diffusealpha,0.5); - }; - LoadFont("_frutiger roman 24px")..{ - Name="SectionDesc"; - Text=THEME:GetString("ScreenReferenceMain",itemName.."Desc"); - InitCommand=cmd(x,-244;y,10;align,0,0;diffuse,color("#222222FF");zoom,0.5); - GainFocusCommand=cmd(decelerate,0.25;diffusealpha,1); - LoseFocusCommand=cmd(stoptweening;decelerate,0.25;diffusealpha,0.5); - }; - LoadActor(THEME:GetPathG("_tango","webbrowser"))..{ - Name="UrlIcon"; - InitCommand=cmd(x,224;y,4;zoom,0.75;visible,url~=""); - GainFocusCommand=cmd(decelerate,0.25;diffusealpha,1); - LoseFocusCommand=cmd(stoptweening;decelerate,0.25;diffusealpha,0.5); - }; - }; -}; - +local gc = Var("GameCommand") +local itemName = gc:GetName() +local url = gc:GetUrl() + +local t = Def.ActorFrame{ + -- focused frame + LoadActor( THEME:GetPathG("SectionMenu","ItemFocused") )..{ + GainFocusCommand=function(self) + self:decelerate(0.25); + self:diffusealpha,(1); + end; + LoseFocusCommand=function(self) + self:stoptweening(); + self:decelerate(0.25); + self:diffusealpha(0); + end; + }; + -- unfocused + LoadActor( THEME:GetPathG("SectionMenu","ItemUnfocused") )..{ + GainFocusCommand=function(self) + self:decelerate(0.25); + self:diffusealpha(0); + end; + LoseFocusCommand=function(self) + self:stoptweening(); + self:decelerate(0.25); + self:diffusealpha(1); + end; + }; + + LoadActor( THEME:GetPathG("_section", "Reference") )..{ + InitCommand=function(self) + self:x(-240); + self:y(-23); + self:Real(); + self:halign(0); + end; + GainFocusCommand=function(self) + self:decelerate(0.25); + self:diffusealpha(0.9); + end; + LoseFocusCommand=function(self) + self:stoptweening(); + self:decelerate(0.25); + self:diffusealpha(0.45); + end; + }; + + Def.ActorFrame{ + LoadFont("_frutiger roman 24px")..{ + Name="SectionName"; + Text=THEME:GetString("ScreenReferenceMain",itemName); + InitCommand=function(self) + self:x(-246); + self:y(-6); + self:halign(0); + self:diffuse(color("#222222FF")); + end; + GainFocusCommand=function(self) + self:decelerate(0.25); + self:diffusealpha(1); + end; + LoseFocusCommand=function(self) + self:stoptweening(); + self:decelerate(0.25); + self:diffusealpha(0.5); + end; + }; + LoadFont("_frutiger roman 24px")..{ + Name="SectionDesc"; + Text=THEME:GetString("ScreenReferenceMain",itemName.."Desc"); + InitCommand=function(self) + self:x(-244); + self:y(10); + self:align(0, 0); + self:diffuse(color("#222222FF")); + self:zoom(0.5); + end; + GainFocusCommand=function(self) + self:decelerate(0.25); + self:diffusealpha(1); + end; + LoseFocusCommand=function(self) + self:stoptweening(); + self:decelerate(0.25); + self:diffusealpha(0.5); + end; + }; + LoadActor(THEME:GetPathG("_tango","webbrowser"))..{ + Name="UrlIcon"; + InitCommand=function(self) + self:x(224); + self:y(4); + self:zoom(0.75); + self:visible(url~=""); + end; + GainFocusCommand=function(self) + self:decelerate(0.25); + self:diffusealpha(1); + end; + LoseFocusCommand=function(self) + self:stoptweening(); + self:decelerate(0.25); + self:diffusealpha(0.5); + end; + }; + }; +}; + return t; \ No newline at end of file diff --git a/Themes/HelloWorld/Graphics/ScreenTitleMenu scroll.lua b/Themes/HelloWorld/Graphics/ScreenTitleMenu scroll.lua index da98cd68ac..52b4c1bc5a 100644 --- a/Themes/HelloWorld/Graphics/ScreenTitleMenu scroll.lua +++ b/Themes/HelloWorld/Graphics/ScreenTitleMenu scroll.lua @@ -1,35 +1,63 @@ --- This file is used to define how the items should look on ScreenTitleMenu. --- The syntax is different because I took this code from moonlight. :) - ---[[ -Concepts used: -* THEME:GetString(screen,string) -* zoom -* shadowlength -* diffuse -* halign (0 = left, 0.5 = middle, 1 = right) -* strokecolor -* stoptweening -* accelerate ---]] - --- this is used as a shorthand for GameCommand. -local gc = Var("GameCommand") - -local t = Def.ActorFrame{ - LoadFont( "_frutiger roman" ) ..{ - -- This line tries to find a corresponding line in the current language - -- ini file; If it doesn't, (and you haven't disabled error messages,) - -- then an error will pop up telling you where you need to add the - -- string. - Text=THEME:GetString( 'ScreenTitleMenu', gc:GetText() ); - InitCommand=cmd(zoom,0.85;y,-1;shadowlength,0;diffuse,color("#000000");halign,1;strokecolor,color("0,0,0,0");); - DisabledCommand=cmd( diffuse,color("0.45,0,0,1") ); - GainFocusCommand=cmd(stoptweening;accelerate,0.15;diffuse,color("#000000");strokecolor,color("0.85,0.9,1,0.75");); - LoseFocusCommand=cmd(stoptweening;accelerate,0.2;diffuse,color("#888888");strokecolor,color("0,0,0,0");); - OffFocusedCommand=cmd(sleep,0.45;decelerate,1;addx,-32;diffuse,color("#FF000000");); - OffUnfocusedCommand=cmd(sleep,0.125*gc:GetIndex();linear,0.5;addx,SCREEN_CENTER_X;); - }; -}; - +-- This file is used to define how the items should look on ScreenTitleMenu. +-- The syntax is different because I took this code from moonlight. :) + +--[[ +Concepts used: +* THEME:GetString(screen,string) +* zoom +* shadowlength +* diffuse +* halign (0 = left, 0.5 = middle, 1 = right) +* strokecolor +* stoptweening +* accelerate +--]] + +-- this is used as a shorthand for GameCommand. +local gc = Var("GameCommand") + +local t = Def.ActorFrame{ + LoadFont( "_frutiger roman" ) ..{ + -- This line tries to find a corresponding line in the current language + -- ini file; If it doesn't, (and you haven't disabled error messages,) + -- then an error will pop up telling you where you need to add the + -- string. + Text=THEME:GetString( 'ScreenTitleMenu', gc:GetText() ); + InitCommand=function(self) + self:zoom(0.85); + self:y(-1); + self:shadowlength(0); + self:diffuse(color("#000000")); + self:halign(1); + self:strokecolor(color("0,0,0,0")); + end; + DisabledCommand=function(self) + self:diffuse(color("0.45,0,0,1")); + end; + GainFocusCommand=function(self) + self:stoptweening(); + self:accelerate(0.15); + self:diffuse(color("#000000")); + self:strokecolor(color("0.85,0.9,1,0.75")); + end; + LoseFocusCommand=function(self) + self:stoptweening(); + self:accelerate(0.2); + self:diffuse(color("#888888")); + self:strokecolor(color("0,0,0,0")); + end; + OffFocusedCommand=function(self) + self:sleep(0.45); + self:decelerate(1); + self:addx(-32); + self:diffuse(color("#FF000000")); + end; + OffUnfocusedCommand=function(self) + self:sleep(0.125 * gc:GetIndex()); + self:linear(0.5); + self:addx(SCREEN_CENTER_X); + end; + }; +}; + return t; \ No newline at end of file diff --git a/Themes/_fallback/Scripts/02 Actor.lua b/Themes/_fallback/Scripts/02 Actor.lua index d13ebf13c0..62e1bae0f2 100644 --- a/Themes/_fallback/Scripts/02 Actor.lua +++ b/Themes/_fallback/Scripts/02 Actor.lua @@ -1,400 +1,400 @@ --- Convenience aliases: -left = "HorizAlign_Left" -center = "HorizAlign_Center" -right = "HorizAlign_Right" -top = "VertAlign_Top" -middle = "VertAlign_Middle" -bottom = "VertAlign_Bottom" - -function Actor:ease(t, fEase) - -- Optimizations: - -- fEase = -100 is equivalent to TweenType_Accelerate. - if fEase == -100 then - self:accelerate(t) - return - end - - -- fEase = 0 is equivalent to TweenType_Linear. - if fEase == 0 then - self:linear(t) - return - end - - -- fEase = +100 is equivalent to TweenType_Decelerate. - if fEase == 100 then - self:decelerate(t) - return - end - - self:tween( t, "TweenType_Bezier", - { - 0, - scale(fEase, -100, 100, 0/3, 2/3), - scale(fEase, -100, 100, 1/3, 3/3), - 1 - } - ) -end --- Notes On Beziers -- --- They can be 1D ( Quadratic ) or 2D ( Bezier ) --- 1D: --- XA XB YC YD --- 2D: --- XA XB XC XD YA YB YC YD --- In 1D Quads, XA XB are beginning time and size, YC YD are ending time and size --- In 2D Quads, X -local BounceBeginBezier = -{ - 0, 0, - 0.42, -0.42, - 2/3, 0.3, - 1, 1 -} -function Actor:bouncebegin(t) - self:tween( t, "TweenType_Bezier", BounceBeginBezier ) -end - -local BounceEndBezier = -{ - 0,0, - 1/3, 0.7, - 0.58, 1.42, - 1, 1 -} -function Actor:bounceend(t) - self:tween( t, "TweenType_Bezier", BounceEndBezier ) -end - -local SmoothBezier = -{ - 0, 0, 1, 1 -} -function Actor:smooth(t) - self:tween( t, "TweenType_Bezier", SmoothBezier ) -end --- SSC Additions -local DropBezier = -{ - 0 , 0, - 1/3 , 1, - 2/3 , 0.5, - 1 , 1, -} -function Actor:drop(t) - self:tween( t, "TweenType_Bezier", DropBezier ) -end - --- compound tweens "combine multiple interpolators to allow generating more --- complex tweens." length is how long to span the animation for, while --- ... is either a string (e.g. "linear,0.25,accelerate,0.75") or a table --- with the tween information. -function Actor:compound(length,...) - local tweens = ... - - if type(tweens) == "string" then - local parsed = split(";",tweens) - tweens = {} -- convert to table - for i,s in pairs(parsed) do - local res = split(",",s) - - tweens[i] = { - Type = res[1], - Percent = res[2], - Bezier = res[3] or nil - } - end - end - - for i,t in pairs(tweens) do - if t.Type == "linear" then self:linear(t.Percent*length) - elseif t.Type == "accelerate" then self:accelerate(t.Percent*length) - elseif t.Type == "decelerate" then self:decelerate(t.Percent*length) - elseif t.Type == "spring" then self:spring(t.Percent*length) - elseif t.Type == "bouncebegin" then self:bouncebegin(t.Percent*length) - elseif t.Type == "bounceend" then self:bounceend(t.Percent*length) - elseif t.Type == "smooth" then self:smooth(t.Percent*length) - elseif t.Type == "drop" then self:smooth(t.Percent*length) - --elseif t.Type == "ease" then self:ease(t.Percent*length) - elseif t.Type == "bezier" then - -- todo: handle using tween and 'TweenType_Bezier' - end - end -end - --- Hide if b is true, but don't unhide if b is false. -function Actor:hide_if(b) - if b then - self:visible(false) - end -end - -function Actor:player(p) - self:visible( GAMESTATE:IsHumanPlayer(p) ) -end - -function ActorFrame:propagatecommand(...) - self:propagate(1) - self:playcommand(...) - self:propagate(0) -end - --- Shortcut for alignment. --- cmd(align,0.5,0.5) -- align center --- cmd(align,0.0,0.0) -- align top-left --- cmd(align,0.5,0.0) -- align top-center -function Actor:align(h, v) - self:halign( h ) - self:valign( v ) -end - -function Actor:FullScreen() - self:stretchto( 0,0,SCREEN_WIDTH,SCREEN_HEIGHT ) -end - -function Actor:scale_or_crop_background() - local graphicAspect = self:GetWidth()/self:GetHeight() - self:zoomto(SCREEN_HEIGHT*graphicAspect,SCREEN_HEIGHT) -end - -function Actor:CenterX() self:x(SCREEN_CENTER_X) end -function Actor:CenterY() self:y(SCREEN_CENTER_Y) end -function Actor:Center() self:xy(SCREEN_CENTER_X,SCREEN_CENTER_Y) end - -function Actor:bezier(...) - local a = {...} - local b = {} - local c = 0 - assert((a == 9 or a == 5), "bad number of arguments for Actor:bezier()") - for i=3,c do - b[#b+1] = a[i] - end - self:tween(a[2], "TweenMode_Bezier", b) -end - -function Actor:Real() - -- scale back down to real pixels. - self:basezoom(GetReal()) - -- don't make this ugly - self:SetTextureFiltering(false) -end - --- Scale things back up after they have already been scaled down. -function Actor:RealInverse() - -- scale back up to theme resolution - self:basezoom(GetRealInverse()) - self:SetTextureFiltering(true) -end - --- MaskSource([clearzbuffer]) --- Sets an actor up as the source for a mask. Clears zBuffer by default. -function Actor:MaskSource(noclear) - if noclear == true then - self:clearzbuffer(true) - end - self:zwrite(true) - self:blend('BlendMode_NoEffect') -end - --- MaskDest() --- Sets an actor up to be masked by anything with MaskSource(). -function Actor:MaskDest() - self:ztest(true) -end - --- Thump() --- A customized version of pulse that is more appealing for on-beat --- effects; -function Actor:thump(fEffectPeriod) - self:pulse() - if fEffectPeriod ~= nil then - self:effecttiming(0,0,0.75*fEffectPeriod,0.25*fEffectPeriod) - else - self:effecttiming(0,0,0.75,0.25) - end - -- The default effectmagnitude will make this effect look very bad. - self:effectmagnitude(1,1.125,1) -end - --- Heartbeat() --- A customized version of pulse that is more appealing for on-beat --- effects; -function Actor:heartbeat(fEffectPeriod) - self:pulse() - if fEffectPeriod ~= nil then - self:effecttiming(0,0.125*fEffectPeriod,0.125*fEffectPeriod,0.75*fEffectPeriod); - else - self:effecttiming(0,0.125,0.125,0.75); - end - self:effecmagnitude(1,1.125,1) -end - ---[[ BitmapText commands ]] - --- PixelFont() --- An alias that turns off texture filtering. --- Named because it works best with pixel fonts. -function BitmapText:PixelFont() - self:SetTextureFiltering(false) -end - --- Stroke(color) --- Sets the text's stroke color. -function BitmapText:Stroke(c) - self:strokecolor( c ) -end - --- NoStroke() --- Removes any stroke. -function BitmapText:NoStroke() - self:strokecolor( color("0,0,0,0") ) -end - --- Set Text With Format (contributed by Daisuke Master) --- this function is my hero - shake -function BitmapText:settextf(...) - self:settext(string.format(...)) -end - --- DiffuseAndStroke(diffuse,stroke) --- Set diffuse and stroke at the same time. -function BitmapText:DiffuseAndStroke(diffuseC,strokeC) - self:diffuse(diffuseC) - self:strokecolor(strokeC) -end; ---[[ end BitmapText commands ]] - -function Actor:LyricCommand(side) - self:settext( Var "LyricText" ) - self:draworder(102) - - self:stoptweening() - self:shadowlengthx(0) - self:shadowlengthy(5) - self:strokecolor(color("#000000")) - - local Zoom = SCREEN_WIDTH / (self:GetZoomedWidth()+1) - if( Zoom > 1 ) then - Zoom = 1 - end - self:zoomx( Zoom ) - - local lyricColor = Var "LyricColor" - local Factor = 1 - if side == "Back" then - Factor = 0.5 - elseif side == "Front" then - Factor = 0.9 - end - self:diffuse( { - lyricColor[1] * Factor, - lyricColor[2] * Factor, - lyricColor[3] * Factor, - lyricColor[4] * Factor } ) - - if side == "Front" then - self:cropright(1) - else - self:cropleft(0) - end - - self:diffusealpha(0) - self:linear(0.2) - self:diffusealpha(0.75) - self:linear( Var "LyricDuration" * 0.75) - if side == "Front" then - self:cropright(0) - else - self:cropleft(1) - end - self:sleep( Var "LyricDuration" * 0.25 ) - self:linear(0.2) - self:diffusealpha(0) -end - --- formerly in 02 HelpDisplay.lua, although nothing uses it: -function HelpDisplay:setfromsongorcourse() - local Artists = {} - local AltArtists = {} - - local Song = GAMESTATE:GetCurrentSong() - local Trail = GAMESTATE:GetCurrentTrail( GAMESTATE:GetMasterPlayerNumber() ) - if Song then - table.insert( Artists, Song:GetDisplayArtist() ) - table.insert( AltArtists, Song:GetTranslitArtist() ) - elseif Trail then - Artists, AltArtists = Trail:GetArtists() - end - - self:settips( Artists, AltArtists ) -end - --- Play the sound on the given player's side. Must set SupportPan = true --- on load. -function ActorSound:playforplayer(pn) - local fBalance = SOUND:GetPlayerBalance(pn) - self:get():SetProperty("Pan", fBalance) - self:play() -end - -function PositionPerPlayer(player, p1X, p2X) - return player == PLAYER_1 and p1X or p2X -end - --- Make graphics their true size at any resolution. ---[[ Note: for screens taller than wide (i.e. phones, sideways displays), -you'll need to get width rather than height (I just don't feel like -uglyfying my code just to handle rare cases). -shake ]] -function GetReal() - local theme = THEME:GetMetric("Common","ScreenHeight") - local res = PREFSMAN:GetPreference("DisplayHeight") - return theme/res -end -function GetRealInverse() - local theme = THEME:GetMetric("Common","ScreenHeight") - local res = PREFSMAN:GetPreference("DisplayHeight") - return res/theme -end - --- command aliases: -function Actor:SetSize(w,h) self:setsize(w,h) end - --- Simple draworder mappings -DrawOrder = { - Background = -100, - Underlay = 0, - Decorations = 100, - Content = 105, - Screen = 120, - Overlay = 200 -}; - --- function Actor:SetDrawOrder - --- deprecated aliases: -function Actor:hidden(bHide) - Warn("hidden is deprecated, use visible instead. (used on ".. self:GetName() ..")") - self:visible(not bHide) -end - --- (c) 2006-2012 Glenn Maynard, the Spinal Shark Collective, et al. --- All rights reserved. --- --- Permission is hereby granted, free of charge, to any person obtaining a --- copy of this software and associated documentation files (the --- "Software"), to deal in the Software without restriction, including --- without limitation the rights to use, copy, modify, merge, publish, --- distribute, and/or sell copies of the Software, and to permit persons to --- whom the Software is furnished to do so, provided that the above --- copyright notice(s) and this permission notice appear in all copies of --- the Software and that both the above copyright notice(s) and this --- permission notice appear in supporting documentation. --- --- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF --- THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS --- INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT --- OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS --- OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR --- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +-- Convenience aliases: +left = "HorizAlign_Left" +center = "HorizAlign_Center" +right = "HorizAlign_Right" +top = "VertAlign_Top" +middle = "VertAlign_Middle" +bottom = "VertAlign_Bottom" + +function Actor:ease(t, fEase) + -- Optimizations: + -- fEase = -100 is equivalent to TweenType_Accelerate. + if fEase == -100 then + self:accelerate(t) + return + end + + -- fEase = 0 is equivalent to TweenType_Linear. + if fEase == 0 then + self:linear(t) + return + end + + -- fEase = +100 is equivalent to TweenType_Decelerate. + if fEase == 100 then + self:decelerate(t) + return + end + + self:tween( t, "TweenType_Bezier", + { + 0, + scale(fEase, -100, 100, 0/3, 2/3), + scale(fEase, -100, 100, 1/3, 3/3), + 1 + } + ) +end +-- Notes On Beziers -- +-- They can be 1D ( Quadratic ) or 2D ( Bezier ) +-- 1D: +-- XA XB YC YD +-- 2D: +-- XA XB XC XD YA YB YC YD +-- In 1D Quads, XA XB are beginning time and size, YC YD are ending time and size +-- In 2D Quads, X +local BounceBeginBezier = +{ + 0, 0, + 0.42, -0.42, + 2/3, 0.3, + 1, 1 +} +function Actor:bouncebegin(t) + self:tween( t, "TweenType_Bezier", BounceBeginBezier ) +end + +local BounceEndBezier = +{ + 0,0, + 1/3, 0.7, + 0.58, 1.42, + 1, 1 +} +function Actor:bounceend(t) + self:tween( t, "TweenType_Bezier", BounceEndBezier ) +end + +local SmoothBezier = +{ + 0, 0, 1, 1 +} +function Actor:smooth(t) + self:tween( t, "TweenType_Bezier", SmoothBezier ) +end +-- SSC Additions +local DropBezier = +{ + 0 , 0, + 1/3 , 1, + 2/3 , 0.5, + 1 , 1, +} +function Actor:drop(t) + self:tween( t, "TweenType_Bezier", DropBezier ) +end + +-- compound tweens "combine multiple interpolators to allow generating more +-- complex tweens." length is how long to span the animation for, while +-- ... is either a string (e.g. "linear,0.25,accelerate,0.75") or a table +-- with the tween information. +function Actor:compound(length,...) + local tweens = ... + + if type(tweens) == "string" then + local parsed = split(";",tweens) + tweens = {} -- convert to table + for i,s in pairs(parsed) do + local res = split(",",s) + + tweens[i] = { + Type = res[1], + Percent = res[2], + Bezier = res[3] or nil + } + end + end + + for i,t in pairs(tweens) do + if t.Type == "linear" then self:linear(t.Percent*length) + elseif t.Type == "accelerate" then self:accelerate(t.Percent*length) + elseif t.Type == "decelerate" then self:decelerate(t.Percent*length) + elseif t.Type == "spring" then self:spring(t.Percent*length) + elseif t.Type == "bouncebegin" then self:bouncebegin(t.Percent*length) + elseif t.Type == "bounceend" then self:bounceend(t.Percent*length) + elseif t.Type == "smooth" then self:smooth(t.Percent*length) + elseif t.Type == "drop" then self:smooth(t.Percent*length) + --elseif t.Type == "ease" then self:ease(t.Percent*length) + elseif t.Type == "bezier" then + -- todo: handle using tween and 'TweenType_Bezier' + end + end +end + +-- Hide if b is true, but don't unhide if b is false. +function Actor:hide_if(b) + if b then + self:visible(false) + end +end + +function Actor:player(p) + self:visible( GAMESTATE:IsHumanPlayer(p) ) +end + +function ActorFrame:propagatecommand(...) + self:propagate(1) + self:playcommand(...) + self:propagate(0) +end + +-- Shortcut for alignment. +-- function(self) self:align(0.5,0.5); end; -- align center +-- function(self) self:align(0.0,0.0); end; -- align top-left +-- function(self) self:align(0.5,0.0); end; -- align top-center +function Actor:align(h, v) + self:halign( h ) + self:valign( v ) +end + +function Actor:FullScreen() + self:stretchto( 0,0,SCREEN_WIDTH,SCREEN_HEIGHT ) +end + +function Actor:scale_or_crop_background() + local graphicAspect = self:GetWidth()/self:GetHeight() + self:zoomto(SCREEN_HEIGHT*graphicAspect,SCREEN_HEIGHT) +end + +function Actor:CenterX() self:x(SCREEN_CENTER_X) end +function Actor:CenterY() self:y(SCREEN_CENTER_Y) end +function Actor:Center() self:xy(SCREEN_CENTER_X,SCREEN_CENTER_Y) end + +function Actor:bezier(...) + local a = {...} + local b = {} + local c = 0 + assert((a == 9 or a == 5), "bad number of arguments for Actor:bezier()") + for i=3,c do + b[#b+1] = a[i] + end + self:tween(a[2], "TweenMode_Bezier", b) +end + +function Actor:Real() + -- scale back down to real pixels. + self:basezoom(GetReal()) + -- don't make this ugly + self:SetTextureFiltering(false) +end + +-- Scale things back up after they have already been scaled down. +function Actor:RealInverse() + -- scale back up to theme resolution + self:basezoom(GetRealInverse()) + self:SetTextureFiltering(true) +end + +-- MaskSource([clearzbuffer]) +-- Sets an actor up as the source for a mask. Clears zBuffer by default. +function Actor:MaskSource(noclear) + if noclear == true then + self:clearzbuffer(true) + end + self:zwrite(true) + self:blend('BlendMode_NoEffect') +end + +-- MaskDest() +-- Sets an actor up to be masked by anything with MaskSource(). +function Actor:MaskDest() + self:ztest(true) +end + +-- Thump() +-- A customized version of pulse that is more appealing for on-beat +-- effects; +function Actor:thump(fEffectPeriod) + self:pulse() + if fEffectPeriod ~= nil then + self:effecttiming(0,0,0.75*fEffectPeriod,0.25*fEffectPeriod) + else + self:effecttiming(0,0,0.75,0.25) + end + -- The default effectmagnitude will make this effect look very bad. + self:effectmagnitude(1,1.125,1) +end + +-- Heartbeat() +-- A customized version of pulse that is more appealing for on-beat +-- effects; +function Actor:heartbeat(fEffectPeriod) + self:pulse() + if fEffectPeriod ~= nil then + self:effecttiming(0,0.125*fEffectPeriod,0.125*fEffectPeriod,0.75*fEffectPeriod); + else + self:effecttiming(0,0.125,0.125,0.75); + end + self:effecmagnitude(1,1.125,1) +end + +--[[ BitmapText commands ]] + +-- PixelFont() +-- An alias that turns off texture filtering. +-- Named because it works best with pixel fonts. +function BitmapText:PixelFont() + self:SetTextureFiltering(false) +end + +-- Stroke(color) +-- Sets the text's stroke color. +function BitmapText:Stroke(c) + self:strokecolor( c ) +end + +-- NoStroke() +-- Removes any stroke. +function BitmapText:NoStroke() + self:strokecolor( color("0,0,0,0") ) +end + +-- Set Text With Format (contributed by Daisuke Master) +-- this function is my hero - shake +function BitmapText:settextf(...) + self:settext(string.format(...)) +end + +-- DiffuseAndStroke(diffuse,stroke) +-- Set diffuse and stroke at the same time. +function BitmapText:DiffuseAndStroke(diffuseC,strokeC) + self:diffuse(diffuseC) + self:strokecolor(strokeC) +end; +--[[ end BitmapText commands ]] + +function Actor:LyricCommand(side) + self:settext( Var "LyricText" ) + self:draworder(102) + + self:stoptweening() + self:shadowlengthx(0) + self:shadowlengthy(5) + self:strokecolor(color("#000000")) + + local Zoom = SCREEN_WIDTH / (self:GetZoomedWidth()+1) + if( Zoom > 1 ) then + Zoom = 1 + end + self:zoomx( Zoom ) + + local lyricColor = Var "LyricColor" + local Factor = 1 + if side == "Back" then + Factor = 0.5 + elseif side == "Front" then + Factor = 0.9 + end + self:diffuse( { + lyricColor[1] * Factor, + lyricColor[2] * Factor, + lyricColor[3] * Factor, + lyricColor[4] * Factor } ) + + if side == "Front" then + self:cropright(1) + else + self:cropleft(0) + end + + self:diffusealpha(0) + self:linear(0.2) + self:diffusealpha(0.75) + self:linear( Var "LyricDuration" * 0.75) + if side == "Front" then + self:cropright(0) + else + self:cropleft(1) + end + self:sleep( Var "LyricDuration" * 0.25 ) + self:linear(0.2) + self:diffusealpha(0) +end + +-- formerly in 02 HelpDisplay.lua, although nothing uses it: +function HelpDisplay:setfromsongorcourse() + local Artists = {} + local AltArtists = {} + + local Song = GAMESTATE:GetCurrentSong() + local Trail = GAMESTATE:GetCurrentTrail( GAMESTATE:GetMasterPlayerNumber() ) + if Song then + table.insert( Artists, Song:GetDisplayArtist() ) + table.insert( AltArtists, Song:GetTranslitArtist() ) + elseif Trail then + Artists, AltArtists = Trail:GetArtists() + end + + self:settips( Artists, AltArtists ) +end + +-- Play the sound on the given player's side. Must set SupportPan = true +-- on load. +function ActorSound:playforplayer(pn) + local fBalance = SOUND:GetPlayerBalance(pn) + self:get():SetProperty("Pan", fBalance) + self:play() +end + +function PositionPerPlayer(player, p1X, p2X) + return player == PLAYER_1 and p1X or p2X +end + +-- Make graphics their true size at any resolution. +--[[ Note: for screens taller than wide (i.e. phones, sideways displays), +you'll need to get width rather than height (I just don't feel like +uglyfying my code just to handle rare cases). -shake ]] +function GetReal() + local theme = THEME:GetMetric("Common","ScreenHeight") + local res = PREFSMAN:GetPreference("DisplayHeight") + return theme/res +end +function GetRealInverse() + local theme = THEME:GetMetric("Common","ScreenHeight") + local res = PREFSMAN:GetPreference("DisplayHeight") + return res/theme +end + +-- command aliases: +function Actor:SetSize(w,h) self:setsize(w,h) end + +-- Simple draworder mappings +DrawOrder = { + Background = -100, + Underlay = 0, + Decorations = 100, + Content = 105, + Screen = 120, + Overlay = 200 +}; + +-- function Actor:SetDrawOrder + +-- deprecated aliases: +function Actor:hidden(bHide) + Warn("hidden is deprecated, use visible instead. (used on ".. self:GetName() ..")") + self:visible(not bHide) +end + +-- (c) 2006-2012 Glenn Maynard, the Spinal Shark Collective, et al. +-- All rights reserved. +-- +-- Permission is hereby granted, free of charge, to any person obtaining a +-- copy of this software and associated documentation files (the +-- "Software"), to deal in the Software without restriction, including +-- without limitation the rights to use, copy, modify, merge, publish, +-- distribute, and/or sell copies of the Software, and to permit persons to +-- whom the Software is furnished to do so, provided that the above +-- copyright notice(s) and this permission notice appear in all copies of +-- the Software and that both the above copyright notice(s) and this +-- permission notice appear in supporting documentation. +-- +-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF +-- THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS +-- INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT +-- OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS +-- OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +-- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -- PERFORMANCE OF THIS SOFTWARE. \ No newline at end of file diff --git a/Themes/default/BGAnimations/ScreenGameplay out.lua b/Themes/default/BGAnimations/ScreenGameplay out.lua index 5ce91f80e6..0c77a0c514 100644 --- a/Themes/default/BGAnimations/ScreenGameplay out.lua +++ b/Themes/default/BGAnimations/ScreenGameplay out.lua @@ -1,50 +1,53 @@ -local raveChildren - -local bg = Def.ActorFrame{ - Def.Quad{ - InitCommand=cmd(FullScreen;diffuse,color("0,0,0,0")); - OnCommand=cmd(linear,5;diffusealpha,1); - }; - - Def.ActorFrame{ - Name="RaveMessages"; - InitCommand=function(self) - raveChildren = self:GetChildren() - self:visible(GAMESTATE:GetPlayMode() == 'PlayMode_Rave') - - raveChildren.P1Win:visible(false) - raveChildren.P2Win:visible(false) - raveChildren.Draw:visible(false) - end; - OffCommand=function(self) - local p1Win = GAMESTATE:IsWinner(PLAYER_1) - local p2Win = GAMESTATE:IsWinner(PLAYER_2) - - if GAMESTATE:IsWinner(PLAYER_1) then - raveChildren.P1Win:visible(true) - elseif GAMESTATE:IsWinner(PLAYER_2) then - raveChildren.P2Win:visible(true) - else - raveChildren.Draw:visible(true) - end - end; - - LoadActor(THEME:GetPathG("_rave result","P1"))..{ - Name="P1Win"; - InitCommand=cmd(Center;cropbottom,1;fadebottom,1;); - OnCommand=cmd(sleep,2;linear,0.5;cropbottom,0;fadebottom,0;sleep,1.75;linear,0.25;diffusealpha,0); - }; - LoadActor(THEME:GetPathG("_rave result","P2"))..{ - Name="P2Win"; - InitCommand=cmd(Center;cropbottom,1;fadebottom,1;); - OnCommand=cmd(sleep,2;linear,0.5;cropbottom,0;fadebottom,0;sleep,1.75;linear,0.25;diffusealpha,0); - }; - LoadActor(THEME:GetPathG("_rave result","draw"))..{ - Name="Draw"; - InitCommand=cmd(Center;cropbottom,1;fadebottom,1;); - OnCommand=cmd(sleep,2;linear,0.5;cropbottom,0;fadebottom,0;sleep,1.75;linear,0.25;diffusealpha,0); - }; - }; -}; - +local raveChildren + +local bg = Def.ActorFrame{ + Def.Quad{ + InitCommand=function(self) + self:FullScreen(); + self:diffuse(color("0,0,0,0")); + end; + OnCommand=cmd(linear,5;diffusealpha,1); + }; + + Def.ActorFrame{ + Name="RaveMessages"; + InitCommand=function(self) + raveChildren = self:GetChildren() + self:visible(GAMESTATE:GetPlayMode() == 'PlayMode_Rave') + + raveChildren.P1Win:visible(false) + raveChildren.P2Win:visible(false) + raveChildren.Draw:visible(false) + end; + OffCommand=function(self) + local p1Win = GAMESTATE:IsWinner(PLAYER_1) + local p2Win = GAMESTATE:IsWinner(PLAYER_2) + + if GAMESTATE:IsWinner(PLAYER_1) then + raveChildren.P1Win:visible(true) + elseif GAMESTATE:IsWinner(PLAYER_2) then + raveChildren.P2Win:visible(true) + else + raveChildren.Draw:visible(true) + end + end; + + LoadActor(THEME:GetPathG("_rave result","P1"))..{ + Name="P1Win"; + InitCommand=cmd(Center;cropbottom,1;fadebottom,1;); + OnCommand=cmd(sleep,2;linear,0.5;cropbottom,0;fadebottom,0;sleep,1.75;linear,0.25;diffusealpha,0); + }; + LoadActor(THEME:GetPathG("_rave result","P2"))..{ + Name="P2Win"; + InitCommand=cmd(Center;cropbottom,1;fadebottom,1;); + OnCommand=cmd(sleep,2;linear,0.5;cropbottom,0;fadebottom,0;sleep,1.75;linear,0.25;diffusealpha,0); + }; + LoadActor(THEME:GetPathG("_rave result","draw"))..{ + Name="Draw"; + InitCommand=cmd(Center;cropbottom,1;fadebottom,1;); + OnCommand=cmd(sleep,2;linear,0.5;cropbottom,0;fadebottom,0;sleep,1.75;linear,0.25;diffusealpha,0); + }; + }; +}; + return bg \ No newline at end of file