[英]Move Circle in Turbo c++
how can we move a circle on the screen in Turbo c++ and without clear device i want to move it from left to right and then to right to left my code is here but it is with clear device which make the screen blink a little so any help??? 我们如何才能在Turbo c ++中在屏幕上移动一个圆且没有清晰的设备,我想从左到右然后从右到左移动它,我的代码在这里,但是它带有清晰的设备,这会使屏幕稍微闪烁一点,所以救命???
main() {
int gd=DETECT,gm,col=0;
initgraph(&gd,&gm,"../bgi");
START:
int get = 0;col=40;
while(!kbhit())
{
rectangle(20,20,getmaxx()-20,getmaxy()-20);
circle(col,210,20);
delay(5);
if(col <600 && get == 0) col++;
else{ get=1; col--; }
cleardevice();
if(col==40) goto START;
}
}
It has been a while since I did Turbo-C++ but I have worked on similar cases. 自从我做Turbo-C ++以来已经有一段时间了,但是我从事过类似的案例。 If the circle is hollow you can simulate a clear by redrawing it in the background color. 如果圆是空心的,则可以通过以背景色重绘来模拟透明。 That will be quick enough to avoid the blinks. 这样将足以避免眨眼。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.