From 84a799853df75973fe4560576d9257f20b5bef85 Mon Sep 17 00:00:00 2001 From: eddie-0815 Date: Sat, 3 Nov 2007 08:47:56 +0000 Subject: Changed DELPHI define to IFDEF LAZARUS ... ELSE ... ENDIF. This should work on all Platforms now (I hope). git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@564 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UTexture.pas | 68 ++++++++++++++++++++---------------------- 1 file changed, 32 insertions(+), 36 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UTexture.pas b/Game/Code/Classes/UTexture.pas index ac3aa7d6..c3ab0d41 100644 --- a/Game/Code/Classes/UTexture.pas +++ b/Game/Code/Classes/UTexture.pas @@ -277,7 +277,38 @@ begin Log.LogStatus( 'IS Resource, because file does not exist.('+Identifier+')', ' LoadImage' ); // load from resource stream - {$IFDEF DELPHI} + {$IFDEF LAZARUS} + lLazRes := LazFindResource( Identifier, 'TEX' ); + if lLazRes <> nil then + begin + lResData := TStringStream.create( lLazRes.value ); + try + lResData.position := 0; + try + TexRWops := SDL_AllocRW; + TexRWops.unknown := TUnknown( lResData ); + TexRWops.seek := SDLStreamSeek; + TexRWops.read := SDLStreamRead; + TexRWops.write := nil; + TexRWops.close := SDLStreamClose; + TexRWops.type_ := 2; + except + Log.LogStatus( 'ERROR Could not assign resource ('+Identifier+')' , Identifier); + beep; + Exit; + end; + + Result := IMG_Load_RW(TexRWops,0); + SDL_FreeRW(TexRWops); + finally + freeandnil( lResData ); + end; + end + else + begin + Log.LogStatus( 'NOT found in Resource ('+Identifier+')', ' LoadImage' ); + end; + {$ELSE} dHandle := FindResource(hInstance, Identifier, 'TEX'); if dHandle=0 then begin @@ -320,42 +351,7 @@ begin if assigned( TexStream ) then freeandnil( TexStream ); end; - - - {$ELSE} - lLazRes := LazFindResource( Identifier, 'TEX' ); - if lLazRes <> nil then - begin - lResData := TStringStream.create( lLazRes.value ); - try - lResData.position := 0; - try - TexRWops := SDL_AllocRW; - TexRWops.unknown := TUnknown( lResData ); - TexRWops.seek := SDLStreamSeek; - TexRWops.read := SDLStreamRead; - TexRWops.write := nil; - TexRWops.close := SDLStreamClose; - TexRWops.type_ := 2; - except - Log.LogStatus( 'ERROR Could not assign resource ('+Identifier+')' , Identifier); - beep; - Exit; - end; - - Result := IMG_Load_RW(TexRWops,0); - SDL_FreeRW(TexRWops); - finally - freeandnil( lResData ); - end; - end - else - begin - Log.LogStatus( 'NOT found in Resource ('+Identifier+')', ' LoadImage' ); - end; {$ENDIF} - - end; end; -- cgit v1.2.3