MCPcopy Create free account
hub / github.com/OpenImageDebugger/OpenImageDebugger / FrameLoop

Class FrameLoop

src/host/frame_loop.h:37–56  ·  view source on GitHub ↗

Drives the per-frame cycle: poll input, begin frame, run the draw callback, end frame. Backend-agnostic so it can be unit-tested against a fake.

Source from the content-addressed store, hash-verified

35/// Drives the per-frame cycle: poll input, begin frame, run the draw callback,
36/// end frame. Backend-agnostic so it can be unit-tested against a fake.
37class FrameLoop {
38 public:
39 FrameLoop(HostBackend& backend, std::function<void()> draw_frame);
40
41 /// Run one iteration. Returns false if the backend requested close (in
42 /// which case nothing was drawn), true after a rendered frame.
43 bool tick();
44
45 /// Loop until tick() returns false.
46 void run();
47
48 [[nodiscard]] int frame_count() const {
49 return frame_count_;
50 }
51
52 private:
53 HostBackend& backend_;
54 std::function<void()> draw_frame_;
55 int frame_count_{0};
56};
57
58} // namespace oid::host
59

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected