Module stage
Class Container
Container.x | x position |
Container.y | y position |
Container.r | rotation in radians |
Container.sx | x scale factor |
Container.sy | y scale factor |
tove.newContainer () | Create new container. |
Container:draw () | Draw container and its children. |
Container:addChild (c1[, c]) | Add child(ren). |
Container:addChildAt (c1[, c], index) | Add child(ren) at position. |
Container:removeChild (c1[, c]) | Remove child(ren). |
Container:removeChildAt (i1[, c]) | Remove child(ren) at position. |
Container:setChildIndex (child, index) | Move child to position. |
Class Stage
tove.newStage () | Create new stage. |
Class Shape
Shape.x | |
Shape.y | |
Shape.rotation | |
Shape.sx | |
Shape.sy | |
tove.newShape (graphics) | Create new shape. |
Shape:draw () | Draw. |
Shape:setDisplay (mode[, args]) | Set display mode. |
Class Container
A container which allows you to draw a couple of things with one draw call.
- Container.x
-
x position
- x number
- Container.y
-
y position
- y number
- Container.r
-
rotation in radians
- r number
- Container.sx
-
x scale factor
- sx number
- Container.sy
-
y scale factor
- sy number
- tove.newContainer ()
-
Create new container.
Returns:
-
Container
new empty container
- Container:draw ()
-
Draw container and its children.
Usage:
container.x = 20 container.y = 30 container:draw()
- Container:addChild (c1[, c])
-
Add child(ren).
Parameters:
- c1 Drawable first child to add
- c Drawable... more children to add (optional)
Usage:
c:addChild(someGraphics)
- Container:addChildAt (c1[, c], index)
-
Add child(ren) at position.
Parameters:
- c1 Drawable first child to add
- c Drawable... more children to add (optional)
- index int where to add children
Usage:
c:addChildAt(otherContainer, someGraphics, 7)
- Container:removeChild (c1[, c])
-
Remove child(ren).
Parameters:
- c1 Drawable first child to remove
- c Drawable... more children to remove (optional)
Usage:
c:removeChild(someGraphics)
- Container:removeChildAt (i1[, c])
-
Remove child(ren) at position.
Parameters:
- i1 int index of first child to remove
- c int... indices of more children to remove (optional)
Usage:
c:removeChildAt(2, 7)
- Container:setChildIndex (child, index)
-
Move child to position.
Parameters:
- child Drawable child to move
- index int index to move the child to
Class Stage
- tove.newStage ()
-
Create new stage.
Returns:
-
Container
empty stage
Class Shape
- Shape.x
-
- x number x position
- Shape.y
-
- y number y position
- Shape.rotation
-
- rotation number rotation in radians
- Shape.sx
-
- sx number x scale factor
- Shape.sy
-
- sy number y scale factor
- tove.newShape (graphics)
-
Create new shape.
Parameters:
- graphics Graphics for drawing this shape
Returns:
-
Shape
new shape
- Shape:draw ()
-
Draw.
See also:
Usage:
shape = tove.newShape(someGraphics) shape.x = 20 shape.y = 30 shape.r = 0.1 -- rotation shape:draw() -- no need to track x, y and r here
- Shape:setDisplay (mode[, args])
-
Set display mode.
Change display mode of underlying Graphics.
Parameters:
- mode string display moede
- args ... additional args (optional)
See also: