pygame - 什么是旗帜? pygame.SRCALPHA 标志的用途是什么(我在示例 aacircle.py 中遇到过该标志)?

标签 pygame

我对 pygame 几乎一无所知,我正在尝试通过弄乱示例来学习。我也在阅读文档并可能尝试一些教程。

我有 javascript 和processing.js 背景,这是我在可汗学院的计算机科学部分学到的。

无论如何,在表面对象的文档(我下载的 pdf 的第 4 页)中,它说“对于普通软件表面,0 可以用于标志。”因此,作为我的第一个实验,我将示例 aacircle.py 中的 pygame.SRCALPHA 更改为 0 并对其进行了测试。屏幕从带有黑色圆圈的红色背景变成了纯黑色。为什么?

最佳答案

我建议您查看 pygame documentation on surfaces :

The pixel format can be controlled by passing the bit depth or an existing Surface. The flags argument is a bitmask of additional features for the surface. You can pass any combination of these flags:

HWSURFACE, creates the image in video memory

SRCALPHA, the pixel format will include a per-pixel alpha

关于pygame - 什么是旗帜? pygame.SRCALPHA 标志的用途是什么(我在示例 aacircle.py 中遇到过该标志)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30879474/

相关文章:

python - 段错误: 11 when I run Pygame

python - 您可以同时拥有两个具有不同 FPS 值的函数吗?

python - 通过传递坐标来位击棋盘上的白色方 block

python - 为什么我的跳跃在 python 3/pygame 中不起作用

python - 使用 pygame 显示不同样式的要点

python - Pymunk Pygame 对象位置不更新

python - 如何在python和pygame中获取鼠标输入

python - 处理自上而下 View 游戏的旋转 Sprite 的最佳方法是什么

python - 尝试在类中绘制 pygame Sprite 但出现错误

python - HSV 到 RGB 颜色转换