I just finished a Tic-Tac-Toe (noughts and crosses), The only problem I have now is that whenever I put the X's and O's onto the screen I have a pink glow left around then from after I set the colour key to them. Is it a coding problem or would this be a problem with the picture I drew?
Well just looking at it I can see that the X and O are antialiased, which means that the pink directly around it is NOT the colorkey color. That would be your problem.
Quit procrastinating and make something awesome.
Ducky wrote:Give a man some wood, he'll be warm for the night. Put him on fire and he'll be warm for the rest of his life.
Ginto8 wrote:Well just looking at it I can see that the X and O are antialiased, which means that the pink directly around it is NOT the colorkey color. That would be your problem.
Yep, I posted right before the picture was uploaded.
You should use a picture format with alpha channel.
K-Bal wrote:You should use a picture format with alpha channel.
Unfortunately that doesn't quite work with SDL. If it were OpenGL (or even SFML IIRC), it'd be fine. But SDL's alpha is crazy slow so colorkeying is his best bet.
Quit procrastinating and make something awesome.
Ducky wrote:Give a man some wood, he'll be warm for the night. Put him on fire and he'll be warm for the rest of his life.
The left one is what it is like now. A colorkey works by removing one specific color while keeping the rest there. The right one is the pink removed as a colorkey would. Notice how there are different shades between pink and black? That's the effect of Anti-Aliasing. Wen you make your X+O, either do it without enabling antialising, or use PNG which has alpha-transparency. How you do this depends on your software naturally.
I have been fiddling with gimp to get rid of the Anti-Aliasing, could not figure it out, so I remade the picture, I kept it as a .png but I used the text tool. The text tool has a button that lets you turn off the Anti-Aliasing, so it worked like a charm. Thanks everyone for the help!
K-Bal wrote:You should use a picture format with alpha channel.
Unfortunately that doesn't quite work with SDL. If it were OpenGL (or even SFML IIRC), it'd be fine. But SDL's alpha is crazy slow so colorkeying is his best bet.
SDL_image would be plenty fine for a game of Tic-Tac-Toe.
K-Bal wrote:You should use a picture format with alpha channel.
Unfortunately that doesn't quite work with SDL. If it were OpenGL (or even SFML IIRC), it'd be fine. But SDL's alpha is crazy slow so colorkeying is his best bet.
SDL_image would be plenty fine for a game of Tic-Tac-Toe.
Yes, but using alpha colors will be slow as hell compared to colorkeying.
Quit procrastinating and make something awesome.
Ducky wrote:Give a man some wood, he'll be warm for the night. Put him on fire and he'll be warm for the rest of his life.
Ginto8 wrote:Yes, but using alpha colors will be slow as hell compared to colorkeying.
I've used alpha images in a shmup with hundreds of objects on screen and it still runs well over 200 FPS. Its kind of a non-issue unless you're porting SDL to the DS or something.
Ginto8 wrote:Yes, but using alpha colors will be slow as hell compared to colorkeying.
I've used alpha images in a shmup with hundreds of objects on screen and it still runs well over 200 FPS. Its kind of a non-issue unless you're porting SDL to the DS or something.
Oh you musta been using SDL_HWSURFACE and other hw accelerated stuff... I forgot SDL had that
Quit procrastinating and make something awesome.
Ducky wrote:Give a man some wood, he'll be warm for the night. Put him on fire and he'll be warm for the rest of his life.
Ginto8 wrote:Yes, but using alpha colors will be slow as hell compared to colorkeying.
Oh you musta been using SDL_HWSURFACE and other hw accelerated stuff... I forgot SDL had that
I think you two are talking about 2 different things. What K-Bal is doing is using PNG's that already have part of the image transparent, so all SDL need to do is draw the non-transparent pixels. What you're talking about is having SDL calculate the alpha at run-time.