当前位置: 首页 > 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://bellhanger .hnsdj.cn
http://elate .hnsdj.cn
http://rekindle .hnsdj.cn
http://moor .hnsdj.cn
http://suboptimal .hnsdj.cn
http://micropore .hnsdj.cn
http://sublineate .hnsdj.cn
http://dextrad .hnsdj.cn
http://intendment .hnsdj.cn
http://emblem .hnsdj.cn
http://generation .hnsdj.cn
http://acrux .hnsdj.cn
http://glyptography .hnsdj.cn
http://santera .hnsdj.cn
http://surgeoncy .hnsdj.cn
http://rathaus .hnsdj.cn
http://vanadous .hnsdj.cn
http://idiomatic .hnsdj.cn
http://clothback .hnsdj.cn
http://ozokerite .hnsdj.cn
http://ducky .hnsdj.cn
http://throat .hnsdj.cn
http://natality .hnsdj.cn
http://epicotyledonary .hnsdj.cn
http://disjunctive .hnsdj.cn
http://cretonne .hnsdj.cn
http://imploration .hnsdj.cn
http://practicoinert .hnsdj.cn
http://slinkingly .hnsdj.cn
http://uptodate .hnsdj.cn
http://www.dtcms.com/a/293765.html

相关文章:

  • 3.6 常见问题与调试
  • 编程语言Java——核心技术篇(二)类的高级特性
  • Semantic Kernel实现调用Kernel Memory
  • 华为云数据库 GaussDB的 nvarchar2隐式类型转换的坑
  • Python-初学openCV——图像预处理(一)
  • C++刷题 - 7.23
  • 开源 Arkts 鸿蒙应用 开发(九)通讯--tcp客户端
  • 在 Ubuntu 20.04.5 LTS 系统上安装 Docker CE 26.1.4 完整指南
  • Spring Cloud Alibaba Sentinel 基本工作原理源码阅读
  • MACOS安装配置Gradle
  • 国产数据库转向 “融合” 赛道:电科金仓的下一代形态定义之路
  • 基于Matlab传统图像处理技术的车辆车型识别与分类方法研究
  • 资本押注会成长的玩具,AI潮玩赛道开始升温
  • 华为云ELB(弹性负载均衡)持续报异常
  • 永磁同步电机控制算法--弱磁控制(负载能力最大化的定交轴)
  • 【C++】C++ 的入门语法知识1
  • 在easyui中如何设置自带的弹窗,有输入框
  • 解决Spring事务中RPC调用无法回滚的问题
  • 零基础学编程,编程从入门到精通系列教程,附:编程工具箱之时间计算构件的用法#零基础自学编程 学习计划#新手学编程 高效学习方法
  • HF83311_VB1/HF83311Q_VB1:高性能USB HiFi音频解码器固件技术解析
  • Leetcode-15. 三数之和
  • 《计算机“十万个为什么”》之 [特殊字符] 深浅拷贝 引用拷贝:内存世界的复制魔法 ✨
  • 1.1 Deep learning?pytorch ?深度学习训练出来的模型通常有效但无法解释合理性? 如何 解释?
  • 英语词汇积累Day1-10(summary)
  • Django实战:Python代码规范指南
  • 【Java】Reflection反射(代理模式)
  • 算法竞赛备赛——【图论】最小生成树
  • 《元素周期表》超高清PDF
  • IDEA如何管理多个Java版本。
  • STM32 基础知识 定时器【概念】