hedgewars/hwengine.pas
changeset 6917 4889c2b779b4
parent 6863 4d1ce4b4f7c6
child 6952 7f70f37bbf08
equal deleted inserted replaced
6916:50243b6ffab5 6917:4889c2b779b4
    84             GameState:= gsGame;
    84             GameState:= gsGame;
    85             end;
    85             end;
    86         gsConfirm, gsGame:
    86         gsConfirm, gsGame:
    87             begin
    87             begin
    88             DrawWorld(Lag); // never place between ProcessKbd and DoGameTick - bugs due to /put cmd and isCursorVisible
    88             DrawWorld(Lag); // never place between ProcessKbd and DoGameTick - bugs due to /put cmd and isCursorVisible
    89             ProcessKbd;
    89 //            ProcessKbd;
    90             DoGameTick(Lag);
    90             DoGameTick(Lag);
    91             ProcessVisualGears(Lag);
    91             ProcessVisualGears(Lag);
    92             end;
    92             end;
    93         gsChat:
    93         gsChat:
    94             begin
    94             begin
   166             case event.type_ of
   166             case event.type_ of
   167 {$IFDEF SDL13}
   167 {$IFDEF SDL13}
   168                 SDL_KEYDOWN:
   168                 SDL_KEYDOWN:
   169                 if GameState = gsChat then
   169                 if GameState = gsChat then
   170                     // sdl on iphone supports only ashii keyboards and the unicode field is deprecated in sdl 1.3
   170                     // sdl on iphone supports only ashii keyboards and the unicode field is deprecated in sdl 1.3
   171                     KeyPressChat(event.key.keysym.sym);
   171                     KeyPressChat(SDL_GetKeyFromScancode(event.key.keysym.sym))//TODO correct for keymodifiers
       
   172                 else
       
   173                     ProcessKey(event.key);
       
   174                 SDL_KEYUP:
       
   175                 if GameState <> gsChat then
       
   176                     ProcessKey(event.key);
   172                     
   177                     
   173                 SDL_WINDOWEVENT:
   178                 SDL_WINDOWEVENT:
   174                     if event.window.event = SDL_WINDOWEVENT_SHOWN then
   179                     if event.window.event = SDL_WINDOWEVENT_SHOWN then
   175                         begin
   180                         begin
   176                         cHasFocus:= true;
   181                         cHasFocus:= true;
   205                 SDL_FINGERUP:
   210                 SDL_FINGERUP:
   206                     onTouchUp(event.tfinger.x, event.tfinger.y, event.tfinger.fingerId);
   211                     onTouchUp(event.tfinger.x, event.tfinger.y, event.tfinger.fingerId);
   207 {$ELSE}
   212 {$ELSE}
   208                 SDL_KEYDOWN:
   213                 SDL_KEYDOWN:
   209                     if GameState = gsChat then
   214                     if GameState = gsChat then
   210                         KeyPressChat(event.key.keysym.unicode);
   215                         KeyPressChat(event.key.keysym.unicode)
       
   216                     else
       
   217                         ProcessKey(event.key);
       
   218                 SDL_KEYUP:
       
   219                 if GameState <> gsChat then
       
   220                     ProcessKey(event.key);
   211                     
   221                     
   212                 SDL_MOUSEBUTTONDOWN:
   222                 SDL_MOUSEBUTTONDOWN:
   213                     if event.button.button = SDL_BUTTON_WHEELDOWN then
   223                     ProcessMouse(event.button, true); 
   214                         wheelDown:= true;
       
   215                 
       
   216                 SDL_MOUSEBUTTONUP:
   224                 SDL_MOUSEBUTTONUP:
   217                     if event.button.button = SDL_BUTTON_WHEELUP then
   225                     ProcessMouse(event.button, false); 
   218                         wheelUp:= true;
       
   219                     
   226                     
   220                 SDL_ACTIVEEVENT:
   227                 SDL_ACTIVEEVENT:
   221                     if (event.active.state and SDL_APPINPUTFOCUS) <> 0 then
   228                     if (event.active.state and SDL_APPINPUTFOCUS) <> 0 then
   222                         begin
   229                         begin
   223                         prevFocusState:= cHasFocus;
   230                         prevFocusState:= cHasFocus;