当前位置: 首页 > news >正文

使用Imgui和SDL2做的一个弹球小游戏-Bounze

使用Imgui和SDL2做的一个弹球小游戏-Bounze

油管上面TheCherno博主分享的一个视频FIRST GAME in C++! Did He Do a Good Job? // Code Review (C++/SDL2)里面分享了一个Github项目:
https://github.com/staticaron/Bounze
使用了Imgui和SDL2,并且可以设置音乐播放,修改音量等,玩家可以得分等,目前游戏支持Windows和Linux。

Bounze

游戏开始界面菜单

运行项目

How to Play.

  • The ball bounces off the bat randomly in normal mode.
  • If boost is active, the ball bounces off according to where it collides with the bat.
  • Balancing the ball on bat and destroying the diamonds using the boosted ball gives points.
  • Get the highscore.

  • I left the debug imgui in the game where you can modify the volumes etc. Press TAB to access.

How to build.

Windows + Visual Studio

  1. Open the folder in visual studio as Cmake Project.
  2. Ctrl + S on the CMakeLists.txt file to build the project.
  3. Run bounze.exe.

NOTE : Copy the /resources folder in same directory as the .exe file.

LINUX

  1. Create a folder /build
  2. Enter the folder cd build
  3. Run the cmake command cmake ..
  4. Make the build file make

NOTE : Copy the /resources folder in same directory as the .exe file.

参考上述https://github.com/staticaron/Bounze的README.md文件,下载上述项目后,在Window11中使用VS2022打开下载的目录,以CMake工程打开;
接着打开CMakeLists.txt,执行Ctrl+S编译,生成Makefile等工程文件;最后将代码根目录下的resources资源文件夹拷贝到和bounze.exe同级目录,运行bounze.exe可执行程序
将资源文件夹和exe放置到同一目录下
然后鼠标双击bounze.exe可执行程序,
鼠标双击bounze.exe可执行程序
如果不拷贝resources资源文件夹,直接鼠标双击bounze.exe可执行程序,会报如下的错误:
不拷贝资源文件夹报错

ERROR loading the font at : ./resources/fonts/mightysouly.ttf Couldn't open ./resources/fonts/mightysouly.ttf

加载资源文件报错,因为找不到资源文件所在目录。

http://www.lryc.cn/news/597641.html

相关文章:

  • 状压Dp和记忆化搜索
  • 服务器对kaggle比赛的数据集下载
  • 【计算机网络】正/反向代理服务器,有状态/无状态应用
  • 力扣MySQL(1)
  • gig-gitignore工具实战开发(一):项目愿景与蓝图规划
  • 宜搜科技与绿地金创考察香港数码港 共探数字科技与RWA领域战略机遇
  • (绕过最新360、火绒)shellcode分离加载实现CS免杀上线
  • JDBC学习
  • AI赋能DBA:数据库管理与运维的智能化工具全景解析
  • 【Linux系统编程】基础指令
  • 如何通过内网穿透,访问公司内部服务器?
  • dfaews
  • React中的antd的表格使用方法
  • docker安装minio及配置禁止列出目录文件
  • 【前沿技术动态】【AI总结】RustFS:从 0 到 1 打造下一代分布式对象存储
  • 《WebGL打造高性能3D粒子特效系统:从0到1的技术探秘》
  • La Création du C++ : Une Épopée dans l‘Évolution de la Programmation
  • 5.综合案例 案例演示
  • Java面试宝典:Spring专题一
  • 背包DP之0/1背包
  • OpenLayers 快速入门(六)Interaction 对象
  • 嵌入式学习-(李宏毅)机器学习(1)-day28
  • 《汇编语言:基于X86处理器》第9章 复习题和练习
  • #Linux内存管理# 详细介绍使用mmap函数创立共享匿名映射的工作原理
  • 力扣146:LRU缓存
  • 单片机-----基础知识整合
  • Win10_Qt6_C++_YOLO推理 -(1)MingW-opencv编译
  • Linux dd命令 数据备份、转换与磁盘操作的终极工具
  • LinkedList的模拟实现+LinkedList和ArrayList的区别
  • 低代码中的统计模型是什么?有什么作用?