From de5174a76a84cc67b3fb611019d0e085a991edb2 Mon Sep 17 00:00:00 2001 From: FajsiEx Date: Thu, 12 Aug 2021 16:20:19 +0200 Subject: [PATCH] > split song select header to component & / z-index issue with filter wheel and header and footer --- scripts/components/footer.lua | 6 +- .../components/headers/songSelectHeader.lua | 69 +++++++++++++++++++ scripts/songselect/filterwheel.lua | 21 +++++- scripts/songselect/songwheel.lua | 35 ++-------- skin.cfg | 3 + 5 files changed, 100 insertions(+), 34 deletions(-) create mode 100644 scripts/components/headers/songSelectHeader.lua diff --git a/scripts/components/footer.lua b/scripts/components/footer.lua index bda8402..b37d78e 100644 --- a/scripts/components/footer.lua +++ b/scripts/components/footer.lua @@ -60,7 +60,11 @@ local progressTransitions = function () footerY = resy-FOOTER_HEIGHT+entryTransitionFooterYOffset; end -local draw = function () +local draw = function (params) + if (params and params.noEnterTransition) then + entryTransitionScale = 1; + end + gfx.Save() resetLayoutInformation() gfx.Scale(scale, scale) diff --git a/scripts/components/headers/songSelectHeader.lua b/scripts/components/headers/songSelectHeader.lua new file mode 100644 index 0000000..7df649d --- /dev/null +++ b/scripts/components/headers/songSelectHeader.lua @@ -0,0 +1,69 @@ + + +local resx, resy = game.GetResolution(); +local desw = 1080; +local desh = 1920; +local scale = 1; + +local BAR_ALPHA = 191; + +local HEADER_HEIGHT = 100 +local headerY = 0; + +local animationHeaderGlowScale = 0; +local animationHeaderGlowAlpha = 0; + +-- Images +local headerTitleImage = gfx.CreateSkinImage("song_select/header/title.png", 1) +local headerGlowTitleImage = gfx.CreateSkinImage("song_select/header/title_glow.png", 1) + +function resetLayoutInformation() + resx, resy = game.GetResolution() + desw = 1080 + desh = 1920 + scale = resx / desw +end + +local drawHeader = function () + gfx.BeginPath(); + gfx.FillColor(0,0,0,BAR_ALPHA); + gfx.Rect(0,0,desw, HEADER_HEIGHT); + gfx.Fill(); + gfx.ClosePath() + + gfx.ImageRect(42, 14, 423*0.85, 80*0.85, headerTitleImage, 1, 0) + gfx.ImageRect(42, 14, 423*0.85, 80*0.85, headerGlowTitleImage, animationHeaderGlowAlpha, 0) +end + +local progressTransitions = function (deltatime) + -- HEADER GLOW ANIMATION + if animationHeaderGlowScale < 1 then + animationHeaderGlowScale = animationHeaderGlowScale + deltatime / 1 -- transition should last for that time in seconds + else + animationHeaderGlowScale = 0 + end + + if animationHeaderGlowScale < 0.5 then + animationHeaderGlowAlpha = animationHeaderGlowScale * 2; + else + animationHeaderGlowAlpha = 1-((animationHeaderGlowScale-0.5) * 2); + end + animationHeaderGlowAlpha = animationHeaderGlowAlpha*0.4 +end + +local draw = function (deltatime) + gfx.Save() + resetLayoutInformation() + gfx.Scale(scale, scale) + + gfx.LoadSkinFont("NotoSans-Regular.ttf"); + + drawHeader(); + + progressTransitions(deltatime); + gfx.Restore() +end + +return { + draw = draw +}; \ No newline at end of file diff --git a/scripts/songselect/filterwheel.lua b/scripts/songselect/filterwheel.lua index 9254dac..b329950 100644 --- a/scripts/songselect/filterwheel.lua +++ b/scripts/songselect/filterwheel.lua @@ -1,5 +1,7 @@ require('common') local Easing = require('common.easings'); +local SongSelectHeader = require('components.headers.songSelectHeader') +local Footer = require('components.footer'); local defaultFolderBgImage = gfx.CreateSkinImage('song_select/filter_wheel/bg.png', 0) @@ -233,16 +235,29 @@ function tickTransitions(deltaTime) end end -render = function(deltaTime, shown) - if not shown then return end +function drawFilterWheel(deltatime) gfx.ResetTransform() resetLayoutInformation() - tickTransitions(deltaTime); + tickTransitions(deltatime); gfx.Scale(scale,scale); drawFolderList() drawCursor() +end + +render = function(deltatime, shown) + if not shown then + game.SetSkinSetting('_songWheelOverlayActive', 0); + else + game.SetSkinSetting('_songWheelOverlayActive', 1); + drawFilterWheel(deltatime) + end + + SongSelectHeader.draw(deltatime); + Footer.draw({ + noEnterTransition = true + }); -- Debug text gfx.BeginPath(); diff --git a/scripts/songselect/songwheel.lua b/scripts/songselect/songwheel.lua index 0132c82..c2a5175 100644 --- a/scripts/songselect/songwheel.lua +++ b/scripts/songselect/songwheel.lua @@ -1,5 +1,6 @@ require('common') local Easing = require('common.easings'); +local SongSelectHeader = require('components.headers.songSelectHeader'); local Footer = require('components.footer'); local HEADER_HEIGHT = 100; @@ -445,20 +446,6 @@ function drawSearch() gfx.Text(songwheel.searchText, desw-200, 30); end -function drawHeader() - gfx.Save() - gfx.BeginPath(); - gfx.FillColor(0,0,0,BAR_ALPHA); - gfx.Rect(0,0,desw, HEADER_HEIGHT); - gfx.Fill(); - gfx.ClosePath() - - gfx.ImageRect(42, 14, 423*0.85, 80*0.85, headerTitleImage, 1, 0) - gfx.ImageRect(42, 14, 423*0.85, 80*0.85, headerGlowTitleImage, animationHeaderGlowAlpha, 0) - - gfx.Restore() -end - function tickTransitions(deltaTime) if transitionScrollScale < 1 then transitionScrollScale = transitionScrollScale + deltaTime / 0.1 -- transition should last for that time in seconds @@ -535,20 +522,6 @@ function tickTransitions(deltaTime) else transitionAfterscrollJacketBgAlpha = 1; end - - -- HEADER GLOW ANIMATION - if animationHeaderGlowScale < 1 then - animationHeaderGlowScale = animationHeaderGlowScale + deltaTime / 1 -- transition should last for that time in seconds - else - animationHeaderGlowScale = 0 - end - - if animationHeaderGlowScale < 0.5 then - animationHeaderGlowAlpha = animationHeaderGlowScale * 2; - else - animationHeaderGlowAlpha = 1-((animationHeaderGlowScale-0.5) * 2); - end - animationHeaderGlowAlpha = animationHeaderGlowAlpha*0.4 end @@ -570,8 +543,10 @@ render = function (deltaTime) drawSearch(); - drawHeader(); - Footer.draw(); + -- if (game.GetSkinSetting('_songWheelOverlayActive') ~= 1) then + -- SongSelectHeader.draw(deltaTime); + -- Footer.draw(); + -- end gfx.BeginPath(); diff --git a/skin.cfg b/skin.cfg index 0d2c1ca..2a86e28 100644 --- a/skin.cfg +++ b/skin.cfg @@ -1 +1,4 @@ username = "GSKBLADE" +_gaugeType = 2.000000 +_gaugeARS = 1.000000 +_songWheelOverlayActive = 0.000000