小妹我最近学习C,做了一个超小程序,后来突发奇想,想把它做成屏保.
请问,我编的这个程序要添加什么才能成为屏保?(C编程中,若想做成屏保,有什么条件吗?是不是很麻烦?)
#include<graphics.h>
#include<stdio.h>
#include<stdlib.h>
#include<alloc.h>
#include<conio.h>
void face(void);
void get(void);
void *buf;
#define x1 240
#define y1 160
#define x2 385
#define y2 320
void face(void)
{
setcolor(rand()%getmaxcolor()+1) ;
setlinestyle(0,0,3);
arc(320,240,5,175,60);
setlinestyle(0,0,3);
line(275,245,276,268);
line(365,243,368,268);
ellipse(323,284,150,30,54,33); /*head*/
setlinestyle(0,0,3);
line(317,265,287,271);
line(330,264,358,271);
arc(320,250,265,295,50); /*eyes and mouth*/
setlinestyle(0,0,3);
line(270,220,267,243);
line(280,215,277,242);
line(290,214,288,241);
line(300,213,297,242);
line(312,210,311,240);
line(324,211,326,239);
line(334,212,335,240);
line(345,212,345,241);
line(355,213,358,240);
line(365,215,369,239);
line(263,240,265,300);
line(373,243,381,299); /*hair*/
}
void get(void)
{
int size;
face();
size=imagesize(x1,y1,x2,y2);
buf=malloc(size);
getimage(x1,y1,x2,y2,buf);
}
main()
{
int driver=DETECT,mode;
registerbgidriver(EGAVGA_driver);
initgraph(&driver,&mode,"");
cleardevice();
while(!kbhit())
{
setactivepage(1);
get();
setactivepage(0);
putimage(rand()%590,rand()%320,buf,XOR_PUT);
delay(900000);
delay(900000);
delay(500000);
cleardevice();
free(buf);
}
}