add WIP screen filter
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
--[[ Screen Filter ]]
|
||||
local numPlayers = GAMESTATE:GetNumPlayersEnabled()
|
||||
local center1P = PREFSMAN:GetPreference("Center1Player")
|
||||
|
||||
local padding = 8 -- 4px on each side
|
||||
local arrowWidth = 64 -- until noteskin metrics are implemented...
|
||||
local filterColor = color("#22222288")
|
||||
|
||||
local t = Def.ActorFrame{};
|
||||
|
||||
local style = GAMESTATE:GetCurrentStyle()
|
||||
local cols = style:ColumnsPerPlayer()
|
||||
local styleType = ToEnumShortString(style:GetStyleType())
|
||||
local filterWidth = (arrowWidth * cols) + padding
|
||||
|
||||
if numPlayers == 1 then
|
||||
local player = GAMESTATE:GetMasterPlayerNumber()
|
||||
local pos;
|
||||
-- [ScreenGameplay] PlayerP#Player*Side(s)X
|
||||
if center1P then
|
||||
pos = SCREEN_CENTER_X
|
||||
else
|
||||
local pNum = (player == PLAYER_1) and 1 or 2
|
||||
local metricName = string.format("PlayerP%i%sX",pNum,styleType)
|
||||
pos = THEME:GetMetric("ScreenGameplay",metricName)
|
||||
end
|
||||
t[#t+1] = Def.Quad{
|
||||
Name="SinglePlayerFilter";
|
||||
InitCommand=cmd(x,pos;CenterY;zoomto,filterWidth,SCREEN_HEIGHT;diffuse,filterColor);
|
||||
};
|
||||
else
|
||||
-- two players... a bit more complex.
|
||||
if styleType == "TwoPlayersSharedSides" then
|
||||
-- routine, just use one in the center.
|
||||
local metricName = "PlayerP1TwoPlayersSharedSidesX"
|
||||
t[#t+1] = Def.Quad{
|
||||
Name="RoutineFilter";
|
||||
InitCommand=cmd(x,THEME:GetMetric("ScreenGameplay",metricName);CenterY;zoomto,filterWidth,SCREEN_HEIGHT;diffuse,filterColor);
|
||||
};
|
||||
else
|
||||
-- otherwise we need two separate ones. to the pairsmobile!
|
||||
for i, player in ipairs(PlayerNumber) do
|
||||
local pNum = (player == PLAYER_1) and 1 or 2
|
||||
local metricName = string.format("PlayerP%i%sX",pNum,styleType)
|
||||
local pos = THEME:GetMetric("ScreenGameplay",metricName)
|
||||
t[#t+1] = Def.Quad{
|
||||
Name="Player"..pNum.."Filter";
|
||||
InitCommand=cmd(x,pos;CenterY;zoomto,filterWidth,SCREEN_HEIGHT;diffuse,filterColor);
|
||||
};
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return t;
|
||||
@@ -0,0 +1,5 @@
|
||||
local t = Def.ActorFrame{
|
||||
LoadActor("ScreenFilter");
|
||||
};
|
||||
|
||||
return t;
|
||||
Reference in New Issue
Block a user