godotgodoc

what Is Mainloop in the Godot game engine??


I am a godot beginner. so i just needed help, if somebody can explain it a little bit and the OS thing. I am stuck. How does the mainloop work and how does it interact with the OS they state in godot doc.


Solution

  • The MainLoop is the, well, main loop of the program. It loops until the app is closed. In this loop it handles, delegates, and processes things such as input, rendering, audio, physics, and more.

    OS is the api to the OS running the app. OS is the interface to the file system, input, system info, interrupts, app container, and more.

    MainLoop uses OS for input, interrupts, initialization, and more.

    Then SceneTree inherits MainLoop which adds on to that loop by managing your tree of nodes that make up your scene.

    This is missing a lot of specifics and is not totally accurate, but I hope it helps.