|
|
@ -267,31 +267,44 @@ |
|
|
|
(SDL_RenderCopy renderer svg-image-texture |
|
|
|
(addr source-rectangle) (addr destination-rectangle))) |
|
|
|
|
|
|
|
(var mouse-x int 0) |
|
|
|
(var mouse-y int 0) |
|
|
|
(SDL_GetMouseState (addr mouse-x) (addr mouse-y)) |
|
|
|
(each-shape-in-svg-image puppet-image shape |
|
|
|
(var shape-bounds SDL_Rect |
|
|
|
(array (type-cast (at 0 (path shape > bounds)) int) |
|
|
|
(type-cast (at 1 (path shape > bounds)) int) |
|
|
|
(type-cast (- (at 2 (path shape > bounds)) |
|
|
|
(at 0 (path shape > bounds))) |
|
|
|
int) |
|
|
|
(type-cast (- (at 3 (path shape > bounds)) |
|
|
|
(at 1 (path shape > bounds))) |
|
|
|
int))) |
|
|
|
(SDL_SetRenderDrawColor renderer 230 10 10 255) |
|
|
|
(when (and (>= mouse-x (type-cast (at 0 (path shape > bounds)) float)) |
|
|
|
(>= mouse-y (type-cast (at 1 (path shape > bounds)) float)) |
|
|
|
(< mouse-x (type-cast (at 2 (path shape > bounds)) float)) |
|
|
|
(< mouse-y (type-cast (at 3 (path shape > bounds)) float))) |
|
|
|
(SDL_SetRenderDrawColor renderer 10 230 10 255) |
|
|
|
(render-string |
|
|
|
renderer (addr (field (at body-font-index font-atlases) atlas)) |
|
|
|
(field (at body-font-index font-atlases) texture) |
|
|
|
(/ true-window-width 9) (- true-window-height 10) |
|
|
|
(path shape > id))) |
|
|
|
(SDL_RenderDrawRect renderer (addr shape-bounds))) |
|
|
|
(scope ;; Shape selection and debug viewing |
|
|
|
(var mouse-x int 0) |
|
|
|
(var mouse-y int 0) |
|
|
|
(SDL_GetMouseState (addr mouse-x) (addr mouse-y)) |
|
|
|
(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 |
|
|
|
(var sized-bounds (array 4 int) (array 0)) |
|
|
|
(nanosvg-get-shape-bounds-with-stroke-int shape sized-bounds) |
|
|
|
(var shape-bounds SDL_Rect |
|
|
|
(array (at 0 sized-bounds) |
|
|
|
(at 1 sized-bounds) |
|
|
|
(type-cast (- (at 2 sized-bounds) |
|
|
|
(at 0 sized-bounds)) |
|
|
|
int) |
|
|
|
(type-cast (- (at 3 sized-bounds) |
|
|
|
(at 1 sized-bounds)) |
|
|
|
int))) |
|
|
|
(SDL_SetRenderDrawColor renderer 230 10 10 255) |
|
|
|
(when (and (>= mouse-x (type-cast (at 0 sized-bounds) float)) |
|
|
|
(>= mouse-y (type-cast (at 1 sized-bounds) float)) |
|
|
|
(< mouse-x (type-cast (at 2 sized-bounds) float)) |
|
|
|
(< mouse-y (type-cast (at 3 sized-bounds) float))) |
|
|
|
(SDL_SetRenderDrawColor renderer 10 230 10 255) |
|
|
|
(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" "%s") |
|
|
|
(path shape > id))))) |
|
|
|
(SDL_RenderDrawRect renderer (addr shape-bounds))) |
|
|
|
(render-string |
|
|
|
renderer (addr (field (at body-font-index font-atlases) atlas)) |
|
|
|
(field (at body-font-index font-atlases) texture) |
|
|
|
(/ true-window-width 9) (- true-window-height 10) |
|
|
|
hovered-shape-id-buffer)) |
|
|
|
|
|
|
|
(when true |
|
|
|
(var buffer (array 256 char) (array 0)) |
|
|
|