5#include <imgui-platform-kit/user_interface.h>
13#define IMGUI_ENABLE_FREETYPE
22 template<
typename T,
typename =
void>
28 std::void_t<decltype(T(std::declval<std::shared_ptr<Simulation>>()))>> : std::true_type {};
31 template<
typename T,
typename =
void>
37 std::void_t<decltype(T(std::declval<std::shared_ptr<Visualization>>()))>> : std::true_type {};
57 std::shared_ptr<Simulation> simulation;
58 std::shared_ptr<Visualization> visualization;
59 std::shared_ptr<imgui_kit::UserInterface> gui;
61 static float uiScalePct;
70 explicit Application(
const std::shared_ptr<Simulation>& simulation =
nullptr,
71 const std::shared_ptr<Visualization>& visualization =
nullptr);
86 template<
typename WindowType,
typename... Args>
89 gui->addWindow<WindowType>(std::forward<Args>(args)...);
93 template<
typename WindowType,
typename... Args>
95 gui->addWindow<WindowType>(simulation, std::forward<Args>(args)...);
99 template<
typename WindowType,
typename... Args>
102 gui->addWindow<WindowType>(visualization, std::forward<Args>(args)...);
116 void setGUIParameters();
117 static void enableKeyboardShortcuts();
118 static void appendFonts();
119 static void defineImGuiStyle();
Top-level application that owns the GUI, simulation, and visualization.
Definition application.h:55
void step() const
Advance the simulation by one step and render all windows.
Definition application.cpp:75
static void registerSettingsHandler()
Register the application's ImGui settings handler (for persistence).
Definition application.cpp:43
bool isGUIActive() const
Return true if the GUI overlay is currently active.
Definition application.cpp:108
bool hasGUIBeenClosed() const
Return true if the user has closed the main window.
Definition application.cpp:100
void addWindow(Args &&... args) const
Register a window that needs no Simulation or Visualization pointer.
Definition application.h:87
static void setUiScalePct(float pct)
Definition application.h:65
static float getUiScalePct()
Definition application.h:64
void toggleGUI()
Toggle the GUI on or off at runtime.
Definition application.cpp:94
void init() const
Initialize the GUI and all registered windows. Call once before step().
Definition application.cpp:27
void close() const
Tear down the GUI and close the simulation. Call once after the main loop.
Definition application.cpp:85
void addWindow(Args &&... args) const
Register a window that takes a Simulation shared_ptr as the first argument.
Definition application.h:94
Definition application.h:20
ImFont * g_MonoMediumFont
JetBrainsMono.
Definition application.h:140
ImFont * g_LargeIconsFont
Font Awesome.
Definition application.h:146
ImFont * g_LightLargeFont
Cera Pro Light.
Definition application.h:125
ImFont * g_MonoLargeFont
JetBrainsMono.
Definition application.h:141
ImFont * g_BlackMediumFont
Cera Pro Black.
Definition application.h:136
ImFont * g_MonoSmallFont
JetBrainsMono.
Definition application.h:139
ImFont * g_MediumIconsFont
Font Awesome.
Definition application.h:145
ImFont * g_SmallIconsFont
Font Awesome.
Definition application.h:144
ImFont * g_BoldMediumFont
Cera Pro Bold.
Definition application.h:132
ImFont * g_BoldLargeFont
Cera Pro Bold.
Definition application.h:133
ImFont * g_BlackSmallFont
Cera Pro Black.
Definition application.h:135
ImFont * g_LightMediumFont
Cera Pro Light.
Definition application.h:123
ImFont * g_BlackLargeFont
Cera Pro Black.
Definition application.h:137
ImFont * g_LightSmallFont
Cera Pro Light.
Definition application.h:124
constexpr size_t g_FontCount
Number of text font variants (icon fonts not counted).
Definition application.h:143
ImFont * g_MediumMediumFont
Cera Pro Medium (main font)
Definition application.h:128
ImFont * g_MediumLargeFont
Cera Pro Medium.
Definition application.h:129
ImFont * g_MediumSmallFont
Cera Pro Medium.
Definition application.h:127
ImFont * g_BoldSmallFont
Cera Pro Bold.
Definition application.h:131
Definition application.h:23
Definition application.h:32