openrndr / org.openrndr / Program

Program

open class Program

The Program class, this is where most user implementations start

Types

CharacterEvent

class CharacterEvent

Clipboard

inner class Clipboard

Window

inner class Window

Simplified window interface

Constructors

<init>

Program()

The Program class, this is where most user implementations start

Properties

application

lateinit var application: Application

backgroundColor

var backgroundColor: ColorRGBa?

clipboard

val clipboard: Clipboard

clock

var clock: () -> Double

clock function. defaults to returning the application time.

dispatcher

val dispatcher: PumpDispatcher

drawer

lateinit var drawer: Drawer

driver

lateinit var driver: Driver

height

var height: Int

keyboard

val keyboard: Keyboard

mouse

val mouse: Mouse

seconds

val seconds: Double

The number of seconds since program start, or the time from a custom clock. value is updated at the beginning of the frame only.

width

var width: Int

window

val window: Window

Functions

draw

open fun draw(): Unit

This is the user facing draw call. It should be overridden by the user.

drawImpl

fun drawImpl(): Unit

This is the draw call that is called by Application. It takes care of handling extensions.

extend

fun extend(extension: Extension): Extension

Install an Extension.

fun <T : Extension> extend(extension: T, configure: T.() -> Unit): Extension

Install an Extension and configure it

fun extend(stage: ExtensionStage = ExtensionStage.BEFORE_DRAW, draw: () -> Unit): Unit

Install an extension function for the given ExtensionStage

setup

open fun setup(): Unit

This is ran exactly once before the first call to draw()

Extension Functions

launch

fun Program.launch(context: CoroutineContext = dispatcher, start: CoroutineStart = CoroutineStart.DEFAULT, block: suspend CoroutineScope.() -> Unit): Job