Advertisement

SDL problem

Started by February 04, 2002 05:50 PM
4 comments, last by TheRealMAN11 22 years, 7 months ago
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
It is foolish for a wise man to be silent, but wise for a fool.
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
Advertisement
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)
------------------------------Put THAT in your smoke and pipe it
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
It is foolish for a wise man to be silent, but wise for a fool.
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)
------------------------------Put THAT in your smoke and pipe it
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
It is foolish for a wise man to be silent, but wise for a fool.

This topic is closed to new replies.

Advertisement