add update button

This commit is contained in:
Sebastien Bourdeauducq 2023-09-07 21:26:26 +08:00
parent 03e46f97eb
commit 49d0fa5130
1 changed files with 3 additions and 1 deletions

View File

@ -168,6 +168,7 @@ int main(int argc, char* argv[])
std::atexit(TerminateDSP);
bool exit = false;
bool update = true;
while(!exit && !glfwWindowShouldClose(window)) {
glfwPollEvents();
glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
@ -177,7 +178,7 @@ int main(int argc, char* argv[])
#if defined(GL_UNPACK_ROW_LENGTH) && !defined(__EMSCRIPTEN__)
glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
#endif
{
if(update) {
std::lock_guard<std::mutex> guard(waterfall_data_mutex);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, waterfall_width, waterfall_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, waterfall_data);
}
@ -195,6 +196,7 @@ int main(int argc, char* argv[])
ImGui::TableSetupColumn("", 0, 280.0);
ImGui::TableSetupColumn("", 0, 1000.0);
ImGui::TableNextColumn();
ImGui::Checkbox("Update", &update);
if(ImGui::Button("Exit"))
exit = true;
ImGui::Text("FPS: %d", (int)fps);