Giter VIP home page Giter VIP logo

notmyhazel's Introduction

NotMyHazel

一、初始构建一个项目

作为输出目录
$(SolutionDir)bin\$(Configuration)-$(Platform)\$(ProjectName)\

作为中间目录(int指intermediate)
$(SolutionDir)bin-int\$(Configuration)-$(Platform)\$(ProjectName)\ 
在winodws下,构建动态库的项目,对于函数声明需要增加
__declspec(dllexport) void Print();
在使用函数的地方的声明应该如下
__declspce(dllimport) void Print();

二、使用spdLog日志系统

//使用git直接将代码作为项目的子模块
git submodule add $(ProjectGitAddress) $(Dirs'/'...)

知识点:

1、静态类成员变量必须在类外进行初始化 2、静态变量必须且只能一次被初始化 3、静态变量初始化时必须携带类型

Cherno是在头文件内定义了私有静态成员变量的get函数(当然也是静态函数),一开始我想在类外进行静态函数的定义,但是我忘记了私有成员变量无法在类外访问。虽然后来改掉了,但是我想,既然这样的话,那我可以利用友元(friend)定义静态成员函数,所以我直接在静态成员函数前加了friend关键字,但是我在cpp文件实现时,发现在Log类的作用域下找不到静态成员函数,后来查询才发现,一旦定义了友元函数,那么该函数将不是类的成员函数,即不带this指针,后来尝试之后,个人的理解是,带了友元的静态成员函数是全局静态函数(不知道这么理解对不对)。

//学会宏的多参数传递
#define HZ_CORE_ERROR(...)        Hazel::Log::GetCorelogger()->error(__VA_ARGS__)

三、设计事件系统

主要就是从github上下载目前的代码,但是那是最终版本,跟着修改代码,完成最初版本的事件系统。对于大致的设计流程有了一定的认识,主要就是提高抽象的层次。在知识点方面:

1、了解了std::function的使用,接收一个函数指针,完成回调。

2、复习了纯虚函数的声明,需要在最后加上=0

3、有纯虚函数的类是抽象类,不能生成对象,只能派生。他派生的类的纯虚函数没有被实现,那么,它的派生类还是个抽象类

4、同时有且只有成员函数可以在方法名后加const进行修饰,主要修饰隐含参数this指针,表明this指针为常量函数,其指向的对象无法修改成员变量,其实也就是表明常量成员函数内无法修改成员变量,最后就是常量成员函数内无法调用非常量成员函数。

5、常量成员函数在执行期间不能修改成员变量的值(静态成员变量除外),也不能调用同类的非常量成员函数(同样的静态成员函数除外)。

notmyhazel's People

Contributors

keybor avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.