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).
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;