dtripper: Mess with wheel items

(Sourced from shakesoda/stepmania.)
This commit is contained in:
Colby Klein
2013-10-07 14:30:28 -07:00
parent ff12dc332f
commit 7b76ed78d6
3 changed files with 90 additions and 0 deletions
Binary file not shown.

After

Width:  |  Height:  |  Size: 203 B

@@ -150,4 +150,10 @@ t[#t].SetMessageCommand = function(self, params)
end
end
t[#t+1] = Def.Quad {}
t[#t].InitCommand = cmd(MaskSource,true;setsize,width+1,height+1)
t[#t+1] = Theme.RoundboxInverse(width+6,height,color("0.85,0.85,0.85,1"))
t[#t].InitCommand = cmd(runcommandsonleaves,cmd(ztestmode,'ZTestMode_WriteOnFail';blend,Blend.InvertDest))
return t
@@ -92,3 +92,87 @@ Theme.MusicWheelAfterSet=function(self, params)
Artist:y(10)
end
end
-- super useful for making code less redundant!
Theme.Roundbox = function(Width, Height, Color)
-- code adapted from shakesoda's optical
assert(Width)
assert(Height)
local corner = THEME:GetPathG("Common","corner") -- graphic file
local DefaultColor = color("0,0,0,0.75") -- black box omg magic
-- Color is optional.
if not Color then Color = DefaultColor end
--[[
How it's drawn:
c----c
OOOOOO
c----c
---- is 8px tall and Width-8 wide. y = (Height/2), flip the bit.
OOOO is Height-8px tall and Width wide.
c's x position is Width - 4, flip the bit if needed.
--]]
local EdgeWidth = Width-8
local EdgePosY = (Height/2)
local CornerPosX = ((Width/2)-4)
return Def.ActorFrame {
BeginCommand=cmd(runcommandsonleaves,cmd(diffuse,Color)),
-- top
Def.Quad { InitCommand=cmd(zoomto,EdgeWidth-8,8;y,-EdgePosY) },
-- middle
Def.Quad { InitCommand=cmd(zoomto,Width,Height-8) },
-- bottom
Def.Quad { InitCommand=cmd(zoomto,EdgeWidth-8,8;y,EdgePosY) },
-- top left
LoadActor(corner)..{ InitCommand=cmd(x,-CornerPosX;y,-EdgePosY) },
-- top right
LoadActor(corner)..{ InitCommand=cmd(x,CornerPosX;y,-EdgePosY;rotationz,90) },
-- bottom left
LoadActor(corner)..{ InitCommand=cmd(x,-CornerPosX;y,EdgePosY;rotationz,-90) },
-- bottom right
LoadActor(corner)..{ InitCommand=cmd(x,CornerPosX;y,EdgePosY;rotationz,180) }
}
end
-- super useful for making code less redundant!
Theme.RoundboxInverse = function(Width, Height, Color)
-- code adapted from shakesoda's optical
assert(Width)
assert(Height)
local corner = THEME:GetPathG("Common","corner") -- graphic file
local DefaultColor = color("0,0,0,0.75") -- black box omg magic
-- Color is optional.
if not Color then Color = DefaultColor end
--[[
How it's drawn:
c----c
OOOOOO
c----c
---- is 8px tall and Width-8 wide. y = (Height/2), flip the bit.
OOOO is Height-8px tall and Width wide.
c's x position is Width - 4, flip the bit if needed.
--]]
local EdgeWidth = Width-8
local EdgePosY = (Height/2)
local CornerPosX = ((Width/2)-4)
return Def.ActorFrame {
BeginCommand=cmd(runcommandsonleaves,cmd(diffuse,Color)),
-- top left
LoadActor(corner)..{ InitCommand=cmd(x,-CornerPosX;y,-EdgePosY;rotationz,180) },
-- top right
LoadActor(corner)..{ InitCommand=cmd(x,CornerPosX;y,-EdgePosY;rotationz,270) },
-- bottom left
LoadActor(corner)..{ InitCommand=cmd(x,-CornerPosX;y,EdgePosY;rotationz,-270) },
-- bottom right
LoadActor(corner)..{ InitCommand=cmd(x,CornerPosX;y,EdgePosY;rotationz,0) }
}
end