gpt4 book ai didi

c - setbkcolor() 在 Dev-C++ 4.9.9.2 中无效

转载 作者:太空宇宙 更新时间:2023-11-04 08:23:38 25 4
gpt4 key购买 nike

我最近开始使用 Dev C++ 4.9.9.2 来试验 C 中的图形程序(感谢这个 tutorial)。但出于某种原因setbkcolor()什么都不做。这是代码...

#include <stdio.h>
#include <graphics.h>
#include <conio.h>

int main()
{
initwindow(800,600);
setbkcolor(GREEN); //FAILED. also tried "setbkcolor(2);"
while ( !kbhit() ){}
return 0;
}

这是输出:black colored screen still

我正在使用 Windows 7 Professional。这与操作系统有关吗?

最佳答案

documentation Windows notes 部分说:

Also, only future drawing will use the new background color (anything currently drawn in the old background color will stay in the old color). Calling setbkcolor(0) will change the background color to the current color at index [0] of the palette (rather than always changing the background to black).

你误解了函数的目标。

关于c - setbkcolor() 在 Dev-C++ 4.9.9.2 中无效,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32184011/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com