小编Las*_*ain的帖子

Pygame sceen.fill()没有正确填充颜色

我刚开始学习Pygame.我正在学习本教程.我运行了以下程序,但它显示的是黑色而不是蓝色:

import pygame

h = input("Enter the height of the window : ")
w = input("Enter the width of the window : ")
screen = pygame.display.set_mode((w,h))

running = True
while running:
    event = pygame.event.poll()
    if event.type == pygame.QUIT:
        running=0

screen.fill((0,0,1))
pygame.display.flip()
Run Code Online (Sandbox Code Playgroud)

python pygame

4
推荐指数
1
解决办法
1万
查看次数

致命错误:freetype/config/ftheader.h

我试图使用freeglut2在OpenGL中渲染文本.当我包含以下标题时,

#include <freetype2/ft2build.h>

它给出以下错误:

/usr/local/include/freetype2/ft2build.h:37:38: fatal error: freetype/config/ftheader.h: No such file or directory

但是当我去的时候/usr/local/include/freetype2/freetype/config,我找到了文件ftheader.h.

请帮我弄清问题.谢谢.

我去了这个,但没有任何效果.

c++ g++ freetype freetype2

3
推荐指数
1
解决办法
5410
查看次数

为什么默认情况下会初始化局部变量?

在"C++编程语言 "一书的 9.2节中,Bjarne Stroustrup写道:

请注意,默认情况下会初始化在全局或命名空间范围内未定义初始值设定项的变量.对于在免费商店中创建的局部变量或对象,情况并非如此.

但是以下程序打印的值为0:

#include <iostream>
using namespace std;

int main() {
    int x;
    cout << x << endl;
    return 0;
}
Run Code Online (Sandbox Code Playgroud)

它不应该返回某种错误吗?

我g++用来编译.

c++ gcc g++

1
推荐指数
2
解决办法
148
查看次数

标签 统计

c++ ×2

g++ ×2

freetype ×1

freetype2 ×1

gcc ×1

pygame ×1

python ×1