@container
A container is a basic box of content. It can contain other objects and draw a background.
A container is a basic box of content. It can contain other objects and draw a background.
#new @container test {
width: 100;
height: 100;
backround: #0;
}
Type: vvar.i64
The identifier of the box for this container.
app.box2ds[@self.componentId].width: value;
Type: vvar.f32
How wide the container is.
theContainer.width: 100;
Type: vvar.f32
How tall the container is.
var height: theContainer.height;
Type: vvar.@rgb
A color object representing the background color of this container.
theContainer.background: #F00;
Type: vvar.f32
The position along the horizontal axis.
theContainer.x +: 100;
Type: vvar.f32
The position along the vertical axis.
theContainer.y -: 20;
Type: vvar.f32
The position along the direction of the depth.
theContainer.z: 0;
Type: vvar.@vel
The speed at which this container should move, in pixels per 60th of a second.
theContainer.velocity: @vel { x: 3; y: 5 };
Type: var.@element
The @element superclass. This field is expanded and gives this class its id field.
var elem: @self.super;
Type: fn => i64
Accessor for the componentId vvar.
var componentId: @self.getComponentId();
Type: fn(ptr(i8),i64) => i64
This method installs a new container into the ECS.
The name of the new container.
The id of the parent of the new container. Defaults to 0, which is the id of the @root object.
var theContainer: @container { };
theContainer.initialize(`myContainer`, 0);
Type: fn(f32)
Setter for the width vvar.
The number in pixels for the width.
theContainer.setWidth(100);
Type: fn => f32
Getter for the width vvar.
if theContainer.getWidth() > 200 {
//etc
}
Type: fn(f32)
Setter for the height vvar.
The number in pixels for the height.
Type: fn => f32
Getter for the height vvar.
print theContainer.getHeight();
Type: fn(@rgb)
Setter for the background vvar.
The color with which to draw the background.
theContainer.setBackground(myBgColor);
Type: fn => @rgb
Value accessor for the background vvar.
var color: theContainer.getBackground();
Type: fn => ptr(@rgb)
Pointer accessor for the background vvar.
var colorPtr: theContainer.getBackgroundPointer();
Type: fn(f32)
Setter for the x vvar.
The number in pixels for the x coordinate.
theContainer.setX(200);
Type: fn => f32
Getter for the x vvar.
if theContainer.getX() > 100 {
//etc
}
Type: fn(f32)
Setter for the y vvar.
The number in pixels for the y coordinate.
theContainer.setY(0);
Type: fn => f32
Getter for the y vvar.
var currentY: theContainer.getY();
Type: fn(f32)
Setter for the z vvar.
The number in pixels for the z coordinate.
theContainer.setZ(0);
Type: fn => f32
Getter for the z vvar.
if theContainer.getZ() > 0 {
//etc
}
Type: fn(@vel)
Setter for the velocity vvar.
A vector describing the velocitiy of the container.
theContainer.setVelocity(@vel {
x: 2;
y: 0;
});
Type: fn => @vel
Value accessor for the velocity vvar.
var vel: theContainer.getVelocity();
Type: fn => ptr(@vel)
Pointer accessor for the volicity vvar.
To gain a better understanding of this class, it is recommended to look at the source code of the following file: