Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

TheRealMAN11

SDL problem

This topic is 6099 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

When I try to blit a sprite off the left side of the screen SDL moves the sprite back onto the screen. When I try to blit off the right side, it works. Does anyone know what is wrong?
It is foolish for a wise man to be silent, but wise for a fool. Matthew WebMaster www.Matt-Land.com All your Xbox base are belong to Nintendo. All your GameDev.net base are belong to Myopic Rhino

Share this post


Link to post
Share on other sites
Advertisement
i''m no sdl expert, but i just got by by cliping the src and dst rect&pos.

but then i had already been doing that since ddraw would crash if you didn''t clip.

its been like that for a while

Share this post


Link to post
Share on other sites
First, test it on someone elses machine (even though I highly doubt it has anything to do with your machine).

Next, make sure you aren''t confusing src(source) and dest(destination) when you blit. That can be quite frustrating, it should always be like this:

  
SDL_BlitSurface(surface, &src, screen, &dest);


And finally, if it''s not your machine, and you don''t have them mixed up, post the code you are using to set the SDL_Rects you''re using for your surfaces.

------------------------------
Simple DirectMedia Layer:

Main Site - (www.libsdl.org)
Cone3D Tutorials- (cone3D.gamedev.net)
GameDev.net''s Tutorials - (Here)

OpenGL:

Main Site - (www.opengl.org)
NeHe Tutorials - (nehe.gamedev.net)
Online Books - (Red Book) (Blue Book)

Share this post


Link to post
Share on other sites
Ok the sprite is blitted to the screen over a back ground, I can move it left and right with the arrow keys. The sprite goes right off of the right side of the screen, but when I move it to the left, it just bumps up on the left side of the screen, and won't move any further.

When I press one of the arrow keys it eigher subtracts or adds to the x value of the rect strut.


It is foolish for a wise man to be silent, but wise for a fool.

Matthew
WebMaster
www.Matt-Land.com

All your Xbox base are belong to Nintendo.
All your GameDev.net base are belong to Myopic Rhino

Edited by - TheRealMAN11 on February 5, 2002 8:43:53 PM

Share this post


Link to post
Share on other sites
Hmm. If your code is small, post it here. If not, send it to me at savestheday0001@hotmail.com and I''ll check over it. I am working on a pong clone now, and I had something similar to this happen to me, but there really wasn''t a solution, the paddle just stopped when it reached (0,0), without me coding it to stop, and then I just coded it to stop/rebound from that position anyway, so, I don''t know if I''m still having that problem.

I''ll take a quick look at your code if you''d like.

------------------------------
Simple DirectMedia Layer:

Main Site - (www.libsdl.org)
Cone3D Tutorials- (cone3D.gamedev.net)
GameDev.net''s Tutorials - (Here)

OpenGL:

Main Site - (www.opengl.org)
NeHe Tutorials - (nehe.gamedev.net)
Online Books - (Red Book) (Blue Book)

Share this post


Link to post
Share on other sites
That is what happened to me. I just figured it out. You have change the source so that it is not off of the screen and so that it only blits the part that is showing


It is foolish for a wise man to be silent, but wise for a fool.

Matthew
WebMaster
www.Matt-Land.com

All your Xbox base are belong to Nintendo.
All your GameDev.net base are belong to Myopic Rhino

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!