Compile fix for android.

"ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement]"

Moving some variable declarations to the top of Android_SetScreenResolution()
This commit is contained in:
Sam Lantinga 2017-03-14 07:22:08 -07:00
parent 6814f5dbc0
commit 22161480ee
1 changed files with 5 additions and 3 deletions

View File

@ -193,6 +193,8 @@ Android_VideoQuit(_THIS)
void void
Android_SetScreenResolution(int width, int height, Uint32 format, float rate) Android_SetScreenResolution(int width, int height, Uint32 format, float rate)
{ {
SDL_VideoDevice* device;
SDL_VideoDisplay *display;
Android_ScreenWidth = width; Android_ScreenWidth = width;
Android_ScreenHeight = height; Android_ScreenHeight = height;
Android_ScreenFormat = format; Android_ScreenFormat = format;
@ -204,10 +206,10 @@ Android_SetScreenResolution(int width, int height, Uint32 format, float rate)
example happen when the Activity enters or exists immersive mode, example happen when the Activity enters or exists immersive mode,
which can happen after VideoInit(). which can happen after VideoInit().
*/ */
SDL_VideoDevice* device = SDL_GetVideoDevice(); device = SDL_GetVideoDevice();
if (device && device->num_displays > 0) if (device && device->num_displays > 0)
{ {
SDL_VideoDisplay* display = &device->displays[0]; display = &device->displays[0];
display->desktop_mode.format = Android_ScreenFormat; display->desktop_mode.format = Android_ScreenFormat;
display->desktop_mode.w = Android_ScreenWidth; display->desktop_mode.w = Android_ScreenWidth;
display->desktop_mode.h = Android_ScreenHeight; display->desktop_mode.h = Android_ScreenHeight;
@ -219,7 +221,7 @@ Android_SetScreenResolution(int width, int height, Uint32 format, float rate)
/* Force the current mode to match the resize otherwise the SDL_WINDOWEVENT_RESTORED event /* Force the current mode to match the resize otherwise the SDL_WINDOWEVENT_RESTORED event
* will fall back to the old mode */ * will fall back to the old mode */
SDL_VideoDisplay *display = SDL_GetDisplayForWindow(Android_Window); display = SDL_GetDisplayForWindow(Android_Window);
display->current_mode.format = format; display->current_mode.format = format;
display->current_mode.w = width; display->current_mode.w = width;