[SDL] correct way of map scrolling

Hasan ZORLU hasanzorlu at gmail.com
Fri Aug 10 05:16:23 PDT 2007


Thank you Stefan,
but i'm finding screenport anyway

in these lines
if (contents[i].X >= 0 && contents[i].X <= stopX) {
                        if (contents[i].Y >= 0 && contents[i].Y <= stopY) {
[...]

if i blit images anywhere in surface during loading map, you're 
absolutely right. when scrolling mouse, i'll find  new  viewport 
(because of i blit images before) images will be appear which are in our 
new viewport. (i'll examine that)

but in my way, i don't blitting any images in surface, when i scroll 
calculate viewport and blit images (which are in my viewport).

review:
now i can scroll endless map (if i didn't set a border)
~50 sprite in my viewport
45% - 60% CPU usage, i must decrease that


also thank you for your next tip, i fix it

Thank you

Hasan ZORLU




More information about the SDL mailing list