package org.openrndr import org.openrndr.draw.* import org.openrndr.extensions.SingleScreenshot import org.openrndr.extra.olive.* import org.openrndr.ffmpeg.ScreenRecorder import phenax.utils.* class Preload : ApplicationPreload() { override fun onProgramSetup(program: Program) { println("Program: ${program.name}") val fileSuffix = if (System.getenv("PHENAX_FILE_SUFFIX").isNullOrEmpty()) { "" } else { ".${System.getenv("PHENAX_FILE_SUFFIX") ?: ""}" } if (recordingEnabled) { program.extend(ScreenRecorder()) { outputToVideo = true outputFile = "video/${program.name}${fileSuffix}.mp4" frameRate = 60 maximumDuration = recordDuration() quitAfterMaximum = true multisample = BufferMultisample.SampleCount(16) } } else if (screenshotEnabled) { program.extend(SingleScreenshot()) { outputFile = "screenshot/${program.name}${fileSuffix}.png" async = false quitAfterScreenshot = true } } } }