[SDL] VERY strange error...
L-28C
kixdemp at gmail.com
Wed Sep 26 23:30:32 PDT 2007
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."
More information about the SDL
mailing list