summaryrefslogtreecommitdiffstats
path: root/virtual-programs/display
diff options
context:
space:
mode:
authorOmar Rizwan <omar@omar.website>2023-10-13 23:37:14 +0000
committerOmar Rizwan <omar@omar.website>2023-10-13 23:37:14 +0000
commita798dca8ca19c2601413e85a316f73dd857a2c14 (patch)
tree3fd5aedfa2044f0a7d120f21e5a38c353106dd9a /virtual-programs/display
parentarc: Re-add arc support (diff)
downloadfolk-a798dca8ca19c2601413e85a316f73dd857a2c14.tar.gz
folk-a798dca8ca19c2601413e85a316f73dd857a2c14.zip
fill,shapes,circle,connections: Breaking: Fix shapes
Shapes all now work by wishes; connections has been ported to use these wishes.
Diffstat (limited to 'virtual-programs/display')
-rw-r--r--virtual-programs/display/circle.folk4
-rw-r--r--virtual-programs/display/fill.folk11
2 files changed, 10 insertions, 5 deletions
diff --git a/virtual-programs/display/circle.folk b/virtual-programs/display/circle.folk
index 2951f3a9..03e4def7 100644
--- a/virtual-programs/display/circle.folk
+++ b/virtual-programs/display/circle.folk
@@ -20,12 +20,12 @@ Wish the GPU compiles pipeline "circle" {
When /someone/ wishes to draw a circle with /...options/ {
set center [dict_getdef $options center ""]
- if {center eq ""} { set center [list [dict get $options x] [dict get $options y]] }
+ if {$center eq ""} { set center [list [dict get $options x] [dict get $options y]] }
set radius [dict get $options radius]
set thickness [dict get $options thickness]
set color [getColor [dict get $options color]]
set filled [dict_getdef $options filled false]
Wish the GPU draws pipeline "circle" with arguments \
- [list $center $radius $thickness $color $filled]
+ [list $center $radius $thickness $color [expr {$filled eq false ? 0 : 1}]]
}
diff --git a/virtual-programs/display/fill.folk b/virtual-programs/display/fill.folk
index ae3626f4..f3057068 100644
--- a/virtual-programs/display/fill.folk
+++ b/virtual-programs/display/fill.folk
@@ -15,6 +15,7 @@ When /someone/ wishes to draw a triangle with /...options/ {
}
When /someone/ wishes to draw a quad with /...options/ {
dict with options {
+ if {![info exists layer]} { set layer 0 }
Wish the GPU draws pipeline "fillTriangle" with arguments \
[list $p1 $p2 $p3 [getColor $color]] layer $layer
Wish the GPU draws pipeline "fillTriangle" with arguments \
@@ -29,9 +30,13 @@ When /someone/ wishes to draw a polygon with /...options/ {
if {$num_points < 3} {
error "At least 3 points are required to form a polygon."
} elseif {$num_points == 3} {
- eval fillTriangle $points $color
+ Wish to draw a triangle with \
+ p0 [lindex $points 0] p1 [lindex $points 1] p2 [lindex $points 2] \
+ color $color
} elseif {$num_points == 4} {
- eval fillQuad $points $color
+ Wish to draw a quad with \
+ p0 [lindex $points 0] p1 [lindex $points 1] p2 [lindex $points 2] p3 [lindex $points 3] \
+ color $color
} else {
# Get the first point in the list as the "base" point of the triangles
set p0 [lindex $points 0]
@@ -40,7 +45,7 @@ When /someone/ wishes to draw a polygon with /...options/ {
set p1 [lindex $points $i]
set p2 [lindex $points [expr {$i+1}]]
Wish the GPU draws pipeline "fillTriangle" with arguments \
- [list $p0 $p1 $p2 $color]
+ [list $p0 $p1 $p2 [getColor $color]]
}
}
}