Merge pull request #118 from sigatrev/master

lua docs for AMV
This commit is contained in:
Colby Klein
2014-04-14 20:28:30 -07:00
4 changed files with 565 additions and 3 deletions
+27
View File
@@ -468,6 +468,24 @@
<Function name='SetTextureCoords'/>
<Function name='SetTextureMode'/>
</Class>
<Class base='Actor' name='ActorMultiVertex'>
<Function name='SetVertex'/>
<Function name='SetVertices'/>
<Function name='SetNumVertices'/>
<Function name='GetNumVertices'/>
<Function name='SetEffectMode'/>
<Function name='SetTextureMode'/>
<Function name='SetLineWidth'/>
<Function name='SetDrawState'/>
<Function name='GetDestDrawMode'/>
<Function name='GetDestFirstToDraw'/>
<Function name='GetDestNumToDraw'/>
<Function name='GetCurrDrawMode'/>
<Function name='GetCurrFirstToDraw'/>
<Function name='GetCurrNumToDraw'/>
<Function name='SetTexture'/>
<Function name='LoadTexture'/>
</Class>
<Class base='Actor' name='ActorProxy'>
<Function name='GetTarget'/>
<Function name='SetTarget'/>
@@ -1874,6 +1892,15 @@
<EnumValue name='&apos;DisplayBPM_Specified&apos;' value='1'/>
<EnumValue name='&apos;DisplayBPM_Random&apos;' value='2'/>
</Enum>
<Enum name='DrawMode'>
<EnumValue name='&apos;DrawMode_Quads&apos;' value='0'/>
<EnumValue name='&apos;DrawMode_QuadStrip&apos;' value='1'/>
<EnumValue name='&apos;DrawMode_Fan&apos;' value='2'/>
<EnumValue name='&apos;DrawMode_Strip&apos;' value='3'/>
<EnumValue name='&apos;DrawMode_Triangles&apos;' value='4'/>
<EnumValue name='&apos;DrawMode_LineStrip&apos;' value='5'/>
<EnumValue name='&apos;DrawMode_SymmetricQuadStrip&apos;' value='6'/>
</Enum>
<Enum name='EarnedExtraStage'>
<EnumValue name='&apos;EarnedExtraStage_No&apos;' value='0'/>
<EnumValue name='&apos;EarnedExtraStage_Extra1&apos;' value='1'/>
+65 -3
View File
@@ -1401,6 +1401,68 @@ save yourself some time, copy this for undocumented things:
Sets a TextureMode on the specified index.
</Function>
</Class>
<Class name='ActorMultiVertex'>
<Function name='SetVertex' return='void' arguments='int index, table { table pos, table color, table textcoords }'>
Sets vertex number <code>index</code> with the properties provided. The tables of properties are each optional and can be provided in any order.
</Function>
<Function name='SetVertices' return='void' arguments='int first, table vertices'>
Sets multiple vertices at once. The elements of <code>vertices</code> should themselves be tables, of the form provided to <Link class='ActorMultiVertex' function='SetVertex'>SetVertex</Link>. If <code>vertices</code> is the first argument it will start from vertex 1. If an integer is provided before <code>vertices</code> it will start from that vertex. It will add vertices as necessary.
Example: self:SetVertices( { { { x1, y1, z1 } , { r1,g1,b1,a1 } , { tcx1,tcy1 } }; { { x2, y2, z2 } , { r2,g2,b2,a2 } , { tcx2,tcy2 } } } )
</Function>
<Function name='SetNumVertices' return='void' arguments='int num'>
Sets the number of vertices.
</Function>
<Function name='GetNumVertices' return='void' arguments='void'>
Returns the number of vertices
</Function>
<Function name='SetDrawState' return='void' arguments='table { Mode= mode, First= first, Num= num }'>
Sets the draw state variables to the values in the table.<br />
Mode must be a <Link class='ENUM' function='DrawMode'>DrawMode</Link>.<br />
First is the index of the first vertex to draw.<br />
Num is the number of vertices to draw. -1 for Num means draw all verts after First.<br />
Any value not in the table defaults to the already set value.<br />
Examples:<br />
-- Sets all three parts of the draw state.<br />
self:SetDrawState{Mode="DrawMode_Quads", First= 1, Num= -1}<br />
-- Set only the draw mode. First and Num remain unchanged from previous.<br />
self:SetDrawState{Mode="DrawMode_Quads"}<br />
-- Set the first and number to draw. Draw mode remains unchanged.<br />
self:SetDrawState{First= 3, Num= 4}<br />
</Function>
<Function name='GetDestDrawMode' return='DrawMode' arguments='void'>
Get the <Link class='ENUM' function='DrawMode'>DrawMode</Link> of the destination tween state.
</Function>
<Function name='GetDestFirstToDraw' return='int' arguments='void'>
Get the FirstToDraw of the destination tween state.
</Function>
<Function name='GetDestNumToDraw' return='int' arguments='void'>
Get the NumToDraw of the destination tween state.
</Function>
<Function name='GetCurrDrawMode' return='DrawMode' arguments='void'>
Get the <Link class='ENUM' function='DrawMode'>DrawMode</Link> of the current tween state.
</Function>
<Function name='GetCurrFirstToDraw' return='int' arguments='void'>
Get the FirstToDraw of the current tween state.
</Function>
<Function name='GetCurrNumToDraw' return='int' arguments='void'>
Get the NumToDraw of the current tween state.
</Function>
<Function name='SetEffectMode' return='void' arguments='EffectMode em'>
Sets the <Link class='ENUM' function='EffectMode'>EffectMode</Link> of the ActorMultiVertex.
</Function>
<Function name='SetTextureMode' return='void' arguments='TextureMode tm'>
Sets the <Link class='ENUM' function='TextureMode'>TextureMode</Link> of the ActorMultiVertex.
</Function>
<Function name='SetLineWidth' return='void' arguments='float width'>
Sets the width of the line for DrawMode_LineStrip.
</Function>
<Function name='SetTexture' return='void' arguments='RageTexture texture'>
Sets the texture to <code>texture</code>
</Function>
<Function name='LoadTexture' return='void' arguments='string path'>
Sets the texture at from the file path <code>path</code>.
</Function>
</Class>
<Class name='ActorProxy'>
<Function name='GetTarget' return='Actor' arguments=''>
Returns the target of the ActorProxy.
@@ -2366,12 +2428,12 @@ save yourself some time, copy this for undocumented things:
<Function name='ResetPlayerOptions' return='void' arguments='PlayerNumber pn'>
Resets the specific Player's mods to the default settings.
</Function>
<Function name='SaveProfiles' return='void' arguments='bool LoadEdits'>
Save profiles.
</Function>
<Function name='SaveLocalData' return='void' arguments=''>
Saves the bookkeeping and machine profile data.
</Function>
<Function name='SaveProfiles' return='void' arguments='bool LoadEdits'>
Save profiles.
</Function>
<Function name='SetCharacter' return='void' arguments='PlayerNumber pn, string sCharID'>
Sets the current <Link class='Character' /> for the specified <Link class='ENUM' function='PlayerNumber' />.
</Function>
+472
View File
@@ -0,0 +1,472 @@
-- General guide:
-- ActorMultiVertex is an actor class that can have any number of vertices.
-- Use it for drawing anything that needs to have some arbitrary shape
-- This screen file contains a simple demo for each draw mode.
-- Each demo starts with a diagram of how its verts are connected.
-- Each of these actors has three commands as part of its demo.
-- The Reset command sets the actor to some initial state.
-- The FirstMove command moves some verts around.
-- The SecondMove command changes the first and num to draw.
-- Testing this screen:
-- To add this screen to your theme so you can observe each of these actors, add these lines to your metrics.ini: (Remove the "-- " from the start of each line, of course)
-- [ScreenAMVTest]
-- Fallback="ScreenWithMenuElements"
-- Class="ScreenWithMenuElements"
-- CodeNames="left,right,reset"
-- Codeleft="Left"
-- Coderight="Right"
-- Codereset="Up"
-- Then set the InitialScreen value in the Common section to the name of this screen. This will make your theme go to this screen when starting.
-- When on the screen, use left and right to change which demo is displayed, and up to send the Reset command to the currently displayed demo so you can watch its animation again.
local function quad_demo(x, y)
-- Minimum verts: 4
-- Verts per group: 4
-- Vert diagram:
-- 1 - 4 5 - 8
-- | | | |
-- 2 - 3 6 - 7
local verts= {
{{0, 0, 0}, Color.Red},
{{0, 20, 0}, Color.Blue},
{{20, 20, 0}, Color.Green},
{{20, 0, 0}, Color.Yellow},
{{40, 0, 0}, Color.Orange},
{{40, 20, 0}, Color.Purple},
{{60, 20, 0}, Color.Black},
{{60, 0, 0}, Color.White},
}
return Def.ActorMultiVertex{
Name= "AMV_Quads",
InitCommand=
function(self)
self:visible(false)
self:xy(x, y)
self:SetDrawState{Mode="DrawMode_Quads"}
end,
ResetCommand=
function(self)
self:SetDrawState{First= 1, Num= -1}
verts[1][1][1]= 0
verts[4][1][1]= 20
verts[7][1][2]= 20
verts[8][1][2]= 0
self:SetVertices(verts)
self:finishtweening()
self:queuecommand("FirstMove")
self:queuecommand("SecondMove")
end,
FirstMoveCommand=
function(self)
self:linear(1)
verts[1][1][1]= verts[1][1][1]+10
verts[4][1][1]= verts[4][1][1]-10
verts[7][1][2]= verts[7][1][2]+10
verts[8][1][2]= verts[8][1][2]-10
self:SetVertices(verts)
end,
SecondMoveCommand=
function(self)
self:linear(1)
self:SetDrawState{First= 3, Num= 4}
end
}
end
local function quadstrip_demo(x, y)
-- Minimum verts: 4
-- Verts per group: 2
-- Vert diagram:
-- 1 - 3 - 5 - 7
-- | | | |
-- 2 - 4 - 6 - 8
local verts= {
{{0, 0, 0}, Color.Red},
{{0, 20, 0}, Color.Blue},
{{20, 0, 0}, Color.Green},
{{20, 20, 0}, Color.Yellow},
{{40, 0, 0}, Color.Orange},
{{40, 20, 0}, Color.Purple},
{{60, 0, 0}, Color.Black},
{{60, 20, 0}, Color.White},
}
return Def.ActorMultiVertex{
Name= "AMV_QuadStrip",
InitCommand=
function(self)
self:visible(false)
self:xy(x, y)
self:SetDrawState{Mode="DrawMode_QuadStrip"}
end,
ResetCommand=
function(self)
self:SetDrawState{First= 1, Num= -1}
verts[1][1][1]= 0
verts[4][1][1]= 20
verts[7][1][2]= 0
verts[8][1][2]= 20
self:SetVertices(verts)
self:finishtweening()
self:queuecommand("FirstMove")
self:queuecommand("SecondMove")
end,
FirstMoveCommand=
function(self)
self:linear(1)
verts[1][1][1]= verts[1][1][1]+10
verts[4][1][1]= verts[4][1][1]-10
verts[7][1][2]= verts[7][1][2]+10
verts[8][1][2]= verts[8][1][2]-10
self:SetVertices(verts)
end,
SecondMoveCommand=
function(self)
self:linear(1)
self:SetDrawState{First= 3, Num= 4}
end
}
end
local function fan_demo(x, y)
-- Minimum verts: 3
-- Verts per group: 1
-- Vert diagram:
-- 2 - 3
-- | / |
-- 8 - 1 - 4
-- | / | \ |
-- 7 - 6 - 5
local verts= {
{{0, 0, 0}, Color.Red},
{{0, -20, 0}, Color.Blue},
{{20, -20, 0}, Color.Green},
{{20, 0, 0}, Color.Yellow},
{{20, 20, 0}, Color.Orange},
{{0, 20, 0}, Color.Purple},
{{-20, 20, 0}, Color.Black},
{{-20, 0, 0}, Color.White},
}
return Def.ActorMultiVertex{
Name= "AMV_Fan",
InitCommand=
function(self)
self:visible(false)
self:xy(x, y)
self:SetDrawState{Mode="DrawMode_Fan"}
end,
ResetCommand=
function(self)
self:SetDrawState{First= 1, Num= -1}
verts[2][1][2]= -20
verts[4][1][1]= 20
verts[6][1][2]= 20
verts[8][1][1]= -20
self:SetVertices(verts)
self:finishtweening()
self:queuecommand("FirstMove")
self:queuecommand("SecondMove")
end,
FirstMoveCommand=
function(self)
self:linear(1)
verts[2][1][2]= verts[2][1][2]-10
verts[4][1][1]= verts[4][1][1]+10
verts[6][1][2]= verts[6][1][2]+10
verts[8][1][1]= verts[8][1][1]-10
self:SetVertices(verts)
end,
SecondMoveCommand=
function(self)
self:linear(1)
self:SetDrawState{First= 3, Num= 6}
end
}
end
local function strip_demo(x, y)
-- Minimum verts: 3
-- Verts per group: 1
-- Suspiciously similar to quad strip,
-- Vert diagram:
-- 1 - 3 - 5 - 7
-- | / | / | / |
-- 2 - 4 - 6 - 8
local verts= {
{{0, 0, 0}, Color.Red},
{{0, 20, 0}, Color.Blue},
{{20, 0, 0}, Color.Green},
{{20, 20, 0}, Color.Yellow},
{{40, 0, 0}, Color.Orange},
{{40, 20, 0}, Color.Purple},
{{60, 0, 0}, Color.Black},
{{60, 20, 0}, Color.White},
}
return Def.ActorMultiVertex{
Name= "AMV_Strip",
InitCommand=
function(self)
self:visible(false)
self:xy(x, y)
self:SetDrawState{Mode="DrawMode_Strip"}
end,
ResetCommand=
function(self)
self:SetDrawState{First= 1, Num= -1}
verts[1][1][1]= 0
verts[4][1][1]= 20
verts[7][1][2]= 0
verts[8][1][2]= 20
self:SetVertices(verts)
self:finishtweening()
self:queuecommand("FirstMove")
self:queuecommand("SecondMove")
end,
FirstMoveCommand=
function(self)
self:linear(1)
verts[1][1][1]= verts[1][1][1]+10
verts[4][1][1]= verts[4][1][1]-10
verts[7][1][2]= verts[7][1][2]+10
verts[8][1][2]= verts[8][1][2]-10
self:SetVertices(verts)
end,
SecondMoveCommand=
function(self)
self:linear(1)
self:SetDrawState{First= 3, Num= 4}
end
}
end
local function triangles_demo(x, y)
-- Minimum verts: 3
-- Verts per group: 3
-- Vert diagram:
-- 2 5 8
-- / \ / \ / \
-- 1 - 3 4 - 6 7 - 9
local verts= {
{{0, 0, 0}, Color.Red},
{{10, -20, 0}, Color.Blue},
{{20, 0, 0}, Color.Green},
{{30, 0, 0}, Color.Yellow},
{{40, -20, 0}, Color.Orange},
{{50, 0, 0}, Color.Purple},
{{60, 20, 0}, Color.Black},
{{70, 0, 0}, Color.White},
{{80, 20, 0}, Color.Orange},
}
return Def.ActorMultiVertex{
Name= "AMV_Triangles",
InitCommand=
function(self)
self:visible(false)
self:xy(x, y)
self:SetDrawState{Mode="DrawMode_Triangles"}
end,
ResetCommand=
function(self)
verts[2][1][2]= -20
verts[4][1][2]= 0
verts[6][1][2]= 0
verts[8][1][2]= -20
self:SetDrawState{First= 1, Num= -1}
self:SetVertices(verts)
self:finishtweening()
self:queuecommand("FirstMove")
self:queuecommand("SecondMove")
end,
FirstMoveCommand=
function(self)
self:linear(1)
verts[2][1][2]= verts[2][1][2]-20
verts[4][1][2]= verts[4][1][2]+20
verts[6][1][2]= verts[6][1][2]+20
verts[8][1][2]= verts[8][1][2]-20
self:SetVertices(verts)
end,
SecondMoveCommand=
function(self)
self:linear(1)
self:SetDrawState{First= 3, Num= 6}
end
}
end
local function linestrip_demo(x, y)
-- Minimum verts: 2
-- Verts per group: 1
-- Vert diagram:
-- 1 - 2 - 3
-- |
-- 8 4
-- | |
-- 7 - 6 - 5
local verts= {
{{-40, -40, 0}, Color.Red},
{{0, -40, 0}, Color.Blue},
{{40, -40, 0}, Color.Green},
{{40, 0, 0}, Color.Yellow},
{{40, 40, 0}, Color.Orange},
{{0, 40, 0}, Color.Purple},
{{-40, 40, 0}, Color.Black},
{{-40, 0, 0}, Color.White},
}
return Def.ActorMultiVertex{
Name= "AMV_LineStrip",
InitCommand=
function(self)
self:visible(false)
self:xy(x, y)
self:SetDrawState{Mode="DrawMode_LineStrip"}
end,
ResetCommand=
function(self)
self:SetLineWidth(1)
self:SetDrawState{First= 1, Num= -1}
verts[1][1][2]= -40
verts[4][1][1]= 40
verts[6][1][2]= 40
verts[8][1][1]= -40
self:SetVertices(verts)
self:finishtweening()
self:queuecommand("FirstMove")
self:queuecommand("SecondMove")
end,
FirstMoveCommand=
function(self)
self:linear(1)
verts[1][1][2]= verts[1][1][2]+20
verts[4][1][1]= verts[4][1][1]+20
verts[6][1][2]= verts[6][1][2]-10
verts[8][1][1]= verts[8][1][1]+10
self:SetLineWidth(20)
self:SetVertices(verts)
end,
SecondMoveCommand=
function(self)
self:linear(1)
self:SetDrawState{First= 3, Num= 4}
end
}
end
local function symmetric_quadstrip_demo(x, y)
-- Minimum verts: 6
-- Verts per group: 3
-- Vert diagram:
-- 1 - 2 - 3
-- | | |
-- 4 - 5 - 6
-- | | |
-- 7 - 8 - 9
local verts= {
{{0, 0, 0}, Color.Red},
{{20, 0, 0}, Color.Blue},
{{40, 0, 0}, Color.Green},
{{-10, 20, 0}, Color.Yellow},
{{20, 20, 0}, Color.Orange},
{{50, 20, 0}, Color.Purple},
{{0, 40, 0}, Color.Black},
{{20, 40, 0}, Color.White},
{{40, 40, 0}, Color.Orange},
}
return Def.ActorMultiVertex{
Name= "AMV_SymmetricQuadStrip",
InitCommand=
function(self)
self:visible(false)
self:xy(x, y)
self:SetDrawState{Mode="DrawMode_SymmetricQuadStrip"}
end,
ResetCommand=
function(self)
self:SetDrawState{First= 1, Num= -1}
verts[2][1][2]= 0
verts[5][1][1]= 20
verts[7][1][1]= 00
verts[7][1][2]= 40
verts[9][1][1]= 40
verts[9][1][2]= 40
self:SetVertices(verts)
self:finishtweening()
self:queuecommand("FirstMove")
self:queuecommand("SecondMove")
end,
FirstMoveCommand=
function(self)
self:linear(1)
verts[2][1][2]= verts[2][1][2]-20
verts[5][1][1]= verts[5][1][1]-20
verts[7][1][1]= verts[7][1][1]-10
verts[7][1][2]= verts[7][1][2]+10
verts[9][1][1]= verts[9][1][1]+10
verts[9][1][2]= verts[9][1][2]+10
self:SetVertices(verts)
end,
SecondMoveCommand=
function(self)
self:linear(1)
self:SetDrawState{First= 4, Num= 6}
end
}
end
local children= {}
local prev_child_index= 1
local current_child_index= 1
local name_disp= false
local args= {
quad_demo(SCREEN_CENTER_X, SCREEN_CENTER_Y),
quadstrip_demo(SCREEN_CENTER_X, SCREEN_CENTER_Y),
fan_demo(SCREEN_CENTER_X, SCREEN_CENTER_Y),
strip_demo(SCREEN_CENTER_X, SCREEN_CENTER_Y),
triangles_demo(SCREEN_CENTER_X, SCREEN_CENTER_Y),
linestrip_demo(SCREEN_CENTER_X, SCREEN_CENTER_Y),
symmetric_quadstrip_demo(SCREEN_CENTER_X, SCREEN_CENTER_Y),
LoadFont("Common Normal") .. {
Name= "NameDisp",
InitCommand=
function(self)
self:xy(SCREEN_CENTER_X, 24)
self:diffuse(Color.White)
end
},
InitCommand=
function(self)
for n, c in pairs(self:GetChildren()) do
if n:find("AMV") then
Trace("Adding " .. n .. " to children list for manipulation.")
children[#children+1]= c
end
end
name_disp= self:GetChild("NameDisp")
children[current_child_index]:visible(true)
children[current_child_index]:queuecommand("Reset")
name_disp:settext(children[current_child_index]:GetName())
end,
CodeMessageCommand=
function(self, param)
if param.Name == "left" then
current_child_index= current_child_index - 1
if current_child_index < 1 then
current_child_index= #children
end
elseif param.Name == "right" then
current_child_index= current_child_index + 1
if current_child_index > #children then
current_child_index= 1
end
end
children[prev_child_index]:visible(false)
children[current_child_index]:visible(true)
children[current_child_index]:queuecommand("Reset")
name_disp:settext(children[current_child_index]:GetName())
prev_child_index= current_child_index
end
}
return Def.ActorFrame(args)
+1
View File
@@ -6,6 +6,7 @@ Actor
ActorFrame
ActorFrameTexture
ActorMultiTexture
ActorMultiVertex
ActorProxy
ActorScroller
Banner