|
|
@ -274,6 +274,43 @@ |
|
|
|
(var hovered-shape-id-buffer (array 1024 char) (array 0)) |
|
|
|
(var hovered-write-head (addr char) hovered-shape-id-buffer) |
|
|
|
(each-shape-in-svg-image puppet-image shape |
|
|
|
(when (= 0 (strncmp (path shape > id) "Bone_" 5)) |
|
|
|
(each-path-in-svg-shape shape current-path |
|
|
|
(var state int 0) |
|
|
|
(each-in-range (* 2 (path current-path > npts)) point-index |
|
|
|
(var point-width (const int) 15) |
|
|
|
(var point-rect SDL_Rect |
|
|
|
(array (- (type-cast (at point-index (path current-path > pts)) int) |
|
|
|
(/ point-width 2)) |
|
|
|
(- (type-cast (at (+ 1 point-index) (path current-path > pts)) int) |
|
|
|
(/ point-width 2)) |
|
|
|
point-width point-width)) |
|
|
|
|
|
|
|
(var is-control-point bool (!= 0 (mod point-index 6))) |
|
|
|
(if is-control-point |
|
|
|
(SDL_SetRenderDrawColor renderer 10 100 10 255) |
|
|
|
(SDL_SetRenderDrawColor renderer 230 10 10 255)) |
|
|
|
|
|
|
|
;; Selection coloring |
|
|
|
(when (and (>= mouse-x (field point-rect x)) |
|
|
|
(>= mouse-y (field point-rect y)) |
|
|
|
(< mouse-x (+ (field point-rect x) |
|
|
|
(field point-rect w))) |
|
|
|
(< mouse-y (+ (field point-rect y) |
|
|
|
(field point-rect h)))) |
|
|
|
(set hovered-write-head |
|
|
|
(+ hovered-write-head |
|
|
|
(snprintf hovered-write-head |
|
|
|
(- (array-size hovered-shape-id-buffer) |
|
|
|
(- hovered-write-head hovered-shape-id-buffer)) |
|
|
|
(? (!= hovered-shape-id-buffer hovered-write-head) |
|
|
|
", %s[%d]" "%s[%d]") |
|
|
|
(path shape > id) (/ point-index 2)))) |
|
|
|
(SDL_SetRenderDrawColor renderer 10 230 10 255)) |
|
|
|
(SDL_RenderDrawRect renderer (addr point-rect)) |
|
|
|
(incr point-index))) |
|
|
|
(continue)) |
|
|
|
|
|
|
|
(var sized-bounds (array 4 int) (array 0)) |
|
|
|
(nanosvg-get-shape-bounds-with-stroke-int shape sized-bounds) |
|
|
|
(var shape-bounds SDL_Rect |
|
|
|