hedgewars/hwengine.pas
changeset 3523 6592fbb969da
parent 3495 a6b4f351d400
child 3525 1d7b056ff866
equal deleted inserted replaced
3522:156c04c6a3d8 3523:6592fbb969da
   138         gsExit: begin
   138         gsExit: begin
   139                 isTerminated:= true;
   139                 isTerminated:= true;
   140                 end;
   140                 end;
   141         end;
   141         end;
   142 
   142 
   143     SDL_GL_SwapBuffers();
       
   144 {$IFDEF SDL13}
   143 {$IFDEF SDL13}
   145     SDL_RenderPresent();
   144     SDL_RenderPresent();
       
   145 {$ELSE}
       
   146     SDL_GL_SwapBuffers();
   146 {$ENDIF}
   147 {$ENDIF}
   147 {$IFNDEF IPHONEOS}
   148 {$IFNDEF IPHONEOS}
   148     // not going to make captures on the iPhone
   149     // not going to make captures on the iPhone
   149     if flagMakeCapture then
   150     if flagMakeCapture then
   150     begin
   151     begin
   181     event: TSDL_Event;
   182     event: TSDL_Event;
   182 begin
   183 begin
   183     PrevTime:= SDL_GetTicks;
   184     PrevTime:= SDL_GetTicks;
   184     while isTerminated = false do
   185     while isTerminated = false do
   185     begin
   186     begin
   186 {$IFNDEF IPHONEOS}
   187 
   187 // have to remove this cycle because otherwise it segfaults at exit
       
   188         while SDL_PollEvent(@event) <> 0 do
   188         while SDL_PollEvent(@event) <> 0 do
   189         begin
   189         begin
   190             case event.type_ of
   190             case event.type_ of
   191                 SDL_KEYDOWN: if GameState = gsChat then KeyPressChat(event.key.keysym.unicode);
   191                 SDL_KEYDOWN: if GameState = gsChat then KeyPressChat(event.key.keysym.unicode);
   192 {$IFDEF SDL13}
   192 {$IFDEF SDL13}
   208                 SDL_JOYBUTTONDOWN: ControllerButtonEvent(event.jbutton.which, event.jbutton.button, true);
   208                 SDL_JOYBUTTONDOWN: ControllerButtonEvent(event.jbutton.which, event.jbutton.button, true);
   209                 SDL_JOYBUTTONUP: ControllerButtonEvent(event.jbutton.which, event.jbutton.button, false);
   209                 SDL_JOYBUTTONUP: ControllerButtonEvent(event.jbutton.which, event.jbutton.button, false);
   210                 SDL_QUITEV: isTerminated:= true
   210                 SDL_QUITEV: isTerminated:= true
   211             end; // end case event.type_
   211             end; // end case event.type_
   212         end; // end while SDL_PollEvent(@event) <> 0
   212         end; // end while SDL_PollEvent(@event) <> 0
   213 {$ENDIF}
       
   214 
   213 
   215         if isTerminated = false then
   214         if isTerminated = false then
   216         begin
   215         begin
   217             CurrTime:= SDL_GetTicks;
   216             CurrTime:= SDL_GetTicks;
   218             if PrevTime + cTimerInterval <= CurrTime then
   217             if PrevTime + cTimerInterval <= CurrTime then