Skip to content
This repository has been archived by the owner on Jan 27, 2022. It is now read-only.

builder macro

Ethosa edited this page Nov 29, 2021 · 1 revision

build macro

It provides powerful and pretty scene building

Get Started

Creating new node

build:
  - Node node_name

Node - any Node object (Scene, Control, Sprite, etc.)
node_name - node name.

Adding node children

build:
  - Scene main:
    - Node child1
    - Node child2
    - Button child3:
      - Node button_child
    - Sprite child4

Changing attributes

build:
  - Node2D node1:  # multiline attributes
    rotation: 90f
    centered: true
  - Node2D node2(rotation: 90f, centered: true)  # one-line attributes
  - Node2D node3(centered: true):  # both
    rotation: 90f

Calling methods

build:
  - Label hw1:
    call setText("Hello, world!")  # one method
  - Label hw_centered:
    call:  # two or more methods
      setText("Hello, world!")
      setAnchor(CENTER_ANCHOR)
      setBackgroundColor(current_theme~background_deep)

Using primitive cycle

build:
  for i in 0..10:
    - Node node_number_i:
      ...