diff options
author | Steve Bennett <steveb@workware.net.au> | 2020-12-30 13:54:59 +1000 |
---|---|---|
committer | Steve Bennett <steveb@workware.net.au> | 2021-01-01 16:54:26 +1000 |
commit | 8e818b3a5ee8647b746bf7ce7d601ca42b6a0ec4 (patch) | |
tree | 22c44e4d9e1f7fcb5f92c45ddb5924d3372ea4f5 /examples/sdlcircles.tcl | |
parent | 3b834e42ee5887f85d10d7e50814b29d1b81a09f (diff) | |
download | jimtcl-8e818b3a5ee8647b746bf7ce7d601ca42b6a0ec4.zip jimtcl-8e818b3a5ee8647b746bf7ce7d601ca42b6a0ec4.tar.gz jimtcl-8e818b3a5ee8647b746bf7ce7d601ca42b6a0ec4.tar.bz2 |
sdl: convert to using jim-subcmd
And add:
- poll ?script?
- optional window title
Signed-off-by: Steve Bennett <steveb@workware.net.au>
Diffstat (limited to 'examples/sdlcircles.tcl')
-rw-r--r-- | examples/sdlcircles.tcl | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/examples/sdlcircles.tcl b/examples/sdlcircles.tcl new file mode 100644 index 0000000..8d1274d --- /dev/null +++ b/examples/sdlcircles.tcl @@ -0,0 +1,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 + } + } +} |