池塘夜降彩色雨
设计一个程序,演示美丽的“池塘夜雨”景色:色彩缤纷的雨点飘飘洒洒地从天而降,滴滴入水有声,溅起圈圈微澜。
(1)雨点的空中出现位置、降落过程的可见程度、入水位置、颜色、最大水圈等,都是随机确定的;
(2)多个雨点按照各自的随机参数和存在状态,同时演示在屏幕上;
(3)有“电闪雷鸣”现象;
(4)有风的效果,展现“风雨飘摇”的情景;
(5)增加雨点密度的变化:时而“和风细雨”,时而“暴风骤雨”
结构体
荷叶
雨滴
雷
主要函数流程图
代码块
#include <graphics.h> //图形库
#include <time.h> //设置随机数的种子
#include <conio.h>
#include<stdio.h>
#include<stdlib.h>
#include<process.h> //多线程
POINT point; //windows自定义的结构体 点
HWND hwnd; //窗口句柄
int sleeptime; //函数挂起时间
//雨的链表节点结构体
typedef struct Rain
{
int x0, y0;//雨滴的起始位置
int x, y;//雨滴的终止位置
double step;//步进
COLORREF color;//雨滴的颜色
//雨滴的绘制所需的参数
int left;
int top;
int right;
int bottom;
double stangle;
double endangle;
int n;
Rain * next;
}Rain;
//雨滴入水声音
struct music
{
int feq;
int time;
music* next;
Rain *rain;
};
//闪电的结构体
typedef struct Thunder
{
int x0, y0;//顶点位置
int x1, y1;
int x2, y2;
int x3, y3;
int x4, y4;
int x5, y5;
int x6, y6;
int x7, y7;
int x8, y8;
int x9, y9;
}Thunder;
//荷叶的结构体
typedef