Hi,
I can’t understand why SDL_SetColorKey doesn’t work. I was coding
like…
SurfaceData = SDL_LoadBMP (filename);
.......
ColorKey = SDL_MapRGB (screen->format, 255, 0, 255);
if (SDL_SetColorKey (SurfaceData,
SDL_SRCCOLORKEY, ColorKey) < 0)
fprintf (stderr, "LoadSprite: Unable to set color key (0x%
X)\n", ColorKey);
…
It doesn’t show any error but the result is not the desired one.
What function should I use to blit it onto a surface with colorkey as
transparent color? I am using SDL_BlitSurface right now without any
desired results.
Also please tell me - ** Does it affect bitmaps (to be used as
sprite) when I initialize video in 16bpp and the bitmap is 8bpp?
Because the screen returned by SDL_SetVideoMode has different format
and bitmap has a different one. **
Please somebody help me as the documentation supplied with SDL is not
enough and very few exapmles are there.
NOTE: I am using WINDOWS & have SDL 1.2.5.
Thanks,
Nayan
Hi,
I can’t understand why SDL_SetColorKey doesn’t work. I was coding
like…
SurfaceData = SDL_LoadBMP (filename);
…
ColorKey = SDL_MapRGB (screen->format, 255, 0, 255);
if (SDL_SetColorKey (SurfaceData,
SDL_SRCCOLORKEY, ColorKey) < 0)
fprintf (stderr, “LoadSprite: Unable to set color key (0x%
X)\n”, ColorKey);
…
Also please tell me - ** Does it affect bitmaps (to be used as
sprite) when I initialize video in 16bpp and the bitmap is 8bpp?
Because the screen returned by SDL_SetVideoMode has different format
and bitmap has a different one. **
Yes, that’s your problem. Your must convert SurfaceData(using
SDL_ConvertSurface function) to Screen format, after loading bitmap.On Tue, 19 Aug 2003, Nayan Choudhary wrote:
–
Dmitry A. Lohansky
You should use SurfaceData->format instead of screen->format in the
SDL_MapRGB() call. You need to construct a color for the surface where
you will be using it.
Lic. Gabriel Gambetta
ARTech - GeneXus Development Team
ggambett at artech.com.uy> ----- Original Message -----
From: Nayan Choudhary [mailto:nayanchoudhary@yahoo.com]
Sent: Martes, 19 de Agosto de 2003 08:18 p.m.
To: sdl at libsdl.org
Subject: [SDL] Why SDL_SetColorKey doesn’t work?
Hi,
I can’t understand why SDL_SetColorKey doesn’t work. I was coding
like…
SurfaceData = SDL_LoadBMP (filename);
…
ColorKey = SDL_MapRGB (screen->format, 255, 0, 255);
if (SDL_SetColorKey (SurfaceData,
SDL_SRCCOLORKEY, ColorKey) < 0)
fprintf (stderr, “LoadSprite: Unable to set color key (0x%
X)\n”, ColorKey);
…
It doesn’t show any error but the result is not the desired one.
What function should I use to blit it onto a surface with colorkey as
transparent color? I am using SDL_BlitSurface right now without any
desired results.
Also please tell me - ** Does it affect bitmaps (to be used as
sprite) when I initialize video in 16bpp and the bitmap is 8bpp?
Because the screen returned by SDL_SetVideoMode has different format
and bitmap has a different one. **
Please somebody help me as the documentation supplied with SDL is not
enough and very few exapmles are there.
NOTE: I am using WINDOWS & have SDL 1.2.5.
Thanks,
Nayan
SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl
Mapping worked!
Thanks a lot Gabriel.
Nayan
— In libsdl at yahoogroups.com, “Gabriel Gambetta”
wrote:
You should use SurfaceData->format instead of screen->format in the
SDL_MapRGB() call. You need to construct a color for the surface
where> you will be using it.
Lic. Gabriel Gambetta
ARTech - GeneXus Development Team
ggambett at a…
-----Original Message-----
From: Nayan Choudhary [mailto:nayanchoudhary at y…]
Sent: Martes, 19 de Agosto de 2003 08:18 p.m.
To: sdl at l…
Subject: [SDL] Why SDL_SetColorKey doesn’t work?
Hi,
I can’t understand why SDL_SetColorKey doesn’t work. I was coding
like…
SurfaceData = SDL_LoadBMP (filename);
…
ColorKey = SDL_MapRGB (screen->format, 255, 0, 255);
if (SDL_SetColorKey (SurfaceData,
SDL_SRCCOLORKEY, ColorKey) < 0)
fprintf (stderr, “LoadSprite: Unable to set color key
(0x%
X)\n”, ColorKey);
…
It doesn’t show any error but the result is not the desired one.
What function should I use to blit it onto a surface with colorkey
as
transparent color? I am using SDL_BlitSurface right now without
any
desired results.
Also please tell me - ** Does it affect bitmaps (to be used as
sprite) when I initialize video in 16bpp and the bitmap is 8bpp?
Because the screen returned by SDL_SetVideoMode has different
format
and bitmap has a different one. **
Please somebody help me as the documentation supplied with SDL is
not
enough and very few exapmles are there.
NOTE: I am using WINDOWS & have SDL 1.2.5.
Thanks,
Nayan
SDL mailing list
SDL at l…
http://www.libsdl.org/mailman/listinfo/sdl
SDL mailing list
SDL at l…
http://www.libsdl.org/mailman/listinfo/sdl