Merge pull request #515 from sigatrev/AFT-example-update
Update AFT examples
This commit is contained in:
@@ -13,8 +13,9 @@ local Example1_AlphaBuffer = true; -- Change this to see the effect of the Alpha
|
|||||||
-- Example 2: An ActorFrameTexture draws a spinning ActorFrame containing 3 color-channging quads. The texture is drawn by a sprite.
|
-- Example 2: An ActorFrameTexture draws a spinning ActorFrame containing 3 color-channging quads. The texture is drawn by a sprite.
|
||||||
local Example2_PreserveTexture = false; -- Change this to see the effect of PreserveTexture.
|
local Example2_PreserveTexture = false; -- Change this to see the effect of PreserveTexture.
|
||||||
|
|
||||||
-- Example 3: An ActorFrameTexture draws a white quad, and then draws 3 quads on top of it all using "BlendMode_Add", each with either
|
-- Example 3: This example shows how the Float property of ActorFrameTexture works. An ActorFrameTexture draws a white quad,
|
||||||
-- R, G, or B. Change the diffuse to see different colors show up as a result of the texture having RGB values greater than 1.
|
-- and then draws 3 quads on top of it all using "BlendMode_Add", each with either R, G, or B. Change the diffuse to see different
|
||||||
|
-- colors show up as a result of the texture having RGB values greater than 1.
|
||||||
local Example3_Diffuse = { 1,0.5,1,1 } -- Note that with Green of 50%, there is still a white rectangle where the Green square intersect the background white square.
|
local Example3_Diffuse = { 1,0.5,1,1 } -- Note that with Green of 50%, there is still a white rectangle where the Green square intersect the background white square.
|
||||||
|
|
||||||
-- Example 4: Use a pair of AFTs to draw an object with a fading trail behind it. This example is a bit odd, in that the length of the
|
-- Example 4: Use a pair of AFTs to draw an object with a fading trail behind it. This example is a bit odd, in that the length of the
|
||||||
@@ -30,6 +31,8 @@ local Example3_Diffuse = { 1,0.5,1,1 } -- Note that with Green of 50%, there is
|
|||||||
|
|
||||||
Because it is not drawing to the screen, an ActorFrameTexture's postion, rotation, and zoom have no affect. Diffuse and
|
Because it is not drawing to the screen, an ActorFrameTexture's postion, rotation, and zoom have no affect. Diffuse and
|
||||||
glow are applied to the children of an ActorFrameTexture the same way they are applied to the children of an ActorFrame.
|
glow are applied to the children of an ActorFrameTexture the same way they are applied to the children of an ActorFrame.
|
||||||
|
Additionally, an ActorFrameTexture can draw to it's texture at any time, by calling the Actor method Draw. For all other
|
||||||
|
Actor classes, the Draw method will have no effect if called outside of the Screen's draw cycle.
|
||||||
|
|
||||||
ActorFrameTextures draw only actors or parts of actors that are located within the range x = 0 to x = <width> and y = 0
|
ActorFrameTextures draw only actors or parts of actors that are located within the range x = 0 to x = <width> and y = 0
|
||||||
to y = <height>. If an actor is sitting at x = 0 inside the ActorFrameTexture, only the right half of the Actor will draw.
|
to y = <height>. If an actor is sitting at x = 0 inside the ActorFrameTexture, only the right half of the Actor will draw.
|
||||||
@@ -101,11 +104,8 @@ Examples[1] = Def.ActorFrame{
|
|||||||
self:Create();
|
self:Create();
|
||||||
|
|
||||||
-- The ActorFrameTexture only needs to draw once, so hide it after the first draw.
|
-- The ActorFrameTexture only needs to draw once, so hide it after the first draw.
|
||||||
self:SetDrawFunction( function()
|
self:Draw()
|
||||||
-- Calling self:Draw() would cause an infinite loop. Wrap all children in a single ActorFrame and draw that instead.
|
self:hibernate(math.huge)
|
||||||
self:GetChild("Draw"):Draw();
|
|
||||||
self:hibernate(math.huge);
|
|
||||||
end )
|
|
||||||
end;
|
end;
|
||||||
Def.ActorFrame{
|
Def.ActorFrame{
|
||||||
Name = "Draw";
|
Name = "Draw";
|
||||||
@@ -158,10 +158,8 @@ Examples[3] = Def.ActorFrame{
|
|||||||
self:EnableFloat( true );
|
self:EnableFloat( true );
|
||||||
self:Create();
|
self:Create();
|
||||||
|
|
||||||
self:SetDrawFunction( function()
|
self:Draw()
|
||||||
self:GetChild("Draw"):Draw();
|
self:hibernate(math.huge)
|
||||||
self:hibernate(math.huge);
|
|
||||||
end )
|
|
||||||
end;
|
end;
|
||||||
Def.ActorFrame{
|
Def.ActorFrame{
|
||||||
Name = "Draw";
|
Name = "Draw";
|
||||||
|
|||||||
Reference in New Issue
Block a user