So I am starting to learn pygame and in this line:
pygame.display.set_mode((640,300), 0, 32)
I'm wondering what does the 0, and 32 mean, and how will the program change if I change these two variables.
So I am starting to learn pygame and in this line:
pygame.display.set_mode((640,300), 0, 32)
I'm wondering what does the 0, and 32 mean, and how will the program change if I change these two variables.
From the documentation:
The flags argument is a collection of additional options. The depth argument represents the number of bits to use for color.
In this case, 0 means "don't set any flags." The available flags are:
pygame.FULLSCREEN create a fullscreen display
pygame.DOUBLEBUF recommended for HWSURFACE or OPENGL
pygame.HWSURFACE hardware accelerated, only in FULLSCREEN
pygame.OPENGL create an opengl renderable display
pygame.RESIZABLE display window should be sizeable
pygame.NOFRAME display window will have no border or controls
If you wanted to, say, have an OpenGL-renderable fullscreen surface, you'd set flags to pygame.FULLSCREEN | pygame.OPENGL
-- OR
-ing them together to get the right flag value.
The 32 is the color depth, in bits, of your display surface.
pygame.display.set_mode((640,300), pygame.FULLSCREEN | pygame.OPENGL | pygame.NOFRAME, 32)
, for example. –
Machellemachete © 2022 - 2024 — McMap. All rights reserved.