小言_互联网的博客

C++编写的表白小程序(图片围成爱心+烟花+音乐)-附源代码

1422人阅读  评论(0)

一、效果

视频效果:

C++编写的表白小程序(图片围成爱心+烟花+音乐)-附源码

 

二、项目完整源代码:

链接:https://pan.baidu.com/s/1zea3Wji1VN4FIrqXoa4LWw 
提取码:ypag

三、程序需要调用EasyX图形库

官网链接:https://easyx.cn/downloads/

使用的版本:EasyX库(附带graphics.h) 2018春分版 (2018-3-21)

四、展现爱心和烟花的代码

==============Romantic.h==================


  
  1. #pragma once
  2. #include "graphics.h"
  3. #include "time.h"
  4. #include "mmsystem.h"
  5. #include <stdio.h> //标准的输入输出头文件。
  6. #include <stdlib.h>
  7. #include <math.h>
  8. #include <conio.h>
  9. #include "windows.h"
  10. #pragma comment(lib,"winmm.lib")
  11. #define nSecond 500
  12. #define PI 3.1415926548
  13. #define NUM 13
  14. class CRomantic
  15. {
  16. public:
  17. CRomantic( void);
  18. virtual ~CRomantic( void);
  19. public:
  20. void ShowLove();
  21. void GaoBaiQiQiu();
  22. //==============第二个================窗口
  23. void FireFlower();
  24. //烟花弹
  25. struct JET
  26. {
  27. int x, y; //烟花弹的坐标
  28. int hx, hy; //最高点坐标 ---> 烟花(爆炸坐标)
  29. int height; //高度 y-hy
  30. bool shoot; //是否可以发射
  31. DWORD t1, t2, dt; //时间间隔
  32. IMAGE img[ 2]; //小数组 存放图片
  33. byte n : 1; //位段
  34. }jet[NUM];
  35. //烟花
  36. struct FIRE
  37. {
  38. int r; //r
  39. int max_r; //
  40. int x, y; //
  41. int cen_x, cen_y; //
  42. int width, height;
  43. int xy[ 240][ 240];
  44. bool show;
  45. bool draw;
  46. DWORD t1, t2, dt;
  47. }fire[NUM];
  48. //声明函数
  49. void Welcome();
  50. void Init(int i); //初始化
  51. void Load(); //加载图片
  52. void Chose(DWORD& t1); //选择可以发射的烟花弹
  53. void Shoot(); //发射
  54. void Show(DWORD* pMem);
  55. };

五、关于如何替换爱心的图片见此文章出处

http://liyanliang.net/index.php/2021/02/16/showmylove/

 

注:转载请标明出处:

https://blog.csdn.net/qq_40416052/article/details/103701756


转载:https://blog.csdn.net/qq_40416052/article/details/103701756
查看评论
* 以上用户言论只代表其个人观点,不代表本网站的观点或立场