Event loop interface.
More...
#include <eventloop.h>
◆ IdleCallback
Event callback function definition.
◆ EventLoop() [1/3]
◆ EventLoop() [2/3]
◆ EventLoop() [3/3]
◆ ~EventLoop()
◆ add_idle_callback()
Add a callback to be called any time the event loop is idle.
◆ draw()
Perform a draw.
- Note
- You do not normally need to call this directly. It is called by step() and run() automatically.
◆ invoke_idle_callbacks()
void invoke_idle_callbacks |
( |
| ) |
|
|
protected |
◆ io()
asio::io_context & io |
( |
| ) |
|
Get a reference to the internal ASIO io_context object.
◆ operator=() [1/2]
◆ operator=() [2/2]
◆ poll()
Run some pending events and return.
- Note
- This does not call draw(). If poll() returns a non-zero value, you must manually call draw().
- Returns
- The number of events handled.
◆ quit()
void quit |
( |
int |
exit_value = 0 | ) |
|
Quit the event loop.
This will cause the run() function to return.
- Note
- Allow optional non-zero exit value
◆ run()
Run the event loop.
This will not return until quit() is called.
- Returns
- The number of events handled.
◆ step()
Single step on the event loop.
This is the same as calling:
if (ret)
void draw()
Perform a draw.
int poll()
Run some pending events and return.
- Note
- If calling this manually, this will not invoke any idle callbacks.
- Returns
- The number of events handled.
◆ wait()
Wait for an event to occur.
◆ m_app
◆ m_do_quit
Used internally to determine whether the event loop should exit.
◆ m_exit_value
Return value when application quits.
◆ m_idle
Registered idle callbacks.
◆ m_impl
std::unique_ptr<EventLoopImpl> m_impl |
|
protected |
Internal event loop implementation.