Skip to content

Commit

Permalink
Merge pull request #129 from Nickito12/cmdy
Browse files Browse the repository at this point in the history
Run cmd lua python script replacer on root folder
  • Loading branch information
nico-abram authored Jan 1, 2018
2 parents e1089e5 + 0791d8d commit e719669
Show file tree
Hide file tree
Showing 7 changed files with 204 additions and 69 deletions.
124 changes: 93 additions & 31 deletions Docs/Themerdocs/Examples/Example_Actors/ActorFrameTexture.lua
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,9 @@ local Example3_Diffuse = { 1,0.5,1,1 } -- Note that with Green of 50%, there is
local Examples = { }

Examples[1] = Def.ActorFrame{
Def.Quad{ InitCommand=cmd(FullScreen) }; -- a blank background.
Def.Quad{ InitCommand=function(self)
self:FullScreen() -- a blank background.
end;
Def.ActorFrameTexture{
InitCommand=function(self)
self:SetTextureName( "Example 1" )
Expand All @@ -110,20 +112,32 @@ Examples[1] = Def.ActorFrame{
Def.ActorFrame{
Name = "Draw";
-- three random quads, two of them strattling the edge of the texture.
Def.Quad{ InitCommand=cmd(zoom,50;diffuse,1,0,0,0.5) };
Def.Quad{ InitCommand=cmd(zoom,50;diffuse,0,1,0,0.5;x,64;y,64) };
Def.Quad{ InitCommand=cmd(zoom,50;diffuse,0,0,1,0.5;x,120;y,100) };
Def.Quad{ InitCommand=function(self)
self:zoom(50):diffuse(1,0,0,0.5)
end;
Def.Quad{ InitCommand=function(self)
self:zoom(50):diffuse(0,1,0,0.5):x(64):y(64)
end;
Def.Quad{ InitCommand=function(self)
self:zoom(50):diffuse(0,0,1,0.5):x(120):y(100)
end;
};
};
Def.Sprite{
Texture="Example 1";
InitCommand=cmd(Center;sleep,1;queuecommand,"Scroll");
ScrollCommand=cmd(texcoordvelocity,1,0.5); -- Scroll the texture. Texture manipulation is one of the things that makes AFT special.
InitCommand=function(self)
self:Center():sleep(1):queuecommand("Scroll")
end;
ScrollCommand=function(self)
self:texcoordvelocity(1,0.5) - Scroll the texture. Texture manipulation is one of the things that makes AFT special.
end;
};
}

Examples[2] = Def.ActorFrame{
Def.Quad{ InitCommand=cmd(FullScreen;diffuse,0,0,0,1) }; -- a blank background.
Def.Quad{ InitCommand=function(self)
self:FullScreen():diffuse(0,0,0,1) -- a blank background.
end;
Def.ActorFrameTexture{
InitCommand=function(self)
self:SetTextureName( "Example 2" )
Expand All @@ -138,17 +152,29 @@ Examples[2] = Def.ActorFrame{
end;
Def.ActorFrame{
Name = "Draw";
InitCommand=cmd(spin;x,64;y,64); -- Something has to change to demonstrate PreserveTexture.
Def.Quad{ InitCommand=cmd(zoom,50;rainbow;effectperiod,3;effectoffset,1;x,-40;y,-56) };
Def.Quad{ InitCommand=cmd(zoom,50;rainbow;effectperiod,3;effectoffset,0) };
Def.Quad{ InitCommand=cmd(zoom,50;rainbow;effectperiod,3;effectoffset,2;x,64;y,50) };
InitCommand=function(self)
self:spin():x(64):y(64) -Something has to change to demonstrate PreserveTexture.
end;
Def.Quad{ InitCommand=function(self)
self:zoom(50):rainbow():effectperiod(3):effectoffset(1):x(-40):y(-56)
end;
Def.Quad{ InitCommand=function(self)
self:zoom(50):rainbow():effectperiod(3):effectoffset(0)
end;
Def.Quad{ InitCommand=function(self)
self:zoom(50):rainbow():effectperiod(3):effectoffset(2):x(64):y(50)
end;
};
};
Def.Sprite{ Texture="Example 2"; InitCommand=cmd(Center); };
Def.Sprite{ Texture="Example 2"; InitCommand=function(self)
self:Center()
end;
}

Examples[3] = Def.ActorFrame{
Def.Quad{ InitCommand=cmd(FullScreen;diffuse,0,0,0,1) }; -- a blank background.
Def.Quad{ InitCommand=function(self)
self:FullScreen():diffuse(0,0,0,1) -- a blank background.
end;
Def.ActorFrameTexture{
InitCommand=function(self)
self:SetTextureName( "Example 3" )
Expand All @@ -163,13 +189,23 @@ Examples[3] = Def.ActorFrame{
end;
Def.ActorFrame{
Name = "Draw";
Def.Quad{ InitCommand=cmd(zoom,80;diffuse,1,1,1,1;x,64;y,64) };
Def.Quad{ InitCommand=cmd(zoom,80;diffuse,1,0,0,1;x,14;y,80;blend,"BlendMode_Add") };
Def.Quad{ InitCommand=cmd(zoom,80;diffuse,0,1,0,1;x,74;y,20;blend,"BlendMode_Add") };
Def.Quad{ InitCommand=cmd(zoom,80;diffuse,0,0,1,1;x,128;y,100;blend,"BlendMode_Add") };
Def.Quad{ InitCommand=function(self)
self:zoom(80):diffuse(1,1,1,1):x(64):y(64)
end;
Def.Quad{ InitCommand=function(self)
self:zoom(80):diffuse(1,0,0,1):x(14):y(80):blend("BlendMode_Add")
end;
Def.Quad{ InitCommand=function(self)
self:zoom(80):diffuse(0,1,0,1):x(74):y(20):blend("BlendMode_Add")
end;
Def.Quad{ InitCommand=function(self)
self:zoom(80):diffuse(0,0,1,1):x(128):y(100):blend("BlendMode_Add")
end;
};
};
Def.Sprite{ Texture = "Example 3"; InitCommand=cmd(Center;diffuse,Example3_Diffuse); };
Def.Sprite{ Texture = "Example 3"; InitCommand=function(self)
self:Center():diffuse(Example3_Diffuse)
end;
}

--[[
Expand All @@ -187,7 +223,9 @@ Examples[3] = Def.ActorFrame{
--]]

Examples[4] = Def.ActorFrame{
Def.Quad{ InitCommand=cmd(FullScreen;diffuse,0,0,0,1) }; -- a blank background.
Def.Quad{ InitCommand=function(self)
self:FullScreen():diffuse(0,0,0,1) -- a blank background.
end;
Def.ActorFrameTexture{
Name = "Memory";
InitCommand=function(self)
Expand All @@ -198,7 +236,9 @@ Examples[4] = Def.ActorFrame{
self:Create();
end;
-- Cannot call the second AFT's texture by name as it has not been created when this Sprite loads.
Def.Sprite{ Name = "Sprite"; InitCommand=cmd(x,128;y,128) };
Def.Sprite{ Name = "Sprite"; InitCommand=function(self)
self:x(128):y(128)
end;
};
Def.ActorFrameTexture{
InitCommand=function(self)
Expand All @@ -211,23 +251,45 @@ Examples[4] = Def.ActorFrame{
self:GetParent():GetChild("Memory"):GetChild("Sprite"):SetTexture( self:GetTexture() );
end;
-- A sprite to draw the 'trail' with.
Def.Sprite{ Texture = "Memory"; InitCommand=cmd(x,128;y,128;diffuse,1,1,1,.995); };
Def.Sprite{ Texture = "Memory"; InitCommand=function(self)
self:x(128):y(128):diffuse(1,1,1,.995)
end;
Def.ActorFrame{ -- eliptical motion.
InitCommand=cmd(x,128;y,128;bob;effectmagnitude,96,0,0;effectoffset,0.5);
InitCommand=function(self)
self:x(128):y(128):bob():effectmagnitude(96,0,0):effectoffset(0.5)
end;
Def.ActorFrame{
InitCommand=cmd(bob;effectmagnitude,0,64,0);
InitCommand=function(self)
self:bob():effectmagnitude(0,64,0)
end;
-- A pixel ghost.
Def.Quad{ InitCommand=cmd(zoomto,32,40); };
Def.Quad{ InitCommand=cmd(zoomto,8,8;x,-8;y,-8;diffuse,0,0,0,1); };
Def.Quad{ InitCommand=cmd(zoomto,8,8;x,8;y,-8;diffuse,0,0,0,1); };
Def.Quad{ InitCommand=cmd(zoomto,24,8;x,0;y,2;diffuse,0,0,0,1); };
Def.Quad{ InitCommand=cmd(zoomto,8,16;x,-12;y,24); };
Def.Quad{ InitCommand=cmd(zoomto,8,16;x,12;y,24); };
Def.Quad{ InitCommand=cmd(zoomto,8,16;x,0;y,24); };
Def.Quad{ InitCommand=function(self)
self:zoomto(32,40)
end;
Def.Quad{ InitCommand=function(self)
self:zoomto(8,8):x(-8):y(-8):diffuse(0,0,0,1)
end;
Def.Quad{ InitCommand=function(self)
self:zoomto(8,8):x(8):y(-8):diffuse(0,0,0,1)
end;
Def.Quad{ InitCommand=function(self)
self:zoomto(24,8):x(0):y(2):diffuse(0,0,0,1)
end;
Def.Quad{ InitCommand=function(self)
self:zoomto(8,16):x(-12):y(24)
end;
Def.Quad{ InitCommand=function(self)
self:zoomto(8,16):x(12):y(24)
end;
Def.Quad{ InitCommand=function(self)
self:zoomto(8,16):x(0):y(24)
end;
};
};
};
Def.Sprite{ Name = "Ghosting"; Texture = "Output"; InitCommand=cmd(Center); };
Def.Sprite{ Name = "Ghosting"; Texture = "Output"; InitCommand=function(self)
self:Center()
end;
}

return Examples[ ExampleToShow ]
20 changes: 15 additions & 5 deletions Docs/Themerdocs/Examples/Example_Actors/ActorScroller.lua
Original file line number Diff line number Diff line change
Expand Up @@ -38,25 +38,35 @@ Def.ActorScroller{
Name="ScrollItem1",
Font="Common Normal",
Text="Scroll Item 1",
InitCommand=cmd(diffuse,color("#FF0000")),
InitCommand=function(self)
self:diffuse(color("#FF0000"))
end,
},
},
Def.ActorFrame{
Def.BitmapText{
Name="ScrollItem2",
Font="Common Normal",
Text="Scroll Item 2",
InitCommand=cmd(glow,color("#00FF0088")),
InitCommand=function(self)
self:glow(color("#00FF0088"))
end,
},
},
Def.BitmapText{
Name="ScrollItem3",
Font="Common Normal",
Text="Scroll Item 3",
InitCommand=cmd(bob;effectmagnitude,8,0,4),
InitCommand=function(self)
self:bob():effectmagnitude(8,0,4)
end,
},

-- Scroller commands
InitCommand=cmd(Center),
OnCommand=cmd(scrollwithpadding,8,8),
InitCommand=function(self)
self:Center()
end,
OnCommand=function(self)
self:scrollwithpadding(8,8)
end,
}
12 changes: 9 additions & 3 deletions Docs/Themerdocs/Examples/Example_Screens/ScreenHeartEntry.lua
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ for i, pn in ipairs(GAMESTATE:GetEnabledPlayers()) do
-- numpad in detail.
heart_entries[pn]= new_numpad_entry{
Name= pn .. "_heart_entry",
InitCommand= cmd(xy, heart_xs[pn], SCREEN_CENTER_Y+48),
InitCommand= function(self)
self:xy(heart_xs[pn], SCREEN_CENTER_Y+48)
end,
-- Settings for value are optional, but you will probably want to
-- change them, so they are provided in this example.
-- If a simple colored BitmapText isn't what you want for displaying
Expand Down Expand Up @@ -168,8 +170,12 @@ local args= {
-- The BitmapText used to display the elapsed time.
Def.BitmapText{
Name= "timer_text", Font= "Common Normal", Text= "00.0",
InitCommand= cmd(xy, SCREEN_CENTER_X, SCREEN_CENTER_Y-80; diffuse, Color.White),
OnCommand= cmd(strokecolor,Color.Outline),
InitCommand= function(self)
self:xy(SCREEN_CENTER_X, SCREEN_CENTER_Y-80):diffuse(Color.White)
end,
OnCommand= function(self)
self:strokecolor(Color.Outline)
end,
}
},
}
Expand Down
76 changes: 57 additions & 19 deletions Docs/Themerdocs/Examples/Example_Screens/ScreenMapControllers.lua
Original file line number Diff line number Diff line change
Expand Up @@ -40,23 +40,37 @@
-- Here is a simple actor that dims the screen and displays the text.
----------------------------------------------------------------
return Def.ActorFrame{
InitCommand=cmd(xy, SCREEN_CENTER_X, SCREEN_CENTER_Y),
InitCommand=function(self)
self:xy(SCREEN_CENTER_X, SCREEN_CENTER_Y)
end,
Def.Quad{
TweenOnCommand=cmd(zoomto, SCREEN_WIDTH, SCREEN_HEIGHT; diffuse, Color.Black),
TweenOffCommand=cmd(linear, 0.5; diffusealpha, 0),
TweenOnCommand=function(self)
self:zoomto(SCREEN_WIDTH, SCREEN_HEIGHT):diffuse(Color.Black)
end,
TweenOffCommand=function(self)
self:linear(0.5):diffusealpha(0)
end,
},
Def.BitmapText{
Font="Common Normal",
Text=ScreenString("WarningHeader"),
TweenOnCommand=cmd(y,-80;diffuse,Color.Red),
TweenOffCommand=cmd(linear,0.5;diffusealpha,0),
TweenOnCommand=function(self)
self:y(-80):diffuse(Color.Red)
end,
TweenOffCommand=function(self)
self:linear(0.5):diffusealpha(0)
end,

},
Def.BitmapText{
Font="Common Normal",
Text=ScreenString("WarningText"),
TweenOnCommand=cmd(y,10;wrapwidthpixels,SCREEN_WIDTH-48),
TweenOffCommand=cmd(linear,0.5;diffusealpha,0),
TweenOnCommand=function(self)
self:y(10):wrapwidthpixels(SCREEN_WIDTH-48)
end,
TweenOffCommand=function(self)
self:linear(0.5):diffusealpha(0)
end,
},
}

Expand All @@ -70,7 +84,9 @@ return Def.ActorFrame{
----------------------------------------------------------------
return Def.BitmapText{
Font="Common Normal",
InitCommand= cmd(x, SCREEN_CENTER_X; zoom, .75; diffuse, color("#808080")),
InitCommand= function(self)
self:x(SCREEN_CENTER_X):zoom(.75):diffuse(color("#808080"))
end,
OnCommand= function(self)
self:diffusealpha(0)
self:decelerate(0.5)
Expand All @@ -84,10 +100,18 @@ return Def.BitmapText{
self:settext(
THEME:GetString("ScreenMapControllers", "Action" .. self:GetName()))
end,
OffCommand=cmd(stoptweening;accelerate,0.3;diffusealpha,0;queuecommand,"Hide"),
HideCommand=cmd(visible,false),
GainFocusCommand=cmd(diffuseshift;effectcolor2,color("#808080");effectcolor1,color("#FFFFFF")),
LoseFocusCommand=cmd(stopeffect),
OffCommand=function(self)
self:stoptweening():accelerate(0.3):diffusealpha(0):queuecommand("Hide")
end,
HideCommand=function(self)
self:visible(false)
end,
GainFocusCommand=function(self)
self:diffuseshift():effectcolor2(color("#808080")):effectcolor1(color("#FFFFFF"))
end,
LoseFocusCommand=function(self)
self:stopeffect()
end,
}

----------------------------------------------------------------
Expand Down Expand Up @@ -116,19 +140,33 @@ return Def.BitmapText{
-- the player from overflowing the tween stack by mashing.
----------------------------------------------------------------
return Def.ActorFrame{
InitCommand=cmd(x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y),
InitCommand=function(self)
self:x(SCREEN_CENTER_X):y(SCREEN_CENTER_Y)
end,
Def.Quad{
InitCommand=cmd(zoomto,SCREEN_WIDTH,SCREEN_HEIGHT;diffuse,Color.Black;diffusealpha,0),
TweenOnCommand=cmd(stoptweening;diffusealpha,1;linear,0.5;diffusealpha,0.8),
TweenOffCommand=cmd(stoptweening;linear,0.5;diffusealpha,0),
InitCommand=function(self)
self:zoomto(SCREEN_WIDTH,SCREEN_HEIGHT):diffuse(Color.Black):diffusealpha(0)
end,
TweenOnCommand=function(self)
self:stoptweening():diffusealpha(1):linear(0.5):diffusealpha(0.8)
end,
TweenOffCommand=function(self)
self:stoptweening():linear(0.5):diffusealpha(0)
end,
},
Def.ActorFrame{
Def.BitmapText{
Font="Common Normal",
Text=ScreenString("NoSetListPrompt"),
InitCommand=cmd(y,10;wrapwidthpixels,SCREEN_WIDTH-48;diffusealpha,0),
TweenOnCommand=cmd(stoptweening;diffusealpha,0;sleep,0.5125;linear,0.125;diffusealpha,1),
TweenOffCommand=cmd(stoptweening;linear,0.5;diffusealpha,0),
InitCommand=function(self)
self:y(10):wrapwidthpixels(SCREEN_WIDTH-48):diffusealpha(0)
end,
TweenOnCommand=function(self)
self:stoptweening():diffusealpha(0):sleep(0.5125):linear(0.125):diffusealpha(1)
end,
TweenOffCommand=function(self)
self:stoptweening():linear(0.5):diffusealpha(0)
end,
},
},
}
8 changes: 6 additions & 2 deletions Docs/steps.lua
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,12 @@ local MetaData = {
startTime = { path, rate, offset, commands }
Any ommitted arguments will default to nil, except for rate, which would use 1.0
]]
0 = {"path/to/bga", 1.0, 0.000, 0, cmd(rainbow) },
0 = {"path/to/bga2", 1.0, 0.000, 0, cmd(thump) }
0 = {"path/to/bga", 1.0, 0.000, 0, function(self)
self:rainbow()
end,
0 = {"path/to/bga2", 1.0, 0.000, 0, function(self)
self:thump()
end}
},
},
--[[
Expand Down
Loading

0 comments on commit e719669

Please sign in to comment.