美文网首页
从零开发游戏引擎系列(六)预编译头

从零开发游戏引擎系列(六)预编译头

作者: zaintan | 来源:发表于2021-02-24 10:40 被阅读0次

    该系列教程源自youtube的cherno的视频-GAME ENGINE series!

    视频地址: https://www.youtube.com/watch?v=vtWdgtMo1T4

    引擎源代码地址: https://github.com/TheCherno/Hazel

    将几乎不会改动的头文件放在一起预编译,加快编译速度

    Hazel/src 下新增 hzpch.h hzpch.cpp

    premake5.luaproject/Hazel 增加预编译头文件配置

        pchheader "hzpch.h"
        pchsource "Hazel/src/hzpch.cpp"
    

    hzpch.h

    #pragma once
    
    #include <iostream>
    #include <memory>
    #include <utility>
    #include <algorithm>
    #include <functional>
    
    #include <string>
    #include <sstream>
    #include <vector>
    #include <unordered_map>
    #include <unordered_set>
    
    #ifdef HZ_PLATFORM_WINDOWS
        #include <Windows.h>
    #endif 
    

    hzpch.cpp

    #include "hzpch.h" 
    

    项目中.h , .cpp可移除对应的include, cpp中#include "hzpch.h"即可

    git提交改动点(一)
    git提交改动点(二)

    相关文章

      网友评论

          本文标题:从零开发游戏引擎系列(六)预编译头

          本文链接:https://www.haomeiwen.com/subject/egjnxltx.html