]> git.lizzy.rs Git - nothing.git/blob - devtools/rects2svg.rkt
Merge pull request #749 from tsoding/739
[nothing.git] / devtools / rects2svg.rkt
1 #!/usr/bin/env racket
2 #lang racket/base
3
4 (printf "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n")
5 (printf "<svg xmlns=\"http://www.w3.org/2000/svg\">\n")
6
7 ;;; Player Section
8 (let ((player-x (read))
9       (player-y (read)))
10   (printf "<rect id=\"player\" x=\"~a\" y=\"~a\" width=\"10\" height=\"10\" style=\"fill:#00ff00\" />\n"
11           player-x player-y))
12
13 ;;; Platforms Section
14 (let ((n (read)))
15   (for ([_ n])
16     (apply printf
17            "<rect x=\"~a\" y=\"~a\" width=\"~a\" height=\"~a\" style=\"fill:#0000ff\" />\n"
18            (for/list ([_ 4]) (read)))))
19
20 (printf "</svg>\n")