Update demos to use MouseTracker (#303)

This commit is contained in:
Abe Pazos
2023-04-19 09:55:24 +02:00
committed by GitHub
parent 4d6b78b73c
commit a8c2f7217c
5 changed files with 17 additions and 6 deletions

View File

@@ -1,3 +1,4 @@
import org.openrndr.MouseTracker
import org.openrndr.application
import org.openrndr.color.ColorRGBa
import org.openrndr.draw.*
@@ -37,6 +38,7 @@ fun main() = application {
//x_fill.rgb = vec3(1.0 / (x_fill.r + x_fill.g));
"""
}
val mouseTracker = MouseTracker(mouse)
extend {
// Draw moving white shapes on a black background
@@ -68,7 +70,7 @@ fun main() = application {
directionalField.apply(rt.colorBuffer(0), result)
drawer.isolated {
if (mouse.pressedButtons.isEmpty()) {
if (mouseTracker.pressedButtons.isEmpty()) {
shadeStyle = shader
image(result)
} else {

View File

@@ -1,3 +1,4 @@
import org.openrndr.MouseTracker
import org.openrndr.application
import org.openrndr.color.ColorRGBa
import org.openrndr.draw.*
@@ -42,6 +43,7 @@ fun main() = application {
vec3(1.0, 0.0, 0.0) : vec3(0.0, 1.0, 1.0));
"""
}
val mouseTracker = MouseTracker(mouse)
extend {
// Draw moving white shapes on a black background
@@ -73,7 +75,7 @@ fun main() = application {
distanceField.apply(rt.colorBuffer(0), result)
drawer.isolated {
if (mouse.pressedButtons.isEmpty()) {
if (mouseTracker.pressedButtons.isEmpty()) {
shadeStyle = shader
image(result)
} else {

View File

@@ -1,3 +1,4 @@
import org.openrndr.MouseTracker
import org.openrndr.application
import org.openrndr.draw.ColorFormat
import org.openrndr.draw.ColorType
@@ -19,8 +20,10 @@ fun main() {
sdf.setShapes(shapes)
sdf.apply(emptyArray(), df)
val mouseTracker = MouseTracker(mouse)
extend {
if(mouse.pressedButtons.isEmpty())
if(mouseTracker.pressedButtons.isEmpty())
drawer.image(df)
else
drawer.shapes(shapes)