Advertisement
Guest User

Untitled

a guest
Apr 2nd, 2012
33
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.13 KB | None | 0 0
  1. #include <iostream>
  2. #include <time.h>
  3. #include <stdlib.h>
  4. #include "SDL/SDL.h"
  5. #include <string>
  6. const int SCREEN_WIDTH = 3000;
  7. const int SCREEN_HEIGHT = 2500;
  8. const int SCREEN_BPP = 32;
  9. SDL_Surface *map = NULL;
  10. SDL_Surface *screen = NULL;
  11. void FillRect(int x, int y, int w, int h, int color) {
  12. SDL_Rect rect = {x,y,w,h};
  13. SDL_FillRect(screen, &rect, color);
  14. }
  15. int main( int args, char * argc[] )
  16. {
  17.     if( SDL_Init( SDL_INIT_EVERYTHING ) == -1 )
  18.     {
  19.         return 1;
  20.     }
  21.     screen = SDL_SetVideoMode( SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_BPP, SDL_SWSURFACE );
  22.     if( screen == NULL )
  23.     {
  24.         return 1;
  25.     }
  26.     srand(time(0));
  27.     int randomness = 5;
  28.     for ( int iX = 0; iX < 100; iX++ )
  29.     {
  30.         int RandomY = rand() % randomness + 1; // Randomness calculations
  31.         FillRect(iX * 10,RandomY * 10,10,10,0xFFFFFF);
  32.         for ( int NewY = RandomY; NewY > 0; NewY-- )
  33.         {
  34.             std::cout << NewY;
  35.             FillRect(iX * 10,NewY * 10,10,10,0xFFFFFF);
  36.         }
  37.     }
  38.         if( SDL_Flip( screen ) == -1 )
  39.     {
  40.         return 1;
  41.     }
  42.     SDL_Delay( 2500 );
  43.  
  44.     return 0;
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement