hedgewars/hwengine.pas
changeset 2390 57fb33ab04a4
parent 2379 d62b1f224982
child 2392 a55dbef5cf31
equal deleted inserted replaced
2389:bc3e45a4d5fb 2390:57fb33ab04a4
   166 begin
   166 begin
   167 PrevTime:= SDL_GetTicks;
   167 PrevTime:= SDL_GetTicks;
   168 repeat
   168 repeat
   169 while SDL_PollEvent(@event) <> 0 do
   169 while SDL_PollEvent(@event) <> 0 do
   170 	case event.type_ of
   170 	case event.type_ of
   171 	{$IFDEF IPHONEOS}
   171 {$IFDEF IPHONEOS}
   172 		SDL_MOUSEMOTION: WriteLnToConsole('mouse number ' + inttostr(SDL_SelectMouse(event.motion.which)) + ' over ' + inttostr(SDL_GetNumMice()));
   172 		SDL_MOUSEMOTION: WriteLnToConsole('mouse number ' + inttostr(SDL_SelectMouse(event.motion.which)) + ' over ' + inttostr(SDL_GetNumMice()));
   173 	{$ELSE}
   173                 SDL_WINDOWEVENT:
       
   174 {$ELSE}
   174 		SDL_KEYDOWN: if GameState = gsChat then KeyPressChat(event.key.keysym.unicode);
   175 		SDL_KEYDOWN: if GameState = gsChat then KeyPressChat(event.key.keysym.unicode);
   175 	{$ENDIF}
   176                 SDL_ACTIVEEVENT:
   176 		SDL_ACTIVEEVENT: if (event.active.state and SDL_APPINPUTFOCUS) <> 0 then
   177 {$ENDIF}
       
   178                         if (event.active.state and SDL_APPINPUTFOCUS) <> 0 then
   177 				cHasFocus:= event.active.gain = 1;
   179 				cHasFocus:= event.active.gain = 1;
   178 		//SDL_VIDEORESIZE: Resize(max(event.resize.w, 600), max(event.resize.h, 450));
   180 		//SDL_VIDEORESIZE: Resize(max(event.resize.w, 600), max(event.resize.h, 450));
       
   181 {$IFNDEF IPHONEOS}
   179 		SDL_MOUSEBUTTONDOWN: if event.button.button = SDL_BUTTON_WHEELDOWN then uKeys.wheelDown:= true;
   182 		SDL_MOUSEBUTTONDOWN: if event.button.button = SDL_BUTTON_WHEELDOWN then uKeys.wheelDown:= true;
   180 		SDL_MOUSEBUTTONUP: if event.button.button = SDL_BUTTON_WHEELDUP then uKeys.wheelUp:= true;
   183 		SDL_MOUSEBUTTONUP: if event.button.button = SDL_BUTTON_WHEELDUP then uKeys.wheelUp:= true;
       
   184 {$ENDIF}
   181 		SDL_QUITEV: isTerminated:= true
   185 		SDL_QUITEV: isTerminated:= true
   182 		end;
   186 		end;
   183 CurrTime:= SDL_GetTicks;
   187 CurrTime:= SDL_GetTicks;
   184 if PrevTime + cTimerInterval <= CurrTime then
   188 if PrevTime + cTimerInterval <= CurrTime then
   185    begin
   189    begin
   243      isMusicEnabled:= ParamStr(15) = '1';
   247      isMusicEnabled:= ParamStr(15) = '1';
   244      cReducedQuality:= ParamStr(16) = '1';
   248      cReducedQuality:= ParamStr(16) = '1';
   245      for p:= Succ(Low(TPathType)) to High(TPathType) do
   249      for p:= Succ(Low(TPathType)) to High(TPathType) do
   246          if p <> ptMapCurrent then Pathz[p]:= PathPrefix + '/' + Pathz[p]
   250          if p <> ptMapCurrent then Pathz[p]:= PathPrefix + '/' + Pathz[p]
   247      end;
   251      end;
   248 	 {$IFDEF IPHONEOS}
   252 {$IFDEF IPHONEOS}
   249   0: begin
   253   0: begin
   250         PathPrefix:= 'hedgewars/Data';
   254         PathPrefix:= 'hedgewars/Data';
   251 		recordFileName:= 'hedgewars/save.hws';
   255 		recordFileName:= 'hedgewars/save.hws';
   252 		val('320', cScreenWidth);
   256 		val('320', cScreenWidth);
   253 		val('480', cScreenHeight);
   257 		val('480', cScreenHeight);
   266 		cReducedQuality:= false;
   270 		cReducedQuality:= false;
   267 
   271 
   268         for p:= Succ(Low(TPathType)) to High(TPathType) do
   272         for p:= Succ(Low(TPathType)) to High(TPathType) do
   269 			if p <> ptMapCurrent then Pathz[p]:= PathPrefix + '/' + Pathz[p]
   273 			if p <> ptMapCurrent then Pathz[p]:= PathPrefix + '/' + Pathz[p]
   270      end;
   274      end;
   271 	 {$ENDIF}
   275 {$ENDIF}
   272   3: begin
   276   3: begin
   273      val(ParamStr(2), ipcPort);
   277      val(ParamStr(2), ipcPort);
   274      GameType:= gmtLandPreview;
   278      GameType:= gmtLandPreview;
   275      if ParamStr(3) <> 'landpreview' then OutError(errmsgShouldntRun, true);
   279      if ParamStr(3) <> 'landpreview' then OutError(errmsgShouldntRun, true);
   276      end;
   280      end;