hedgewars/hwengine.pas
changeset 15304 3bf780084c86
parent 14901 63357ed39886
equal deleted inserted replaced
15303:976b3ed9b1fd 15304:3bf780084c86
   228 {$ENDIF}
   228 {$ENDIF}
   229                         SDL_WINDOWEVENT_RESTORED:
   229                         SDL_WINDOWEVENT_RESTORED:
   230                                 begin
   230                                 begin
   231                                 if GameState = gsSuspend then
   231                                 if GameState = gsSuspend then
   232                                     GameState:= previousGameState;
   232                                     GameState:= previousGameState;
       
   233                                 cWindowedMaximized:= false;
   233 {$IFDEF ANDROID}
   234 {$IFDEF ANDROID}
   234                                 //This call is used to reinitialize the glcontext and reload the textures
   235                                 //This call is used to reinitialize the glcontext and reload the textures
   235                                 ParseCommand('fullscr '+intToStr(LongInt(cFullScreen)), true);
   236                                 ParseCommand('fullscr '+intToStr(LongInt(cFullScreen)), true);
   236 {$ENDIF}
   237 {$ENDIF}
   237                                 end;
   238                                 end;
       
   239                         SDL_WINDOWEVENT_MAXIMIZED:
       
   240                                 cWindowedMaximized:= true;
   238                         SDL_WINDOWEVENT_RESIZED:
   241                         SDL_WINDOWEVENT_RESIZED:
   239                                 begin
   242                                 begin
   240                                 cNewScreenWidth:= max(2 * (event.window.data1 div 2), cMinScreenWidth);
   243                                 cNewScreenWidth:= max(2 * (event.window.data1 div 2), cMinScreenWidth);
   241                                 cNewScreenHeight:= max(2 * (event.window.data2 div 2), cMinScreenHeight);
   244                                 cNewScreenHeight:= max(2 * (event.window.data2 div 2), cMinScreenHeight);
   242                                 cScreenResizeDelay:= RealTicks + 500{$IFDEF IPHONEOS}div 2{$ENDIF};
   245                                 cScreenResizeDelay:= RealTicks + 500{$IFDEF IPHONEOS}div 2{$ENDIF};
   300             cWindowedHeight:= cNewScreenHeight;
   303             cWindowedHeight:= cNewScreenHeight;
   301             cScreenWidth:= cWindowedWidth;
   304             cScreenWidth:= cWindowedWidth;
   302             cScreenHeight:= cWindowedHeight;
   305             cScreenHeight:= cWindowedHeight;
   303 
   306 
   304             ParseCommand('fullscr '+intToStr(LongInt(cFullScreen)), true);
   307             ParseCommand('fullscr '+intToStr(LongInt(cFullScreen)), true);
   305             WriteLnToConsole('window resize: ' + IntToStr(cScreenWidth) + ' x ' + IntToStr(cScreenHeight));
   308             if cWindowedMaximized then
       
   309                 WriteLnToConsole('window resize: ' + IntToStr(cScreenWidth) + ' x ' + IntToStr(cScreenHeight) + ' (maximized)')
       
   310             else
       
   311                 WriteLnToConsole('window resize: ' + IntToStr(cScreenWidth) + ' x ' + IntToStr(cScreenHeight));
   306             ScriptOnScreenResize();
   312             ScriptOnScreenResize();
   307             InitCameraBorders();
   313             InitCameraBorders();
   308             InitTouchInterface();
   314             InitTouchInterface();
   309             InitZoom(zoomValue);
   315             InitZoom(zoomValue);
   310             SendIPC('W' + IntToStr(cScreenWidth) + 'x' + IntToStr(cScreenHeight));
   316             if cWindowedMaximized then
       
   317                 SendIPC('W' + IntToStr(cScreenWidth) + 'x' + IntToStr(cScreenHeight) + 'M')
       
   318             else
       
   319                 SendIPC('W' + IntToStr(cScreenWidth) + 'x' + IntToStr(cScreenHeight));
   311         end;
   320         end;
   312 
   321 
   313         CurrTime:= SDL_GetTicks();
   322         CurrTime:= SDL_GetTicks();
   314         if PrevTime + longword(cTimerInterval) <= CurrTime then
   323         if PrevTime + longword(cTimerInterval) <= CurrTime then
   315         begin
   324         begin