祝愿大家,在新的一年里面也要更加好哦!
以下就是我们的新年烟花程序源码了!大家一起来学习吧~
源码分享:
#include<stdio.h>
#include<math.h>
#include<time.h>
#include<conio.h>
#include<graphics.h> //自己安装了才有
#include<mmsystem.h>
#pragma comment(lib,"winmm.lib")//多媒体设备接口库文件
#define PI 3.1415
#define NUM 13 //烟花弹数量
#define WIDTH 960
#define HEIGHT 640
/*
开发环境:vs2019+easyx
*/
struct Fire
{
int x, y;
int cen_x, cen_y; //中心点坐标
int r; //当前绽放半径
int max_r; //最大绽放半径

int width, height;
DWORD pixel[240][240]; //图片像素数组
bool isShow; //烟花是否准备好了
bool isDraw; //是否绘制烟花
}fire[NUM];
struct Jet //烟花弹
{
int x, y; //坐标
int hx, hy; //最高点的坐标
bool isLaunch; //烟花弹是否在发射中
IMAGE img[2];
byte n : 1; //位段 0 1 0 1 0 1 0 1 0 1
}jet[NUM];
void welcome()
{
mciSendString(L"open ./res/小幸运.mp3", 0, 0, 0);
mciSendString(L"play ./res/小幸运.mp3", 0, 0, 0);
for (int i = 0; i < 50; i++)
{
//清除屏幕
cleardevice();
int x = 500 + 180 * sin(2 * PI / 60 * i);
int y = 200 + 180

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容,请联系我们,一经查实,本站将立刻删除。
如需转载请保留出处:https://51itzy.com/kjqy/133552.html