12345678910111213141516171819 |
- #include "spawn.h"
- #define SAMPLER_X 19
- #define SAMPLER_Y 10
- #define WIDE_X w/SAMPLER_X
- #define WIDE_Y h/SAMPLER_Y
- #define WIDE_SUM WIDE_MAX+WIDE_MIN
- #define SAFE_ZONE 200
- void spawn( std::vector<SDL_Rect>* obs, Uint16 nb, Uint16 w, Uint16 h )
- {
- for ( Uint16 i(0); i < nb; i++)
- {
- obs->push_back( { SAFE_ZONE + rand()%(w-SAFE_ZONE-WIDE_X), // x
- rand()%(h-WIDE_Y), // y
- WIDE_X, // w
- WIDE_Y} ); // h
- }
- }
|