.. include:: ../../defs.hrst Loops ##### At the heart of many game engines lies the event loop, a continuous cycle that checks for and responds to events, such as user input or system triggers. In |Obscura|, loops are extensions of dispatchers. This means every loop has its own dedicated dispatcher. When you want a loop to respond to specific events or inputs, you need to register the appropriate listeners with that particular loop. We recommend to initialize and organize loops via the :ref:`Scheduler `. There are three types of loops: - **MainLoop**: The main loop for the engine. There should only be one main loop. - **SyncLoop**: A loop that runs in sync with the main loop. - **AsyncLoop**: A loop that runs asynchronously to the main loop. Available loops --------------- .. doxygenclass:: obscura::MainLoop :members: :undoc-members: .. doxygenclass:: obscura::SyncLoop :members: :undoc-members: .. doxygenclass:: obscura::AsyncLoop :members: :undoc-members: Loop base class --------------- .. doxygenclass:: obscura::LoopBase :members: :undoc-members: Loop config ----------- .. doxygenclass:: obscura::LoopConfig :members: :undoc-members: .. doxygenclass:: obscura::FractionalLoopConfig :members: :undoc-members: .. doxygenclass:: obscura::TargetFPSLoopConfig :members: :undoc-members: .. doxygenclass:: obscura::BaseLoopConfig :members: :undoc-members: Examples -------- Create and use multiple synchronous loops ^^^^^^^^^^^ .. literalinclude:: ../../../../examples/use_multiple_sync_loops.cxx :language: c++