Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <time.h>
- #include <stdlib.h>
- #include "SDL/SDL.h"
- #include <string>
- const int SCREEN_WIDTH = 3000;
- const int SCREEN_HEIGHT = 2500;
- const int SCREEN_BPP = 32;
- SDL_Surface *map = NULL;
- SDL_Surface *screen = NULL;
- void FillRect(int x, int y, int w, int h, int color) {
- SDL_Rect rect = {x,y,w,h};
- SDL_FillRect(screen, &rect, color);
- }
- int main( int args, char * argc[] )
- {
- if( SDL_Init( SDL_INIT_EVERYTHING ) == -1 )
- {
- return 1;
- }
- screen = SDL_SetVideoMode( SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_BPP, SDL_SWSURFACE );
- if( screen == NULL )
- {
- return 1;
- }
- srand(time(0));
- int randomness = 5;
- for ( int iX = 0; iX < 100; iX++ )
- {
- int RandomY = rand() % randomness + 1; // Randomness calculations
- FillRect(iX * 10,RandomY * 10,10,10,0xFFFFFF);
- for ( int NewY = RandomY; NewY > 0; NewY-- )
- {
- std::cout << NewY;
- FillRect(iX * 10,NewY * 10,10,10,0xFFFFFF);
- }
- }
- if( SDL_Flip( screen ) == -1 )
- {
- return 1;
- }
- SDL_Delay( 2500 );
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement