aboutsummaryrefslogtreecommitdiff
path: root/examples/sdlcircles.tcl
blob: 8d1274d9b7b42fc888c844ac7f164bd4d51ec61a (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
package require sdl

set xres 1024
set yres 768
set s [sdl.screen $xres $yres "Jim SDL Circles"]

proc drawlist {s list} {
    foreach item $list {
        $s {*}$item
    }
}

proc rand_circle {xres yres maxradius alpha} {
    list fcircle [rand $xres] [rand $yres] [rand $maxradius] [rand 256] [rand 256] [rand 256] $alpha
}

loop i 0 200 {
    set commands {}
    loop j 0 1000 {
        lappend commands [rand_circle $xres $yres 40 100]
        if {$j % 50 == 0} {
            #$s clear 200 200 200
            drawlist $s $commands
            $s flip
            sleep 0.1
        }
    }
}