changed scale_or_crop_background function (technically it just scales now...) and replaced various scaletoclipped references with it. Hopefully this fixes the problems people have been having with song backgrounds.
This commit is contained in:
@@ -3,7 +3,7 @@ local Color2 = color(Var "Color2");
|
||||
|
||||
local t = Def.ActorFrame {
|
||||
Def.Sprite {
|
||||
OnCommand=cmd(LoadFromCurrentSongBackground;x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y;scaletoclipped,SCREEN_WIDTH,SCREEN_HEIGHT;diffuse,Color1;effectclock,"music");
|
||||
OnCommand=cmd(LoadFromCurrentSongBackground;x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y;scale_or_crop_background;diffuse,Color1;effectclock,"music");
|
||||
};
|
||||
|
||||
LoadActor(Var "File1") .. {
|
||||
|
||||
@@ -2,7 +2,7 @@ local Color1 = color(Var "Color1");
|
||||
|
||||
local t = Def.ActorFrame {
|
||||
LoadActor(Var "File1") .. {
|
||||
OnCommand=cmd(x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y;scaletoclipped,SCREEN_WIDTH,SCREEN_HEIGHT;diffuse,Color1;effectclock,"music");
|
||||
OnCommand=cmd(x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y;scale_or_crop_background;diffuse,Color1;effectclock,"music");
|
||||
GainFocusCommand=cmd(play);
|
||||
LoseFocusCommand=cmd(pause);
|
||||
};
|
||||
|
||||
@@ -151,34 +151,9 @@ function Actor:FullScreen()
|
||||
self:stretchto( 0,0,SCREEN_WIDTH,SCREEN_HEIGHT )
|
||||
end
|
||||
|
||||
--[[ Typical background sizes:
|
||||
320x240 - [4:3]
|
||||
640x480 - [4:3] (most simfiles in distribution today use this res.)
|
||||
768x480 - [16:10]
|
||||
854x480 - [16:9]
|
||||
]]
|
||||
function Actor:scale_or_crop_background()
|
||||
local gw = self:GetWidth()
|
||||
local gh = self:GetHeight()
|
||||
|
||||
local graphicAspect = gw/gh
|
||||
local displayAspect = DISPLAY:GetDisplayWidth()/DISPLAY:GetDisplayHeight()
|
||||
|
||||
if graphicAspect == displayAspect then
|
||||
-- bga matches the current aspect, we can stretch it.
|
||||
self:stretchto( 0,0,SCREEN_WIDTH,SCREEN_HEIGHT )
|
||||
else
|
||||
-- temp
|
||||
self:scaletocover( 0,0,SCREEN_WIDTH,SCREEN_HEIGHT )
|
||||
--[[
|
||||
-- bga doesn't match the aspect.
|
||||
if displayAspect > graphicAspect then
|
||||
-- the graphic is smaller than the display aspect ratio
|
||||
else
|
||||
-- the graphic is bigger than the display aspect ratio; crop me
|
||||
end
|
||||
--]]
|
||||
end
|
||||
local graphicAspect = self:GetWidth()/self:GetHeight()
|
||||
self:zoomto(SCREEN_HEIGHT*graphicAspect,SCREEN_HEIGHT)
|
||||
end
|
||||
|
||||
-- xy(actorX,actorY)
|
||||
|
||||
@@ -9,7 +9,7 @@ t[#t+1] = Def.ActorFrame {
|
||||
if song:HasBackground() then
|
||||
self:LoadBackground(song:GetBackgroundPath());
|
||||
end;
|
||||
self:scaletoclipped( SCREEN_WIDTH+1,SCREEN_HEIGHT );
|
||||
self:scale_or_crop_background()
|
||||
(cmd(fadebottom,0.25;fadetop,0.25;croptop,48/480;cropbottom,48/480))(self);
|
||||
else
|
||||
self:visible(false);
|
||||
|
||||
@@ -2,6 +2,6 @@ local t = Def.ActorFrame {};
|
||||
t[#t+1] = Def.Sprite {
|
||||
InitCommand=cmd(Center);
|
||||
BeginCommand=cmd(LoadFromCurrentSongBackground);
|
||||
OnCommand=cmd(diffusealpha,1;scaletoclipped,SCREEN_WIDTH,SCREEN_HEIGHT;linear,1;diffusealpha,0;);
|
||||
OnCommand=cmd(diffusealpha,1;scale_or_crop_background;linear,1;diffusealpha,0;);
|
||||
};
|
||||
return t;
|
||||
@@ -5,7 +5,7 @@ if not GAMESTATE:IsCourseMode() then return t; end;
|
||||
t[#t+1] = Def.Sprite {
|
||||
InitCommand=cmd(Center);
|
||||
BeforeLoadingNextCourseSongMessageCommand=function(self) self:LoadFromSongBackground( SCREENMAN:GetTopScreen():GetNextCourseSong() ) end;
|
||||
ChangeCourseSongInMessageCommand=cmd(scaletoclipped,SCREEN_WIDTH,SCREEN_HEIGHT);
|
||||
ChangeCourseSongInMessageCommand=cmd(scale_or_crop_background);
|
||||
StartCommand=cmd(diffusealpha,0;decelerate,0.5;diffusealpha,1;);
|
||||
FinishCommand=cmd(linear,0.1;glow,Color.Alpha(Color("White"),0.5);decelerate,0.4;glow,Color("Invisible");diffusealpha,0);
|
||||
};
|
||||
|
||||
@@ -10,7 +10,7 @@ t[#t+1] = Def.ActorFrame {
|
||||
if song:HasBackground() then
|
||||
self:LoadBackground(song:GetBackgroundPath());
|
||||
end;
|
||||
self:scaletoclipped( SCREEN_WIDTH+1,SCREEN_HEIGHT );
|
||||
self:scale_or_crop_background();
|
||||
(cmd(fadebottom,0.25;fadetop,0.25;croptop,48/480;cropbottom,48/480))(self);
|
||||
else
|
||||
self:visible(false);
|
||||
|
||||
@@ -13,12 +13,12 @@ local t = Def.ActorFrame{
|
||||
self:LoadFromCurrentSongBackground()
|
||||
end
|
||||
end;
|
||||
OnCommand=cmd(diffusealpha,0;scaletoclipped,SCREEN_WIDTH,SCREEN_HEIGHT;sleep,0.5;linear,0.50;diffusealpha,1;sleep,3);
|
||||
OnCommand=cmd(diffusealpha,0;scale_or_crop_background;sleep,0.5;linear,0.50;diffusealpha,1;sleep,3);
|
||||
};
|
||||
-- alternate background
|
||||
Def.Sprite{
|
||||
InitCommand=cmd(Center;);
|
||||
BeginCommand=cmd(LoadFromCurrentSongBackground;scaletoclipped,SCREEN_WIDTH,SCREEN_HEIGHT;diffusealpha,0);
|
||||
BeginCommand=cmd(LoadFromCurrentSongBackground;scale_or_crop_background;diffusealpha,0);
|
||||
OnCommand=cmd(sleep,4;playcommand,"Show");
|
||||
ShowCommand=function(self)
|
||||
if course:HasBackground() then
|
||||
|
||||
@@ -28,7 +28,7 @@ else
|
||||
t[#t+1] = Def.Sprite {
|
||||
InitCommand=cmd(Center);
|
||||
BeginCommand=cmd(LoadFromCurrentSongBackground);
|
||||
OnCommand=cmd(diffusealpha,0;scaletoclipped,SCREEN_WIDTH,SCREEN_HEIGHT;sleep,0.5;linear,0.50;diffusealpha,1;sleep,3);
|
||||
OnCommand=cmd(diffusealpha,0;scale_or_crop_background;sleep,0.5;linear,0.50;diffusealpha,1;sleep,3);
|
||||
};
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user