LIL is a Language Make games, nicely

@app

The app object is the heart of your application. It provides the storage for the ECS architecture and stuff like movement or the selection system.

The file std/app.lil defines a global variable called app. You can call methods on it directly, but usually it is changed indirectly, through classes such as @container or @sprite.

Example code

//you wouldn't usually do this, it is just an example
app.selectByName(
	nameId: app.registerName(`mytestobj`);
	parentId: 0
);

Member variables

  • selectables

    Type: var.[2048 x @selectable]

    Each item in the ECS corresponds to one selectable of this array.

    var sel: pointerTo app.selectables[entityId];
  • boxPositions

    Type: var.[2048 x @pos]

    Position storage for boxes (containers).

    app.boxPositions[i].x +: ((app.boxVelocities[i].x => f64) * dt) => f32;
  • boxVelocities

    Type: var.[2048 x @vel]

    Storage for the velocities of boxes.

    app.boxVelocities[@self.componentId]: value;
  • box2ds

    Type: var.[2048 x @box2d]

    The data of the 2d boxes is stored in this static array.

    var bgColor: app.box2ds[0].bgColor;
  • boxCount

    Type: var.i64

    The amount of 2d boxes that are currently in use.

    vertexCount: app.boxCount * 6;
  • imgPositions

    Type: var.[2048 x @pos]

    Position storage for images.

    app.imgPositions[@self.componentId].x: value;
  • imgVelocities

    Type: var.[2048 x @vel]

    The velocities of the images are stored in this static array.

    app.imgPositions[i].x +: ((app.imgVelocities[i].x => f64) * dt) => f32;
  • imgClips

    Type: var.[2048 x @pos2d]

    Storage for clipping data of @sprite objects.

    var clip: app.imgClips[i];
  • imgs

    Type: var.[2048 x @img]

    Image data such as width and height are stored in this static array.

    app.imgs[imgId].textureWidth: width;
  • imgCount

    Type: var.i64

    The amount of images that are currently in use.

    var.i64 bufferSize: (sizeOf(type @vertex) * 6 * app.imgCount);
  • shapes

    Type: var.[2048 x @shapeData]

    Storage for vector shape data.

    var shape: pointerTo app.shapes[i];
  • shapesCount

    Type: var.i64

    The amount of vector shapes that are currently in use.

    for (var.i64 i:0; i<app.shapesCount; i+:1) {
    //etc
    }
  • colliderIds

    Type: var.[2048 x i64]

    This is currently unused

  • colliders

    Type: var.[32 x @collider]

    This is currently unused

  • names

    Type: var.[32 x ptr(i8)]

    Storage for names that have been given a name id.

    @self.names[currentCount]: name;
  • nameCount

    Type: var.i64

    The amount of names that are currently in use.

    @self.nameCount +: 1;
  • typeCount

    Type: var.i64

    The amount of types of objects that are currently in use.

    var currentCount: @self.typeCount;
  • resourceIds

    Type: var.[2048 x i64]

    Storage for the ids of resources.

    var resId: app.resourceIds[id];
  • resources

    Type: var.[2048 x @resource]

    Data of resources are stored in this static array.

    return pointerTo app.resources[resId];
  • resourceCount

    Type: var.i64

    The amount of resources that are currently in use.

    @self.resourceIds[@self.resourceCount]: id;
  • actions

    Type: var.[2048 x @action]

    Action data is stored in this static array.

    var action: app.actions[i];
  • actionCount

    Type: var.i64

    The amount of actions that are currently in use.

    var currentCount: @self.actionCount;

Member functions

  • initialize

    Type: fn

    Sets up the background color and mouse listener

    app.initialize();
  • newEntity

    Type: fn => i64

    Bumps the current entity count by one and returns the new entity id

    var newId: app.newEntity();
  • newType

    Type: fn => i64

    Bumps the current type count by one and returns the new type id

    var newTypeId: app.newType();
  • registerName

    Type: fn(ptr(i8)) => i64

    For each unique string passed in to this function it returns a corresponding id.

    Arguments
    • var.ptr(i8) name:

      The C string containing the name to be identified.

    var.i64 nameId: @self.registerName(name);
  • getName

    Type: fn(i64) => ptr(i8)

    Returns the name at given id.

    Arguments
    • var.i64 id:

      The number that was previously handed out by the registerName method.