创建win32控制台应用程序,选择空项目。
创建完毕后,右击头文件新建一个头文件(.h)。名字写main.h
然后在源文件新建一个C++文件(.cpp)。名字写main.cpp
如图:
然后在main.h里面写上如下代码:
#include
#include
#include
#include
#include
#include
#pragma comment(lib,"winmm.lib")
#define PI3.1415926535
#define NUM13
//烟花弹
struct JET
{
intx, y;//坐标
inthx,hy; //最高点坐标
boolshoot; //判断烟花弹是不是发射状态
DWORD t1, t2, dt; //烟花弹发射的速度
IMAGE img[2]; //图片2张 一明一暗的两张
byte n : 1; //结构体 位段 变量 n 占用内存的一个位!
}jet[NUM];
//烟花
struct FIRE
{
int r; //半径
int maxr; //最大半径
int x, y;//相对于窗口 中心点的坐标
int cenx, ceny; //相对于图片本身 中心点的坐标
int width, height;
int xy[240][240]; //图片 保存到一个像素矩阵。
bool show;//是否绽放
bool draw;//是否绘制
DWORD t1, t2, dt;//爆炸的速度
}fire[NUM];
void Init(int i);
void Load();
void Chose(DWORD& t1);
void Shoot();
void Show(DWORD* pem);
在main.cpp写上如下代码:
/****************************************************
*****************************************************
****************表白浪漫烟花项目开发********************
****************主讲人:三黑之毅************************
****************最后修改:2019年3月20日****************
*****************************************************
****************************************************/
#inc