Sorry I couldn't think of a better title, but hopefully you'll understand. I've worked with the SDL library for quite some time and whenever you have to set the video mode, there are flags that that tell whether to go fullscreen, use OpenGL, or whatever such as SDL_OPENGL | SDL_FULLSCREEN.
What I want to know is how would I break down these flags if I wanted to know if the Uint32 variable contained the flag for fullscreen or if it contained the flag for something else?
If you don't want to use a variable and just check it inside an if statement it would like like if ((Flags & SDL_OPENGL) == SDL_OPENGL), or if ((Flags & SDL_OPENGL) != 0), or if (Flags & SDL_OPENGL).
EDIT:
EssGeEich's way is better if you have combined flags with more than one bit set. const Uint32 OPENGL_AND_FULLSCREEN = SDL_OPENGL | SDL_FULLSCREEN;
Now this would not work. bool IsOpenGLAndFullScreen = (Flags & OPENGL_AND_FULLSCREEN);
IsOpenGLAndFullScreen would be set to true if at least one of the two flags are true. By using EssGeEich's way it would work correctly. bool IsOpenGLAndFullScreen = (Flags & OPENGL_AND_FULLSCREEN) == OPENGL_AND_FULLSCREEN;
SDL_OPENGL and SDL_FULLSCREEN aren't values I set, they're values set by the SDL library, but that's useful information if I wanted to do something like that.
Yeah, I told you in case you wanted to do your enumeration. Almost everyone uses this kind of enumeration for bitmasks, so it should work almost everywhere.
Also feel free to use Peter87's code: It works almost the same, and it's shorter.