+ scaling suport to songtransition screen & + fade in and fade out animations to songtransition screen
This commit is contained in:
parent
eee4922e18
commit
c23b407e53
|
@ -12,29 +12,69 @@ local difficultyLabelImages = {
|
||||||
gfx.CreateSkinImage("songtransition/difficulty_labels/mxm.png", 0),
|
gfx.CreateSkinImage("songtransition/difficulty_labels/mxm.png", 0),
|
||||||
}
|
}
|
||||||
|
|
||||||
local transitionTimer = 3
|
local transitionTimer = 0;
|
||||||
|
local outTimer = 0
|
||||||
|
|
||||||
local resx, resy = game.GetResolution()
|
local resx, resy = game.GetResolution()
|
||||||
local outTimer = 1
|
local desw, desh -- The resolution of the deisign
|
||||||
|
local scale;
|
||||||
|
|
||||||
local noJacket = gfx.CreateSkinImage("song_select/loading.png", 0)
|
local noJacket = gfx.CreateSkinImage("song_select/loading.png", 0)
|
||||||
|
|
||||||
local wasEnterSfxPlayed = false;
|
local wasEnterSfxPlayed = false;
|
||||||
|
|
||||||
|
function resetLayoutInformation()
|
||||||
|
resx, resy = game.GetResolution()
|
||||||
|
-- portrait = resy > resx
|
||||||
|
-- desw = portrait and 1080 or 1920
|
||||||
|
-- desh = desw * (resy / resx)
|
||||||
|
desw = 1080
|
||||||
|
desh = 1920
|
||||||
|
scale = resx / desw
|
||||||
|
end
|
||||||
|
|
||||||
function render(deltaTime)
|
function render(deltaTime)
|
||||||
if not wasEnterSfxPlayed then
|
if not wasEnterSfxPlayed then
|
||||||
game.PlaySample('song_transition_screen/transition_enter.wav');
|
game.PlaySample('song_transition_screen/transition_enter.wav');
|
||||||
wasEnterSfxPlayed = true;
|
wasEnterSfxPlayed = true;
|
||||||
end
|
end
|
||||||
|
|
||||||
render_screen(transitionTimer)
|
resetLayoutInformation()
|
||||||
transitionTimer = transitionTimer + deltaTime * 2
|
gfx.ResetTransform();
|
||||||
|
gfx.Scale(scale, scale);
|
||||||
|
|
||||||
|
render_screen(transitionTimer);
|
||||||
|
|
||||||
|
transitionTimer = transitionTimer + deltaTime * 0.2
|
||||||
transitionTimer = math.min(transitionTimer,1)
|
transitionTimer = math.min(transitionTimer,1)
|
||||||
|
|
||||||
|
if transitionTimer < 0.25 then
|
||||||
|
local whiteAlpha = math.max(0, (1-transitionTimer/0.25))
|
||||||
|
|
||||||
|
gfx.BeginPath();
|
||||||
|
gfx.FillColor(255,255,255,math.floor(255*whiteAlpha));
|
||||||
|
gfx.Rect(0,0,desw,desh);
|
||||||
|
gfx.Fill();
|
||||||
|
gfx.ClosePath();
|
||||||
|
end
|
||||||
|
|
||||||
|
if transitionTimer > 0.85 then
|
||||||
|
local blackAlpha = math.min(1, ((transitionTimer-0.85)/0.15))
|
||||||
|
|
||||||
|
gfx.BeginPath();
|
||||||
|
gfx.FillColor(0,0,0,math.floor(255*blackAlpha));
|
||||||
|
gfx.Rect(0,0,desw,desh);
|
||||||
|
gfx.Fill();
|
||||||
|
gfx.ClosePath();
|
||||||
|
end
|
||||||
|
|
||||||
return transitionTimer >= 1
|
return transitionTimer >= 1
|
||||||
end
|
end
|
||||||
|
|
||||||
function render_out(deltaTime)
|
function render_out(deltaTime)
|
||||||
outTimer = outTimer + deltaTime * 2
|
outTimer = outTimer + deltaTime * 0.2
|
||||||
outTimer = math.min(outTimer, 2)
|
outTimer = math.min(outTimer, 1)
|
||||||
-- render_screen(outTimer)
|
|
||||||
return outTimer >= 1;
|
return outTimer >= 1;
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -43,7 +83,7 @@ function sign(x)
|
||||||
end
|
end
|
||||||
|
|
||||||
function render_screen(progress)
|
function render_screen(progress)
|
||||||
gfx.ImageRect(0, 0, resx, resy, bgImage,1,0);
|
gfx.ImageRect(0, 0, 1080, 1920, bgImage,1,0);
|
||||||
|
|
||||||
|
|
||||||
local jacket = song.jacket == 0 and noJacket or song.jacket
|
local jacket = song.jacket == 0 and noJacket or song.jacket
|
||||||
|
@ -56,10 +96,10 @@ function render_screen(progress)
|
||||||
gfx.TextAlign(gfx.TEXT_ALIGN_CENTER + gfx.TEXT_ALIGN_MIDDLE)
|
gfx.TextAlign(gfx.TEXT_ALIGN_CENTER + gfx.TEXT_ALIGN_MIDDLE)
|
||||||
|
|
||||||
gfx.FontSize(55)
|
gfx.FontSize(55)
|
||||||
gfx.Text(song.title,resx/2, 1114)
|
gfx.Text(song.title,desw/2, 1114)
|
||||||
|
|
||||||
gfx.FontSize(30)
|
gfx.FontSize(30)
|
||||||
gfx.Text(song.artist, resx/2 , 1182)
|
gfx.Text(song.artist, desw/2 , 1182)
|
||||||
|
|
||||||
|
|
||||||
local EFFECTOR_LABEL_Y = 1288
|
local EFFECTOR_LABEL_Y = 1288
|
||||||
|
@ -67,8 +107,8 @@ function render_screen(progress)
|
||||||
|
|
||||||
gfx.FontSize(22)
|
gfx.FontSize(22)
|
||||||
|
|
||||||
gfx.Text(song.effector, resx/2+70 , EFFECTOR_LABEL_Y-1)
|
gfx.Text(song.effector, desw/2+70 , EFFECTOR_LABEL_Y-1)
|
||||||
gfx.Text(song.illustrator, resx/2+70 , ILLUSTRATOR_LABEL_Y-3)
|
gfx.Text(song.illustrator, desw/2+70 , ILLUSTRATOR_LABEL_Y-3)
|
||||||
|
|
||||||
gfx.BeginPath();
|
gfx.BeginPath();
|
||||||
local diffLabelImage = difficultyLabelImages[song.difficulty+1];
|
local diffLabelImage = difficultyLabelImages[song.difficulty+1];
|
||||||
|
@ -116,6 +156,6 @@ end
|
||||||
function reset()
|
function reset()
|
||||||
transitionTimer = 0
|
transitionTimer = 0
|
||||||
resx, resy = game.GetResolution()
|
resx, resy = game.GetResolution()
|
||||||
outTimer = 1
|
outTimer = 0
|
||||||
wasEnterSfxPlayed = false;
|
wasEnterSfxPlayed = false;
|
||||||
end
|
end
|
Loading…
Reference in New Issue