summaryrefslogtreecommitdiff
path: root/shaders/main.cc
diff options
context:
space:
mode:
authorHunter Kvalevog <hunter@kvog.sh>2025-11-30 14:48:38 -0600
committerHunter Kvalevog <hunter@kvog.sh>2025-11-30 14:48:38 -0600
commit4700fd33dad4c5aa20567624d3b6ef12bb7ccfb1 (patch)
treee61879fa7c0a8fad62b2f11615466640a9971001 /shaders/main.cc
parent37c55fb7a21c2c49ff16de720ded3556e0453e0a (diff)
parenteb6c99135e76db2161f0bb6f91d25a2d035c1554 (diff)
Merge branch 'master' of github.com:k-vog/demos
Diffstat (limited to 'shaders/main.cc')
-rw-r--r--shaders/main.cc8
1 files changed, 6 insertions, 2 deletions
diff --git a/shaders/main.cc b/shaders/main.cc
index 11688b5..c026eb2 100644
--- a/shaders/main.cc
+++ b/shaders/main.cc
@@ -390,6 +390,7 @@ static struct
SDL_Window* wnd;
ShaderMetadata sm;
bool ui_hidden;
+ bool pause;
GLuint shader;
@@ -661,7 +662,9 @@ SDL_AppResult SDLCALL SDL_AppIterate(void*)
GL(glUniform2f(u_id, (float)wnd_x, (float)wnd_y));
}
if ((u_id = glGetUniformLocation(G.shader, "u_time")) != -1) {
- GL(glUniform1f(u_id, SDL_GetTicks() / 1e3f));
+ if (!G.pause) {
+ GL(glUniform1f(u_id, SDL_GetTicks() / 1e3f));
+ }
}
if (Is3D()) {
@@ -712,7 +715,7 @@ SDL_AppResult SDLCALL SDL_AppIterate(void*)
SDL_GetWindowSize(G.wnd, NULL, &wnd_height);
if (!G.ui_hidden) {
ImGui::SetNextWindowPos(ImVec2(15.0f, 15.0f), ImGuiCond_Once);
- ImGui::SetNextWindowSize(ImVec2(200.0f, wnd_height - 30.0f), ImGuiCond_Once);
+ ImGui::SetNextWindowSize(ImVec2(300.0f, wnd_height - 30.0f), ImGuiCond_Once);
ImGuiWindowFlags flags =
ImGuiWindowFlags_NoTitleBar |
ImGuiWindowFlags_NoMove |
@@ -720,6 +723,7 @@ SDL_AppResult SDLCALL SDL_AppIterate(void*)
if (ImGui::Begin("Test", NULL, flags)) {
ImGui::SeparatorText("Controls");
ImGui::Text("Tab: Toggle UI");
+ ImGui::Checkbox("Pause time", &G.pause);
if (G.sm.uniforms.size() > 0) {
ImGui::SeparatorText("Uniforms");
for (auto& u : G.sm.uniforms) {