hedgewars/hwengine.pas
branchhedgeroid
changeset 5725 e27100a0e2d0
parent 5644 4ad07103cfae
parent 5686 3f2e6ec7719a
child 5824 2e5835130d9a
equal deleted inserted replaced
5671:ba4c3a4c8b09 5725:e27100a0e2d0
    99                     end;
    99                     end;
   100                 end;
   100                 end;
   101         gsExit: begin
   101         gsExit: begin
   102                 isTerminated:= true;
   102                 isTerminated:= true;
   103                 end;
   103                 end;
   104         gsSuspend: exit;
       
   105         end;
   104         end;
   106 
   105 
   107 {$IFDEF SDL13}
   106 {$IFDEF SDL13}
   108     SDL_GL_SwapWindow(SDLwindow);
   107     SDL_GL_SwapWindow(SDLwindow);
   109 {$ELSE}
   108 {$ELSE}
   182                         prevFocusState:= cHasFocus;
   181                         prevFocusState:= cHasFocus;
   183                         cHasFocus:= event.active.gain = 1;
   182                         cHasFocus:= event.active.gain = 1;
   184                         if prevFocusState xor cHasFocus then
   183                         if prevFocusState xor cHasFocus then
   185                             onFocusStateChanged()
   184                             onFocusStateChanged()
   186                         end;
   185                         end;
       
   186                 SDL_VIDEORESIZE: begin
       
   187                     // using lower values causes widget overlap and video issues
       
   188                     if event.resize.w > cMinScreenWidth then cScreenWidth:= event.resize.w
       
   189                     else cScreenWidth:= cMinScreenWidth;
       
   190                     if event.resize.h > cMinScreenHeight then cScreenHeight:= event.resize.h
       
   191                     else cScreenHeight:= cMinScreenHeight;
       
   192                     ParseCommand('fullscr '+intToStr(LongInt(cFullScreen)), true);
       
   193                     WriteLnToConsole('window resize');
       
   194                     InitCameraBorders();
       
   195                     end;
   187 {$ENDIF}
   196 {$ENDIF}
   188                 SDL_JOYAXISMOTION: ControllerAxisEvent(event.jaxis.which, event.jaxis.axis, event.jaxis.value);
   197                 SDL_JOYAXISMOTION: ControllerAxisEvent(event.jaxis.which, event.jaxis.axis, event.jaxis.value);
   189                 SDL_JOYHATMOTION: ControllerHatEvent(event.jhat.which, event.jhat.hat, event.jhat.value);
   198                 SDL_JOYHATMOTION: ControllerHatEvent(event.jhat.which, event.jhat.hat, event.jhat.value);
   190                 SDL_JOYBUTTONDOWN: ControllerButtonEvent(event.jbutton.which, event.jbutton.button, true);
   199                 SDL_JOYBUTTONDOWN: ControllerButtonEvent(event.jbutton.which, event.jbutton.button, true);
   191                 SDL_JOYBUTTONUP: ControllerButtonEvent(event.jbutton.which, event.jbutton.button, false);
   200                 SDL_JOYBUTTONUP: ControllerButtonEvent(event.jbutton.which, event.jbutton.button, false);
   242     cAltDamage:= gameArgs[8] = '1';
   251     cAltDamage:= gameArgs[8] = '1';
   243     val(gameArgs[9], rotationQt);
   252     val(gameArgs[9], rotationQt);
   244     recordFileName:= gameArgs[10];
   253     recordFileName:= gameArgs[10];
   245     cStereoMode:= smNone;
   254     cStereoMode:= smNone;
   246 {$ENDIF}
   255 {$ENDIF}
       
   256     cMinScreenWidth:= cScreenWidth;
       
   257     cMinScreenHeight:= cScreenHeight;
       
   258     cOrigScreenWidth:= cScreenWidth;
       
   259     cOrigScreenHeight:= cScreenHeight;
       
   260     if 480 < cMinScreenWidth then cMinScreenWidth:= 480;
       
   261     if 320 < cMinScreenHeight then cMinScreenHeight:= 320;
   247 
   262 
   248     initEverything(true);
   263     initEverything(true);
   249     WriteLnToConsole('Hedgewars ' + cVersionString + ' engine (network protocol: ' + inttostr(cNetProtoVersion) + ')');
   264     WriteLnToConsole('Hedgewars ' + cVersionString + ' engine (network protocol: ' + inttostr(cNetProtoVersion) + ')');
   250     AddFileLog('Prefix: "' + PathPrefix +'"');
   265     AddFileLog('Prefix: "' + PathPrefix +'"');
   251     AddFileLog('UserPrefix: "' + UserPathPrefix +'"');
   266     AddFileLog('UserPrefix: "' + UserPathPrefix +'"');