The SDL forums have moved to discourse.libsdl.org.
This is just a read-only archive of the previous forums, to keep old links working.


SDL Forum Index
SDL
Simple Directmedia Layer Forums
Strange timing bug on Android
ProphetOfDoom


Joined: 26 Jun 2016
Posts: 1
Hi there,

I'm using SDL2-2.0.4 on an Ubuntu 15.10 machine targeting Android API level 21. The device I'm testing on is an 8 inch tablet, a Samsung Galaxy Tab S2 with Android 6.0.1 installed.
At first I thought this was a problem with my game logic, but it turns out not. The problem also occurs with the testgles2.c example program that comes with the SDL source. Basically, the first time a surface is created, the game (or example) seems to run extremely fast. In fact, the test program is so fast that you can't recognise that what you're seeing is a cuboid - it just looks like a blur of colours. Then, when the surface is destroyed and recreated, it runs much slower and is clearly a spinning cuboid. As I said, the same thing happens with my game - a massive speed decrease (I'd estimate about 10-fold) after the surface is destroyed and recreated. This happens for instance when I press the device's physical home button. It's definitely related to surface destruction, as when I put the device to sleep with the power button then wake it up again, everything's still lightning fast.
This is concerning for me as I want my game to work across a range of devices and don't know which speed is the device's "natural" speed.
Can anyone help? Is this a known issue? Which speed is the "correct" speed? Should I blame SDL or my tablet? Should I just "work around" this problem?