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

使用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.xdnf.cn/news/16109.html

相关文章:

  • 回顾 Palantir:八年之旅的反思
  • RCLAMP0502A.TCT Semtech:超低电容TVS二极管,高速接口+军工级防护!
  • lumerical——光纤布拉格光栅(Fiber Bragg gratings)
  • 2025 ACT 汽车功能安全相关PPT分享
  • Python-初学openCV——图像预处理(一)
  • 【盘古100Pro+开发板实验例程】FPGA学习 | Modelsim 的使用和 do 文件编写
  • IO补充.
  • WebGIS 中常用空间数据格式
  • UE 模型动画播放控制
  • Linux下的lcd屏幕显示操作
  • Java学习---Spring及其衍生(上)
  • S段和G段到底有什么区别
  • 算法笔记之归并排序
  • Windows 用 Python3 快速搭建 HTTP 服务器
  • linux驱动开发笔记--GPIO驱动开发
  • WPF的一些基础知识学习记录
  • 应用层自定义协议【序列化+反序列化】
  • TODAY()-WEEKDAY(TODAY(),2)+1
  • 彻底掌握双列集合——Map接口以及实现类和常用API及其底层原理
  • python学智能算法(二十九)|SVM-拉格朗日函数求解中-KKT条件
  • Python爬虫--Xpath的应用
  • 分布式限流算法与组件
  • jenkins 入门指南:从安装到启动的完整教程
  • 分布式系统中的缓存设计与应用
  • 网络调制技术对比表
  • 算法竞赛备赛——【图论】拓扑排序
  • 关于网络安全等级保护的那些事
  • 重磅发布:Oracle ADG 一键自动化搭建脚本
  • java设计模式 -【策略模式】
  • 为什么本地ip记录成0.0.0.1