Commit graph

25 commits

Author SHA1 Message Date
Sam Lantinga
af32a2f4cd Updated copyright for 2019 2019-01-04 22:01:14 -08:00
Sam Lantinga
346af016a5 Updated copyright for 2018 2018-01-03 10:03:25 -08:00
Sam Lantinga
851e3a72b1 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
1b24bfad38 Updated copyright for 2017 2017-01-01 18:33:28 -08:00
Philipp Wiesemann
ee01a42541 Removed not needed SDL_WINDOW_SHOWN from chessboard test program. 2016-03-28 21:02:30 +02:00
Sam Lantinga
7ee8dda270 Updated copyright to 2016 2016-01-02 10:10:34 -08:00
Philipp Wiesemann
da4d0e4a52 Replaced tabs with spaces in test programs. 2015-11-25 21:39:28 +01:00
Philipp Wiesemann
55792afb68 Added missing SDL_Quit() in test program. 2015-08-09 20:01:01 +02:00
Philipp Wiesemann
8c7a005cbd Fixed not needed calculation in test program. 2015-06-04 17:52:27 +02:00
Sam Lantinga
56b58afdbe Updated the copyright year to 2015 2015-05-26 06:27:46 -07:00
Philipp Wiesemann
a5c372da01 Fixed undefined key access in test program. 2015-05-21 21:25:14 +02:00
Philipp Wiesemann
566df69b69 Added missing loop cancel for Emscripten in test programs. 2015-05-18 21:21:14 +02:00
Philipp Wiesemann
204e676bfe Fixed handling only one event per frame in test program. 2015-05-18 21:12:16 +02:00
Ryan C. Gordon
de88474dda 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!)

--HG--
extra : rebase_source : 97af74c8a5121e926ebe89f123536b5dd6681695
2014-12-18 00:19:52 -05:00
Philipp Wiesemann
452ba51ebd Fixed typos in test program. 2014-08-20 22:51:56 +02:00
Philipp Wiesemann
3d122d4d7c Fixed not needed standard includes in test program. 2014-08-20 22:49:59 +02:00
Philipp Wiesemann
80ff7925b5 Fixed warnings about unused value in test program. 2014-08-20 22:47:07 +02:00
Sam Lantinga
d7940a513e Fixed bug 2374 - Update copyright for 2014...
Is it that time already??
2014-02-02 00:53:27 -08:00
Sam Lantinga
37b1229722 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
3d37a0f6c9 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
16a40598f6 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
1baa9e9bda Changed test program to be more compatible C. 2013-07-27 21:11:12 +02:00
Philipp Wiesemann
6b494e5eeb Removed unused variable from test program. 2013-07-27 21:07:07 +02:00
Philipp Wiesemann
c03703d90d Corrected words in comments of test programs. 2013-07-27 21:02:50 +02:00
Sam Lantinga
17482012af Added example of using the software renderer and window surface API, contributed by Nitin Jain. 2013-07-27 03:48:23 -07:00