HelloWorld theme handled.

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