Posted to tcl by ro at Sun Jan 06 23:25:07 GMT 2008view raw
- tcl3d> SDL_VideoInfo x
- _38678502_p_SDL_VideoInfo
- tcl3d> x cget -video_mem
- 0
- tcl3d> SDL_Init $SDL_INIT_VIDEO
- 0
- tcl3d> SDL_SetVideoMode 256 256 32 0
- _801d8102_p_SDL_Surface
- tcl3d> set screen _801d8102_p_SDL_Surface
- _801d8102_p_SDL_Surface
- # this is like: screen->pixels
- tcl3d> set pixels [$screen cget -pixels]
- _78f58502_p_void
- tcl3d> $screen cget -format
- _f8048002_p_SDL_PixelFormat
- tcl3d> set pixel_format [$screen cget -format]
- _f8048002_p_SDL_PixelFormat
- tcl3d> SDL_MapRGB $pixel_format 1 0 33
- 65569
- tcl3d> set pitch [$screen cget -pitch]
- 1024
- proc offset {x y} {global pitch; expr {(($pitch / 4) * $y) + $x}}
- tcl3d> offset 255 255
- 65535
- tcl3d> SDL_LockSurface $screen
- 0
- tcl3d> SDL_UnlockSurface $screen
- tcl3d> SDL_Flip $screen
- 0
- tcl3d> set rect [SDL_Rect]
- _40578102_p_SDL_Rect
- tcl3d> $rect configure -x 0 -y 0 -w 200 -h 200
- tcl3d> $rect cget -x
- 0
- tcl3d> $rect cget -y
- 0
- tcl3d> $rect cget -w
- 200
- tcl3d> $rect cget -h
- 200
- tcl3d> SDL_LockSurface $screen
- 0
- tcl3d> SDL_FillRect $screen $rect 32
- 0
- tcl3d> SDL_UnlockSurface $screen
- tcl3d> SDL_Flip $screen
- 0
- tcl3d> proc color {r g b} {global pixel_format ; SDL_MapRGB $pixel_format $r $g $b}
- proc paint {r g b} {
- global screen rect
- SDL_LockSurface $screen
- SDL_FillRect $screen $rect [color $r $g $b]
- SDL_UnlockSurface $screen
- SDL_Flip $screen
- }
- proc fun {} {
- for {set i 0} {$i < 256} {incr i} {paint 0 0 $i}
- for {set i 0} {$i < 256} {incr i} {paint 0 $i 0}
- for {set i 0} {$i < 256} {incr i} {paint $i 0 0}
- }