-
Notifications
You must be signed in to change notification settings - Fork 0
/
run-prejure.clj
99 lines (95 loc) · 2.15 KB
/
run-prejure.clj
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
(require 'prejure)
(use 'prejure.piclang)
(use 'prejure.gui)
(use 'clojure.contrib.swing-utils)
(use 'clojure.contrib.command-line)
(import '(javax.swing JFrame))
(import '(java.awt Color))
(defn main [args]
(let [player
(prejure/make-player
{:width 800, :height 600}
(list
(within-rect
[1/4 1/4 1/2 1/2]
(with-background
Color/BLACK
nop-painter)))
(list
(do-painters
(with-background
Color/WHITE
(with-color
Color/BLACK
(corner-split wave 6)))
(within-rect
[1/4 1/4 1/2 1/2]
(with-background
Color/BLACK
nop-painter))
(within-rect
[1/4 1/4 1/2 1/2]
(with-color
Color/WHITE
(draw-wrapped-plain-text
(apply str
(interpose
". " (repeat 10 "The quick brown fox jumps over the lazy dog"))))))))
(list
(with-background
Color/WHITE
(with-color
Color/BLACK
(verticals [1/2 (draw-line 0 0 1 1)]
[1/4 (draw-line 0 0 1 1)]
[1/8 (draw-line 0 0 1 1)]
[1/16 (draw-line 0 0 1 1)]
[1/32 (draw-line 0 0 1 1)]
[1/64 (draw-line 0 0 1 1)]
[* (draw-line 0 0.5 1 0.5)]))))
(list
(with-background
Color/WHITE
(with-color
Color/BLACK
(let [line
(draw-line 0 0 1 1)]
(beside
(below
(draw-fitted-plain-text
"Hello world")
(draw-wrapped-plain-text
(apply str
(interpose
". " (repeat 10 "The quick brown fox jumps over the lazy dog")))))
(below
(corner-split wave 3)
(below
line (flip-vert line)))))))
(with-background
Color/WHITE
(with-color
Color/BLACK
(let [line
(draw-line 0 0 1 1)]
(beside
line (flip-vert line))))))
(list
(with-background
Color/WHITE
(with-color
Color/BLACK
(let [line
(draw-line 0 0 1 1)]
(beside
line (flip-vert line)))))))]
(do-swing-and-wait
(let [terminal (prejure/jframe-terminal player)]
(doto terminal
(.setDefaultCloseOperation JFrame/EXIT_ON_CLOSE)
(.setVisible true))))))
(defn main [args]
(do-swing-and-wait
(.setVisible prejure.gui/*main-window* true)
))
(main *command-line-args*)