Diffstat (limited to 'noncore/games/sfcave-sdl/terrain.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/games/sfcave-sdl/terrain.cpp | 22 |
1 files changed, 3 insertions, 19 deletions
diff --git a/noncore/games/sfcave-sdl/terrain.cpp b/noncore/games/sfcave-sdl/terrain.cpp index c001a56..b243f45 100644 --- a/noncore/games/sfcave-sdl/terrain.cpp +++ b/noncore/games/sfcave-sdl/terrain.cpp @@ -48,4 +48,5 @@ void Terrain :: initTerrain() SDL_FillRect( terrainSurface, 0, 0 ); + // Draw Terrain into surface Sint16 px[5]; @@ -92,5 +93,4 @@ void Terrain :: moveTerrain( int amountToMove ) speed = offset/segSize; -// printf( "offset - %d, speed - %d\n", offset, speed ); if ( offset >= segSize ) { @@ -196,5 +196,4 @@ void Terrain :: drawTerrain( SDL_Surface *screen ) dst.w = sWidth; dst.h = sHeight; -// dst.h = maxHeight; SDL_Rect dst2; @@ -205,20 +204,4 @@ void Terrain :: drawTerrain( SDL_Surface *screen ) stars->draw( screen ); - -// dst.y = sHeight - maxHeight; -// dst2.y = sHeight - maxHeight; -// SDL_BlitSurface(terrainSurface, &dst, screen, &dst2 ); - -/* - for ( int i = 0 ; i < MAPSIZE ; ++i ) - { - int x1 = (i*segSize) - (offset*speed); - int x2 = ((i+1)*segSize)-(offset*speed); - if ( x2 >= sWidth ) - x2 = sWidth-1; - aalineRGBA( screen, x1, mapTop[i], x2, mapTop[i+1], 0, 220, 0, 255 ); - aalineRGBA( screen, x1, mapBottom[i], x2, mapBottom[i+1], 0, 220, 0, 255 ); - } -*/ } @@ -227,4 +210,5 @@ bool Terrain :: checkCollision( int x, int y, int h ) if ( y < 0 || y > sHeight ) return true; + // First get segment that matches x SDL_LockSurface( terrainSurface ); @@ -248,5 +232,5 @@ Terrain *terrain; void go() { - /* Initialize SDL */ + // Initialize SDL if ( SDL_Init(SDL_INIT_VIDEO) < 0 ) { |