Commit Graph

24 Commits

Author SHA1 Message Date
Sam Lantinga
a9072159b2 Updated copyright for 2018 2018-01-03 10:03:25 -08:00
Sam Lantinga
868f6e95b8 Fixed bug 3605 - Software renderer no longer renders after Android screen orientation change
Sylvain

This still happens with the current trunk version.  (software renderer of testdrawchessboard.c)

When there is a rotation, the window size changed and the internal surface is marked as "surface_valid == SDL_FALSE".
And all further call fails.

SDL_video.c :

2478 void
2479 SDL_OnWindowResized(SDL_Window * window)
2480 {
2481     window->surface_valid = SDL_FALSE;
2482     SDL_SendWindowEvent(window, SDL_WINDOWEVENT_SIZE_CHANGED, window->w, window->h);
2483 }

some error set to :
2233         return SDL_SetError("Window surface is invalid, please call SDL_GetWindowSurface() to get a new surface");


So, this seems to be the behavior of the API ...


In the loop() function of testdrawchessboard.c, we can recreate the surface/renderer :

 65        if (e.type == SDL_WINDOWEVENT)
 66        {
 67             if (e.window.event == SDL_WINDOWEVENT_SIZE_CHANGED)
 68             {
 69                surface = SDL_GetWindowSurface(window);
 70                renderer = SDL_CreateSoftwareRenderer(surface);
 71             }
 72             /* Clear the rendering surface with the specified color */
 73             SDL_SetRenderDrawColor(renderer, 0xFF, 0xFF, 0xFF, 0xFF);
 74             SDL_RenderClear(renderer);
 75        }

And it displays correctly.
2017-08-13 21:12:14 -07:00
Sam Lantinga
d77ab77a7a Updated copyright for 2017 2017-01-01 18:33:28 -08:00
Philipp Wiesemann
167819be2c Removed not needed SDL_WINDOW_SHOWN from chessboard test program. 2016-03-28 21:02:30 +02:00
Sam Lantinga
255c182471 Updated copyright to 2016 2016-01-02 10:10:34 -08:00
Philipp Wiesemann
9677d33467 Replaced tabs with spaces in test programs. 2015-11-25 21:39:28 +01:00
Philipp Wiesemann
16c3694035 Added missing SDL_Quit() in test program. 2015-08-09 20:01:01 +02:00
Philipp Wiesemann
3834b61647 Fixed not needed calculation in test program. 2015-06-04 17:52:27 +02:00
Sam Lantinga
78f2198e6c Updated the copyright year to 2015 2015-05-26 06:27:46 -07:00
Philipp Wiesemann
dbd2fc4f33 Fixed undefined key access in test program. 2015-05-21 21:25:14 +02:00
Philipp Wiesemann
a96660cbde Added missing loop cancel for Emscripten in test programs. 2015-05-18 21:21:14 +02:00
Philipp Wiesemann
adceb46138 Fixed handling only one event per frame in test program. 2015-05-18 21:12:16 +02:00
Ryan C. Gordon
a9626cb76e Initial merge of Emscripten port!
With this commit, you can compile SDL2 with Emscripten
( http://emscripten.org/ ), and make your SDL-based C/C++ program
into a web app.

This port was due to the efforts of several people, including: Charlie Birks,
Sathyanarayanan Gunasekaran, Jukka Jylänki, Alon Zakai, Edward Rudd,
Bruce Mitchener, and Martin Gerhardy. (Thanks, everyone!)
2014-12-18 00:19:52 -05:00
Philipp Wiesemann
c626378e71 Fixed typos in test program. 2014-08-20 22:51:56 +02:00
Philipp Wiesemann
3d544f92eb Fixed not needed standard includes in test program. 2014-08-20 22:49:59 +02:00
Philipp Wiesemann
4406b42cfe Fixed warnings about unused value in test program. 2014-08-20 22:47:07 +02:00
Sam Lantinga
dba255c1e5 Fixed bug 2374 - Update copyright for 2014...
Is it that time already??
2014-02-02 00:53:27 -08:00
Sam Lantinga
f92e7a48c8 Fixed bug 2294 - testdrawchessboard.c Sets the render color alpha to 0x0.
Brandon Schaefer

This means everything will render black if the software rendering backend selects a pixel format that supports alpha. So it seems best to at lease assume alpha is supported.
2013-12-11 21:13:45 -08:00
Sam Lantinga
9cbfde6d89 Fixed bug 2190 - test/testdrawchessboard.c line endings
Joseph Carter
test/testdrawchessboard.c checks out of hg with DOS line endings on non-dos systems.  Fixed via:

perl -pi -e 's/\r//g' test/testdrawchessboard.c
2013-11-03 11:27:06 -08:00
Andreas Schiffler
7582a71d05 Fix bug 2034: replace printf by SDL_Log in tests; update loopwave VS solution: copy missing dependency 2013-08-14 23:30:10 -07:00
Philipp Wiesemann
1de7a622ab Changed test program to be more compatible C. 2013-07-27 21:11:12 +02:00
Philipp Wiesemann
719f8227e0 Removed unused variable from test program. 2013-07-27 21:07:07 +02:00
Philipp Wiesemann
81450906db Corrected words in comments of test programs. 2013-07-27 21:02:50 +02:00
Sam Lantinga
aab0048d87 Added example of using the software renderer and window surface API, contributed by Nitin Jain. 2013-07-27 03:48:23 -07:00