equal
deleted
inserted
replaced
161 begin |
161 begin |
162 PrevTime:= SDL_GetTicks; |
162 PrevTime:= SDL_GetTicks; |
163 while isTerminated = false do |
163 while isTerminated = false do |
164 begin |
164 begin |
165 SDL_PumpEvents(); |
165 SDL_PumpEvents(); |
166 {$IFDEF SDL13} |
166 while SDL_PeepEvents(@event, 1, SDL_GETEVENT, {$IFDEF SDL13}SDL_FIRSTEVENT, SDL_LASTEVENT{$ELSE}SDL_ALLEVENTS{$ENDIF}) > 0 do |
167 while SDL_PeepEvents(@event, 1, SDL_GETEVENT, SDL_FIRSTEVENT, SDL_LASTEVENT) > 0 do |
|
168 {$ELSE} |
|
169 while SDL_PeepEvents(@event, 1, SDL_GETEVENT, SDL_ALLEVENTS) > 0 do |
|
170 {$ENDIF} |
|
171 begin |
167 begin |
172 case event.type_ of |
168 case event.type_ of |
|
169 {$IFDEF SDL13} |
173 SDL_KEYDOWN: if GameState = gsChat then |
170 SDL_KEYDOWN: if GameState = gsChat then |
174 {$IFDEF SDL13} |
|
175 // sdl on iphone supports only ashii keyboards and the unicode field is deprecated in sdl 1.3 |
171 // sdl on iphone supports only ashii keyboards and the unicode field is deprecated in sdl 1.3 |
176 KeyPressChat(event.key.keysym.sym); |
172 KeyPressChat(event.key.keysym.sym); |
177 SDL_WINDOWEVENT: |
173 SDL_WINDOWEVENT: |
178 if event.window.event = SDL_WINDOWEVENT_SHOWN then |
174 if event.window.event = SDL_WINDOWEVENT_SHOWN then |
179 begin |
175 begin |
194 cNewScreenWidth:= max(2 * (event.window.data1 div 2), cMinScreenWidth); |
190 cNewScreenWidth:= max(2 * (event.window.data1 div 2), cMinScreenWidth); |
195 cNewScreenHeight:= max(2 * (event.window.data2 div 2), cMinScreenHeight); |
191 cNewScreenHeight:= max(2 * (event.window.data2 div 2), cMinScreenHeight); |
196 cScreenResizeDelay:= RealTicks+500; |
192 cScreenResizeDelay:= RealTicks+500; |
197 end; |
193 end; |
198 {$ELSE} |
194 {$ELSE} |
|
195 SDL_KEYDOWN: if GameState = gsChat then |
199 KeyPressChat(event.key.keysym.unicode); |
196 KeyPressChat(event.key.keysym.unicode); |
200 SDL_MOUSEBUTTONDOWN: if event.button.button = SDL_BUTTON_WHEELDOWN then wheelDown:= true; |
197 SDL_MOUSEBUTTONDOWN: if event.button.button = SDL_BUTTON_WHEELDOWN then wheelDown:= true; |
201 SDL_MOUSEBUTTONUP: if event.button.button = SDL_BUTTON_WHEELUP then wheelUp:= true; |
198 SDL_MOUSEBUTTONUP: if event.button.button = SDL_BUTTON_WHEELUP then wheelUp:= true; |
202 SDL_ACTIVEEVENT: |
199 SDL_ACTIVEEVENT: |
203 if (event.active.state and SDL_APPINPUTFOCUS) <> 0 then |
200 if (event.active.state and SDL_APPINPUTFOCUS) <> 0 then |
222 SDL_JOYBUTTONDOWN: ControllerButtonEvent(event.jbutton.which, event.jbutton.button, true); |
219 SDL_JOYBUTTONDOWN: ControllerButtonEvent(event.jbutton.which, event.jbutton.button, true); |
223 SDL_JOYBUTTONUP: ControllerButtonEvent(event.jbutton.which, event.jbutton.button, false); |
220 SDL_JOYBUTTONUP: ControllerButtonEvent(event.jbutton.which, event.jbutton.button, false); |
224 SDL_QUITEV: isTerminated:= true |
221 SDL_QUITEV: isTerminated:= true |
225 end; //end case event.type_ of |
222 end; //end case event.type_ of |
226 end; //end while SDL_PollEvent(@event) <> 0 do |
223 end; //end while SDL_PollEvent(@event) <> 0 do |
|
224 |
227 if (cScreenResizeDelay <> 0) and (cScreenResizeDelay < RealTicks) and ((cNewScreenWidth <> cScreenWidth) or (cNewScreenHeight <> cScreenHeight)) then |
225 if (cScreenResizeDelay <> 0) and (cScreenResizeDelay < RealTicks) and ((cNewScreenWidth <> cScreenWidth) or (cNewScreenHeight <> cScreenHeight)) then |
228 begin |
226 begin |
229 cScreenResizeDelay:= 0; |
227 cScreenResizeDelay:= 0; |
230 cScreenWidth:= cNewScreenWidth; |
228 cScreenWidth:= cNewScreenWidth; |
231 cScreenHeight:= cNewScreenHeight; |
229 cScreenHeight:= cNewScreenHeight; |
235 ScriptOnScreenResize(); |
233 ScriptOnScreenResize(); |
236 InitCameraBorders() |
234 InitCameraBorders() |
237 end; |
235 end; |
238 |
236 |
239 if isTerminated = false then |
237 if isTerminated = false then |
240 begin |
238 begin |
241 CurrTime:= SDL_GetTicks; |
239 CurrTime:= SDL_GetTicks; |
242 if PrevTime + longword(cTimerInterval) <= CurrTime then |
240 if PrevTime + longword(cTimerInterval) <= CurrTime then |
243 begin |
241 begin |
244 DoTimer(CurrTime - PrevTime); |
242 DoTimer(CurrTime - PrevTime); |
245 PrevTime:= CurrTime |
243 PrevTime:= CurrTime |
246 end |
244 end |
247 else SDL_Delay(1); |
245 else SDL_Delay(1); |
248 IPCCheckSock(); |
246 IPCCheckSock(); |
249 end; |
247 end; |
250 end; |
248 end; |
251 end; |
249 end; |
252 |
250 |
253 /////////////// |
251 /////////////// |
254 {$IFDEF HWLIBRARY} |
252 procedure Game{$IFDEF HWLIBRARY}(gameArgs: PPChar); cdecl; export{$ENDIF}; |
255 procedure Game(gameArgs: PPChar); cdecl; export; |
|
256 {$ELSE} |
|
257 procedure Game; |
|
258 {$ENDIF} |
|
259 var p: TPathType; |
253 var p: TPathType; |
260 s: shortstring; |
254 s: shortstring; |
261 i: LongInt; |
255 i: LongInt; |
262 begin |
256 begin |
263 {$IFDEF HWLIBRARY} |
257 {$IFDEF HWLIBRARY} |