Skip to content

Commit

Permalink
47-pixelformats: Scroll checkerboard.
Browse files Browse the repository at this point in the history
  • Loading branch information
bkaradzic committed Aug 23, 2022
1 parent 58e82fb commit c08e514
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions examples/47-pixelformats/pixelformats.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,6 @@ class ExamplePixelFormats : public entry::AppI
);

const uint32_t flags = 0
| BGFX_SAMPLER_U_CLAMP
| BGFX_SAMPLER_V_CLAMP
| BGFX_SAMPLER_MIN_POINT
| BGFX_SAMPLER_MAG_POINT
;
Expand Down Expand Up @@ -246,8 +244,13 @@ class ExamplePixelFormats : public entry::AppI
{
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);
Expand Down

0 comments on commit c08e514

Please sign in to comment.