hedgewars/hwengine.pas
changeset 9028 3a38c9453697
parent 8948 c8a6f789398d
child 9080 9b42757d7e71
equal deleted inserted replaced
9027:4b8e326251b3 9028:3a38c9453697
    91             PlayMusic;
    91             PlayMusic;
    92             SetScale(zoom);
    92             SetScale(zoom);
    93             ScriptCall('onGameStart');
    93             ScriptCall('onGameStart');
    94             GameState:= gsGame;
    94             GameState:= gsGame;
    95             end;
    95             end;
    96         gsConfirm, gsGame:
    96         gsConfirm, gsGame, gsChat:
    97             begin
       
    98             if not cOnlyStats then DrawWorld(Lag);
       
    99             DoGameTick(Lag);
       
   100             if not cOnlyStats then ProcessVisualGears(Lag);
       
   101             end;
       
   102         gsChat:
       
   103             begin
    97             begin
   104             if not cOnlyStats then DrawWorld(Lag);
    98             if not cOnlyStats then DrawWorld(Lag);
   105             DoGameTick(Lag);
    99             DoGameTick(Lag);
   106             if not cOnlyStats then ProcessVisualGears(Lag);
   100             if not cOnlyStats then ProcessVisualGears(Lag);
   107             end;
   101             end;
   166                     if GameState = gsChat then
   160                     if GameState = gsChat then
   167                         begin
   161                         begin
   168                     // sdl on iphone supports only ashii keyboards and the unicode field is deprecated in sdl 1.3
   162                     // sdl on iphone supports only ashii keyboards and the unicode field is deprecated in sdl 1.3
   169                         KeyPressChat(SDL_GetKeyFromScancode(event.key.keysym.sym), event.key.keysym.sym); //TODO correct for keymodifiers
   163                         KeyPressChat(SDL_GetKeyFromScancode(event.key.keysym.sym), event.key.keysym.sym); //TODO correct for keymodifiers
   170                         end
   164                         end
   171                     else
   165                     else 
   172                         ProcessKey(event.key);
   166                         if GameState >= gsGame then ProcessKey(event.key);
   173                 SDL_KEYUP:
   167                 SDL_KEYUP:
   174                     if GameState <> gsChat then
   168                     if (GameState <> gsChat) and (GameState >= gsGame) then
   175                         ProcessKey(event.key);
   169                         ProcessKey(event.key);
   176 
   170 
   177                 SDL_WINDOWEVENT:
   171                 SDL_WINDOWEVENT:
   178                     if event.window.event = SDL_WINDOWEVENT_SHOWN then
   172                     if event.window.event = SDL_WINDOWEVENT_SHOWN then
   179                     begin
   173                     begin
   211 {$ELSE}
   205 {$ELSE}
   212                 SDL_KEYDOWN:
   206                 SDL_KEYDOWN:
   213                     if GameState = gsChat then
   207                     if GameState = gsChat then
   214                         KeyPressChat(event.key.keysym.unicode, event.key.keysym.sym)
   208                         KeyPressChat(event.key.keysym.unicode, event.key.keysym.sym)
   215                     else
   209                     else
   216                         ProcessKey(event.key);
   210                         if GameState >= gsGame then ProcessKey(event.key);
   217                 SDL_KEYUP:
   211                 SDL_KEYUP:
   218                     if GameState <> gsChat then
   212                     if (GameState <> gsChat) and (GameState >= gsGame) then
   219                         ProcessKey(event.key);
   213                         ProcessKey(event.key);
   220 
   214 
   221                 SDL_MOUSEBUTTONDOWN:
   215                 SDL_MOUSEBUTTONDOWN:
   222                     if GameState = gsConfirm then
   216                     if GameState = gsConfirm then
   223                         ParseCommand('quit', true)
   217                         ParseCommand('quit', true)
   224                     else
   218                     else
   225                         ProcessMouse(event.button, true);
   219                         if (GameState >= gsGame) then ProcessMouse(event.button, true);
   226 
   220 
   227                 SDL_MOUSEBUTTONUP:
   221                 SDL_MOUSEBUTTONUP:
   228                     ProcessMouse(event.button, false);
   222                     if (GameState >= gsGame) then ProcessMouse(event.button, false);
   229 
   223 
   230                 SDL_ACTIVEEVENT:
   224                 SDL_ACTIVEEVENT:
   231                     if (event.active.state and SDL_APPINPUTFOCUS) <> 0 then
   225                     if (event.active.state and SDL_APPINPUTFOCUS) <> 0 then
   232                     begin
   226                     begin
   233                         prevFocusState:= cHasFocus;
   227                         prevFocusState:= cHasFocus;