From c08e51441f8daf3cf2c67fc0a5ce44502d13f37f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=91=D1=80=D0=B0=D0=BD=D0=B8=D0=BC=D0=B8=D1=80=20=D0=9A?= =?UTF-8?q?=D0=B0=D1=80=D0=B0=D1=9F=D0=B8=D1=9B?= Date: Mon, 22 Aug 2022 21:49:26 -0700 Subject: [PATCH] 47-pixelformats: Scroll checkerboard. --- examples/47-pixelformats/pixelformats.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/examples/47-pixelformats/pixelformats.cpp b/examples/47-pixelformats/pixelformats.cpp index b80048c13..31abc208a 100644 --- a/examples/47-pixelformats/pixelformats.cpp +++ b/examples/47-pixelformats/pixelformats.cpp @@ -55,8 +55,6 @@ public: ); const uint32_t flags = 0 - | BGFX_SAMPLER_U_CLAMP - | BGFX_SAMPLER_V_CLAMP | BGFX_SAMPLER_MIN_POINT | BGFX_SAMPLER_MAG_POINT ; @@ -246,8 +244,13 @@ public: { if (bgfx::isValid(m_checkerboard) ) { + static int64_t timeOffset = bx::getHPCounter(); + const float time = float( (bx::getHPCounter()-timeOffset)/double(bx::getHPFrequency() ) ); + const float xx = bx::sin(time * 0.17f); + const float yy = bx::cos(time * 0.13f); + ImGui::SetCursorScreenPos(previewPos); - ImGui::Image(m_checkerboard, previewSize); + ImGui::Image(m_checkerboard, previewSize, ImVec2(xx, yy), ImVec2(xx+1.0f, yy+1.0f) ); } ImGui::SetCursorScreenPos(previewPos);