最终效果
代码
#include<stdio.h>
#include<stdlib.h>
#include<Windows.h>
#include<string.h>
#include<graphics.h>
void print_text(char a[20]);
int main(void)
{
int d=0;
initgraph(600,400);
char s[20]="游戏加载中---";
print_text(s);
Sleep(300);
getchar();
closegraph();
return 0;
}
void print_text(char a[20])
{
int x,y;
int size_text=10;
IMAGE mg;
x=y=0;
settextcolor(RED);
while(x<=600&&y<=400)
{
setbkmode(TRANSPARENT);
settextstyle(size_text,0,"consolas");
outtextxy(x,y,a);
Sleep(200);
cleardevice();
x=x+23;
y=y+25;
if(size_text<=80)
{
size_text=size_text+8;
}
}
loadimage(&mg,"背景.png",600,400);
putimage(0,0,&mg);
for(x=0;x<=600;x=x+20)
{
loadimage(&mg,"背景.png",600,400);
putimage(0,0,&mg);
outtextxy(x,150,"欢迎来到");
Sleep(100);
cleardevice();
}
loadimage(&mg,"背景.png",600,400);
putimage(0,0,&mg);
settextstyle(50,0,"consolas");
outtextxy(200,150,"球球炫歌");
}
|