Skip to content

Commit

Permalink
Add a couple lua libs
Browse files Browse the repository at this point in the history
  • Loading branch information
nico-abram committed Jun 29, 2018
1 parent dae1f09 commit 82dd344
Show file tree
Hide file tree
Showing 48 changed files with 13,706 additions and 19 deletions.
24 changes: 8 additions & 16 deletions Themes/Til Death/BGAnimations/ScreenTitleMenu underlay.lua
Original file line number Diff line number Diff line change
@@ -1,32 +1,24 @@
t = Def.ActorFrame{}
Req.using(func)


t = Def.ActorFrame{}
local frameX = THEME:GetMetric("ScreenTitleMenu","ScrollerX")-10
local frameY = THEME:GetMetric("ScreenTitleMenu","ScrollerY")

t[#t+1] = Def.Quad{
InitCommand=function(self)
self:draworder(-300):xy(frameX,frameY):zoomto(SCREEN_WIDTH,160):halign(0):diffuse(getMainColor('highlight')):diffusealpha(0.15):diffusetopedge(color("0,0,0,0"))
end
BeginCommand=_1:draworder(-300):xy(frameX,frameY):zoomto(SCREEN_WIDTH,160):halign(0):diffuse(getMainColor('highlight')):diffusealpha(0.15):diffusetopedge(color("0,0,0,0"))
}

t[#t+1] = Def.Quad{
InitCommand=function(self)
self:draworder(-300):xy(frameX,frameY-100):zoomto(SCREEN_WIDTH,160):halign(0):diffuse(getMainColor('highlight')):diffusealpha(0.15):diffusebottomedge(color("0,0,0,0"))
end
BeginCommand=_1:draworder(-300):xy(frameX,frameY-100):zoomto(SCREEN_WIDTH,160):halign(0):diffuse(getMainColor('highlight')):diffusealpha(0.15):diffusebottomedge(color("0,0,0,0"))
}

t[#t+1] = LoadFont("Common Large") .. {
InitCommand=function(self)
self:xy(10,frameY-180):zoom(0.65):valign(1):halign(0):diffuse(getDifficultyColor("Difficulty_Couple"))
end,
OnCommand=function(self)
self:settext(getThemeName())
end,
BeginCommand=_1:xy(10,frameY-180):zoom(0.65):valign(1):halign(0):diffuse(getDifficultyColor("Difficulty_Couple")),
InitCommand=_1:settext(getThemeName()),
}

t[#t+1] = LoadActor(THEME:GetPathG("","_ring")) .. {
InitCommand=function(self)
self:xy(capWideScale(get43size(SCREEN_WIDTH-10),SCREEN_WIDTH-530),frameY-130):diffuse(getDifficultyColor("Difficulty_Couple")):diffusealpha(1):baserotationx(0)
end
BeginCommand=_1:xy(capWideScale(get43size(SCREEN_WIDTH-10),SCREEN_WIDTH-530),frameY-130):diffuse(getDifficultyColor("Difficulty_Couple")):diffusealpha(1):baserotationx(0)
}
return t
8 changes: 8 additions & 0 deletions Themes/_fallback/Scripts/01 requires.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
require 'pl'
class = require 'middleclass/middleclass'
Req = {}
function Req.using(envToAdd)
local env = envToAdd
setmetatable(env, {__index=getfenv(2)})
setfenv(2, env)
end
15 changes: 13 additions & 2 deletions Themes/_fallback/Scripts/02 ActorDef.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ end

local function MergeTables( left, right )
local ret = { }
setmetatable( ret, getmetatable(left) )
for key, val in pairs(left) do
ret[key] = val
end
Expand All @@ -33,13 +34,19 @@ local function MergeTables( left, right )

ret[key] = val
end
setmetatable( ret, getmetatable(left) )
return ret
end

DefMetatable = {
__concat = function(left, right)
return MergeTables( left, right )
end,
__newindex = function(t, key, value)
if type(value) == 'table' and type(key) == 'string' and stringx.endswith(key, 'Command') then
rawset(t,key,func.I(value))
else
rawset(t,key,value)
end
end
}

Expand All @@ -55,7 +62,11 @@ setmetatable( Def, {
if not ActorUtil.IsRegisteredClass(Class) then
error( Class .. " is not a registered actor class", 2 )
end

for key,value in pairs(t) do
if type(value) == 'table' and value.op and type(key) == 'string' and stringx.endswith(key, 'Command') then
rawset(t,key,func.I(value))
end
end
t.Class = Class

local level = 2
Expand Down
Loading

0 comments on commit 82dd344

Please sign in to comment.