Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/leungll/baymaxfootballgame
BaymaxFootballGame, Software Development Based on Graphics Engine course, 2020 Spring, NENU
https://github.com/leungll/baymaxfootballgame
codeblocks-ide graphics-engine mingw64 nenu opengl windows-10 wingui
Last synced: about 2 months ago
JSON representation
BaymaxFootballGame, Software Development Based on Graphics Engine course, 2020 Spring, NENU
- Host: GitHub
- URL: https://github.com/leungll/baymaxfootballgame
- Owner: leungll
- License: apache-2.0
- Created: 2020-07-06T09:07:53.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2024-05-12T13:56:43.000Z (8 months ago)
- Last Synced: 2024-05-12T14:49:25.629Z (8 months ago)
- Topics: codeblocks-ide, graphics-engine, mingw64, nenu, opengl, windows-10, wingui
- Language: C
- Homepage:
- Size: 576 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# BaymaxFootballGame
**BaymaxFootballGame**, Software Development Based on Graphics Engine course, 2020 Spring, NENU![maven](https://img.shields.io/badge/C-passing-red)
![maven](https://img.shields.io/badge/MinGW-compile-green)
![maven](https://img.shields.io/badge/IDE-Code%3A%3ABlocks%20-yellow)
![maven](https://img.shields.io/badge/version-v1.0-orange)
![maven](https://img.shields.io/badge/License-Apache%202.0-blue)## 开发环境
* System: Win10
* IDE: Code::Blocks 17.12
* Compiler: MinGW
* Frame: WinGUI
* 注:WinGUI框架搭建模型来源于我的课程教师:[封子军老师](http://js.nenu.edu.cn/teacher/index.php?zgh=2005900028)## 引入资源
* `glut.h & gl.h & windows.h`
* 可在仓库 `resource` 文件夹中引入## 编译 & 运行
* `cd BaymaxFootballGame\BaymaxFootballGame\`
* 用 Code::Blocks 打开 `BaymaxFootballGame.cbp` 文件
* `Build and run`
* 注:查看足球贴图效果时,需进入路径 `BaymaxFootballGame\bin\Debug` ,打开 `BaymaxFootballGame.exe` 程序查看## 设计思路
- 整个程序框架是在老师的 `WiuGUI` 框架下进行编码操作
- 首先在 `Draw3D` 中绘制 `3D` 版 `Baymax`,再绘制足球球体
- 其次加上光照材质及纹理映射效果,使物体呈现真实感与立体感
- 最后依次加上键盘、鼠标、菜单的变色,旋转,平移操作## 实现功能
- 键盘操作
- 旋转操作
- `UP`、`DOWN` 键:物体绕 `X` 轴旋转
- `LEFT`、`RIGHT` 键:物体绕 `Y` 轴旋转
- `HOME`、`END` 键:物体绕 `Z` 轴旋转
- 平移操作
- `A`、`D` 键:物体沿 `X` 轴平移
- `W`、`S` 键:物体沿 `Y` 轴平移
- `Q`、`E` 键:物体沿 `Z` 轴平移
- 鼠标操作
- 按住 `鼠标左键`,拖动物体旋转,松开停止旋转
- 鼠标消息:`WM_MOUSEMOVE`
- 按住 `鼠标中键`,物体自动旋转,松开停止旋转
- 时间控件,定时器消息:
```
VOID CALLBACK MyTimerProc(HWND hwnd, UINT uMsg, UINT idEvent, DWORD dwTime);
SetTimer(hwnd, ID_TIMER, 1000, MyTimerProc);
```
- 菜单操作
- 主菜单 `hMenuMain`
- 右键弹出式菜单 `hPopup`
- 功能操作
- 控制物体自动旋转:`Auto-Rotate`
- 停止物体自动旋转:`Stop`
- `Baymax` 变色
- 按钮操作
- 左处窗体:控制足球平移操作
- 右处窗体:控制物体旋转、平移操作
- 光照材质
- 针对 `Baymax`
- `glLightfv, glMaterialfv`
- 纹理映射
- 针对球体 `gluSphere` 贴图
- 函数 `load_texture` 读取 `BMP` 文件作为纹理## 页面截图
>程序的灵感来源于游戏机,在窗体的中间是游戏界面,左右两处的面板则像游戏机的控制按钮。左处面板,控制足球运动;右处面板,可控制整个物体的运动。最后呈现出的效果为控制 `Baymax` 踢足球。![baymax-football-01](https://cdn.jsdelivr.net/gh/leungll/MyImgHosting/img/baymax-football-01.jpg)
![baymax-football-02](https://cdn.jsdelivr.net/gh/leungll/MyImgHosting/img/baymax-football-02.jpg)