Hello everyone!
…
Here are all of the code I use this image on: (all lines on different
functions)
spritesImg = SDL_LoadBMP(“sprites.bmp”);
if (spritesImg == NULL) return -1;
SDL_DisplayFormat(spritesImg);
/* Replace all cyan(bg1) and light yellow (bg2) colors with magenta (bgd)
*/
for (x = 0; x < surf->w; x++)
{
for (y = 0; y < surf->h; y++)
{
px = sge_GetPixel(surf, x, y);
if (px == bg1 || px == bg2)
sge_PutPixel(surf, x, y, bgd);
}
}
SDL_SetColorKey(s, SDL_SRCCOLORKEY, bgd))
…
I’ll try to answer as best as I can. Haven’t tried manipulating the pixels
directly.
What is the “surf” variable?
What are the definition of sge_GetPixel & sge_PutPixel? I reckon it is
similar with the getpixel() and putpixel() method from the documentation,
right?
AFAIK, to manipulate a surface, you must lock the surface first.
Fare thee well,
Bawenang R. P. P.----------------
ERROR: Brain not found. Please insert a new brain!
?Do nothing which is of no use.? - Miyamoto Musashi.
“I live for my dream. And my dream is to live my life to the fullest.”
Hello everyone!
…
Here are all of the code I use this image on: (all lines on different
functions)
spritesImg = SDL_LoadBMP(“sprites.bmp”);
if (spritesImg == NULL) return -1;
SDL_DisplayFormat(spritesImg);
/* Replace all cyan(bg1) and light yellow (bg2) colors with magenta (bgd)
*/
for (x = 0; x < surf->w; x++)
{
for (y = 0; y < surf->h; y++)
{
px = sge_GetPixel(surf, x, y);
if (px == bg1 || px == bg2)
sge_PutPixel(surf, x, y, bgd);
}
}
SDL_SetColorKey(s, SDL_SRCCOLORKEY, bgd))
…
I’ll try to answer as best as I can. Haven’t tried manipulating the pixels
directly.
What is the “surf” variable?
What are the definition of sge_GetPixel & sge_PutPixel? I reckon it is
similar with the getpixel() and putpixel() method from the documentation,
right?
AFAIK, to manipulate a surface, you must lock the surface first.
Fare thee well,
Bawenang R. P. P.
ERROR: Brain not found. Please insert a new brain!
?Do nothing which is of no use.? - Miyamoto Musashi.
“I live for my dream. And my dream is to live my life to the fullest.”
Watch out for SGE… After looking through the source code, I’ve noticed it doesn’t always handle endianness correctly (it doesn’t define PI correctly either, among other things). It is a really old library now, so I’m working on a new version here: http://pubpages.unh.edu/~jmb97
Jonny D> To: sdl at libsdl.org> From: kixdemp at gmail.com> Date: Thu, 27 Sep 2007 02:30:32 -0400> Subject: Re: [SDL] VERY strange error…> > Uh, nevermind that - turned out I was overflowing an array… Sorry for > wasting your time! :$> > benang at cs.its.ac.id wrote:> > Leo28C wrote:> >> Hello everyone!> >> …> >> Here are all of the code I use this image on: (all lines on different> >> functions)> >>> >> spritesImg = SDL_LoadBMP(“sprites.bmp”);> >> if (spritesImg == NULL) return -1;> >> SDL_DisplayFormat(spritesImg);> >>> >> /* Replace all cyan(bg1) and light yellow (bg2) colors with magenta (bgd)> >> */> >>> >> for (x = 0; x < surf->w; x++)> >> {> >> for (y = 0; y < surf->h; y++)> >> {> >> px = sge_GetPixel(surf, x, y);> >> if (px == bg1 || px == bg2)> >> sge_PutPixel(surf, x, y, bgd);> >> }> >> }> >> SDL_SetColorKey(s, SDL_SRCCOLORKEY, bgd))> >>> >> …> > > > I’ll try to answer as best as I can. Haven’t tried manipulating the pixels> > directly.> > > > 1. What is the “surf” variable?> > > > 2. What are the definition of sge_GetPixel & sge_PutPixel? I reckon it is> > similar with the getpixel() and putpixel() method from the documentation,> > right?> > > > 3. AFAIK, to manipulate a surface, you must lock the surface first.> > > > Fare thee well,> > Bawenang R. P. P.> > > > ----------------> > ERROR: Brain not found. Please insert a new brain!> > > > ?Do nothing which is of no use.? - Miyamoto Musashi.> > > > “I live for my dream. And my dream is to live my life to the fullest.”> > _______________________________________________> SDL mailing list> SDL at lists.libsdl.org> http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org