godot engine c++ source code in-depth analysis series one

I haven’t developed a project using C++ for a long time. If according to the entry requirements of the unit at this time, I must have project experience, then I have to go back to the university era more than ten years ago. Which time was really good? Computers were not so popular and mobile phones were Without such intelligence, the Internet was not as developed, and information dissemination was not as fast as it is now. In that era, a newspaper worth 50 cents a piece might be really good. Learning technology can only be gained by reading a lot of books.

Since joining the IT industry, many colleagues and seniors must have known that the only requirement for software development is strong practical ability. Without practicing it yourself, you will never know how many pitfalls there are in the code. The same piece of code will It can run on computer A, but cannot run on computer B. This is the impact of the environment on this.

At this time, looking at the colleagues around me, they all have their own strengths and weaknesses, but as for myself, I am indeed back to where I was before.

Godot is an open source cross-platform game engine for developing 2D and 3D games. It is developed and maintained by a non-profit organization focused on game development. Here is some sample code for Godot:

extends Node2D

func _ready():
    var sprite = Sprite.new()
    sprite.texture = load("res://texture.png")
    add_child(sprite)

After reading the above code, do you think it feels familiar and very simple? No, No, No, there are many more to come. Let’s take a look at the development tool interface first

 This interface still looks very comfortable. If you feel uncomfortable, no problem, just open the source code and we can modify it ourselves. As mentioned before, godot is an open source game engine. Since it is open source, we will modify its interface from the source code to see if it can be implemented.

We have downloaded the source code. If you have not downloaded it yet, you can refer to the address below.

  1. Official website: Godot Engine - Free and open source 2D and 3D game engine
  2. Official documentation: Godot Docs – 4.1 branch — Godot Engine (stable) documentation in English
  3. GitHub仓库:GitHub - godotengine/godot: Godot Engine – Multi-platform 2D and 3D game engine

 Seeing the above source code structure, I really don’t know where to start. After all, I haven’t used C++ for a long time. Fortunately, with the little memory left in my brain, I found the entry file of the program, which started my journey of reading the source code.

Now that you have found a familiar feeling, let’s start the first attempt, which is to add a function to enable users to practice typing.

After a long day, I finally have some appearance. Although it is a little ugly, at least I know where to enter.

Of course, the purpose of studying the source code is not only to add a window for typing practice, but also to implement many functions. To express it in one sentence, "The road is long and long , and I will search up and down."

Finally, after a day of tossing and turning, I used all my years of college experience, communicating in English, and returning to the original development language C++. Although ten years have passed, everything seems to be yesterday.。 

Guess you like

Origin blog.csdn.net/xinshuai_1/article/details/131875780