screen = SDL_SetVideoMode(1000,1000,32, SDL_HWSURFACE | SDL_FULLSCREEN);
What does the |
do in SDL_HWSURFACE | SDL_FULLSCREEN
C / C++ APIs often set up bit 'flags' when there are a lot of different, non-mutually exclusive options that can be set for a given function call. Each of the flags will be assigned a bit position in a value (often a DWORD
or other large integer type). One or more of these bits can then be set by bitwise OR-ing a collection of defined constants that represent the options and give you a more clear label to identify them than a raw numeric constant. The resultant value is passed as a single argument to the API function, which helps to keep the signature manageable.
In this particular case, SDL_HWSURFACE
and SDL_FULLSCREEN
represent options that can be passed in to the SDL_SetVideoMode
call. There are probably several other possible options available as well that were not set in this case. This particular call sets the two options by bitwise OR-ing the flag constants together, and passing the result as the last parameter.