ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I have 2 sprites in an sdl program. Sprite A has a large transparent center, sprite B is solid.
The transparency works fine for A as long as it is moving...however, if A stops on top of B (B is now visible through the transparency in A) - and B moves away, the image of B is still displayed as A's transparency, even though it is gone.
Sprite A has to be moved a distance for the correct transparency to be restored. Is this a common problem?
I can post code, but it's 300 lines long and I dont really know which sections are relevant.
I changed my sprite for a single image with a transparency, and there was no problem. I did also did not need to use updateRectangle(...).
But when I use a sprite, the problem does occur, and updateRectangle doesnt seem to help, the transparency doesnt get refresed unless the sprite is moved.
In the void CSprite::updateBG() function, I would try to add :
...
SDL_BlitSurface(mScreen, &srcrect, mBackreplacement, NULL);
SDL_UpdateRects(mScreen, 1, &srcrect);
and in the void DrawIMG(SDL_Surface *img, int x, int y) function :
...
SDL_BlitSurface(img, NULL, screen, &dest);
SDL_UpdateRects(screen, 1, &dest);
Are there any other good resources for learning SDL? I have the documentation project stuff, and the tutorials from the website. I dont mind buying a book, but I'd prefer something on soft copy.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.