# FULLSCREEN and DOUBLEBUF

```Paul St George wrote:

> So...
>
>      print pygame.display.get_surface()
> gives
> <Surface(720x480x32 SW)>
>
> and
>      print screen.get_flags()
> gives
> -2147483648

> To recap: this thread started with a question. How do I know whether
> DOUBLEBUF has been set with:
>
> screen = pygame.display.set_mode((720,480), pygame.DOUBLEBUF |
> pygame.FULLSCREEN)

flags = screen.get_flags()
if flags & pygame.DOUBLEBUF:
print("DOUBLEBUF has been set")
if flags & pygame.FULLSCREEN:
print("FULLSCREEN has been set")

See the pattern?

The easiest way to argue about flags is in binary notation. Every flag
corresponds to an integer with a single bit set, e. g.

HOT = 0b001
BLUE = 0b010
RIGHTEOUS = 0b100

You can combine the flags with bitwise or

hot_and_righteous = HOT | RIGHTEOUS # 0b101

and query them  with bitwise and:

>>> if hot_and_righteous & HOT: print("hot")
...
hot
>>> if hot_and_righteous & BLUE: print("blue")
...
>>> if hot_and_righteous & RIGHTEOUS: print("righteous")
...
righteous

With your actual pygame flags it's very much the same. However, because
integers in Python are signed numbers like

-2147483648

may be puzzling, even when you display them in binary

>>> bin(-2147483648)
'-0b10000000000000000000000000000000'

You might think that only one flag is set because there is only one 1, but
the - sign corresponds to an "infinite" number of leading 1s.

If you know that the flags are stored (for example) in a 32bit integer you
can mask off these leading 1s and see the actual data more clearly:

>>> bin(-2147483648 & 0b11111111111111111111111111111111)
'0b10000000000000000000000000000000'

OK, so in this case it probably* was a single flag, but that's not always
the case:

>>> bin(-7)
'-0b111'
>>> bin(-7 & 0b11111111111111111111111111111111)
'0b11111111111111111111111111111001'

(*) What if the flags were stored in a 64bit integer?

```