# GameEngineFromScratch **Repository Path**: dream_zhou/GameEngineFromScratch ## Basic Information - **Project Name**: GameEngineFromScratch - **Description**: 跟着 陈文礼 的从零开始手敲次世代游戏引擎系列手敲的代码 https://zhuanlan.zhihu.com/c_119702958 - **Primary Language**: Unknown - **License**: GPL-3.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 1 - **Forks**: 0 - **Created**: 2018-10-08 - **Last Updated**: 2024-07-13 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # GameEngineFromScratch ## 项目介绍 跟着 陈文礼 的从零开始手敲次世代游戏引擎系列手敲的代码 ## Windows 下编译 ### `helloengine_win` ```shell # 0 pwd # X:\xx\xx\GameEngineFromScratch # 1 cd Platform/Windows/ mkdir -p build\helloengine_win cd build\helloengine_win # 2 clang -l user32.lib -l gdi32.lib -o helloengine_win.exe ../../helloengine_win.c # 3 运行 helloengine_win.exe ``` ### `helloengine_d2d` ```shell # 0 pwd # X:\xx\xx\GameEngineFromScratch # 1 cd Platform/Windows/ mkdir -p build\helloengine_d2d cd build\helloengine_d2d # 2 clang -l user32.lib -l ole32.lib -l d2d1.lib -o helloengine_d2d.exe ../../helloengine_d2d.cpp # 3 运行 helloengine_d2d.exe ``` ### `helloengine_d3d` 安装 DirectXMath ```shell git submodule add https://github.com/Microsoft/DirectXMath.git DirectXMath git submodule init DirectXMath git submodule update DirectXMath ``` ```shell # 0 pwd # X:\xx\xx\GameEngineFromScratch # 1 cd Platform/Windows/ mkdir -p build\helloengine_d3d cd build\helloengine_d3d # 2 编译Shader(D3D规格) # 使用 `Developer Command Prompt` fxc /T vs_5_0 /Zi /Fo copy.vso ../../copy.vs fxc /T ps_5_0 /Zi /Fo copy.pso ../../copy.ps # 3 debug # clang-cl -I ../../DirectXMath/Inc/ -c -Z7 -o helloengine_d3d.obj ../../helloengine_d3d.cpp # link -debug user32.lib d3d11.lib d3dcompiler.lib helloengine_d3d.obj # 4 release clang -I ../../DirectXMath/Inc -l user32.lib -l d3d11.lib -l d3dcompiler.lib -o helloengine_d3d.exe ../../helloengine_d3d.cpp # 5 运行 helloengine_d3d.exe ``` ### `helloengine_opengl` ```shell # 0 pwd # X:\xx\xx\GameEngineFromScratch # 1 cd Platform/Windows/ mkdir build\helloengine_opengl cd build\helloengine_opengl # 2 clang-cl /EHsc -o helloengine_opengl ../../helloengine_opengl.cpp user32.lib gdi32.lib opengl32.lib # 或 clang -o helloengine_opengl.exe ../../helloengine_opengl.cpp -luser32 -lgdi32 -lopengl3 # 3 helloengine_opengl.exe ``` ## Mac 下 编译 ```shell # 0 pwd # X:\xx\xx\GameEngineFromScratch # 1 cd Platform/Darwin/ mkdir build cmake -H. -Bbuild -GXcode -DCMAKE_EXPORT_COMPILE_COMMANDS=1 cmake --build build/ open build/test_mac_app.xcodeproj # 使用 Xcode 编译运行 ``` ## 第5章 1. 编译命令 ```bash # 在项目的根目录 mkdir build cd build cmake .. make # 执行 ./Empty/Empty ``` ## 第7章 1. clang 编译命令 ```shell clang -l user32.lib -o helloengine_win.exe helloengine_win.c ``` 2. cl 编译命令 ```shell cl -l user32.lib helloengine_win.c ``` 3. gcc 编译 helloengine_xcb ```shell gcc -Wall helloengine_xcb.c -lxcb -o helloengine_xcb # 运行 ./helloengine_xcb ``` 4. gcc 编译 helloengine_opengl ```shell gcc -Wall helloengine_xcb.c -lxcb -o helloengine_xcb # 运行 ./helloengine_xcb ``` ## 第8章 - DirectDraw (Direct2D) :专门绘制2D图形 - Direct3D: 专门绘制3D图形 - DirectShow:专门用于多媒体播放 ## 第21章 - Platform 按平台分类 - Asset shader, 贴图, 模型 场景 动画 音频等资源 - External 第三方库或源码 - RHI (Render Hardware Interface) 存放图形API的接口 -