摘要: 字符阵是 EasyX 的经典样例程序: https://codebus.cn/yangw/character-matrix 使用 raylib 替代 easyx. 除了常规的 API 替换, 还需要额外调用 SwapScreenBuffer(). 由于 DrawText() / DrawTextEx 阅读全文
posted @ 2023-01-25 21:19 ChrisZZ 阅读(112) 评论(0) 推荐(0) 编辑
摘要: 基于 EasyX // 根据《C和C++游戏趣味编程》第三章 别碰方块 写出 #include <graphics.h> #include <conio.h> // _kbhit() #include <stdio.h> // 检测按下了空格键 void demo_3_1_3() { while ( 阅读全文
posted @ 2023-01-25 20:32 ChrisZZ 阅读(66) 评论(0) 推荐(0) 编辑
摘要: 基于 EasyX // 根据《C和C++游戏趣味编程》第10章 十字消除 写出 #include <graphics.h> #include <conio.h> // _kbhit() #include <stdio.h> #include <stdlib.h> #include <time.h> 阅读全文
posted @ 2023-01-25 20:30 ChrisZZ 阅读(96) 评论(0) 推荐(0) 编辑
摘要: 这个简陋的小游戏,在 《C和C++游戏趣味编程》 第三章, 是逐次迭代写成的。这里贴出基于 easyx 和 raylib 的各自实现。 基于 EasyX // 根据《C和C++游戏趣味编程》第二章 仿真“自由落体小球” 写出 #include <graphics.h> #include <conio 阅读全文
posted @ 2023-01-25 20:28 ChrisZZ 阅读(62) 评论(0) 推荐(0) 编辑
摘要: Raylib 播放音频毫无压力, 相比之下 EasyX 需要借助 Windows API mciString 传入播放相关的命令, 感觉风格不统一, 不够优雅。 另一个问题是 clock() 和 CLOCKS_PER_SEC 在 Linux 下结果和 windows 相差了10倍, 需要手动处理下。 阅读全文
posted @ 2023-01-25 20:24 ChrisZZ 阅读(191) 评论(0) 推荐(0) 编辑
摘要: 基于 EasyX // 根据《C和C++游戏趣味编程》第九章 推箱子 写出 #include <graphics.h> #include <conio.h> // _kbhit() #include <stdio.h> #include <stdlib.h> // 玩家位置 struct Playe 阅读全文
posted @ 2023-01-25 20:16 ChrisZZ 阅读(149) 评论(0) 推荐(0) 编辑
摘要: 基于 EasyX // 根据《C和C++游戏趣味编程》第七章 贪吃蛇 写出 #include <graphics.h> #include <conio.h> // _kbhit() #include <stdio.h> #include <stdlib.h> // 全局变量定义 #define HE 阅读全文
posted @ 2023-01-25 20:13 ChrisZZ 阅读(101) 评论(0) 推荐(0) 编辑
摘要: 思路 按如下顺序尝试: 绘制一个字符下落 绘制4个字符(一列)的下落 绘制20个字符(一列)的下落,并封装其位置更新、绘制的过程为 Rain 类的成员函数 绘制多个雨滴 每个雨滴在更新位置时, 也修改字符 每个雨滴初始化时,位置、速度都随即化 基于 EasyX // 字符雨 (基于 easyx) / 阅读全文
posted @ 2023-01-25 20:11 ChrisZZ 阅读(92) 评论(0) 推荐(0) 编辑