From e8f7471663fff4409235063d4c7691f6817cc98a Mon Sep 17 00:00:00 2001 From: Hersi Date: Sun, 3 Apr 2022 03:02:16 +0200 Subject: [PATCH] preliminary version of credits splash --- scripts/titlescreen/splash.lua | 44 +++++++++++++++++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) diff --git a/scripts/titlescreen/splash.lua b/scripts/titlescreen/splash.lua index e1df3c4..7af04ff 100644 --- a/scripts/titlescreen/splash.lua +++ b/scripts/titlescreen/splash.lua @@ -11,6 +11,10 @@ local splash2BgColor = {255, 255, 255} local splash2Logo = gfx.CreateSkinImage("titlescreen/splash/usc2.png", 0) local splash2LogoWidth, splash2LogoHeight = gfx.ImageSize(splash2Logo) +local splash3BgColor = {255, 255, 255} +local splash3Logo = gfx.CreateSkinImage("titlescreen/splash/team-exceed.png", 0) +local splash3LogoWidth, splash3LogoHeight = gfx.ImageSize(splash3Logo) + local splashState = "init" local splashTimer = 0 local fadeDuration = 0.5 @@ -18,6 +22,7 @@ local fadeAlpha = 0 local splashInitDuration = 1 local splash1Duration = 4 local splash2Duration = 4 +local splash3Duration = 4 game.LoadSkinSample("titlescreen/splash/splash1.wav") local splash1SfxPlayed = false @@ -114,7 +119,7 @@ local function splash2(deltaTime) gfx.Text("Press START to skip...", 10, Dim.design.height - 10) if (splashTimer < 0) then - splashState = "done" + splashState = "splash3" splashTimer = 0 return end @@ -126,6 +131,41 @@ local function splash2(deltaTime) splashTimer = splashTimer - deltaTime end +local function splash3(deltaTime) + local splash3LogoXOffset = (Dim.design.width - splash3LogoWidth) / 2 + local splash3LogoYOffset = (Dim.design.height - splash3LogoHeight) / 2 + + calcFade(splash3Duration) + + gfx.BeginPath() + gfx.Rect(0, 0, Dim.design.width, Dim.design.height) + gfx.FillColor(splash3BgColor[1], splash3BgColor[2], splash3BgColor[3], fadeAlpha) + gfx.Fill() + + gfx.BeginPath() + gfx.ImageRect(splash3LogoXOffset, splash3LogoYOffset, splash3LogoWidth, splash3LogoHeight, splash3Logo, fadeAlpha / 255, 0) + + gfx.BeginPath() + gfx.LoadSkinFont("segoeui.ttf") + gfx.FillColor(0, 0, 0, fadeAlpha) + gfx.TextAlign(gfx.TEXT_ALIGN_LEFT + gfx.TEXT_ALIGN_BOTTOM) + gfx.FontSize(28) + + gfx.Text("Press START to skip...", 10, Dim.design.height - 10) + + if (splashTimer < 0) then + splashState = "done" + splashTimer = 0 + return + end + + if splashTimer == 0 then + splashTimer = splash3Duration + end + + splashTimer = splashTimer - deltaTime +end + local function reset() triggerSkip = false splashState = "init" @@ -160,6 +200,8 @@ function render(deltaTime) splash1(deltaTime) elseif splashState == "splash2" then splash2(deltaTime) + elseif splashState == "splash3" then + splash3(deltaTime) elseif splashState == "done" then reset() return {