diff --git a/scripts/songtransition.lua b/scripts/songtransition.lua index 19bebe4..b70c444 100644 --- a/scripts/songtransition.lua +++ b/scripts/songtransition.lua @@ -1,6 +1,17 @@ game.LoadSkinSample('song_transition_screen/transition_enter.wav'); +local bgImage = gfx.CreateSkinImage("songtransition/bg.png", 0) + +local difficultyLabelImages = { + gfx.CreateSkinImage("songtransition/difficulty_labels/nov.png", 0), + gfx.CreateSkinImage("songtransition/difficulty_labels/adv.png", 0), + gfx.CreateSkinImage("songtransition/difficulty_labels/exh.png", 0), + gfx.CreateSkinImage("songtransition/difficulty_labels/mxm.png", 0), + gfx.CreateSkinImage("songtransition/difficulty_labels/mxm.png", 0), + gfx.CreateSkinImage("songtransition/difficulty_labels/mxm.png", 0), +} + local transitionTimer = 3 local resx, resy = game.GetResolution() local outTimer = 1 @@ -17,14 +28,14 @@ function render(deltaTime) render_screen(transitionTimer) transitionTimer = transitionTimer + deltaTime * 2 transitionTimer = math.min(transitionTimer,1) - return transitionTimer >= 1 + return transitionTimer >= 10 end function render_out(deltaTime) outTimer = outTimer + deltaTime * 2 outTimer = math.min(outTimer, 2) - render_screen(outTimer) - return outTimer >= 2; + -- render_screen(outTimer) + return outTimer >= 10; end function sign(x) @@ -32,31 +43,74 @@ function sign(x) end function render_screen(progress) - for i=0,resx/50 do - local dir = sign((i % 2) - 0.5) - local yoff = dir * resy * (1 - progress) - gfx.Save() - gfx.Translate(0,yoff) - gfx.BeginPath() - gfx.Rect(60 * i, yoff, 60, resy) - gfx.FillColor(0,64, 150 + 25 * dir) - gfx.Fill() - gfx.Restore() - end - local y = (resy/2 + 100) * (math.sin(0.5 * progress * math.pi)^7) - 200 - gfx.Save() - gfx.BeginPath() - gfx.Translate(resx/2, y) + gfx.ImageRect(0, 0, resx, resy, bgImage,1,0); + + local jacket = song.jacket == 0 and noJacket or song.jacket - gfx.ImageRect(-150,-150,300,300,jacket,1,0) - gfx.Restore() - gfx.Translate(resx/2, resy - y - 50) - gfx.FillColor(255,255,255) - gfx.TextAlign(gfx.TEXT_ALIGN_CENTER + gfx.TEXT_ALIGN_TOP) - gfx.FontSize(80) - gfx.Text(song.title,0,0) + gfx.BeginPath(); + gfx.ImageRect(235, 385, 608, 608, jacket, 1, 0) + gfx.ClosePath(); + + + + gfx.TextAlign(gfx.TEXT_ALIGN_CENTER + gfx.TEXT_ALIGN_MIDDLE) + gfx.FontSize(55) - gfx.Text(song.artist,0,80) + gfx.Text(song.title,resx/2, 1114) + + gfx.FontSize(30) + gfx.Text(song.artist, resx/2 , 1182) + + + local EFFECTOR_LABEL_Y = 1288 + local ILLUSTRATOR_LABEL_Y = 1347 + + gfx.FontSize(22) + + gfx.Text(song.effector, resx/2+70 , EFFECTOR_LABEL_Y-1) + gfx.Text(song.illustrator, resx/2+70 , ILLUSTRATOR_LABEL_Y-3) + + gfx.BeginPath(); + local diffLabelImage = difficultyLabelImages[song.difficulty+1]; + local diffLabelW, diffLabelH = gfx.ImageSize(diffLabelImage); + gfx.ImageRect(952-diffLabelW/2, 1154-diffLabelH/2, diffLabelW, diffLabelH, diffLabelImage,1,0); + gfx.ClosePath(); + + gfx.Save(); + gfx.FontSize(24) + gfx.LoadSkinFont('Digital-Serial-Bold.ttf') + gfx.TextAlign(gfx.TEXT_ALIGN_CENTER + gfx.TEXT_ALIGN_MIDDLE) + gfx.BeginPath(); + + gfx.Text('BPM', 127, 1140) + gfx.Text(song.bpm, 127, 1167) + + gfx.ClosePath(); + gfx.Restore(); + +-- for i=0,resx/50 do +-- local dir = sign((i % 2) - 0.5) +-- local yoff = dir * resy * (1 - progress) +-- gfx.Save() +-- gfx.Translate(0,yoff) +-- gfx.BeginPath() +-- gfx.Rect(60 * i, yoff, 60, resy) +-- gfx.FillColor(0,64, 150 + 25 * dir) +-- gfx.Fill() +-- gfx.Restore() +-- end +-- local y = (resy/2 + 100) * (math.sin(0.5 * progress * math.pi)^7) - 200 +-- gfx.Save() +-- gfx.BeginPath() +-- gfx.Translate(resx/2, y) +-- gfx.Restore() +-- gfx.Translate(resx/2, resy - y - 50) +-- gfx.FillColor(255,255,255) +-- gfx.TextAlign(gfx.TEXT_ALIGN_CENTER + gfx.TEXT_ALIGN_TOP) +-- gfx.FontSize(80) +-- gfx.Text(song.title,0,0) +-- gfx.FontSize(55) +-- gfx.Text(song.artist,0,80) end function reset() diff --git a/textures/songtransition/bg.png b/textures/songtransition/bg.png new file mode 100644 index 0000000..7074e54 Binary files /dev/null and b/textures/songtransition/bg.png differ diff --git a/textures/songtransition/difficulty_labels/adv.png b/textures/songtransition/difficulty_labels/adv.png new file mode 100644 index 0000000..1128b0e Binary files /dev/null and b/textures/songtransition/difficulty_labels/adv.png differ diff --git a/textures/songtransition/difficulty_labels/exh.png b/textures/songtransition/difficulty_labels/exh.png new file mode 100644 index 0000000..a66ea3c Binary files /dev/null and b/textures/songtransition/difficulty_labels/exh.png differ diff --git a/textures/songtransition/difficulty_labels/mxm.png b/textures/songtransition/difficulty_labels/mxm.png new file mode 100644 index 0000000..825c362 Binary files /dev/null and b/textures/songtransition/difficulty_labels/mxm.png differ diff --git a/textures/songtransition/difficulty_labels/nov.png b/textures/songtransition/difficulty_labels/nov.png new file mode 100644 index 0000000..c8dcf1a Binary files /dev/null and b/textures/songtransition/difficulty_labels/nov.png differ