Mac HELP: Scrolling in SDL, have code, just need help fixing it

slooksterPSV

macrumors 68040
Original poster
Apr 17, 2004
3,281
126
Nowheresville
I found a great tutorial out there on the internet that shows how to do scrolling for your games and that. I implemeted this using all kinds of work arounds and memory tools. Anyways, here's the problem, when I scroll to the right or the bottom too far it shows a black box the height or the width of the screen, respectively. I'm not sure what piece of code fixes this, but I need help fixing it. Also, the character moves 3x faster when it scrolls as well. Here's the link to my entire source project.

... I'm not sure if I did or didn't, but there may be code that prints to the stderr file with locations. -- I'm using XCode 2.3 btw, and its a Univ Binary, and you have to have SDL 1.2.10 installed (compile and build it), http://rapidshare.de/files/22604081/CSliceUniv.zip.html
http://rapidshare.de/files/22604081/CSliceUniv.zip.html
http://rapidshare.de/files/22604081/CSliceUniv.zip.html there's the link
 

slooksterPSV

macrumors 68040
Original poster
Apr 17, 2004
3,281
126
Nowheresville
If I do it like the author of the original code did it, blitting the character with an offset of the characters x - camera's x and the characters y - camera's y then it duplicates the screen bitmap and walks with the user. E.g.
Code:
...
HandleUpdate(mc->GetCenterX()-camera.x, mc->GetCenterY()-camera.y, playertemp, g_Window, NULL);
...