hedgewars/uStore.pas
changeset 11518 02a13be714d2
parent 11507 bd9a2f1b0080
child 11532 bf86c6cb9341
equal deleted inserted replaced
11517:b3ee79e8e3b9 11518:02a13be714d2
  1064    IMO we should rely on the gl_config defaults from SDL, and use
  1064    IMO we should rely on the gl_config defaults from SDL, and use
  1065    SDL_GL_GetAttribute to possibly post warnings if any bad values are set.
  1065    SDL_GL_GetAttribute to possibly post warnings if any bad values are set.
  1066  *)
  1066  *)
  1067     SetupOpenGLAttributes();
  1067     SetupOpenGLAttributes();
  1068 {$ENDIF}
  1068 {$ENDIF}
       
  1069 
  1069     // these values in x and y make the window appear in the center
  1070     // these values in x and y make the window appear in the center
  1070     x:= SDL_WINDOWPOS_CENTERED_MASK;
  1071     x:= SDL_WINDOWPOS_CENTERED_MASK;
  1071     y:= SDL_WINDOWPOS_CENTERED_MASK;
  1072     y:= SDL_WINDOWPOS_CENTERED_MASK;
  1072     // SDL_WINDOW_RESIZABLE makes the window resizable and
       
  1073     //  respond to rotation events on mobile devices
       
  1074     flags:= SDL_WINDOW_OPENGL or SDL_WINDOW_SHOWN or SDL_WINDOW_RESIZABLE;
       
  1075 
       
  1076     {$IFDEF MOBILE}
       
  1077     if isPhone() then
       
  1078         SDL_SetHint('SDL_IOS_ORIENTATIONS','LandscapeLeft LandscapeRight');
       
  1079     // no need for borders on mobile devices
       
  1080     flags:= flags or SDL_WINDOW_BORDERLESS;
       
  1081     {$ENDIF}
       
  1082 
       
  1083     if cFullScreen then
       
  1084         flags:= flags or SDL_WINDOW_FULLSCREEN;
       
  1085 
  1073 
  1086     if SDLwindow = nil then
  1074     if SDLwindow = nil then
       
  1075         begin
       
  1076 
       
  1077         // SDL_WINDOW_RESIZABLE makes the window resizable and
       
  1078         //  respond to rotation events on mobile devices
       
  1079         flags:= SDL_WINDOW_OPENGL or SDL_WINDOW_SHOWN or SDL_WINDOW_RESIZABLE;
       
  1080 
       
  1081         {$IFDEF MOBILE}
       
  1082         if isPhone() then
       
  1083             SDL_SetHint('SDL_IOS_ORIENTATIONS','LandscapeLeft LandscapeRight');
       
  1084         // no need for borders on mobile devices
       
  1085         flags:= flags or SDL_WINDOW_BORDERLESS;
       
  1086         {$ENDIF}
       
  1087 
       
  1088         if cFullScreen then
       
  1089             flags:= flags or SDL_WINDOW_FULLSCREEN;
       
  1090 
  1087         SDLwindow:= SDL_CreateWindow(PChar('Hedgewars'), x, y, cScreenWidth, cScreenHeight, flags);
  1091         SDLwindow:= SDL_CreateWindow(PChar('Hedgewars'), x, y, cScreenWidth, cScreenHeight, flags);
       
  1092         end
       
  1093     // we're toggling
       
  1094     else if Length(s) = 0 then
       
  1095         begin
       
  1096         if cFullScreen then
       
  1097             begin
       
  1098             SDL_SetWindowSize(SDLwindow, cScreenWidth, cScreenHeight);
       
  1099             SDL_SetWindowFullscreen(SDLwindow, SDL_WINDOW_FULLSCREEN);
       
  1100             end
       
  1101         else
       
  1102             begin
       
  1103             SDL_SetWindowFullscreen(SDLwindow, 0);
       
  1104             SDL_SetWindowSize(SDLwindow, cScreenWidth, cScreenHeight);
       
  1105             SDL_SetWindowPosition(SDLwindow, x, y);
       
  1106             end;
       
  1107         updateViewLimits();
       
  1108         end;
       
  1109 
  1088     if SDLCheck(SDLwindow <> nil, 'SDL_CreateWindow', true) then exit;
  1110     if SDLCheck(SDLwindow <> nil, 'SDL_CreateWindow', true) then exit;
  1089 
  1111 
  1090     // load engine ico
  1112     // load engine ico
  1091     {$IFNDEF DARWIN}
  1113     {$IFNDEF DARWIN}
  1092     ico:= LoadDataImage(ptGraphics, 'hwengine', ifIgnoreCaps);
  1114     ico:= LoadDataImage(ptGraphics, 'hwengine', ifIgnoreCaps);