0 votes

Can someone point me the source in GitHub of how Godot Engine handles multi-platform window abstraction or some other resource (Book, blog, GitHub, etc..) on how to do this?

I can't find a single resource (free or paid) on how to accomplish this without using something like GLFW3.

Thanks,
--Jeff

asked Mar 29, 2019 in Engine by kershnerd (12 points)

2 Answers

0 votes

I'm not sure what you are looking for but the there is the platform directory

answered Mar 31, 2019 by flurick (878 points)
0 votes

The abstraction is done directly into the core of the engine. In the class /core/os/os.h, there is a virtual function called "initialized". This class is actually extended by any os_*.cpp class (in each platform directory) and an OpenGL Context is created in this specific function. This is then into that function that you should look to know how the window is created as it is required in order to create an OpenGl Context (you will probably need to get your hand on the OpenGL documentation to be able to read those parts though).

For how Godot know which os class it has to use, it is actually injected, but I don't know when. Probably at compilation time, but it is also possible that it is at runtime, using a factory pattern (less likely as it would be less performant, and the game would be heavier, but I am not an engine dev).

answered May 23, 2019 by BlackWave42 (16 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.