
#include <stdio.h>
# include <graphics.h>
#include<vector>
#define ScreenWidth 800
#define ScreenHight 600
int main(int argc, char *argv[])
{
initgraph(ScreenWidth, ScreenHight, 1);
IMAGE m;
loadimage(&m, "花纹.png");
int t0 = GetTickCount();
int y0 = -401;
BeginBatchDraw();
do {
cleardevice();
//背景移动
for (int y = y0; y < ScreenHight + 198; y += 198) {
for (int x = 0; x < ScreenWidth; x += 336) {
putimage(x, y, &m);//图像大小:336,198
}
}
//控制滚动速度
int time = GetTickCount() - t0;
if (time > 100) {
t0 = GetTickCount();
y0++; if (y0 >= 0)y0 = -398;
}
FlushBatchDraw();
} while (1);
return 0;
}