Program
The program block houses the actual programming logic. Note that program {}
has a Program
receiver.
The code inside the program
block is only executed after a window has been created and a graphical context has been set up. This code is only executed once.
In the program
block one can install extensions using extend
. Extensions are by default executed as often as possible. The most important type of extension is the one holding the user code.
A minimal application-program-extend setup would then look like this:
fun main() = application {
program {
// -- what is here is executed once
// -- It's a good place to load assets
extend {
// -- what is here is executed 'as often as possible'
drawer.circle(width / 2.0, height / 2.0, 100.0)
}
}
}