Application: improve drawUnsafeWidget().
This commit is contained in:
parent
6aba2bf8c5
commit
e425c81db6
1 changed files with 1 additions and 0 deletions
|
@ -186,6 +186,7 @@ class Application: public Platform::Sdl2Application, public efsw::FileWatchListe
|
||||||
|
|
||||||
template<typename Functor, typename... Args>
|
template<typename Functor, typename... Args>
|
||||||
bool drawUnsafeWidget(Functor func, Args... args) {
|
bool drawUnsafeWidget(Functor func, Args... args) {
|
||||||
|
static_assert(std::is_invocable_r_v<bool, Functor, Args...>);
|
||||||
GameState game_state = _gameState; // Copying the value to reduce the risk of a data race.
|
GameState game_state = _gameState; // Copying the value to reduce the risk of a data race.
|
||||||
ImGui::BeginDisabled(game_state != GameState::NotRunning);
|
ImGui::BeginDisabled(game_state != GameState::NotRunning);
|
||||||
bool result = func(std::forward<Args>(args)...);
|
bool result = func(std::forward<Args>(args)...);
|
||||||
|
|
Loading…
Reference in a new issue