# HG changeset patch # User koda # Date 1253645882 0 # Node ID 57fb33ab04a49c60f4098e61b1d95cb12e1d1b6c # Parent bc3e45a4d5fb86c588ea479fa6df908c472d5c64 converts some gl calls to gles diff -r bc3e45a4d5fb -r 57fb33ab04a4 hedgewars/SDLh.pas --- a/hedgewars/SDLh.pas Tue Sep 22 15:48:49 2009 +0000 +++ b/hedgewars/SDLh.pas Tue Sep 22 18:58:02 2009 +0000 @@ -47,22 +47,25 @@ {$ENDIF} (* SDL *) -const {$IFDEF WIN32} - SDLLibName = 'SDL.dll'; - {$ENDIF} - {$IFDEF UNIX} - {$IFDEF DARWIN} - SDLLibName = 'SDL'; - {$ELSE} - SDLLibName = 'libSDL.so'; - {$ENDIF} - {$ENDIF} +const +{$IFDEF WIN32} + SDLLibName = 'SDL.dll'; +{$ENDIF} +{$IFDEF UNIX} + {$IFDEF DARWIN} + SDLLibName = 'SDL'; + {$ELSE} + SDLLibName = 'libSDL.so'; + {$ENDIF} +{$ENDIF} SDL_SWSURFACE = $00000000; SDL_HWSURFACE = $00000001; SDL_SRCALPHA = $00010000; SDL_INIT_VIDEO = $00000020; SDL_INIT_AUDIO = $00000010; + SDL_APPINPUTFOCUS=$00000010; + {$IFDEF SDL13} SDL_ASYNCBLIT = $08000000; SDL_ANYFORMAT = $10000000; @@ -89,22 +92,28 @@ SDL_RESIZABLE = $00000010; {$ENDIF} +{*begin sdl_event binding*} SDL_NOEVENT = 0; - SDL_ACTIVEEVENT = 1; SDL_KEYDOWN = 2; SDL_KEYUP = 3; - SDL_MOUSEBUTTONDOWN = 5; - SDL_MOUSEBUTTONUP = 6; SDL_QUITEV = 12; SDL_VIDEORESIZE = 16; {$IFDEF SDL13} + SDL_WINDOWEVENT = 1; + SDL_TEXTINPUT = 4; SDL_MOUSEMOTION = 5; + SDL_MOUSEBUTTONDOWN = 6; + SDL_MOUSEBUTTONUP = 7; + SDL_MOUSEWHEEL = 8; //different handling, should create SDL_MouseWheelEvent type +{$ELSE} + SDL_ACTIVEEVENT = 1; + SDL_MOUSEBUTTONDOWN = 5; + SDL_MOUSEBUTTONUP = 6; + SDL_BUTTON_WHEELDUP = 4; + SDL_BUTTON_WHEELDOWN = 5; {$ENDIF} - - SDL_APPINPUTFOCUS = 2; - SDL_BUTTON_WHEELDUP = 4; - SDL_BUTTON_WHEELDOWN = 5; +{*end sdl_event binding*} RMask = $000000FF; GMask = $0000FF00; @@ -113,12 +122,12 @@ type PSDL_Rect = ^TSDL_Rect; TSDL_Rect = record - {$IFDEF SDL13} +{$IFDEF SDL13} x, y, w, h: LongInt; - {$ELSE} +{$ELSE} x, y: SmallInt; w, h: Word; - {$ENDIF} +{$ENDIF} end; TPoint = record @@ -277,15 +286,25 @@ PSDL_Event = ^TSDL_Event; TSDL_Event = record case Byte of +{$IFDEF SDL13} + //doublecheck the type of WINDOWEVENT TEXTINPUT + SDL_NOEVENT: (type_: byte); + SDL_WINDOWEVENT: (active: TSDL_ActiveEvent); + SDL_KEYDOWN, + SDL_KEYUP: (key: TSDL_KeyboardEvent); + SDL_TEXTINPUT: (txtin: byte); + SDL_MOUSEMOTION: (motion: TSDL_MouseMotionEvent); + SDL_MOUSEBUTTONDOWN, + SDL_MOUSEBUTTONUP: (button: TSDL_MouseButtonEvent); +{$ELSE} SDL_NOEVENT: (type_: byte); SDL_ACTIVEEVENT: (active: TSDL_ActiveEvent); - SDL_KEYDOWN, SDL_KEYUP: (key: TSDL_KeyboardEvent); + SDL_KEYDOWN, + SDL_KEYUP: (key: TSDL_KeyboardEvent); SDL_QUITEV: (quit: TSDL_QuitEvent); SDL_VIDEORESIZE: (resize: TSDL_ResizeEvent); SDL_MOUSEBUTTONDOWN, SDL_MOUSEBUTTONUP: (button: TSDL_MouseButtonEvent); -{$IFDEF SDL13} - SDL_MOUSEMOTION: (motion: TSDL_MouseMotionEvent); {$ENDIF} end; diff -r bc3e45a4d5fb -r 57fb33ab04a4 hedgewars/hwengine.pas --- a/hedgewars/hwengine.pas Tue Sep 22 15:48:49 2009 +0000 +++ b/hedgewars/hwengine.pas Tue Sep 22 18:58:02 2009 +0000 @@ -168,16 +168,20 @@ repeat while SDL_PollEvent(@event) <> 0 do case event.type_ of - {$IFDEF IPHONEOS} +{$IFDEF IPHONEOS} SDL_MOUSEMOTION: WriteLnToConsole('mouse number ' + inttostr(SDL_SelectMouse(event.motion.which)) + ' over ' + inttostr(SDL_GetNumMice())); - {$ELSE} + SDL_WINDOWEVENT: +{$ELSE} SDL_KEYDOWN: if GameState = gsChat then KeyPressChat(event.key.keysym.unicode); - {$ENDIF} - SDL_ACTIVEEVENT: if (event.active.state and SDL_APPINPUTFOCUS) <> 0 then + SDL_ACTIVEEVENT: +{$ENDIF} + if (event.active.state and SDL_APPINPUTFOCUS) <> 0 then cHasFocus:= event.active.gain = 1; //SDL_VIDEORESIZE: Resize(max(event.resize.w, 600), max(event.resize.h, 450)); +{$IFNDEF IPHONEOS} SDL_MOUSEBUTTONDOWN: if event.button.button = SDL_BUTTON_WHEELDOWN then uKeys.wheelDown:= true; SDL_MOUSEBUTTONUP: if event.button.button = SDL_BUTTON_WHEELDUP then uKeys.wheelUp:= true; +{$ENDIF} SDL_QUITEV: isTerminated:= true end; CurrTime:= SDL_GetTicks; @@ -245,7 +249,7 @@ for p:= Succ(Low(TPathType)) to High(TPathType) do if p <> ptMapCurrent then Pathz[p]:= PathPrefix + '/' + Pathz[p] end; - {$IFDEF IPHONEOS} +{$IFDEF IPHONEOS} 0: begin PathPrefix:= 'hedgewars/Data'; recordFileName:= 'hedgewars/save.hws'; @@ -268,7 +272,7 @@ for p:= Succ(Low(TPathType)) to High(TPathType) do if p <> ptMapCurrent then Pathz[p]:= PathPrefix + '/' + Pathz[p] end; - {$ENDIF} +{$ENDIF} 3: begin val(ParamStr(2), ipcPort); GameType:= gmtLandPreview; diff -r bc3e45a4d5fb -r 57fb33ab04a4 hedgewars/uChat.pas --- a/hedgewars/uChat.pas Tue Sep 22 15:48:49 2009 +0000 +++ b/hedgewars/uChat.pas Tue Sep 22 18:58:02 2009 +0000 @@ -237,15 +237,6 @@ FreezeEnterKey; GameState:= gsGame end; - {missing Mac keys} - {* - 63272 is canc - 63232 is UP - 63234 is LEFT - 63235 is RIGHT - 63233 is DOWN - *} - 63272, 63232, 36233, 36234, 36235: Key:= 28; else if (Key < $80) then btw:= 1 else if (Key < $800) then btw:= 2 diff -r bc3e45a4d5fb -r 57fb33ab04a4 hedgewars/uGears.pas --- a/hedgewars/uGears.pas Tue Sep 22 15:48:49 2009 +0000 +++ b/hedgewars/uGears.pas Tue Sep 22 18:58:02 2009 +0000 @@ -1280,10 +1280,11 @@ glLineWidth(4.0); - glColor3ub($B0, $B0, $B0); +// glColor3ub($B0, $B0, $B0); + glColor4f(176.0, 176.0, 176.0, 1.0); glEnableClientState(GL_VERTEX_ARRAY); - glVertexPointer(2, GL_INT, 0, @RopePoints.rounded[0]); + glVertexPointer(2, GL_FLOAT, 0, @RopePoints.rounded[0]); glDrawArrays(GL_LINE_STRIP, 0, RopePoints.Count + 2); glColor4f(1, 1, 1, 1); diff -r bc3e45a4d5fb -r 57fb33ab04a4 hedgewars/uSound.pas --- a/hedgewars/uSound.pas Tue Sep 22 15:48:49 2009 +0000 +++ b/hedgewars/uSound.pas Tue Sep 22 18:58:02 2009 +0000 @@ -103,6 +103,8 @@ const numSounds = 80; begin if not isSoundEnabled then exit; +{*sound works in ipodtouch only if LAND_WIDTH = 1024; LAND_HEIGHT = 512; +or if ogg are loaded in stream or if sound is loaded by demand*} WriteToConsole('Init OpenAL sound...'); isSoundEnabled:= openal_init(numSounds); if isSoundEnabled then WriteLnToConsole(msgOK)