@image
An image is a box with a texture.
An image is a box with a texture.
#new @image logo {
src: "logo.png";
x: 20;
y: 10;
}
Type: vvar.i64
The identifier of the data for this image.
app.imgs[@self.componentId].width: value;
Type: vvar.f32
How wide the image is.
theImage.width: 100;
Type: vvar.f32
How tall the image is.
var height: theImage.height;
Type: vvar.f32
The position along the horizontal axis.
theImage.x +: 100;
Type: vvar.f32
The position along the vertical axis.
theImage.y -: 20;
Type: vvar.f32
The position along the direction of the depth.
theImage.z: 0;
Type: vvar.@vel
The speed at which this image should move, in pixels per 60th of a second.
theImage.velocity: @vel { x: 3; y: 5 };
Type: vvar.ptr(@string)
A string containing the file path for the resource. Returns the string as a cstr.
theImage.src: "sprite.png";
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 image into the ECS.
The name of the new image.
The id of the parent of the new image. Defaults to 0, which is the id of the @root object.
var theImage: @image { };
theImage.initialize(`myImage`, 0);
Type: fn(f32)
Setter for the width vvar.
The number in pixels for the width.
theImage.setWidth(100);
Type: fn => f32
Getter for the width vvar.
if theImage.getWidth() > 200 {
//etc
}
Type: fn(f32)
Setter for the height vvar.
The number in pixels for the height.
theImage.setHeight(200);
Type: fn => f32
Getter for the height vvar.
print theImage.getHeight();
Type: fn(f32)
Setter for the x vvar.
The number in pixels for the x coordinate.
theImage.setX(200);
Type: fn => f32
Getter for the x vvar.
if theImage.getX() > 100 {
//etc
}
Type: fn(f32)
Setter for the y vvar.
The number in pixels for the y coordinate.
theImage.setY(0);
Type: fn => f32
Getter for the y vvar.
var currentY: theImage.getY();
Type: fn(f32)
Setter for the z vvar.
The number in pixels for the z coordinate.
theImage.setZ(0);
Type: fn => f32
Getter for the z vvar.
if theImage.getZ() > 0 {
//etc
}
Type: fn(@vel)
Setter for the velocity vvar.
A vector describing the velocitiy of the image.
theImage.setVelocity(@vel {
x: 2;
y: 0;
});
Type: fn => @vel
Value accessor for the velocity vvar.
var vel: theImage.getVelocity();
Type: fn => ptr(@vel)
Pointer accessor for the volicity vvar.
var ptrToVel: theImage.getVelocityPointer();
Type: fn(ptr(@string))
Setter for the src vvar.
A string containing the path to the image inside the Resources folder.
theImage.setSrc("newImage.png");
Type: fn => ptr(i8)
Getter for the src vvar.
print theImage.getSrc();
Type: fn(ptr(@string))
Loads a new image into the system, creating the new texture.
A string containing the path to the image inside the Resources folder.
To gain a better understanding of this class, it is recommended to look at the source code of the following file: