这个能不能用C语言做出来?
c语言吧
全部回复
仅看楼主
level 5
白芦花 楼主
2024年12月12日 23点12分 1
level 11
意思是,一张背景图片,然后很多雪花飘落。
2024年12月13日 01点12分 2
这个很简单吗?
2024年12月13日 01点12分
这个很简单吗?
2024年12月13日 01点12分
@白芦花 用easyx还好吧。你应该自己试一试
2024年12月13日 02点12分
@風之街 在下一楼
2024年12月13日 02点12分
level 5
白芦花 楼主
#include <stdlib.h>
#include <math.h>
#include <conio.h>
#include <graphics.h>
#include <time.h>
#define PI 3.1415926
IMAGE img[2];
void save();//绘制雪花,并存储
void dsnow();//用于实现雪花飘落的过程
void font();//来实现在屏幕中输出字符串 //定义雪花结构
struct Snow
{
int x;
int y;
int speed;
}snow[100]; //绘制雪花,并存储
void save()
{
int i,x,y;
setcolor(WHITE);
for(i = 1; i <= 6;i++ ){
x = 200 + 5 * sin(i * PI / 3);
y = 200 - 5 * cos(i * PI / 3);
line(200,200,x,y);
}
getimage(&img[1],100,100,10,10);
getimage(&img[0],195,195,10,10);
} //来实现在屏幕中输出字符串
void font()
{
outtextxy(180 , 200, "Merry Christmas" );
setfont(40, 0 ,"微软雅黑"); //用于字体颜色变更
setcolor(RGB(rand() % 256, rand() % 256, rand() % 256));
} //用于实现雪花飘落的过程
void dsnow()
{
int i,num = 0;
srand((unsigned )time(NULL));
cleardevice();
while( !_kbhit()){
font();
if( num != 100 ){
snow[num].speed = 2 + rand()%10;
snow[num].x = rand()%640;
snow[num].y = 0;
}
for( i = 0;i < num;i ++)
putimage(snow[i].x,snow[i].y,&img[0]);
Sleep(20);
font();
if( num != 100 )
num++;
for(i = 0;i < num;i++){
snow[i].y += 4;
putimage(snow[i].x,snow[i].y-4,&img[1]);
Sleep(10);
if( snow[i].y > 500 )
snow[i].y = 0;
}
}
}
int main()
{ initgraph( 640,480);
setbkcolor(BLACK); save();
dsnow();
_getch();
closegraph();
return 0;
}
2024年12月13日 02点12分 3
大佬
2024年12月13日 05点12分
膜拜大佬![突然兴奋]
2024年12月13日 07点12分
98
2024年12月13日 19点12分
level 2
用的啥编译器啊,为啥我这弄不了
2024年12月13日 03点12分 4
需要安装easyx库
2024年12月13日 05点12分
level 1
一眼上 GDI+ 硬画。 不过已经到 C++ 范畴了
2024年12月13日 15点12分 5
GDI+提供了flat API,C语言可以用
2024年12月14日 01点12分
@Dangfer 然后目测要陷入 handle 的恐惧中
2024年12月14日 04点12分
@t3486784401 有什么可恐惧的,和C++差不多的啊,无非多一步释放资源的操作罢了
2024年12月14日 05点12分
@Dangfer flat API是什么?很好用吗?
2024年12月15日 00点12分
level 5
白芦花 楼主
加上半透明随机,和尺寸大小随机
2024年12月14日 01点12分 6
level 1
能是肯定能 不过用c写这玩意 纯调库写的又难受 不如用Python省时间
2024年12月14日 16点12分 7
对对,有时速度慢点
2024年12月15日 00点12分
level 7
用easyx应该还行
2024年12月14日 17点12分 8
level 7
推荐使用ege,如果用小熊猫C++可以免配置使用[开心]
2024年12月15日 05点12分 9
1