blob: cf42d88d50d85d6f25afbb52d4fd9decd3fcc8ae (
plain)
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
|
package require sdl
# Basic test of all sdl commands
set xres 640
set yres 384
set s [sdl.screen $xres $yres]
set cyan {0 255 255 200}
set yellow {255 255 0 200}
set red {255 0 0 200}
set green {0 255 0 200}
set grey {50 50 50 200}
set white {255 255 255}
set blue {0 0 255 200}
$s clear {*}$grey
$s fcircle 320 280 40 {*}$cyan
$s circle 320 280 60 {*}$yellow
$s aacircle 320 280 80 {*}$green
$s rectangle 200 100 300 180 {*}$cyan
$s box 210 110 290 170 {*}$yellow
set x 20
set y 20
set dy 10
set dx 10
foreach i [range 50] {
set nx $($x + $dx)
set ny $($y + $dy)
$s line $x $y $nx $ny {*}$green
$s aaline $x $($y+30) $nx $($ny+30) {*}$red
set x $nx
set y $ny
set dy $(-$dy)
}
$s rectangle 50 200 150 300 {*}$yellow
foreach i [range 500] {
$s pixel $([rand 100] + 50) $([rand 100] + 200) {*}$white
}
$s poll { sleep 0.25 }
$s free
|