pulsatrix
Loading...
Searching...
No Matches
window.hpp
Go to the documentation of this file.
1
5#pragma once
6
7#include <functional>
8#include <string>
9
10// Only compiled when PULSATRIX_ENABLE_VIZ builds pulsatrix_viz (see root CMakeLists.txt) --
11// this is the one header in the viz module allowed to assume ImGui/ImPlot/GLFW are present.
12// pulsatrix_core never includes this header or links pulsatrix_viz (charter non-negotiable
13// #2's plugin-boundary discipline, extended to the native viz module).
14struct GLFWwindow;
15
16namespace pulsatrix {
17
27class VizWindow {
28public:
35 VizWindow(const std::string& title, int width, int height);
36
38
39 VizWindow(const VizWindow&) = delete;
40 VizWindow& operator=(const VizWindow&) = delete;
41
47 void run(const std::function<void()>& draw_frame);
48
55 void run(const std::function<void()>& draw_frame, const std::function<void(int, int)>& after_render);
56
59
60private:
61 GLFWwindow* window_;
62};
63
64} // namespace pulsatrix
Owns a GLFW window, OpenGL3 context, and ImGui/ImPlot context for the lifetime of one demo app....
Definition window.hpp:27
VizWindow & operator=(const VizWindow &)=delete
void run(const std::function< void()> &draw_frame)
Runs the main loop, calling draw_frame() once per frame between ImGui::NewFrame()/ImGui::Render(),...
VizWindow(const VizWindow &)=delete
void run(const std::function< void()> &draw_frame, const std::function< void(int, int)> &after_render)
Same as run(draw_frame), plus after_render(framebuffer_width, framebuffer_height) called once per fra...
void request_close()
Asks the main loop to exit after the current frame (e.g. a scripted/screenshot run).
VizWindow(const std::string &title, int width, int height)
Creates the GLFW window, OpenGL3 context, and ImGui/ImPlot contexts.
Definition acquisition_functions.hpp:16