SDL_FillRect(ThisSurface.pSurface,
NULL,
SDL_MapRGB(ThisSurface.pSurface->format,
0,//Random(256, -1),
255,//Random(256, -1),
255));//Random(256, -1)));
Surface Creation and wrong filling in?
I'm working on a particle system, and I have everything up and running. Only thing left is to make different particles different colors. However - it won't work:
Normally, it should be 'Random', but even TRYING to make it another color doesn't work, like in the above code snippet. IT IS ALWAYS WHITE.
I'm creating the surface with SDL_CreateRGBSurface and using all of my screen's flags and the screen's bpp. The width and height are either 1, 2, or 3... and the RMASK and so only are #defined according to the ... what do you call it? You know, the SDL_BIG_ENDIAN and SDL_LIL_ENDIAN (wow I seem stupid).
Also, I'm putting in 25 more particles every frame, the speed is huge.
Thanks to all.
Anyone? Please?
I really wan't to make my particles another color but it won't work... And I don't know why!
The CSurface (the ThisSurface variable) looks like this:
Any help is GREATLY appreciated!
I really wan't to make my particles another color but it won't work... And I don't know why!
The CSurface (the ThisSurface variable) looks like this:
class Sprite::CSurface { SDL_Surface *pSurface; bool Load(const std::string &File);};
Any help is GREATLY appreciated!
Quote:Maps the RGB color value to the specified pixel format and returns the pixel value as a 32-bit int.
If the format has a palette (8-bit) the index of the closest matching color in the palette will be returned.
are you sure ThisSurface.pSurface->format != palette?
Quote:Original post by noofQuote:Maps the RGB color value to the specified pixel format and returns the pixel value as a 32-bit int.
If the format has a palette (8-bit) the index of the closest matching color in the palette will be returned.
are you sure ThisSurface.pSurface->format != palette?
Well, it's 32-bit. Even if it does have a palette, it's:
Quote:
If the format has a palette (8-bit) the index of the closest matching color in the palette will be returned.
FYI, I'm making the surfaces using SDL_CreateRGBSurface. Any other ideas?
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement