为什么加了双缓冲之后for循环里的东西不能挨个输出,而是当for循环执行完毕后在一总输出?
想让for循环挨个的输出该怎么解决?
(除了"//双缓冲();"还有什么方法)
#include <graphics.h>
IMAGE tu[3];
void LoadImage() {
loadimage(&tu[0], "./image/tu0.png", 100, 100);
loadimage(&tu[1], "./image/tu1.png", 100, 100);
}
int x = 0, y = 0;
void ll() {
putimage(x, y, &tu[0]);
putimage(100, 100, &tu[1]);
}
void mm() {
for (int i = 0; i < 100; i++) {
y++;
ll();
Sleep(10);
}
}
int main() {
initgraph(800, 800, 1);
LoadImage();
//可以注释下面双缓冲来观察具体情况
BeginBatchDraw();
while (1){
mm();
FlushBatchDraw();
}
EndBatchDraw();
return 0;
}
别忘了自己搞张图像(100x100)