编码中的旗标和深度(Pygame) [英] Flags and Depth in Coding (Pygame)

查看:76
本文介绍了编码中的旗标和深度(Pygame)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我开始学习pygame,并且在这一行中:

So I am starting to learn pygame and in this line:

pygame.display.set_mode((640,300), 0, 32)

我想知道0和32是什么意思,如果我更改这两个变量,程序也会更改.

I'm wondering what does the 0, and 32 mean, and how will the program change if I change these two variables.

推荐答案

来自文档:

flags参数是其他选项的集合.depth参数代表用于颜色的位数.

The flags argument is a collection of additional options. The depth argument represents the number of bits to use for color.

在这种情况下,0表示不设置任何标志".可用的标志是:

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

例如,如果要拥有可渲染OpenGL的全屏表面,可以将标志设置为 pygame.FULLSCREEN |.pygame.OPENGL - OR -将它们放在一起以获得正确的标志值.

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.

32位是显示表面的颜色深度(以位为单位).

The 32 is the color depth, in bits, of your display surface.

这篇关于编码中的旗标和深度(Pygame)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆