> split song select header to component & / z-index issue with filter wheel and header and footer

This commit is contained in:
FajsiEx 2021-08-12 16:20:19 +02:00
parent da48de6957
commit de5174a76a
5 changed files with 100 additions and 34 deletions

View File

@ -60,7 +60,11 @@ local progressTransitions = function ()
footerY = resy-FOOTER_HEIGHT+entryTransitionFooterYOffset; footerY = resy-FOOTER_HEIGHT+entryTransitionFooterYOffset;
end end
local draw = function () local draw = function (params)
if (params and params.noEnterTransition) then
entryTransitionScale = 1;
end
gfx.Save() gfx.Save()
resetLayoutInformation() resetLayoutInformation()
gfx.Scale(scale, scale) gfx.Scale(scale, scale)

View File

@ -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
};

View File

@ -1,5 +1,7 @@
require('common') require('common')
local Easing = require('common.easings'); 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) local defaultFolderBgImage = gfx.CreateSkinImage('song_select/filter_wheel/bg.png', 0)
@ -233,16 +235,29 @@ function tickTransitions(deltaTime)
end end
end end
render = function(deltaTime, shown) function drawFilterWheel(deltatime)
if not shown then return end
gfx.ResetTransform() gfx.ResetTransform()
resetLayoutInformation() resetLayoutInformation()
tickTransitions(deltaTime); tickTransitions(deltatime);
gfx.Scale(scale,scale); gfx.Scale(scale,scale);
drawFolderList() drawFolderList()
drawCursor() 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 -- Debug text
gfx.BeginPath(); gfx.BeginPath();

View File

@ -1,5 +1,6 @@
require('common') require('common')
local Easing = require('common.easings'); local Easing = require('common.easings');
local SongSelectHeader = require('components.headers.songSelectHeader');
local Footer = require('components.footer'); local Footer = require('components.footer');
local HEADER_HEIGHT = 100; local HEADER_HEIGHT = 100;
@ -445,20 +446,6 @@ function drawSearch()
gfx.Text(songwheel.searchText, desw-200, 30); gfx.Text(songwheel.searchText, desw-200, 30);
end 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) function tickTransitions(deltaTime)
if transitionScrollScale < 1 then if transitionScrollScale < 1 then
transitionScrollScale = transitionScrollScale + deltaTime / 0.1 -- transition should last for that time in seconds transitionScrollScale = transitionScrollScale + deltaTime / 0.1 -- transition should last for that time in seconds
@ -535,20 +522,6 @@ function tickTransitions(deltaTime)
else else
transitionAfterscrollJacketBgAlpha = 1; transitionAfterscrollJacketBgAlpha = 1;
end 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 end
@ -570,8 +543,10 @@ render = function (deltaTime)
drawSearch(); drawSearch();
drawHeader(); -- if (game.GetSkinSetting('_songWheelOverlayActive') ~= 1) then
Footer.draw(); -- SongSelectHeader.draw(deltaTime);
-- Footer.draw();
-- end
gfx.BeginPath(); gfx.BeginPath();

View File

@ -1 +1,4 @@
username = "GSKBLADE" username = "GSKBLADE"
_gaugeType = 2.000000
_gaugeARS = 1.000000
_songWheelOverlayActive = 0.000000