hedgewars/hwengine.pas
changeset 6072 e3dc802965d6
parent 6021 652a199d4f38
child 6131 4e8816cf9459
--- a/hedgewars/hwengine.pas	Fri Sep 30 13:17:34 2011 +0400
+++ b/hedgewars/hwengine.pas	Fri Sep 30 12:55:04 2011 +0200
@@ -163,15 +163,11 @@
     while isTerminated = false do
     begin
         SDL_PumpEvents();
-{$IFDEF SDL13}
-        while SDL_PeepEvents(@event, 1, SDL_GETEVENT, SDL_FIRSTEVENT, SDL_LASTEVENT) > 0 do
-{$ELSE}
-        while SDL_PeepEvents(@event, 1, SDL_GETEVENT, SDL_ALLEVENTS) > 0 do
-{$ENDIF}
+        while SDL_PeepEvents(@event, 1, SDL_GETEVENT, {$IFDEF SDL13}SDL_FIRSTEVENT, SDL_LASTEVENT{$ELSE}SDL_ALLEVENTS{$ENDIF}) > 0 do
         begin
             case event.type_ of
+{$IFDEF SDL13}
                 SDL_KEYDOWN: if GameState = gsChat then
-{$IFDEF SDL13}
                     // sdl on iphone supports only ashii keyboards and the unicode field is deprecated in sdl 1.3
                     KeyPressChat(event.key.keysym.sym);
                 SDL_WINDOWEVENT:
@@ -196,6 +192,7 @@
                         cScreenResizeDelay:= RealTicks+500;
                         end;
 {$ELSE}
+                SDL_KEYDOWN: if GameState = gsChat then
                     KeyPressChat(event.key.keysym.unicode);
                 SDL_MOUSEBUTTONDOWN: if event.button.button = SDL_BUTTON_WHEELDOWN then wheelDown:= true;
                 SDL_MOUSEBUTTONUP: if event.button.button = SDL_BUTTON_WHEELUP then wheelUp:= true;
@@ -224,6 +221,7 @@
                 SDL_QUITEV: isTerminated:= true
             end; //end case event.type_ of
         end; //end while SDL_PollEvent(@event) <> 0 do
+
         if (cScreenResizeDelay <> 0) and (cScreenResizeDelay < RealTicks) and ((cNewScreenWidth <> cScreenWidth) or (cNewScreenHeight <> cScreenHeight)) then
             begin
             cScreenResizeDelay:= 0;
@@ -237,25 +235,21 @@
             end;
 
         if isTerminated = false then
-        begin
+            begin
             CurrTime:= SDL_GetTicks;
             if PrevTime + longword(cTimerInterval) <= CurrTime then
-            begin
+                begin
                 DoTimer(CurrTime - PrevTime);
                 PrevTime:= CurrTime
-            end
+                end
             else SDL_Delay(1);
             IPCCheckSock();
-        end;
+            end;
     end;
 end;
 
 ///////////////
-{$IFDEF HWLIBRARY}
-procedure Game(gameArgs: PPChar); cdecl; export;
-{$ELSE}
-procedure Game;
-{$ENDIF}
+procedure Game{$IFDEF HWLIBRARY}(gameArgs: PPChar); cdecl; export{$ENDIF};
 var p: TPathType;
     s: shortstring;
     i: LongInt;