run¶
File: samarium/util/file.hpp
Encapsulates an event loop
- 
namespace sm
- Functions - 
auto run(Window &window, const std::invocable auto &update)¶
- call update -> display the window - Parameters:
- window – Window to display 
- update – Callable which updates the state of objects 
 
 
 - 
auto run(Window &window, const auto &update, const auto &draw, u64 substeps = 1)¶
- call update -> call draw -> display the window - Parameters:
- window – Window to display 
- update – Callable which updates the state of objects 
- draw – Callable which draws objects 
- substeps – Call update this many times for better accuracy. Divide \( \Delta t \) accordingly 
 
 
 - 
auto run(Window &window, const auto &update, const auto &draw, u64 substeps, f64 dt)¶
- call update -> call draw -> display the window - Parameters:
- window – Window to display 
- update – Callable which updates the state of objects 
- draw – Callable which draws objects 
- substeps – 
- dt – Fixed time to assume bewteen frames 
 
 
 - 
auto zoom_pan(Window &window, f64 zoom_factor = 0.1, f64 pan_factor = 1.0)¶
 - 
auto zoom_pan(Window &window, const std::invocable auto &zoom_condition, const std::invocable auto &pan_condition, f64 zoom_factor = 0.1, f64 pan_factor = 1.0)¶
 
- 
auto run(Window &window, const std::invocable auto &update)¶