Lazy Foo' Productions

Scrolling

Last Updated 4/09/14

Up until now, you've been working with environments that were 640 x 480. In this lesson we're going to redo the
motion tutorial only this time we're going to be able to move around an area of any size thanks to scrolling.

We have our standard constants, surfaces, event structure and all that good stuff,
but this time we have 2 new constants defining the level width and height.
Since we can scroll, we don't confine everything inside of the screen, but now we confine the dot within a level.

As I mentioned before, we need a camera to define what part of the level we will show on the screen.
Since the screen is a rectangular area, the camera is a SDL_Rect.
Here we initialize the camera in the top left corner and set the width and height to be that of the screen.