[SDL] "explosions" demo

Mark K. Kim markslist at cbreak.org
Wed Aug 1 18:05:00 PDT 2001


Hey Bill!

There's an example in the SDL documentation project on getting and putting
pixels in all supported modes:

  http://sdldoc.csn.ul.ie/guidevideo.php#AEN90
  http://sdldoc.csn.ul.ie/guidevideo.php#AEN93

BTW, how'd you make a public directory on sonic?

-Mark (also a sonic isp subscriber, thanks to bill)

On Wed, 1 Aug 2001, William Kendrick wrote:

> On Wed, Aug 01, 2001 at 11:53:32AM +0000, Samuel Hart wrote:
> > On Tuesday 31 July 2001 11:30pm, William Kendrick wrote:
> > > Best of all, I've totally commented the code (more so than usual :) )
> > > so some of you might find it useful, even! ;)
> > >
> > >
> > >   ftp://ftp.sonic.net/pub/users/nbs/unix/x/explosions/
> > 
> > This is actually very kewl. ;-)
> 
> Thanks!  I have a question about SDL, though...
> 
> Can someone give me a REAL simple, portable example piece of code to
> read pixels (into RGB) and write pixels (as RGB) to and from a surface?
> 
> Everything I've tried either seems to push out two pixels at a time
> (I'm using 16bit depth surface on a 16bbp X server) or segfault. ;)
> 
> 
> My current _lame_ way of doing it is reading pixels off the surface
> using SDL_BlitSurface() (with a 1x1 rectangle... once for each pixel.. UGH!)
> and then grabbing their RGB value by examining the "surface->pixels" RAM
> in the surface I just blitted into (ie, to get the (0,0) position pixel)
> 
> 
> To write into the surface (after altering the RGBs I just read), I use
> SDL_FillRect() (with a 1x1 rectangle... once for each pixel... DOUBLE-UGH!)
> 
> 
> Anyone got something simple you can show me?  Esp. with lots of comments
> (since I'm sure in involves pointer hell :( )
> 
> 
> Thanks!
> 
> -bill!
> (working on frame bluring :) )
> 
> _______________________________________________
> SDL mailing list
> SDL at libsdl.org
> http://www.libsdl.org/mailman/listinfo/sdl
> 

--
Mark K. Kim
http://www.cbreak.org/mark/
PGP key available upon request.





More information about the SDL mailing list