Add "Add log entry every second"
This commit is contained in:
parent
11eb08b08f
commit
8a0d2b428e
|
@ -71,6 +71,8 @@ static inline void main_window(Config& active_config, bool* show_settings_window
|
|||
static inline void debug_window() {
|
||||
static bool show_demo_window = false;
|
||||
static size_t add_log_entry_presses = 1;
|
||||
static bool log_entry_every_second = false;
|
||||
static float log_entry_every_second_delta;
|
||||
|
||||
if (show_demo_window) {
|
||||
ImGui::ShowDemoWindow(&show_demo_window);
|
||||
|
@ -79,13 +81,29 @@ static inline void debug_window() {
|
|||
ImGui::End();
|
||||
return;
|
||||
}
|
||||
|
||||
ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate);
|
||||
ImGui::Checkbox("Show Dear ImGui Demo Window", &show_demo_window);
|
||||
|
||||
ImGui::Separator();
|
||||
if (ImGui::Button("Add Log Entry")) {
|
||||
std::exception e;
|
||||
log(std::string("Add log entry button pressed ") + std::to_string(add_log_entry_presses++) + " time(s)", e);
|
||||
log(std::string("Debug log entry #") + std::to_string(add_log_entry_presses++) + " (activated via manual button press)", e);
|
||||
}
|
||||
ImGui::SameLine();
|
||||
// returns true when it's pressed
|
||||
if (ImGui::Checkbox("Add log entry every second", &log_entry_every_second)) {
|
||||
log_entry_every_second_delta = 0.0f;
|
||||
}
|
||||
if (log_entry_every_second) {
|
||||
log_entry_every_second_delta += ImGui::GetIO().DeltaTime;
|
||||
if (log_entry_every_second_delta >= 1.0f) {
|
||||
std::exception e;
|
||||
log_entry_every_second_delta = 0.0f;
|
||||
log(std::string("Debug log entry #") + std::to_string(add_log_entry_presses++) + " (activated by add log entry every second)", e);
|
||||
}
|
||||
}
|
||||
|
||||
ImGui::End();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue