| Summary: | Black screen on Android with SDL 2.0.12 while 2.0.8 worked fine | ||
|---|---|---|---|
| Product: | SDL | Reporter: | Steve Robinson <ssrobins> |
| Component: | render | Assignee: | Sam Lantinga <slouken> |
| Status: | RESOLVED INVALID | QA Contact: | Sam Lantinga <slouken> |
| Severity: | normal | ||
| Priority: | P2 | CC: | sylvain.becker |
| Version: | 2.0.12 | ||
| Hardware: | ARM | ||
| OS: | Android (All) | ||
| Attachments: | Example code | ||
|
Description
Steve Robinson
2020-04-05 19:53:23 UTC
Hi, can you try to add to your test-case the usual event polling loop ? I had the event loop in my actual code, but I put in logic to only render the title screen once because it's completely static. So this example code is representative of that. When I remove that logic and repeatedly render my title screen, it does work. That will likely be my workaround, especially since the title screen will eventually not be static. I still wanted to log the issue because it was a change in behavior and it cost me some time figuring it out. I think it's because of modifications done to prevent other issues of synchronisation between java Activity and the main() thread, and switching pause/resume states. When the app starts, it switches from start->pause->resume states. Depending on orientation or because of the platform, and you can have small variation of timing, and something it goes several times to pause (eg background) state. You need to consider that you cannot use the SDL_Renderer and draw while your are in background. And to know whether you are in background/foreground you first need to poll the event loop(). You need to poll, to know if you are in bg or fg. and the loop is blocking just before entering in bg. If you check your log, I believe, your are trying to draw while the app is still in background. Makes sense, thanks for explaining it to me! |