|
1 |
| -! Graphics test |
| 1 | +! Graphics demo |
2 | 2 |
|
3 |
| - script GTest |
| 3 | + script Graphics-Demo |
4 | 4 |
|
5 |
| - ! debug step |
6 | 5 | rectangle BlueRect
|
7 |
| - rectangle RedRect |
| 6 | + ellipse RedEllipse |
| 7 | + ellipse GreenCircle |
8 | 8 | variable Spec
|
9 | 9 | variable Widget
|
| 10 | + variable Widget2 |
10 | 11 | variable N
|
11 | 12 | variable M
|
12 | 13 |
|
| 14 | +! debug step |
| 15 | + |
13 | 16 | create screen at 300 300 size 640 480 fill color yellow
|
14 | 17 | put json `{}` into Spec
|
15 |
| - set property `#` of Spec to json `["BlueRect","RedRect"]` |
| 18 | + set property `#` of Spec to json `["BlueRect","RedEllipse"]` |
16 | 19 |
|
17 | 20 | ! Blue rectangle
|
18 | 21 | put json `{}` into Widget
|
|
23 | 26 | set property `height` of Widget to 100
|
24 | 27 | set property `fill` of Widget to `blue`
|
25 | 28 | set property `id` of Widget to `bluerect`
|
| 29 | + |
| 30 | + ! Green circle |
| 31 | + put json `{}` into Widget2 |
| 32 | + set property `type` of Widget2 to `ellipse` |
| 33 | + set property `left` of Widget2 to 20 |
| 34 | + set property `top` of Widget2 to 20 |
| 35 | + set property `width` of Widget2 to 60 |
| 36 | + set property `height` of Widget2 to 60 |
| 37 | + set property `fill` of Widget2 to `green` |
| 38 | + set property `id` of Widget2 to `greencircle` |
| 39 | + set property `#` of Widget to json `["GreenCircle"]` |
| 40 | + set property `GreenCircle` of Widget to Widget2 |
26 | 41 | set property `BlueRect` of Spec to Widget
|
27 | 42 |
|
28 |
| - ! Red rectangle |
| 43 | + ! Red ellipse |
29 | 44 | put json `{}` into Widget
|
30 |
| - set property `type` of Widget to `rect` |
| 45 | + set property `type` of Widget to `ellipse` |
31 | 46 | set property `left` of Widget to 400
|
32 | 47 | set property `top` of Widget to 200
|
33 |
| - set property `width` of Widget to 100 |
| 48 | + set property `width` of Widget to 200 |
34 | 49 | set property `height` of Widget to 100
|
35 | 50 | set property `fill` of Widget to `red`
|
36 |
| - set property `id` of Widget to `redrect` |
37 |
| - set property `RedRect` of Spec to Widget |
| 51 | + set property `id` of Widget to `redellipse` |
| 52 | + set property `RedEllipse` of Spec to Widget |
38 | 53 |
|
39 | 54 | ! print stringify Spec
|
40 | 55 | render stringify Spec
|
41 | 56 |
|
42 | 57 | attach BlueRect to `bluerect`
|
43 | 58 | on click BlueRect print `Click Blue`
|
44 |
| - attach RedRect to `redrect` |
45 |
| - on click RedRect print `Click Red` |
| 59 | + attach RedEllipse to `redellipse` |
| 60 | + on click RedEllipse print `Click Red` |
| 61 | + attach GreenCircle to `greencircle` |
| 62 | + on click GreenCircle print `Click Green` |
| 63 | + |
| 64 | + debug stop |
46 | 65 |
|
47 | 66 | put 0 into N
|
48 | 67 | on tick
|
|
0 commit comments