how can I implement a slow smooth background scrolling in sdl
<p>I am trying to implement background scrolling using SDL 2.
As far as I understand one can only move source rectangle by an integer value.
My scrolling works fine when I move it by one every iteration of the game loop.
But I want to move it slower. I tried to move it using this code</p>

<pre><code>    moved += speed;
    if (moved &gt;= 1.0) {
        ++src_rect.x;
        moved -= 1;
    }
</code></pre>

<p>Here <code>moved</code> and <code>speed</code> are <code>double</code>s . I want my background to move something like ten times slower, therefore I set <code>speed</code> to <code>0.1</code>. It does move ten times slower, but the animation is no longer smooth. It kind of jumps from one pixel to another, which looks and feels ugly when the speed is low.</p>

<p>I am thinking of making my background larger and scrolling it using an integer. Maybe when background is large enough the speed of <code>1</code> will seem slower.</p>

<p>Is there a way to scroll not a very large background slowly and smoothly and the same time?</p>

<p>Thanks.</p>