--- a/hedgewars/hwengine.pas Fri Oct 28 17:41:39 2011 +0200
+++ b/hedgewars/hwengine.pas Fri Oct 28 18:26:17 2011 +0200
@@ -164,15 +164,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:
@@ -192,14 +188,18 @@
end
else if event.window.event = SDL_WINDOWEVENT_RESIZED then
begin
+ // way too broken right now
+ (*
cNewScreenWidth:= max(2 * (event.window.data1 div 2), cMinScreenWidth);
cNewScreenHeight:= max(2 * (event.window.data2 div 2), cMinScreenHeight);
cScreenResizeDelay:= RealTicks+500;
+ *)
end;
SDL_FINGERMOTION: onTouchMotion(event.tfinger.x, event.tfinger.y,event.tfinger.dx, event.tfinger.dy, event.tfinger.fingerId);
SDL_FINGERDOWN: onTouchDown(event.tfinger.x, event.tfinger.y, event.tfinger.fingerId);
SDL_FINGERUP: onTouchUp(event.tfinger.x, event.tfinger.y, event.tfinger.fingerId);
{$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;
@@ -228,6 +228,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;
@@ -241,25 +242,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;