diff options
author | eddie-0815 <eddie-0815@b956fd51-792f-4845-bead-9b4dfca2ff2c> | 2007-11-04 15:23:42 +0000 |
---|---|---|
committer | eddie-0815 <eddie-0815@b956fd51-792f-4845-bead-9b4dfca2ff2c> | 2007-11-04 15:23:42 +0000 |
commit | 9edc9535e5570807990e39703dca7c05e6758256 (patch) | |
tree | 2d330b6ebb37cc7faf9a5861a81f787a4c05fd98 | |
parent | 19149849a2de8bf79d9f9095e290fd662efa7238 (diff) | |
download | usdx-9edc9535e5570807990e39703dca7c05e6758256.tar.gz usdx-9edc9535e5570807990e39703dca7c05e6758256.tar.xz usdx-9edc9535e5570807990e39703dca7c05e6758256.zip |
Added MacResources.pas. Fixed some resource loading issues on OS X. The main screen is still not loading.
git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@581 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to '')
-rw-r--r-- | Game/Code/Classes/UTexture.pas | 2281 | ||||
-rw-r--r-- | Game/Code/MacOSX/UltraStarDX.pas | 2 | ||||
-rw-r--r-- | Game/Code/MacOSX/UltraStarDX.xcodeproj/eddie.mode1 | 231 | ||||
-rw-r--r-- | Game/Code/MacOSX/UltraStarDX.xcodeproj/eddie.pbxuser | 448 | ||||
-rw-r--r-- | Game/Code/MacOSX/UltraStarDX.xcodeproj/project.pbxproj | 18 | ||||
-rwxr-xr-x | Game/Code/MacOSX/Wrapper/MacClasses.pas | 57 | ||||
-rwxr-xr-x | Game/Code/MacOSX/Wrapper/MacResources.pas | 72 |
7 files changed, 1510 insertions, 1599 deletions
diff --git a/Game/Code/Classes/UTexture.pas b/Game/Code/Classes/UTexture.pas index c3ab0d41..7b537840 100644 --- a/Game/Code/Classes/UTexture.pas +++ b/Game/Code/Classes/UTexture.pas @@ -1,1139 +1,1142 @@ -unit UTexture;
-// added for easier debug disabling
-{$define blindydebug}
-
-// Plain (alpha = 1)
-// Transparent
-// Colorized
-
-// obsolete?
-// Transparent Range
-// Font (white is drawn, black is transparent)
-// Font Outline (Font with darker outline)
-// Font Outline 2 (Font with darker outline)
-// Font Black (black is drawn, white is transparent)
-// Font Gray (gray is drawn, white is transparent)
-// Arrow (for arrows, white is white, gray has color, black is transparent);
-
-interface
-
-{$IFDEF FPC}
- {$MODE Delphi}
-{$ENDIF}
-
-{$I switches.inc}
-
-uses OpenGL12,
- {$IFDEF win32}
- windows,
- {$ENDIF}
- Math,
- Classes,
- SysUtils,
- Graphics,
- UCommon,
- UThemes,
- SDL,
- sdlutils,
- SDL_Image;
-
-type
- TTexture = record
- TexNum: integer;
- X: real;
- Y: real;
- Z: real; // new
- W: real;
- H: real;
- ScaleW: real; // for dynamic scalling while leaving width constant
- ScaleH: real; // for dynamic scalling while leaving height constant
- Rot: real; // 0 - 2*pi
- Int: real; // intensity
- ColR: real;
- ColG: real;
- ColB: real;
- TexW: real; // used?
- TexH: real; // used?
- TexX1: real;
- TexY1: real;
- TexX2: real;
- TexY2: real;
- Alpha: real;
- Name: string; // 0.5.0: experimental for handling cache images. maybe it's useful for dynamic skins
- end;
-
- TTextureEntry = record
- Name: string;
- Typ: string;
-
- // we use normal TTexture, it's easier to implement and if needed - we copy ready data
- Texture: TTexture;
- TextureCache: TTexture; // 0.5.0
- end;
-
- TTextureDatabase = record
- Texture: array of TTextureEntry;
- end;
-
- TTextureUnit = class
-
- private
- function LoadImage(Identifier: PChar): PSDL_Surface;
- function pixfmt_eq(fmt1,fmt2: PSDL_Pixelformat): boolean;
- procedure AdjustPixelFormat(var TexSurface: PSDL_Surface; Typ: PChar);
- function GetScaledTexture(TexSurface: PSDL_Surface; W,H: Cardinal): PSDL_Surface;
- procedure ScaleTexture(var TexSurface: PSDL_Surface; W,H: Cardinal);
- procedure FitTexture(var TexSurface: PSDL_Surface; W,H: Cardinal);
- procedure ColorizeTexture(TexSurface: PSDL_Surface; Col: Cardinal);
-
- public
- Limit: integer;
- CreateCacheMipmap: boolean;
-
-// function GetNumberFor
- function GetTexture(Name, Typ: string): TTexture; overload;
- function GetTexture(Name, Typ: string; FromCache: boolean): TTexture; overload;
- function FindTexture(Name: string): integer;
- function LoadTexture(FromRegistry: boolean; Identifier, Format, Typ: PChar; Col: LongWord): TTexture; overload;
- function LoadTexture(Identifier, Format, Typ: PChar; Col: LongWord): TTexture; overload;
- function LoadTexture(Identifier: string): TTexture; overload;
- function CreateTexture(var Data: array of byte; Name: string; W, H: word; Bits: byte): TTexture;
- procedure UnloadTexture(Name: string; FromCache: boolean);
- Constructor Create;
- Destructor Destroy;
- end;
-
-var
- Texture: TTextureUnit;
- TextureDatabase: TTextureDatabase;
-
- // this should be in UDisplay?!
- PrintScreenData: array[0..1024*768-1] of longword;
-
- ActTex: GLuint;//integer;
-
-// TextureD8: array[1..1024*1024] of byte; // 1MB
- TextureD16: array[1..1024*1024, 1..2] of byte; // luminance/alpha tex (2MB)
-// TextureD24: array[1..1024*1024, 1..3] of byte; // normal 24-bit tex (3MB)
-// TextureD242: array[1..512*512, 1..3] of byte; // normal 24-bit tex (0,75MB)
-// TextureD32: array[1..1024*1024, 1..4] of byte; // transparent 32-bit tex (4MB)
- // total 40MB at 2048*2048
- // total 10MB at 1024*1024
-
- Mipmapping: Boolean;
-
- CacheMipmap: array[0..256*256*3-1] of byte; // 3KB
- CacheMipmapSurface: PSDL_Surface;
-
-
-implementation
-
-uses ULog,
- DateUtils,
- UCovers,
- {$IFDEF LAZARUS}
- LResources,
- {$ENDIF}
- StrUtils, dialogs;
-
-const
- fmt_rgba: TSDL_Pixelformat=(palette: nil;
- BitsPerPixel: 32;
- BytesPerPixel: 4;
- Rloss: 0;
- Gloss: 0;
- Bloss: 0;
- Aloss: 0;
- Rshift: 0;
- Gshift: 8;
- Bshift: 16;
- Ashift: 24;
- Rmask: $000000ff;
- Gmask: $0000ff00;
- Bmask: $00ff0000;
- Amask: $ff000000;
- ColorKey: 0;
- Alpha: 255);
- fmt_rgb: TSDL_Pixelformat=( palette: nil;
- BitsPerPixel: 24;
- BytesPerPixel: 3;
- Rloss: 0;
- Gloss: 0;
- Bloss: 0;
- Aloss: 0;
- Rshift: 0;
- Gshift: 8;
- Bshift: 16;
- Ashift: 0;
- Rmask: $000000ff;
- Gmask: $0000ff00;
- Bmask: $00ff0000;
- Amask: $00000000;
- ColorKey: 0;
- Alpha: 255);
-
-
-Constructor TTextureUnit.Create;
-begin
- inherited Create;
-end;
-
-Destructor TTextureUnit.Destroy;
-begin
- inherited Destroy;
-end;
-
-function TTextureUnit.pixfmt_eq(fmt1,fmt2: PSDL_Pixelformat): boolean;
-begin
- if (fmt1^.BitsPerPixel = fmt2^.BitsPerPixel) and
- (fmt1^.BytesPerPixel = fmt2^.BytesPerPixel) and
- (fmt1^.Rloss = fmt2^.Rloss) and (fmt1^.Gloss = fmt2^.Gloss) and
- (fmt1^.Bloss = fmt2^.Bloss) and (fmt1^.Rmask = fmt2^.Rmask) and
- (fmt1^.Gmask = fmt2^.Gmask) and (fmt1^.Bmask = fmt2^.Bmask) and
- (fmt1^.Rshift = fmt2^.Rshift) and (fmt1^.Gshift = fmt2^.Gshift) and
- (fmt1^.Bshift = fmt2^.Bshift)
- then
- Result:=True
- else
- Result:=False;
-end;
-
-// +++++++++++++++++++++ helpers for loadimage +++++++++++++++
- function SdlStreamSeek( context : PSDL_RWops; offset : Integer; whence : Integer ) : integer; cdecl;
- var
- stream : TStream;
- origin : Word;
- begin
- stream := TStream( context.unknown );
- if ( stream = nil ) then
- raise EInvalidContainer.Create( 'SDLStreamSeek on nil' );
- case whence of
- 0 : origin := soFromBeginning; // Offset is from the beginning of the resource. Seek moves to the position Offset. Offset must be >= 0.
- 1 : origin := soFromCurrent; // Offset is from the current position in the resource. Seek moves to Position + Offset.
- 2 : origin := soFromEnd;
- else
- origin := soFromBeginning; // just in case
- end;
- Result := stream.Seek( offset, origin );
- end;
- function SdlStreamRead( context : PSDL_RWops; Ptr : Pointer; size : Integer; maxnum: Integer ) : Integer; cdecl;
- var
- stream : TStream;
- begin
- stream := TStream( context.unknown );
- if ( stream = nil ) then
- raise EInvalidContainer.Create( 'SDLStreamRead on nil' );
- try
- Result := stream.read( Ptr^, Size * maxnum ) div size;
- except
- Result := -1;
- end;
- end;
- function SDLStreamClose( context : PSDL_RWops ) : Integer; cdecl;
- var
- stream : TStream;
- begin
- stream := TStream( context.unknown );
- if ( stream = nil ) then
- raise EInvalidContainer.Create( 'SDLStreamClose on nil' );
- stream.Free;
- Result := 1;
- end;
-// -----------------------------------------------
-
-function TTextureUnit.LoadImage(Identifier: PChar): PSDL_Surface;
-var
-
- TexRWops: PSDL_RWops;
- dHandle: THandle;
-
- {$IFDEF LAZARUS}
- lLazRes : TLResource;
- lResData : TStringStream;
- {$ELSE}
- TexStream: TStream;
- {$ENDIF}
-
-begin
- Result := nil;
- TexRWops := nil;
-
-// Log.LogStatus( Identifier, 'LoadImage' );
-
- if ( FileExists(Identifier) ) then
- begin
- // load from file
- Log.LogStatus( 'Is File', ' LoadImage' );
- try
- Result:=IMG_Load(Identifier);
- except
- Log.LogStatus( 'ERROR Could not load from file' , Identifier);
- beep;
- Exit;
- end;
- end
- else
- begin
- Log.LogStatus( 'IS Resource, because file does not exist.('+Identifier+')', ' LoadImage' );
-
- // load from resource stream
- {$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
- Log.LogStatus( 'ERROR Could not find resource' , ' '+ Identifier);
- beep;
- Exit;
- end;
-
-
- TexStream := nil;
- try
- TexStream := TResourceStream.Create(HInstance, Identifier, 'TEX');
- except
- Log.LogStatus( 'ERROR Could not load from resource' , Identifier);
- beep;
- Exit;
- end;
-
- try
- TexStream.position := 0;
- try
- TexRWops := SDL_AllocRW;
- TexRWops.unknown := TUnknown(TexStream);
- TexRWops.seek := SDLStreamSeek;
- TexRWops.read := SDLStreamRead;
- TexRWops.write := nil;
- TexRWops.close := SDLStreamClose;
- TexRWops.type_ := 2;
- except
- Log.LogStatus( 'ERROR Could not assign resource' , Identifier);
- beep;
- Exit;
- end;
-
- Log.LogStatus( 'resource Assigned....' , Identifier);
- Result:=IMG_Load_RW(TexRWops,0);
- SDL_FreeRW(TexRWops);
-
- finally
- if assigned( TexStream ) then
- freeandnil( TexStream );
- end;
- {$ENDIF}
- end;
-end;
-
-procedure TTextureUnit.AdjustPixelFormat(var TexSurface: PSDL_Surface; Typ: PChar);
-var
- TempSurface: PSDL_Surface;
- NeededPixFmt: PSDL_Pixelformat;
-begin
- NeededPixFmt:=@fmt_rgba;
- if Typ= 'Plain' then NeededPixFmt:=@fmt_rgb
- else
- if (Typ='Transparent') or
- (Typ='Colorized')
- then NeededPixFmt:=@fmt_rgba
- else
- NeededPixFmt:=@fmt_rgb;
-
-
- if not pixfmt_eq(TexSurface^.format, NeededPixFmt) then
- begin
- TempSurface:=TexSurface;
- TexSurface:=SDL_ConvertSurface(TempSurface,NeededPixFmt,SDL_SWSURFACE);
- SDL_FreeSurface(TempSurface);
- end;
-end;
-
-function TTextureUnit.GetScaledTexture(TexSurface: PSDL_Surface; W,H: Cardinal): PSDL_Surface;
-var
- TempSurface: PSDL_Surface;
-begin
- TempSurface:=TexSurface;
- Result:=SDL_ScaleSurfaceRect(TempSurface,
- 0,0,TempSurface^.W,TempSurface^.H,
- W,H);
-end;
-
-procedure TTextureUnit.ScaleTexture(var TexSurface: PSDL_Surface; W,H: Cardinal);
-var
- TempSurface: PSDL_Surface;
-begin
- TempSurface:=TexSurface;
- TexSurface:=SDL_ScaleSurfaceRect(TempSurface,
- 0,0,TempSurface^.W,TempSurface^.H,
- W,H);
- SDL_FreeSurface(TempSurface);
-end;
-
-procedure TTextureUnit.FitTexture(var TexSurface: PSDL_Surface; W,H: Cardinal);
-var
- TempSurface: PSDL_Surface;
-begin
- TempSurface:=TexSurface;
- with TempSurface^.format^ do
- TexSurface:=SDL_CreateRGBSurface(SDL_SWSURFACE,W,H,BitsPerPixel,RMask, GMask, BMask, AMask);
- SDL_SetAlpha(TexSurface, 0, 255);
- SDL_SetAlpha(TempSurface, 0, 255);
- SDL_BlitSurface(TempSurface,nil,TexSurface,nil);
- SDL_FreeSurface(TempSurface);
-end;
-
-procedure TTextureUnit.ColorizeTexture(TexSurface: PSDL_Surface; Col: Cardinal);
- //returns hue within range [0.0-6.0)
- function col2h(Color:Cardinal):double;
- var
- clr,hls: array[0..2] of double;
- delta: double;
- begin
- clr[0]:=((Color and $ff0000) shr 16)/255;
- clr[1]:=((Color and $ff00) shr 8)/255;
- clr[2]:=(Color and $ff)/255;
- hls[1]:=maxvalue(clr);
- delta:=hls[1]-minvalue(clr);
- if clr[0]=hls[1] then hls[0]:=(clr[1]-clr[2])/delta
- else if clr[1]=hls[1] then hls[0]:=2.0+(clr[2]-clr[0])/delta
- else if clr[2]=hls[1] then hls[0]:=4.0+(clr[0]-clr[1])/delta;
- if hls[0]<0.0 then hls[0]:=hls[0]+6.0;
- if hls[0]=6.0 then hls[0]:=0.0;
- col2h:=hls[0];
- end;
- procedure ColorizePixel(Pix: PByteArray; hue: Double);
- var
- i,j,k: Cardinal;
- clr, hls: array[0..2] of Double;
- delta, f, p, q, t: Double;
- begin
- hls[0]:=hue;
-
- clr[0] := Pix[0]/255;
- clr[1] := Pix[1]/255;
- clr[2] := Pix[2]/255;
-
- //calculate luminance and saturation from rgb
- hls[1] := maxvalue(clr); //l:=...
- delta := hls[1] - minvalue(clr);
-
- if hls[1] = 0.0 then
- hls[2] := 0.0
- else
- hls[2] := delta/hls[1]; //v:=...
-
- // calc new rgb from our hls (h from color, l ans s from pixel)
- // if (hls[1]<>0.0) and (hls[2]<>0.0) then // only if colorizing makes sense
- begin
- k:=trunc(hls[0]);
- f:=hls[0]-k;
- p:=hls[1]*(1.0-hls[2]);
- q:=hls[1]*(1.0-(hls[2]*f));
- t:=hls[1]*(1.0-(hls[2]*(1.0-f)));
- case k of
- 0: begin clr[0]:=hls[1]; clr[1]:=t; clr[2]:=p; end;
- 1: begin clr[0]:=q; clr[1]:=hls[1]; clr[2]:=p; end;
- 2: begin clr[0]:=p; clr[1]:=hls[1]; clr[2]:=t; end;
- 3: begin clr[0]:=p; clr[1]:=q; clr[2]:=hls[1]; end;
- 4: begin clr[0]:=t; clr[1]:=p; clr[2]:=hls[1]; end;
- 5: begin clr[0]:=hls[1]; clr[1]:=p; clr[2]:=q; end;
- end;
- // and store new rgb back into the image
- Pix[0]:=floor(255*clr[0]);
- Pix[1]:=floor(255*clr[1]);
- Pix[2]:=floor(255*clr[2]);
- end;
- end;
-
-var
- DestinationHue: Double;
- PixelIndex: Cardinal;
-begin
- DestinationHue:=col2h(Col);
- for PixelIndex:=0 to (TexSurface^.W*TexSurface^.H -1) do
- ColorizePixel(@(PByteArray(TexSurface^.Pixels)[PixelIndex*TexSurface^.format.BytesPerPixel]),DestinationHue);
-end;
-
-function TTextureUnit.LoadTexture(FromRegistry: boolean; Identifier, Format, Typ: PChar; Col: LongWord): TTexture;
-var
- TexSurface: PSDL_Surface;
- MipmapSurface: PSDL_Surface;
- newWidth, newHeight: Cardinal;
- oldWidth, oldHeight: Cardinal;
- kopierindex: Cardinal;
-begin
- Log.BenchmarkStart(4);
- Mipmapping := true;
-(*
- Log.LogStatus( '', '' );
-
- if Identifier = nil then
- Log.LogStatus(' ERROR unknown Identifier', 'Id:'''+Identifier+''' Fmt:'''+Format+''' Typ:'''+Typ+'''')
- else
- Log.LogStatus(' should be ok - trying to load', 'Id:'''+Identifier+''' Fmt:'''+Format+''' Typ:'''+Typ+'''');
-*)
-
- // load texture data into memory
- {$ifdef blindydebug}
- Log.LogStatus('',' ----------------------------------------------------');
- Log.LogStatus('',' LoadImage('''+Identifier+''') (called by '+Format+')');
- {$endif}
- TexSurface := LoadImage(Identifier);
- {$ifdef blindydebug}
- Log.LogStatus('',' ok');
- {$endif}
- if not assigned(TexSurface) then
- begin
- Log.LogStatus( 'ERROR Could not load texture' , Identifier +' '+ Format +' '+ Typ );
- beep;
- Exit;
- end;
-
- // convert pixel format as needed
- {$ifdef blindydebug}
- Log.LogStatus('',' AdjustPixelFormat');
- {$endif}
- AdjustPixelFormat(TexSurface, Typ);
- {$ifdef blindydebug}
- Log.LogStatus('',' ok');
- {$endif}
- // adjust texture size (scale down, if necessary)
- newWidth := TexSurface.W;
- newHeight := TexSurface.H;
-
- if (newWidth > Limit) then
- newWidth := Limit;
-
- if (newHeight > Limit) then
- newHeight := Limit;
-
- if (TexSurface.W > newWidth) or (TexSurface.H > newHeight) then
- begin
- {$ifdef blindydebug}
- Log.LogStatus('',' ScaleTexture');
- {$endif}
- ScaleTexture(TexSurface,newWidth,newHeight);
- {$ifdef blindydebug}
- Log.LogStatus('',' ok');
- {$endif}
- end;
-
- {$ifdef blindydebug}
- Log.LogStatus('',' JB-1 : typ='+Typ);
- {$endif}
-
-
-
- // don't actually understand, if this is needed...
- // this should definately be changed... together with all this
- // cover cache stuff
- if (CreateCacheMipmap) and (Typ='Plain') then
- begin
- {$ifdef blindydebug}
- Log.LogStatus('',' JB-1 : Minimap');
- {$endif}
-
- if (Covers.W <= 256) and (Covers.H <= 256) then
- begin
- {$ifdef blindydebug}
- Log.LogStatus('',' GetScaledTexture('''+inttostr(Covers.W)+''','''+inttostr(Covers.H)+''') (for CacheMipmap)');
- {$endif}
- MipmapSurface:=GetScaledTexture(TexSurface,Covers.W, Covers.H);
- if assigned(MipmapSurface) then
- begin
- {$ifdef blindydebug}
- Log.LogStatus('',' ok');
- Log.LogStatus('',' BlitSurface Stuff');
- {$endif}
- // creating and freeing the surface could be done once, if Cover.W and Cover.H don't change
- CacheMipmapSurface:=SDL_CreateRGBSurfaceFrom(@CacheMipmap[0], Covers.W, Covers.H, 24, Covers.W*3, $000000ff, $0000ff00, $00ff0000, 0);
- SDL_BlitSurface(MipMapSurface,nil,CacheMipmapSurface,nil);
- SDL_FreeSurface(CacheMipmapSurface);
- {$ifdef blindydebug}
- Log.LogStatus('',' ok');
- Log.LogStatus('',' SDL_FreeSurface (CacheMipmap)');
- {$endif}
- SDL_FreeSurface(MipmapSurface);
- {$ifdef blindydebug}
- Log.LogStatus('',' ok');
- {$endif}
- end
- else
- begin
- Log.LogStatus(' Error creating CacheMipmap',' LoadTexture('''+Identifier+''')');
- end;
- end;
- // should i create a cache texture, if Covers.W/H are larger?
- end;
-
- {$ifdef blindydebug}
- Log.LogStatus('',' JB-2');
- {$endif}
-
-
- // now we might colorize the whole thing
- if Typ='Colorized' then
- ColorizeTexture(TexSurface,Col);
-
- // save actual dimensions of our texture
- oldWidth:=newWidth;
- oldHeight:=newHeight;
- // make texture dimensions be powers of 2
- newWidth:=Round(Power(2, Ceil(Log2(newWidth))));
- newHeight:=Round(Power(2, Ceil(Log2(newHeight))));
- if (newHeight <> oldHeight) or (newWidth <> oldWidth) then
- FitTexture(TexSurface,newWidth,newHeight);
-
- // at this point we have the image in memory...
- // scaled to be at most 1024x1024 pixels large
- // scaled so that dimensions are powers of 2
- // and converted to either RGB or RGBA
-
- {$ifdef blindydebug}
- Log.LogStatus('',' JB-3');
- {$endif}
-
-
- // if we got a Texture of Type Plain, Transparent or Colorized,
- // then we're done manipulating it
- // and could now create our openGL texture from it
-
- // prepare OpenGL texture
-
- // JB_linux : this is causing AV's on linux... ActText seems to be nil !
-// {$IFnDEF win32}
-// if pointer(ActTex) = nil then
-// exit;
-// {$endif}
-
- glGenTextures(1, @ActTex);
-
- glBindTexture(GL_TEXTURE_2D, ActTex);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
-
- // load data into gl texture
- if (Typ = 'Transparent') or
- (Typ='Colorized') then
- begin
- glTexImage2D(GL_TEXTURE_2D, 0, 4, newWidth, newHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, TexSurface.pixels);
- end
- {if Typ = 'Plain' then} else
- begin
- glTexImage2D(GL_TEXTURE_2D, 0, 3, newWidth, newHeight, 0, GL_RGB, GL_UNSIGNED_BYTE, TexSurface.pixels);
- end;
-
- {$ifdef blindydebug}
- Log.LogStatus('',' JB-4');
- {$endif}
-
-{
- if Typ = 'Transparent Range' then
- // set alpha to 256-green-component (not sure)
- Pix := TextureB.Canvas.Pixels[Position2, Position];
- TextureD32[Position*TexNewW + Position2+1, 1] := Pix;
- TextureD32[Position*TexNewW + Position2+1, 2] := Pix div 256;
- TextureD32[Position*TexNewW + Position2+1, 3] := Pix div (256*256);
- TextureD32[Position*TexNewW + Position2+1, 4] := 256 - Pix div 256;
-}
-{
- if Typ = 'Font' then
- // either create luminance-alpha texture
- // or use transparency from differently saved file
- // or do something totally different (text engine with ttf)
- Pix := PPix[Position2 * 3];
- TextureD16[Position*TextureB.Width + Position2 + 1, 1] := 255;
- TextureD16[Position*TextureB.Width + Position2 + 1, 2] := Pix;
- glTexImage2D(GL_TEXTURE_2D, 0, 2, TextureB.Width, TextureB.Height, 0, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, @TextureD16);
-}
-{
- if Typ = 'Font Outline' then
- // no idea...
- begin
- TextureB.PixelFormat := pf24bit;
- for Position := 0 to TextureB.Height-1 do begin
- PPix := TextureB.ScanLine[Position];
- for Position2 := 0 to TextureB.Width-1 do begin
- Pix := PPix[Position2 * 3];
-
- Col := Pix;
- if Col < 127 then Col := 127;
-
- TempA := Pix;
- if TempA >= 95 then TempA := 255;
- if TempA >= 31 then TempA := 255;
- if Pix < 95 then TempA := (Pix * 256) div 96;
-
-
- TextureD16[Position*TextureB.Width + Position2 + 1, 1] := Col;
- TextureD16[Position*TextureB.Width + Position2 + 1, 2] := TempA;
- end;
- end;
- glTexImage2D(GL_TEXTURE_2D, 0, 2, TextureB.Width, TextureB.Height, 0, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, @TextureD16);
- end;
-}
-{
- if Typ = 'Font Outline 2' then
- // same as above
- begin
- TextureB.PixelFormat := pf24bit;
- for Position := 0 to TextureB.Height-1 do begin
- PPix := TextureB.ScanLine[Position];
- for Position2 := 0 to TextureB.Width-1 do begin
- Pix := PPix[Position2 * 3];
-
- Col := Pix;
- if Col < 31 then Col := 31;
-
- TempA := Pix;
- if TempA >= 31 then TempA := 255;
- if Pix < 31 then TempA := Pix * (256 div 32);
-
- TextureD16[Position*TextureB.Width + Position2 + 1, 1] := Col;
- TextureD16[Position*TextureB.Width + Position2 + 1, 2] := TempA;
- end;
- end;
- glTexImage2D(GL_TEXTURE_2D, 0, 2, TextureB.Width, TextureB.Height, 0, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, @TextureD16);
- if Mipmapping then glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
- if Mipmapping then begin
- Error := gluBuild2DMipmaps(GL_TEXTURE_2D, 2, TextureB.Width, TextureB.Height, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, @TextureD16);
- if Error > 0 then beep;
- end;
- end;
-
- if Typ = 'Font Black' then
- // and so on
- begin
- // normalnie 0,125s bez niczego 0,015s - 0,030s z pix 0,125s <-- ???
- // dimensions
- TextureB.PixelFormat := pf24bit;
- TexOrigW := TextureB.Width;
- TexOrigH := TextureB.Height;
- TexNewW := Round(Power(2, Ceil(Log2(TexOrigW))));
- TexNewH := Round(Power(2, Ceil(Log2(TexOrigH))));
- TextureB.Width := TexNewW;
- TextureB.Height := TexNewH;
- // copy and process pixeldata
- for Position := 0 to TextureB.Height-1 do begin
- PPix := TextureB.ScanLine[Position];
- for Position2 := 0 to TextureB.Width-1 do begin
- Pix := PPix[Position2*3];
- TextureD32[Position*TextureB.Width + Position2 + 1, 1] := 255;
- TextureD32[Position*TextureB.Width + Position2 + 1, 2] := 255;
- TextureD32[Position*TextureB.Width + Position2 + 1, 3] := 255;
- TextureD32[Position*TextureB.Width + Position2 + 1, 4] := 255 - (Pix mod 256);
- end;
- end;
- glTexImage2D(GL_TEXTURE_2D, 0, 4, TextureB.Width, TextureB.Height, 0, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32);
- end;
-
- if Typ = 'Alpha Black Colored' then
- // ... hope, noone needs this
- begin
- TextureB.PixelFormat := pf24bit;
- TexOrigW := TextureB.Width;
- TexOrigH := TextureB.Height;
- TexNewW := Round(Power(2, Ceil(Log2(TexOrigW))));
- TexNewH := Round(Power(2, Ceil(Log2(TexOrigH))));
- TextureB.Width := TexNewW;
- TextureB.Height := TexNewH;
- // copy and process pixeldata
- for Position := 0 to TextureB.Height-1 do begin
- PPix := TextureB.ScanLine[Position];
- for Position2 := 0 to TextureB.Width-1 do begin
- Pix := PPix[Position2*3];
- TextureD32[Position*TextureB.Width + Position2 + 1, 1] := (Col div $10000) and $FF;
- TextureD32[Position*TextureB.Width + Position2 + 1, 2] := (Col div $100) and $FF;
- TextureD32[Position*TextureB.Width + Position2 + 1, 3] := Col and $FF;
- TextureD32[Position*TextureB.Width + Position2 + 1, 4] := 255 - (Pix mod 256);
- end;
- end;
- glTexImage2D(GL_TEXTURE_2D, 0, 4, TextureB.Width, TextureB.Height, 0, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32);
- end;
-
- if Typ = 'Font Gray' then
- begin
- // dimensions
- TexOrigW := TextureB.Width;
- TexOrigH := TextureB.Height;
- TexNewW := Round(Power(2, Ceil(Log2(TexOrigW))));
- TexNewH := Round(Power(2, Ceil(Log2(TexOrigH))));
- TextureB.Width := TexNewW;
- TextureB.Height := TexNewH;
- // copy and process pixeldata
- for Position := 0 to TextureB.Height-1 do begin
- for Position2 := 0 to TextureB.Width-1 do begin
- Pix := TextureB.Canvas.Pixels[Position2, Position];
- TextureD32[Position*TextureB.Width + Position2 + 1, 1] := 127;
- TextureD32[Position*TextureB.Width + Position2 + 1, 2] := 127;
- TextureD32[Position*TextureB.Width + Position2 + 1, 3] := 127;
- TextureD32[Position*TextureB.Width + Position2 + 1, 4] := 255 - (Pix mod 256);
- end;
- end;
- glTexImage2D(GL_TEXTURE_2D, 0, 4, TextureB.Width, TextureB.Height, 0, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32);
- end;
-
- if Typ = 'Arrow' then
- begin
- TextureB.PixelFormat := pf24bit;
- for Position := 0 to TextureB.Height-1 do begin
- PPix := TextureB.ScanLine[Position];
- for Position2 := 0 to TextureB.Width-1 do begin
- Pix := PPix[Position2 * 3];
-
- // transparency
- if Pix >= 127 then TempA := 255;
- if Pix < 127 then TempA := Pix * 2;
-
- // ColInt = color intensity
- if Pix < 127 then ColInt := 1;
- if Pix >= 127 then ColInt := 2 - Pix / 128;
- //0.75, 0.6, 0.25
-
- TextureD32[Position*TextureB.Width + Position2 + 1, 1] := Round(ColInt * 0.75 * 255 + (1 - ColInt) * 255);
- TextureD32[Position*TextureB.Width + Position2 + 1, 2] := Round(ColInt * 0.6 * 255 + (1 - ColInt) * 255);
- TextureD32[Position*TextureB.Width + Position2 + 1, 3] := Round(ColInt * 0.25 * 255 + (1 - ColInt) * 255);
- TextureD32[Position*TextureB.Width + Position2 + 1, 4] := TempA;
- end;
- end;
- glTexImage2D(GL_TEXTURE_2D, 0, 4, TextureB.Width, TextureB.Height, 0, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32);
-
- if Mipmapping then glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
- if Mipmapping then begin
- Error := gluBuild2DMipmaps(GL_TEXTURE_2D, 4, TextureB.Width, TextureB.Height, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32);
- if Error > 0 then beep;
- end;
- end;
-
- if Typ = 'Note Plain' then
- begin
- for Position := 0 to TextureB.Height-1 do
- begin
- PPix := TextureB.ScanLine[Position];
- for Position2 := 0 to TextureB.Width-1 do
- begin
-
-
-
- // Skin Patch
- // 0-191= Fade Black to Col, 192= Col, 193-254 Fade Col to White, 255= White
- case PPix[Position2*3] of
- 0..191: Pix := $10000 * ((((Col div $10000) and $FF) * PPix[Position2*3]) div $Bf) + $100 * ((((Col div $100) and $FF) * PPix[Position2*3]) div $Bf) + (((Col and $FF) * PPix[Position2*3]) div $Bf);
- 192: Pix := Col;
- 193..254: Pix := Col + ($10000 * ((($FF - ((Col div $10000) and $FF)) * ((PPix[Position2*3] - $C0) * 4) ) div $FF) + $100 * ((($FF - ((Col div $100) and $FF)) * ((PPix[Position2*3] - $C0) * 4)) div $FF) + ((($FF - (Col and $FF)) * ((PPix[Position2*3] - $C0) * 4)) div $FF));
- 255: Pix := $FFFFFF;
- end;
-// 0.5.0. Original
-// case PPix[Position2*3] of
-// 128: Pix := $10000 * ((Col div $10000) div 2) + $100 * (((Col div $100) and $FF) div 2) + (Col and $FF) div 2;
-// 192: Pix := Col;
-// 255: Pix := $FFFFFF;
-// end;
-
-
-
-
-
- TextureD24[Position*TextureB.Width + Position2 + 1, 1] := Pix div $10000;
- TextureD24[Position*TextureB.Width + Position2 + 1, 2] := (Pix div $100) and $FF;
- TextureD24[Position*TextureB.Width + Position2 + 1, 3] := Pix and $FF;
- end;
- end;
- glTexImage2D(GL_TEXTURE_2D, 0, 3, TextureB.Width, TextureB.Height, 0, GL_RGB, GL_UNSIGNED_BYTE, @TextureD24);
- end;
-
- if Typ = 'Note Transparent' then
- begin
- for Position := 0 to TextureB.Height-1 do begin
- PPix := TextureB.ScanLine[Position];
- for Position2 := 0 to TextureB.Width-1 do begin
- TempA := 255;
-
-
-
- //Skin Patch
- // 0= Transparent, 1-191= Fade Black to Col, 192= Col, 193-254 Fade Col to White, 255= White
- case PPix[Position2*3] of
- 0: TempA := 0;
- 1..191: Pix := $10000 * ((((Col div $10000) and $FF) * PPix[Position2*3]) div $Bf) + $100 * ((((Col div $100) and $FF) * PPix[Position2*3]) div $Bf) + (((Col and $FF) * PPix[Position2*3]) div $Bf);
- 192: Pix := Col;
- 193..254: Pix := Col + ($10000 * ((($FF - ((Col div $10000) and $FF)) * ((PPix[Position2*3] - $C0) * 4) ) div $FF) + $100 * ((($FF - ((Col div $100) and $FF)) * ((PPix[Position2*3] - $C0) * 4)) div $FF) + ((($FF - (Col and $FF)) * ((PPix[Position2*3] - $C0) * 4)) div $FF));
- 255: Pix := $FFFFFF;
- end;
-// 0.5.0 Original
-// case PPix[Position2*3] of
-// 0: TempA := 0;
-// 128: Pix := $10000 * ((Col div $10000) div 2) + $100 * (((Col div $100) and $FF) div 2) + (Col and $FF) div 2;
-// 192: Pix := Col;
-// 255: Pix := $FFFFFF;
-// end;
-
-
-
-
- TextureD32[Position*TextureB.Width + Position2 + 1, 1] := Pix div $10000;
- TextureD32[Position*TextureB.Width + Position2 + 1, 2] := (Pix div $100) and $FF;
- TextureD32[Position*TextureB.Width + Position2 + 1, 3] := Pix and $FF;
- TextureD32[Position*TextureB.Width + Position2 + 1, 4] := TempA;
- end;
- end;
- glTexImage2D(GL_TEXTURE_2D, 0, 4, TextureB.Width, TextureB.Height, 0, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32);
- end;
-}
-
- {$ifdef blindydebug}
- Log.LogStatus('',' JB-5');
- {$endif}
-
-
- Result.X := 0;
- Result.Y := 0;
- Result.W := 0;
- Result.H := 0;
- Result.ScaleW := 1;
- Result.ScaleH := 1;
- Result.Rot := 0;
- Result.TexNum := ActTex;
- Result.TexW := oldWidth / newWidth;
- Result.TexH := oldHeight / newHeight;
-
- Result.Int := 1;
- Result.ColR := 1;
- Result.ColG := 1;
- Result.ColB := 1;
- Result.Alpha := 1;
-
- // 0.4.2 new test - default use whole texure, taking TexW and TexH as const and changing these
- Result.TexX1 := 0;
- Result.TexY1 := 0;
- Result.TexX2 := 1;
- Result.TexY2 := 1;
-
- {$ifdef blindydebug}
- Log.LogStatus('',' JB-6');
- {$endif}
-
-
- // 0.5.0
- Result.Name := Identifier;
-
- SDL_FreeSurface(TexSurface);
-
- {$ifdef blindydebug}
- Log.LogStatus('',' JB-7');
- {$endif}
-
-
- Log.BenchmarkEnd(4);
- if Log.BenchmarkTimeLength[4] >= 1 then
- Log.LogBenchmark('**********> Texture Load Time Warning - ' + Format + '/' + Identifier + '/' + Typ, 4);
-
- {$ifdef blindydebug}
- Log.LogStatus('',' JB-8');
- {$endif}
-
-end;
-
-
-function TTextureUnit.GetTexture(Name, Typ: string): TTexture;
-begin
- Result := GetTexture(Name, Typ, true);
-end;
-
-function TTextureUnit.GetTexture(Name, Typ: string; FromCache: boolean): TTexture;
-var
- T: integer; // texture
- C: integer; // cover
- Data: array of byte;
-begin
-
- if Name = '' then
- exit;
-
- // find texture entry
- T := FindTexture(Name);
-
- if T = -1 then
- begin
- // create texture entry
- T := Length(TextureDatabase.Texture);
- SetLength(TextureDatabase.Texture, T+1);
-
- TextureDatabase.Texture[T].Name := Name;
- TextureDatabase.Texture[T].Typ := Typ;
-
- // inform database that no textures have been loaded into memory
- TextureDatabase.Texture[T].Texture.TexNum := -1;
- TextureDatabase.Texture[T].TextureCache.TexNum := -1;
- end;
-
- // use preloaded texture
- if (not FromCache) or (FromCache and not Covers.CoverExists(Name)) then
- begin
- // use full texture
- if TextureDatabase.Texture[T].Texture.TexNum = -1 then
- begin
- // load texture
- {$ifdef blindydebug}
- Log.LogStatus('...', 'GetTexture('''+Name+''','''+Typ+''')');
- {$endif}
- TextureDatabase.Texture[T].Texture := LoadTexture(false, pchar(Name), 'JPG', pchar(Typ), $0);
- {$ifdef blindydebug}
- Log.LogStatus('done',' ');
- {$endif}
- end;
-
- // use texture
- Result := TextureDatabase.Texture[T].Texture;
- end;
-
- if FromCache and Covers.CoverExists(Name) then
- begin
- // use cache texture
- C := Covers.CoverNumber(Name);
-
- if TextureDatabase.Texture[T].TextureCache.TexNum = -1 then
- begin
- // load texture
- Covers.PrepareData(Name);
- TextureDatabase.Texture[T].TextureCache := CreateTexture(Covers.Data, Name, Covers.Cover[C].W, Covers.Cover[C].H, 24);
- end;
-
- // use texture
- Result := TextureDatabase.Texture[T].TextureCache;
- end;
-end;
-
-function TTextureUnit.FindTexture(Name: string): integer;
-var
- T: integer; // texture
-begin
- Result := -1;
- for T := 0 to high(TextureDatabase.Texture) do
- if TextureDatabase.Texture[T].Name = Name then
- Result := T;
-end;
-
-function TTextureUnit.LoadTexture(Identifier, Format, Typ: PChar; Col: LongWord): TTexture;
-begin
- Result := LoadTexture(false, Identifier, Format, Typ, Col);
-end;
-
-function TTextureUnit.LoadTexture(Identifier: string): TTexture;
-begin
- Result := LoadTexture(false, pchar(Identifier), 'JPG', 'Plain', 0);
-end;
-
-function TTextureUnit.CreateTexture(var Data: array of byte; Name: string; W, H: word; Bits: byte): TTexture;
-var
- Position: integer;
- Position2: integer;
- Pix: integer;
- ColInt: real;
- PPix: PByteArray;
- TempA: integer;
- Error: integer;
-begin
- Mipmapping := false;
-
- glGenTextures(1, @ActTex); // ActText = new texture number
- glBindTexture(GL_TEXTURE_2D, ActTex);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
-
- glTexImage2D(GL_TEXTURE_2D, 0, 3, W, H, 0, GL_RGB, GL_UNSIGNED_BYTE, @Data[0]);
- if Mipmapping then begin
- Error := gluBuild2DMipmaps(GL_TEXTURE_2D, 3, W, H, GL_RGB, GL_UNSIGNED_BYTE, @Data[0]);
- if Error > 0 then beep;
- end;
-
- Result.X := 0;
- Result.Y := 0;
- Result.W := 0;
- Result.H := 0;
- Result.ScaleW := 1;
- Result.ScaleH := 1;
- Result.Rot := 0;
- Result.TexNum := ActTex;
- Result.TexW := 1;
- Result.TexH := 1;
-
- Result.Int := 1;
- Result.ColR := 1;
- Result.ColG := 1;
- Result.ColB := 1;
- Result.Alpha := 1;
-
- // 0.4.2 new test - default use whole texure, taking TexW and TexH as const and changing these
- Result.TexX1 := 0;
- Result.TexY1 := 0;
- Result.TexX2 := 1;
- Result.TexY2 := 1;
-
- // 0.5.0
- Result.Name := Name;
-end;
-
-procedure TTextureUnit.UnloadTexture(Name: string; FromCache: boolean);
-var
- T: integer;
- TexNum: GLuint;
-begin
- T := FindTexture(Name);
-
- if not FromCache then begin
- TexNum := TextureDatabase.Texture[T].Texture.TexNum;
- if TexNum >= 0 then begin
- glDeleteTextures(1, @TexNum);
- TextureDatabase.Texture[T].Texture.TexNum := -1;
-// Log.LogError('Unload texture no '+IntToStr(TexNum));
- end;
- end else begin
- TexNum := TextureDatabase.Texture[T].TextureCache.TexNum;
- if TexNum >= 0 then begin
- glDeleteTextures(1, @TexNum);
- TextureDatabase.Texture[T].TextureCache.TexNum := -1;
-// Log.LogError('Unload texture cache no '+IntToStr(TexNum));
- end;
- end;
-end;
-
-{$IFDEF LAZARUS}
-initialization
- {$I UltraStar.lrs}
-{$ENDIF}
-
-
-end.
+unit UTexture; +// added for easier debug disabling +{$define blindydebug} + +// Plain (alpha = 1) +// Transparent +// Colorized + +// obsolete? +// Transparent Range +// Font (white is drawn, black is transparent) +// Font Outline (Font with darker outline) +// Font Outline 2 (Font with darker outline) +// Font Black (black is drawn, white is transparent) +// Font Gray (gray is drawn, white is transparent) +// Arrow (for arrows, white is white, gray has color, black is transparent); + +interface + +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + +{$I switches.inc} + +uses OpenGL12, + {$IFDEF win32} + windows, + {$ENDIF} + Math, + Classes, + SysUtils, + Graphics, + UCommon, + UThemes, + SDL, + sdlutils, + SDL_Image; + +type + TTexture = record + TexNum: integer; + X: real; + Y: real; + Z: real; // new + W: real; + H: real; + ScaleW: real; // for dynamic scalling while leaving width constant + ScaleH: real; // for dynamic scalling while leaving height constant + Rot: real; // 0 - 2*pi + Int: real; // intensity + ColR: real; + ColG: real; + ColB: real; + TexW: real; // used? + TexH: real; // used? + TexX1: real; + TexY1: real; + TexX2: real; + TexY2: real; + Alpha: real; + Name: string; // 0.5.0: experimental for handling cache images. maybe it's useful for dynamic skins + end; + + TTextureEntry = record + Name: string; + Typ: string; + + // we use normal TTexture, it's easier to implement and if needed - we copy ready data + Texture: TTexture; + TextureCache: TTexture; // 0.5.0 + end; + + TTextureDatabase = record + Texture: array of TTextureEntry; + end; + + TTextureUnit = class + + private + function LoadImage(Identifier: PChar): PSDL_Surface; + function pixfmt_eq(fmt1,fmt2: PSDL_Pixelformat): boolean; + procedure AdjustPixelFormat(var TexSurface: PSDL_Surface; Typ: PChar); + function GetScaledTexture(TexSurface: PSDL_Surface; W,H: Cardinal): PSDL_Surface; + procedure ScaleTexture(var TexSurface: PSDL_Surface; W,H: Cardinal); + procedure FitTexture(var TexSurface: PSDL_Surface; W,H: Cardinal); + procedure ColorizeTexture(TexSurface: PSDL_Surface; Col: Cardinal); + + public + Limit: integer; + CreateCacheMipmap: boolean; + +// function GetNumberFor + function GetTexture(Name, Typ: string): TTexture; overload; + function GetTexture(Name, Typ: string; FromCache: boolean): TTexture; overload; + function FindTexture(Name: string): integer; + function LoadTexture(FromRegistry: boolean; Identifier, Format, Typ: PChar; Col: LongWord): TTexture; overload; + function LoadTexture(Identifier, Format, Typ: PChar; Col: LongWord): TTexture; overload; + function LoadTexture(Identifier: string): TTexture; overload; + function CreateTexture(var Data: array of byte; Name: string; W, H: word; Bits: byte): TTexture; + procedure UnloadTexture(Name: string; FromCache: boolean); + Constructor Create; + Destructor Destroy; + end; + +var + Texture: TTextureUnit; + TextureDatabase: TTextureDatabase; + + // this should be in UDisplay?! + PrintScreenData: array[0..1024*768-1] of longword; + + ActTex: GLuint;//integer; + +// TextureD8: array[1..1024*1024] of byte; // 1MB + TextureD16: array[1..1024*1024, 1..2] of byte; // luminance/alpha tex (2MB) +// TextureD24: array[1..1024*1024, 1..3] of byte; // normal 24-bit tex (3MB) +// TextureD242: array[1..512*512, 1..3] of byte; // normal 24-bit tex (0,75MB) +// TextureD32: array[1..1024*1024, 1..4] of byte; // transparent 32-bit tex (4MB) + // total 40MB at 2048*2048 + // total 10MB at 1024*1024 + + Mipmapping: Boolean; + + CacheMipmap: array[0..256*256*3-1] of byte; // 3KB + CacheMipmapSurface: PSDL_Surface; + + +implementation + +uses ULog, + DateUtils, + UCovers, + {$IFDEF LAZARUS} + LResources, + {$ENDIF} + {$IFDEF DARWIN} + MacResources, + {$ENDIF} + StrUtils, dialogs; + +const + fmt_rgba: TSDL_Pixelformat=(palette: nil; + BitsPerPixel: 32; + BytesPerPixel: 4; + Rloss: 0; + Gloss: 0; + Bloss: 0; + Aloss: 0; + Rshift: 0; + Gshift: 8; + Bshift: 16; + Ashift: 24; + Rmask: $000000ff; + Gmask: $0000ff00; + Bmask: $00ff0000; + Amask: $ff000000; + ColorKey: 0; + Alpha: 255); + fmt_rgb: TSDL_Pixelformat=( palette: nil; + BitsPerPixel: 24; + BytesPerPixel: 3; + Rloss: 0; + Gloss: 0; + Bloss: 0; + Aloss: 0; + Rshift: 0; + Gshift: 8; + Bshift: 16; + Ashift: 0; + Rmask: $000000ff; + Gmask: $0000ff00; + Bmask: $00ff0000; + Amask: $00000000; + ColorKey: 0; + Alpha: 255); + + +Constructor TTextureUnit.Create; +begin + inherited Create; +end; + +Destructor TTextureUnit.Destroy; +begin + inherited Destroy; +end; + +function TTextureUnit.pixfmt_eq(fmt1,fmt2: PSDL_Pixelformat): boolean; +begin + if (fmt1^.BitsPerPixel = fmt2^.BitsPerPixel) and + (fmt1^.BytesPerPixel = fmt2^.BytesPerPixel) and + (fmt1^.Rloss = fmt2^.Rloss) and (fmt1^.Gloss = fmt2^.Gloss) and + (fmt1^.Bloss = fmt2^.Bloss) and (fmt1^.Rmask = fmt2^.Rmask) and + (fmt1^.Gmask = fmt2^.Gmask) and (fmt1^.Bmask = fmt2^.Bmask) and + (fmt1^.Rshift = fmt2^.Rshift) and (fmt1^.Gshift = fmt2^.Gshift) and + (fmt1^.Bshift = fmt2^.Bshift) + then + Result:=True + else + Result:=False; +end; + +// +++++++++++++++++++++ helpers for loadimage +++++++++++++++ + function SdlStreamSeek( context : PSDL_RWops; offset : Integer; whence : Integer ) : integer; cdecl; + var + stream : TStream; + origin : Word; + begin + stream := TStream( context.unknown ); + if ( stream = nil ) then + raise EInvalidContainer.Create( 'SDLStreamSeek on nil' ); + case whence of + 0 : origin := soFromBeginning; // Offset is from the beginning of the resource. Seek moves to the position Offset. Offset must be >= 0. + 1 : origin := soFromCurrent; // Offset is from the current position in the resource. Seek moves to Position + Offset. + 2 : origin := soFromEnd; + else + origin := soFromBeginning; // just in case + end; + Result := stream.Seek( offset, origin ); + end; + function SdlStreamRead( context : PSDL_RWops; Ptr : Pointer; size : Integer; maxnum: Integer ) : Integer; cdecl; + var + stream : TStream; + begin + stream := TStream( context.unknown ); + if ( stream = nil ) then + raise EInvalidContainer.Create( 'SDLStreamRead on nil' ); + try + Result := stream.read( Ptr^, Size * maxnum ) div size; + except + Result := -1; + end; + end; + function SDLStreamClose( context : PSDL_RWops ) : Integer; cdecl; + var + stream : TStream; + begin + stream := TStream( context.unknown ); + if ( stream = nil ) then + raise EInvalidContainer.Create( 'SDLStreamClose on nil' ); + stream.Free; + Result := 1; + end; +// ----------------------------------------------- + +function TTextureUnit.LoadImage(Identifier: PChar): PSDL_Surface; +var + + TexRWops: PSDL_RWops; + dHandle: THandle; + + {$IFDEF LAZARUS} + lLazRes : TLResource; + lResData : TStringStream; + {$ELSE} + TexStream: TStream; + {$ENDIF} + +begin + Result := nil; + TexRWops := nil; + +// Log.LogStatus( Identifier, 'LoadImage' ); + + if ( FileExists(Identifier) ) then + begin + // load from file + Log.LogStatus( 'Is File', ' LoadImage' ); + try + Result:=IMG_Load(Identifier); + except + Log.LogStatus( 'ERROR Could not load from file' , Identifier); + beep; + Exit; + end; + end + else + begin + Log.LogStatus( 'IS Resource, because file does not exist.('+Identifier+')', ' LoadImage' ); + + // load from resource stream + {$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 + Log.LogStatus( 'ERROR Could not find resource' , ' '+ Identifier); + beep; + Exit; + end; + + + TexStream := nil; + try + TexStream := TResourceStream.Create(HInstance, Identifier, 'TEX'); + except + Log.LogStatus( 'ERROR Could not load from resource' , Identifier); + beep; + Exit; + end; + + try + TexStream.position := 0; + try + TexRWops := SDL_AllocRW; + TexRWops.unknown := TUnknown(TexStream); + TexRWops.seek := SDLStreamSeek; + TexRWops.read := SDLStreamRead; + TexRWops.write := nil; + TexRWops.close := SDLStreamClose; + TexRWops.type_ := 2; + except + Log.LogStatus( 'ERROR Could not assign resource' , Identifier); + beep; + Exit; + end; + + Log.LogStatus( 'resource Assigned....' , Identifier); + Result:=IMG_Load_RW(TexRWops,0); + SDL_FreeRW(TexRWops); + + finally + if assigned( TexStream ) then + freeandnil( TexStream ); + end; + {$ENDIF} + end; +end; + +procedure TTextureUnit.AdjustPixelFormat(var TexSurface: PSDL_Surface; Typ: PChar); +var + TempSurface: PSDL_Surface; + NeededPixFmt: PSDL_Pixelformat; +begin + NeededPixFmt:=@fmt_rgba; + if Typ= 'Plain' then NeededPixFmt:=@fmt_rgb + else + if (Typ='Transparent') or + (Typ='Colorized') + then NeededPixFmt:=@fmt_rgba + else + NeededPixFmt:=@fmt_rgb; + + + if not pixfmt_eq(TexSurface^.format, NeededPixFmt) then + begin + TempSurface:=TexSurface; + TexSurface:=SDL_ConvertSurface(TempSurface,NeededPixFmt,SDL_SWSURFACE); + SDL_FreeSurface(TempSurface); + end; +end; + +function TTextureUnit.GetScaledTexture(TexSurface: PSDL_Surface; W,H: Cardinal): PSDL_Surface; +var + TempSurface: PSDL_Surface; +begin + TempSurface:=TexSurface; + Result:=SDL_ScaleSurfaceRect(TempSurface, + 0,0,TempSurface^.W,TempSurface^.H, + W,H); +end; + +procedure TTextureUnit.ScaleTexture(var TexSurface: PSDL_Surface; W,H: Cardinal); +var + TempSurface: PSDL_Surface; +begin + TempSurface:=TexSurface; + TexSurface:=SDL_ScaleSurfaceRect(TempSurface, + 0,0,TempSurface^.W,TempSurface^.H, + W,H); + SDL_FreeSurface(TempSurface); +end; + +procedure TTextureUnit.FitTexture(var TexSurface: PSDL_Surface; W,H: Cardinal); +var + TempSurface: PSDL_Surface; +begin + TempSurface:=TexSurface; + with TempSurface^.format^ do + TexSurface:=SDL_CreateRGBSurface(SDL_SWSURFACE,W,H,BitsPerPixel,RMask, GMask, BMask, AMask); + SDL_SetAlpha(TexSurface, 0, 255); + SDL_SetAlpha(TempSurface, 0, 255); + SDL_BlitSurface(TempSurface,nil,TexSurface,nil); + SDL_FreeSurface(TempSurface); +end; + +procedure TTextureUnit.ColorizeTexture(TexSurface: PSDL_Surface; Col: Cardinal); + //returns hue within range [0.0-6.0) + function col2h(Color:Cardinal):double; + var + clr,hls: array[0..2] of double; + delta: double; + begin + clr[0]:=((Color and $ff0000) shr 16)/255; + clr[1]:=((Color and $ff00) shr 8)/255; + clr[2]:=(Color and $ff)/255; + hls[1]:=maxvalue(clr); + delta:=hls[1]-minvalue(clr); + if clr[0]=hls[1] then hls[0]:=(clr[1]-clr[2])/delta + else if clr[1]=hls[1] then hls[0]:=2.0+(clr[2]-clr[0])/delta + else if clr[2]=hls[1] then hls[0]:=4.0+(clr[0]-clr[1])/delta; + if hls[0]<0.0 then hls[0]:=hls[0]+6.0; + if hls[0]=6.0 then hls[0]:=0.0; + col2h:=hls[0]; + end; + procedure ColorizePixel(Pix: PByteArray; hue: Double); + var + i,j,k: Cardinal; + clr, hls: array[0..2] of Double; + delta, f, p, q, t: Double; + begin + hls[0]:=hue; + + clr[0] := Pix[0]/255; + clr[1] := Pix[1]/255; + clr[2] := Pix[2]/255; + + //calculate luminance and saturation from rgb + hls[1] := maxvalue(clr); //l:=... + delta := hls[1] - minvalue(clr); + + if hls[1] = 0.0 then + hls[2] := 0.0 + else + hls[2] := delta/hls[1]; //v:=... + + // calc new rgb from our hls (h from color, l ans s from pixel) + // if (hls[1]<>0.0) and (hls[2]<>0.0) then // only if colorizing makes sense + begin + k:=trunc(hls[0]); + f:=hls[0]-k; + p:=hls[1]*(1.0-hls[2]); + q:=hls[1]*(1.0-(hls[2]*f)); + t:=hls[1]*(1.0-(hls[2]*(1.0-f))); + case k of + 0: begin clr[0]:=hls[1]; clr[1]:=t; clr[2]:=p; end; + 1: begin clr[0]:=q; clr[1]:=hls[1]; clr[2]:=p; end; + 2: begin clr[0]:=p; clr[1]:=hls[1]; clr[2]:=t; end; + 3: begin clr[0]:=p; clr[1]:=q; clr[2]:=hls[1]; end; + 4: begin clr[0]:=t; clr[1]:=p; clr[2]:=hls[1]; end; + 5: begin clr[0]:=hls[1]; clr[1]:=p; clr[2]:=q; end; + end; + // and store new rgb back into the image + Pix[0]:=floor(255*clr[0]); + Pix[1]:=floor(255*clr[1]); + Pix[2]:=floor(255*clr[2]); + end; + end; + +var + DestinationHue: Double; + PixelIndex: Cardinal; +begin + DestinationHue:=col2h(Col); + for PixelIndex:=0 to (TexSurface^.W*TexSurface^.H -1) do + ColorizePixel(@(PByteArray(TexSurface^.Pixels)[PixelIndex*TexSurface^.format.BytesPerPixel]),DestinationHue); +end; + +function TTextureUnit.LoadTexture(FromRegistry: boolean; Identifier, Format, Typ: PChar; Col: LongWord): TTexture; +var + TexSurface: PSDL_Surface; + MipmapSurface: PSDL_Surface; + newWidth, newHeight: Cardinal; + oldWidth, oldHeight: Cardinal; + kopierindex: Cardinal; +begin + Log.BenchmarkStart(4); + Mipmapping := true; +(* + Log.LogStatus( '', '' ); + + if Identifier = nil then + Log.LogStatus(' ERROR unknown Identifier', 'Id:'''+Identifier+''' Fmt:'''+Format+''' Typ:'''+Typ+'''') + else + Log.LogStatus(' should be ok - trying to load', 'Id:'''+Identifier+''' Fmt:'''+Format+''' Typ:'''+Typ+''''); +*) + + // load texture data into memory + {$ifdef blindydebug} + Log.LogStatus('',' ----------------------------------------------------'); + Log.LogStatus('',' LoadImage('''+Identifier+''') (called by '+Format+')'); + {$endif} + TexSurface := LoadImage(Identifier); + {$ifdef blindydebug} + Log.LogStatus('',' ok'); + {$endif} + if not assigned(TexSurface) then + begin + Log.LogStatus( 'ERROR Could not load texture' , Identifier +' '+ Format +' '+ Typ ); + beep; + Exit; + end; + + // convert pixel format as needed + {$ifdef blindydebug} + Log.LogStatus('',' AdjustPixelFormat'); + {$endif} + AdjustPixelFormat(TexSurface, Typ); + {$ifdef blindydebug} + Log.LogStatus('',' ok'); + {$endif} + // adjust texture size (scale down, if necessary) + newWidth := TexSurface.W; + newHeight := TexSurface.H; + + if (newWidth > Limit) then + newWidth := Limit; + + if (newHeight > Limit) then + newHeight := Limit; + + if (TexSurface.W > newWidth) or (TexSurface.H > newHeight) then + begin + {$ifdef blindydebug} + Log.LogStatus('',' ScaleTexture'); + {$endif} + ScaleTexture(TexSurface,newWidth,newHeight); + {$ifdef blindydebug} + Log.LogStatus('',' ok'); + {$endif} + end; + + {$ifdef blindydebug} + Log.LogStatus('',' JB-1 : typ='+Typ); + {$endif} + + + + // don't actually understand, if this is needed... + // this should definately be changed... together with all this + // cover cache stuff + if (CreateCacheMipmap) and (Typ='Plain') then + begin + {$ifdef blindydebug} + Log.LogStatus('',' JB-1 : Minimap'); + {$endif} + + if (Covers.W <= 256) and (Covers.H <= 256) then + begin + {$ifdef blindydebug} + Log.LogStatus('',' GetScaledTexture('''+inttostr(Covers.W)+''','''+inttostr(Covers.H)+''') (for CacheMipmap)'); + {$endif} + MipmapSurface:=GetScaledTexture(TexSurface,Covers.W, Covers.H); + if assigned(MipmapSurface) then + begin + {$ifdef blindydebug} + Log.LogStatus('',' ok'); + Log.LogStatus('',' BlitSurface Stuff'); + {$endif} + // creating and freeing the surface could be done once, if Cover.W and Cover.H don't change + CacheMipmapSurface:=SDL_CreateRGBSurfaceFrom(@CacheMipmap[0], Covers.W, Covers.H, 24, Covers.W*3, $000000ff, $0000ff00, $00ff0000, 0); + SDL_BlitSurface(MipMapSurface,nil,CacheMipmapSurface,nil); + SDL_FreeSurface(CacheMipmapSurface); + {$ifdef blindydebug} + Log.LogStatus('',' ok'); + Log.LogStatus('',' SDL_FreeSurface (CacheMipmap)'); + {$endif} + SDL_FreeSurface(MipmapSurface); + {$ifdef blindydebug} + Log.LogStatus('',' ok'); + {$endif} + end + else + begin + Log.LogStatus(' Error creating CacheMipmap',' LoadTexture('''+Identifier+''')'); + end; + end; + // should i create a cache texture, if Covers.W/H are larger? + end; + + {$ifdef blindydebug} + Log.LogStatus('',' JB-2'); + {$endif} + + + // now we might colorize the whole thing + if Typ='Colorized' then + ColorizeTexture(TexSurface,Col); + + // save actual dimensions of our texture + oldWidth:=newWidth; + oldHeight:=newHeight; + // make texture dimensions be powers of 2 + newWidth:=Round(Power(2, Ceil(Log2(newWidth)))); + newHeight:=Round(Power(2, Ceil(Log2(newHeight)))); + if (newHeight <> oldHeight) or (newWidth <> oldWidth) then + FitTexture(TexSurface,newWidth,newHeight); + + // at this point we have the image in memory... + // scaled to be at most 1024x1024 pixels large + // scaled so that dimensions are powers of 2 + // and converted to either RGB or RGBA + + {$ifdef blindydebug} + Log.LogStatus('',' JB-3'); + {$endif} + + + // if we got a Texture of Type Plain, Transparent or Colorized, + // then we're done manipulating it + // and could now create our openGL texture from it + + // prepare OpenGL texture + + // JB_linux : this is causing AV's on linux... ActText seems to be nil ! +// {$IFnDEF win32} +// if pointer(ActTex) = nil then +// exit; +// {$endif} + + glGenTextures(1, @ActTex); + + glBindTexture(GL_TEXTURE_2D, ActTex); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + + // load data into gl texture + if (Typ = 'Transparent') or + (Typ='Colorized') then + begin + glTexImage2D(GL_TEXTURE_2D, 0, 4, newWidth, newHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, TexSurface.pixels); + end + {if Typ = 'Plain' then} else + begin + glTexImage2D(GL_TEXTURE_2D, 0, 3, newWidth, newHeight, 0, GL_RGB, GL_UNSIGNED_BYTE, TexSurface.pixels); + end; + + {$ifdef blindydebug} + Log.LogStatus('',' JB-4'); + {$endif} + +{ + if Typ = 'Transparent Range' then + // set alpha to 256-green-component (not sure) + Pix := TextureB.Canvas.Pixels[Position2, Position]; + TextureD32[Position*TexNewW + Position2+1, 1] := Pix; + TextureD32[Position*TexNewW + Position2+1, 2] := Pix div 256; + TextureD32[Position*TexNewW + Position2+1, 3] := Pix div (256*256); + TextureD32[Position*TexNewW + Position2+1, 4] := 256 - Pix div 256; +} +{ + if Typ = 'Font' then + // either create luminance-alpha texture + // or use transparency from differently saved file + // or do something totally different (text engine with ttf) + Pix := PPix[Position2 * 3]; + TextureD16[Position*TextureB.Width + Position2 + 1, 1] := 255; + TextureD16[Position*TextureB.Width + Position2 + 1, 2] := Pix; + glTexImage2D(GL_TEXTURE_2D, 0, 2, TextureB.Width, TextureB.Height, 0, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, @TextureD16); +} +{ + if Typ = 'Font Outline' then + // no idea... + begin + TextureB.PixelFormat := pf24bit; + for Position := 0 to TextureB.Height-1 do begin + PPix := TextureB.ScanLine[Position]; + for Position2 := 0 to TextureB.Width-1 do begin + Pix := PPix[Position2 * 3]; + + Col := Pix; + if Col < 127 then Col := 127; + + TempA := Pix; + if TempA >= 95 then TempA := 255; + if TempA >= 31 then TempA := 255; + if Pix < 95 then TempA := (Pix * 256) div 96; + + + TextureD16[Position*TextureB.Width + Position2 + 1, 1] := Col; + TextureD16[Position*TextureB.Width + Position2 + 1, 2] := TempA; + end; + end; + glTexImage2D(GL_TEXTURE_2D, 0, 2, TextureB.Width, TextureB.Height, 0, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, @TextureD16); + end; +} +{ + if Typ = 'Font Outline 2' then + // same as above + begin + TextureB.PixelFormat := pf24bit; + for Position := 0 to TextureB.Height-1 do begin + PPix := TextureB.ScanLine[Position]; + for Position2 := 0 to TextureB.Width-1 do begin + Pix := PPix[Position2 * 3]; + + Col := Pix; + if Col < 31 then Col := 31; + + TempA := Pix; + if TempA >= 31 then TempA := 255; + if Pix < 31 then TempA := Pix * (256 div 32); + + TextureD16[Position*TextureB.Width + Position2 + 1, 1] := Col; + TextureD16[Position*TextureB.Width + Position2 + 1, 2] := TempA; + end; + end; + glTexImage2D(GL_TEXTURE_2D, 0, 2, TextureB.Width, TextureB.Height, 0, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, @TextureD16); + if Mipmapping then glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); + if Mipmapping then begin + Error := gluBuild2DMipmaps(GL_TEXTURE_2D, 2, TextureB.Width, TextureB.Height, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, @TextureD16); + if Error > 0 then beep; + end; + end; + + if Typ = 'Font Black' then + // and so on + begin + // normalnie 0,125s bez niczego 0,015s - 0,030s z pix 0,125s <-- ??? + // dimensions + TextureB.PixelFormat := pf24bit; + TexOrigW := TextureB.Width; + TexOrigH := TextureB.Height; + TexNewW := Round(Power(2, Ceil(Log2(TexOrigW)))); + TexNewH := Round(Power(2, Ceil(Log2(TexOrigH)))); + TextureB.Width := TexNewW; + TextureB.Height := TexNewH; + // copy and process pixeldata + for Position := 0 to TextureB.Height-1 do begin + PPix := TextureB.ScanLine[Position]; + for Position2 := 0 to TextureB.Width-1 do begin + Pix := PPix[Position2*3]; + TextureD32[Position*TextureB.Width + Position2 + 1, 1] := 255; + TextureD32[Position*TextureB.Width + Position2 + 1, 2] := 255; + TextureD32[Position*TextureB.Width + Position2 + 1, 3] := 255; + TextureD32[Position*TextureB.Width + Position2 + 1, 4] := 255 - (Pix mod 256); + end; + end; + glTexImage2D(GL_TEXTURE_2D, 0, 4, TextureB.Width, TextureB.Height, 0, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32); + end; + + if Typ = 'Alpha Black Colored' then + // ... hope, noone needs this + begin + TextureB.PixelFormat := pf24bit; + TexOrigW := TextureB.Width; + TexOrigH := TextureB.Height; + TexNewW := Round(Power(2, Ceil(Log2(TexOrigW)))); + TexNewH := Round(Power(2, Ceil(Log2(TexOrigH)))); + TextureB.Width := TexNewW; + TextureB.Height := TexNewH; + // copy and process pixeldata + for Position := 0 to TextureB.Height-1 do begin + PPix := TextureB.ScanLine[Position]; + for Position2 := 0 to TextureB.Width-1 do begin + Pix := PPix[Position2*3]; + TextureD32[Position*TextureB.Width + Position2 + 1, 1] := (Col div $10000) and $FF; + TextureD32[Position*TextureB.Width + Position2 + 1, 2] := (Col div $100) and $FF; + TextureD32[Position*TextureB.Width + Position2 + 1, 3] := Col and $FF; + TextureD32[Position*TextureB.Width + Position2 + 1, 4] := 255 - (Pix mod 256); + end; + end; + glTexImage2D(GL_TEXTURE_2D, 0, 4, TextureB.Width, TextureB.Height, 0, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32); + end; + + if Typ = 'Font Gray' then + begin + // dimensions + TexOrigW := TextureB.Width; + TexOrigH := TextureB.Height; + TexNewW := Round(Power(2, Ceil(Log2(TexOrigW)))); + TexNewH := Round(Power(2, Ceil(Log2(TexOrigH)))); + TextureB.Width := TexNewW; + TextureB.Height := TexNewH; + // copy and process pixeldata + for Position := 0 to TextureB.Height-1 do begin + for Position2 := 0 to TextureB.Width-1 do begin + Pix := TextureB.Canvas.Pixels[Position2, Position]; + TextureD32[Position*TextureB.Width + Position2 + 1, 1] := 127; + TextureD32[Position*TextureB.Width + Position2 + 1, 2] := 127; + TextureD32[Position*TextureB.Width + Position2 + 1, 3] := 127; + TextureD32[Position*TextureB.Width + Position2 + 1, 4] := 255 - (Pix mod 256); + end; + end; + glTexImage2D(GL_TEXTURE_2D, 0, 4, TextureB.Width, TextureB.Height, 0, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32); + end; + + if Typ = 'Arrow' then + begin + TextureB.PixelFormat := pf24bit; + for Position := 0 to TextureB.Height-1 do begin + PPix := TextureB.ScanLine[Position]; + for Position2 := 0 to TextureB.Width-1 do begin + Pix := PPix[Position2 * 3]; + + // transparency + if Pix >= 127 then TempA := 255; + if Pix < 127 then TempA := Pix * 2; + + // ColInt = color intensity + if Pix < 127 then ColInt := 1; + if Pix >= 127 then ColInt := 2 - Pix / 128; + //0.75, 0.6, 0.25 + + TextureD32[Position*TextureB.Width + Position2 + 1, 1] := Round(ColInt * 0.75 * 255 + (1 - ColInt) * 255); + TextureD32[Position*TextureB.Width + Position2 + 1, 2] := Round(ColInt * 0.6 * 255 + (1 - ColInt) * 255); + TextureD32[Position*TextureB.Width + Position2 + 1, 3] := Round(ColInt * 0.25 * 255 + (1 - ColInt) * 255); + TextureD32[Position*TextureB.Width + Position2 + 1, 4] := TempA; + end; + end; + glTexImage2D(GL_TEXTURE_2D, 0, 4, TextureB.Width, TextureB.Height, 0, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32); + + if Mipmapping then glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); + if Mipmapping then begin + Error := gluBuild2DMipmaps(GL_TEXTURE_2D, 4, TextureB.Width, TextureB.Height, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32); + if Error > 0 then beep; + end; + end; + + if Typ = 'Note Plain' then + begin + for Position := 0 to TextureB.Height-1 do + begin + PPix := TextureB.ScanLine[Position]; + for Position2 := 0 to TextureB.Width-1 do + begin + + + + // Skin Patch + // 0-191= Fade Black to Col, 192= Col, 193-254 Fade Col to White, 255= White + case PPix[Position2*3] of + 0..191: Pix := $10000 * ((((Col div $10000) and $FF) * PPix[Position2*3]) div $Bf) + $100 * ((((Col div $100) and $FF) * PPix[Position2*3]) div $Bf) + (((Col and $FF) * PPix[Position2*3]) div $Bf); + 192: Pix := Col; + 193..254: Pix := Col + ($10000 * ((($FF - ((Col div $10000) and $FF)) * ((PPix[Position2*3] - $C0) * 4) ) div $FF) + $100 * ((($FF - ((Col div $100) and $FF)) * ((PPix[Position2*3] - $C0) * 4)) div $FF) + ((($FF - (Col and $FF)) * ((PPix[Position2*3] - $C0) * 4)) div $FF)); + 255: Pix := $FFFFFF; + end; +// 0.5.0. Original +// case PPix[Position2*3] of +// 128: Pix := $10000 * ((Col div $10000) div 2) + $100 * (((Col div $100) and $FF) div 2) + (Col and $FF) div 2; +// 192: Pix := Col; +// 255: Pix := $FFFFFF; +// end; + + + + + + TextureD24[Position*TextureB.Width + Position2 + 1, 1] := Pix div $10000; + TextureD24[Position*TextureB.Width + Position2 + 1, 2] := (Pix div $100) and $FF; + TextureD24[Position*TextureB.Width + Position2 + 1, 3] := Pix and $FF; + end; + end; + glTexImage2D(GL_TEXTURE_2D, 0, 3, TextureB.Width, TextureB.Height, 0, GL_RGB, GL_UNSIGNED_BYTE, @TextureD24); + end; + + if Typ = 'Note Transparent' then + begin + for Position := 0 to TextureB.Height-1 do begin + PPix := TextureB.ScanLine[Position]; + for Position2 := 0 to TextureB.Width-1 do begin + TempA := 255; + + + + //Skin Patch + // 0= Transparent, 1-191= Fade Black to Col, 192= Col, 193-254 Fade Col to White, 255= White + case PPix[Position2*3] of + 0: TempA := 0; + 1..191: Pix := $10000 * ((((Col div $10000) and $FF) * PPix[Position2*3]) div $Bf) + $100 * ((((Col div $100) and $FF) * PPix[Position2*3]) div $Bf) + (((Col and $FF) * PPix[Position2*3]) div $Bf); + 192: Pix := Col; + 193..254: Pix := Col + ($10000 * ((($FF - ((Col div $10000) and $FF)) * ((PPix[Position2*3] - $C0) * 4) ) div $FF) + $100 * ((($FF - ((Col div $100) and $FF)) * ((PPix[Position2*3] - $C0) * 4)) div $FF) + ((($FF - (Col and $FF)) * ((PPix[Position2*3] - $C0) * 4)) div $FF)); + 255: Pix := $FFFFFF; + end; +// 0.5.0 Original +// case PPix[Position2*3] of +// 0: TempA := 0; +// 128: Pix := $10000 * ((Col div $10000) div 2) + $100 * (((Col div $100) and $FF) div 2) + (Col and $FF) div 2; +// 192: Pix := Col; +// 255: Pix := $FFFFFF; +// end; + + + + + TextureD32[Position*TextureB.Width + Position2 + 1, 1] := Pix div $10000; + TextureD32[Position*TextureB.Width + Position2 + 1, 2] := (Pix div $100) and $FF; + TextureD32[Position*TextureB.Width + Position2 + 1, 3] := Pix and $FF; + TextureD32[Position*TextureB.Width + Position2 + 1, 4] := TempA; + end; + end; + glTexImage2D(GL_TEXTURE_2D, 0, 4, TextureB.Width, TextureB.Height, 0, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32); + end; +} + + {$ifdef blindydebug} + Log.LogStatus('',' JB-5'); + {$endif} + + + Result.X := 0; + Result.Y := 0; + Result.W := 0; + Result.H := 0; + Result.ScaleW := 1; + Result.ScaleH := 1; + Result.Rot := 0; + Result.TexNum := ActTex; + Result.TexW := oldWidth / newWidth; + Result.TexH := oldHeight / newHeight; + + Result.Int := 1; + Result.ColR := 1; + Result.ColG := 1; + Result.ColB := 1; + Result.Alpha := 1; + + // 0.4.2 new test - default use whole texure, taking TexW and TexH as const and changing these + Result.TexX1 := 0; + Result.TexY1 := 0; + Result.TexX2 := 1; + Result.TexY2 := 1; + + {$ifdef blindydebug} + Log.LogStatus('',' JB-6'); + {$endif} + + + // 0.5.0 + Result.Name := Identifier; + + SDL_FreeSurface(TexSurface); + + {$ifdef blindydebug} + Log.LogStatus('',' JB-7'); + {$endif} + + + Log.BenchmarkEnd(4); + if Log.BenchmarkTimeLength[4] >= 1 then + Log.LogBenchmark('**********> Texture Load Time Warning - ' + Format + '/' + Identifier + '/' + Typ, 4); + + {$ifdef blindydebug} + Log.LogStatus('',' JB-8'); + {$endif} + +end; + + +function TTextureUnit.GetTexture(Name, Typ: string): TTexture; +begin + Result := GetTexture(Name, Typ, true); +end; + +function TTextureUnit.GetTexture(Name, Typ: string; FromCache: boolean): TTexture; +var + T: integer; // texture + C: integer; // cover + Data: array of byte; +begin + + if Name = '' then + exit; + + // find texture entry + T := FindTexture(Name); + + if T = -1 then + begin + // create texture entry + T := Length(TextureDatabase.Texture); + SetLength(TextureDatabase.Texture, T+1); + + TextureDatabase.Texture[T].Name := Name; + TextureDatabase.Texture[T].Typ := Typ; + + // inform database that no textures have been loaded into memory + TextureDatabase.Texture[T].Texture.TexNum := -1; + TextureDatabase.Texture[T].TextureCache.TexNum := -1; + end; + + // use preloaded texture + if (not FromCache) or (FromCache and not Covers.CoverExists(Name)) then + begin + // use full texture + if TextureDatabase.Texture[T].Texture.TexNum = -1 then + begin + // load texture + {$ifdef blindydebug} + Log.LogStatus('...', 'GetTexture('''+Name+''','''+Typ+''')'); + {$endif} + TextureDatabase.Texture[T].Texture := LoadTexture(false, pchar(Name), 'JPG', pchar(Typ), $0); + {$ifdef blindydebug} + Log.LogStatus('done',' '); + {$endif} + end; + + // use texture + Result := TextureDatabase.Texture[T].Texture; + end; + + if FromCache and Covers.CoverExists(Name) then + begin + // use cache texture + C := Covers.CoverNumber(Name); + + if TextureDatabase.Texture[T].TextureCache.TexNum = -1 then + begin + // load texture + Covers.PrepareData(Name); + TextureDatabase.Texture[T].TextureCache := CreateTexture(Covers.Data, Name, Covers.Cover[C].W, Covers.Cover[C].H, 24); + end; + + // use texture + Result := TextureDatabase.Texture[T].TextureCache; + end; +end; + +function TTextureUnit.FindTexture(Name: string): integer; +var + T: integer; // texture +begin + Result := -1; + for T := 0 to high(TextureDatabase.Texture) do + if TextureDatabase.Texture[T].Name = Name then + Result := T; +end; + +function TTextureUnit.LoadTexture(Identifier, Format, Typ: PChar; Col: LongWord): TTexture; +begin + Result := LoadTexture(false, Identifier, Format, Typ, Col); +end; + +function TTextureUnit.LoadTexture(Identifier: string): TTexture; +begin + Result := LoadTexture(false, pchar(Identifier), 'JPG', 'Plain', 0); +end; + +function TTextureUnit.CreateTexture(var Data: array of byte; Name: string; W, H: word; Bits: byte): TTexture; +var + Position: integer; + Position2: integer; + Pix: integer; + ColInt: real; + PPix: PByteArray; + TempA: integer; + Error: integer; +begin + Mipmapping := false; + + glGenTextures(1, @ActTex); // ActText = new texture number + glBindTexture(GL_TEXTURE_2D, ActTex); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + + glTexImage2D(GL_TEXTURE_2D, 0, 3, W, H, 0, GL_RGB, GL_UNSIGNED_BYTE, @Data[0]); + if Mipmapping then begin + Error := gluBuild2DMipmaps(GL_TEXTURE_2D, 3, W, H, GL_RGB, GL_UNSIGNED_BYTE, @Data[0]); + if Error > 0 then beep; + end; + + Result.X := 0; + Result.Y := 0; + Result.W := 0; + Result.H := 0; + Result.ScaleW := 1; + Result.ScaleH := 1; + Result.Rot := 0; + Result.TexNum := ActTex; + Result.TexW := 1; + Result.TexH := 1; + + Result.Int := 1; + Result.ColR := 1; + Result.ColG := 1; + Result.ColB := 1; + Result.Alpha := 1; + + // 0.4.2 new test - default use whole texure, taking TexW and TexH as const and changing these + Result.TexX1 := 0; + Result.TexY1 := 0; + Result.TexX2 := 1; + Result.TexY2 := 1; + + // 0.5.0 + Result.Name := Name; +end; + +procedure TTextureUnit.UnloadTexture(Name: string; FromCache: boolean); +var + T: integer; + TexNum: GLuint; +begin + T := FindTexture(Name); + + if not FromCache then begin + TexNum := TextureDatabase.Texture[T].Texture.TexNum; + if TexNum >= 0 then begin + glDeleteTextures(1, @TexNum); + TextureDatabase.Texture[T].Texture.TexNum := -1; +// Log.LogError('Unload texture no '+IntToStr(TexNum)); + end; + end else begin + TexNum := TextureDatabase.Texture[T].TextureCache.TexNum; + if TexNum >= 0 then begin + glDeleteTextures(1, @TexNum); + TextureDatabase.Texture[T].TextureCache.TexNum := -1; +// Log.LogError('Unload texture cache no '+IntToStr(TexNum)); + end; + end; +end; + +{$IFDEF LAZARUS} +initialization + {$I UltraStar.lrs} +{$ENDIF} + + +end. diff --git a/Game/Code/MacOSX/UltraStarDX.pas b/Game/Code/MacOSX/UltraStarDX.pas index 6c5d4e2b..1b8a3b63 100644 --- a/Game/Code/MacOSX/UltraStarDX.pas +++ b/Game/Code/MacOSX/UltraStarDX.pas @@ -1,6 +1,6 @@ program UltraStarDX; -uses UMain, UAudio_bass, UAudio_FFMpeg, UMedia_dummy, USingNotes, UTextClasses, UVideo; +uses UMain, UMedia_dummy, UAudio_FFMpeg, UAudio_bass, USingNotes, UTextClasses, UVideo; begin Main; diff --git a/Game/Code/MacOSX/UltraStarDX.xcodeproj/eddie.mode1 b/Game/Code/MacOSX/UltraStarDX.xcodeproj/eddie.mode1 index 3dd9e158..b56265f4 100644 --- a/Game/Code/MacOSX/UltraStarDX.xcodeproj/eddie.mode1 +++ b/Game/Code/MacOSX/UltraStarDX.xcodeproj/eddie.mode1 @@ -190,64 +190,24 @@ <key>Content</key> <dict> <key>PBXProjectModuleGUID</key> - <string>2C0C2C180CDC7312004A651F</string> + <string>2CF3EF8A0CDE1898004F5956</string> <key>PBXProjectModuleLabel</key> - <string>USongs.pas</string> + <string>MacResources.pas</string> <key>PBXSplitModuleInNavigatorKey</key> <dict> <key>Split0</key> <dict> <key>PBXProjectModuleGUID</key> - <string>2C0C2C190CDC7312004A651F</string> + <string>2CF3EF8B0CDE1898004F5956</string> <key>PBXProjectModuleLabel</key> - <string>USongs.pas</string> + <string>MacResources.pas</string> <key>_historyCapacity</key> <integer>0</integer> <key>bookmark</key> - <string>2CD3B28C0CDC76B6001F1030</string> + <string>2CF3EFEC0CDE1AB6004F5956</string> <key>history</key> <array> - <string>2CD3B2550CDC7564001F1030</string> - </array> - </dict> - <key>SplitCount</key> - <string>1</string> - </dict> - <key>StatusBarVisibility</key> - <true/> - </dict> - <key>Geometry</key> - <dict> - <key>Frame</key> - <string>{{0, 20}, {797, 748}}</string> - <key>PBXModuleWindowStatusBarHidden2</key> - <false/> - <key>RubberWindowFrame</key> - <string>84 171 797 789 0 0 1680 1028 </string> - </dict> - </dict> - <dict> - <key>Content</key> - <dict> - <key>PBXProjectModuleGUID</key> - <string>2CF552990CDA426600627463</string> - <key>PBXProjectModuleLabel</key> - <string>UMain.pas</string> - <key>PBXSplitModuleInNavigatorKey</key> - <dict> - <key>Split0</key> - <dict> - <key>PBXProjectModuleGUID</key> - <string>2CF5529A0CDA426600627463</string> - <key>PBXProjectModuleLabel</key> - <string>UMain.pas</string> - <key>_historyCapacity</key> - <integer>0</integer> - <key>bookmark</key> - <string>2CD3B28D0CDC76B6001F1030</string> - <key>history</key> - <array> - <string>2C0C2C430CDC73BE004A651F</string> + <string>2CF3EFA30CDE1A19004F5956</string> </array> </dict> <key>SplitCount</key> @@ -263,31 +223,31 @@ <key>PBXModuleWindowStatusBarHidden2</key> <false/> <key>RubberWindowFrame</key> - <string>222 147 1052 687 0 0 1680 1028 </string> + <string>515 276 1052 687 0 0 1680 1028 </string> </dict> </dict> <dict> <key>Content</key> <dict> <key>PBXProjectModuleGUID</key> - <string>2CF5536C0CDA575B00627463</string> + <string>2C0C2C180CDC7312004A651F</string> <key>PBXProjectModuleLabel</key> - <string>UltraStarDX.pas</string> + <string>USongs.pas</string> <key>PBXSplitModuleInNavigatorKey</key> <dict> <key>Split0</key> <dict> <key>PBXProjectModuleGUID</key> - <string>2CF5536D0CDA575B00627463</string> + <string>2C0C2C190CDC7312004A651F</string> <key>PBXProjectModuleLabel</key> - <string>UltraStarDX.pas</string> + <string>USongs.pas</string> <key>_historyCapacity</key> <integer>0</integer> <key>bookmark</key> - <string>2CD3B28E0CDC76B6001F1030</string> + <string>2CF3EFED0CDE1AB6004F5956</string> <key>history</key> <array> - <string>2C0C2C450CDC73BE004A651F</string> + <string>2CE7D8F70CDCA55E0027F7CD</string> </array> </dict> <key>SplitCount</key> @@ -299,11 +259,11 @@ <key>Geometry</key> <dict> <key>Frame</key> - <string>{{0, 20}, {987, 762}}</string> + <string>{{0, 20}, {797, 748}}</string> <key>PBXModuleWindowStatusBarHidden2</key> <false/> <key>RubberWindowFrame</key> - <string>189 142 987 803 0 0 1680 1028 </string> + <string>84 171 797 789 0 0 1680 1028 </string> </dict> </dict> <dict> @@ -324,10 +284,10 @@ <key>_historyCapacity</key> <integer>0</integer> <key>bookmark</key> - <string>2CD3B28F0CDC76B6001F1030</string> + <string>2CF3EFEE0CDE1AB6004F5956</string> <key>history</key> <array> - <string>2C0C2C460CDC73BE004A651F</string> + <string>2CE7D8F90CDCA55E0027F7CD</string> </array> </dict> <key>SplitCount</key> @@ -364,10 +324,10 @@ <key>_historyCapacity</key> <integer>0</integer> <key>bookmark</key> - <string>2CD3B2900CDC76B6001F1030</string> + <string>2CF3EFEF0CDE1AB6004F5956</string> <key>history</key> <array> - <string>2C0C2C470CDC73BE004A651F</string> + <string>2CE7D8FA0CDCA55E0027F7CD</string> </array> </dict> <key>SplitCount</key> @@ -404,10 +364,10 @@ <key>_historyCapacity</key> <integer>0</integer> <key>bookmark</key> - <string>2CD3B2910CDC76B6001F1030</string> + <string>2CF3EFF00CDE1AB6004F5956</string> <key>history</key> <array> - <string>2C0C2C480CDC73BE004A651F</string> + <string>2CE7D8FB0CDCA55E0027F7CD</string> </array> </dict> <key>SplitCount</key> @@ -444,10 +404,10 @@ <key>_historyCapacity</key> <integer>0</integer> <key>bookmark</key> - <string>2CD3B2920CDC76B6001F1030</string> + <string>2CF3EFF10CDE1AB6004F5956</string> <key>history</key> <array> - <string>2C0C2C490CDC73BE004A651F</string> + <string>2CE7D8FC0CDCA55E0027F7CD</string> </array> </dict> <key>SplitCount</key> @@ -484,10 +444,10 @@ <key>_historyCapacity</key> <integer>0</integer> <key>bookmark</key> - <string>2CD3B2930CDC76B6001F1030</string> + <string>2CF3EFF20CDE1AB6004F5956</string> <key>history</key> <array> - <string>2C0C2C4A0CDC73BE004A651F</string> + <string>2CE7D8FD0CDCA55E0027F7CD</string> </array> </dict> <key>SplitCount</key> @@ -506,46 +466,6 @@ <string>15 338 616 685 0 0 1680 1028 </string> </dict> </dict> - <dict> - <key>Content</key> - <dict> - <key>PBXProjectModuleGUID</key> - <string>2CF5528D0CDA426600627463</string> - <key>PBXProjectModuleLabel</key> - <string>Windows.pas</string> - <key>PBXSplitModuleInNavigatorKey</key> - <dict> - <key>Split0</key> - <dict> - <key>PBXProjectModuleGUID</key> - <string>2CF5528E0CDA426600627463</string> - <key>PBXProjectModuleLabel</key> - <string>Windows.pas</string> - <key>_historyCapacity</key> - <integer>0</integer> - <key>bookmark</key> - <string>2CD3B2940CDC76B6001F1030</string> - <key>history</key> - <array> - <string>2C0C2C4B0CDC73BE004A651F</string> - </array> - </dict> - <key>SplitCount</key> - <string>1</string> - </dict> - <key>StatusBarVisibility</key> - <true/> - </dict> - <key>Geometry</key> - <dict> - <key>Frame</key> - <string>{{0, 20}, {616, 644}}</string> - <key>PBXModuleWindowStatusBarHidden2</key> - <false/> - <key>RubberWindowFrame</key> - <string>176 191 616 685 0 0 1680 1028 </string> - </dict> - </dict> </array> <key>PerspectiveWidths</key> <array> @@ -623,13 +543,13 @@ <key>PBXSmartGroupTreeModuleOutlineStateSelectionKey</key> <array> <array> - <integer>17</integer> + <integer>21</integer> <integer>15</integer> <integer>0</integer> </array> </array> <key>PBXSmartGroupTreeModuleOutlineStateVisibleRectKey</key> - <string>{{0, 20}, {266, 694}}</string> + <string>{{0, 0}, {266, 694}}</string> </dict> <key>PBXTopSmartGroupGIDs</key> <array/> @@ -648,7 +568,7 @@ <real>266</real> </array> <key>RubberWindowFrame</key> - <string>772 270 817 753 0 0 1680 1028 </string> + <string>767 271 817 753 0 0 1680 1028 </string> </dict> <key>Module</key> <string>PBXSmartGroupTreeModule</string> @@ -685,7 +605,7 @@ <key>Frame</key> <string>{{0, 0}, {529, 0}}</string> <key>RubberWindowFrame</key> - <string>772 270 817 753 0 0 1680 1028 </string> + <string>767 271 817 753 0 0 1680 1028 </string> </dict> <key>Module</key> <string>PBXNavigatorGroup</string> @@ -707,7 +627,7 @@ <key>Frame</key> <string>{{0, 5}, {529, 707}}</string> <key>RubberWindowFrame</key> - <string>772 270 817 753 0 0 1680 1028 </string> + <string>767 271 817 753 0 0 1680 1028 </string> </dict> <key>Module</key> <string>XCDetailModule</string> @@ -731,9 +651,9 @@ </array> <key>TableOfContents</key> <array> - <string>2CD3B23F0CDC7545001F1030</string> + <string>2CF3EE840CDE0AAA004F5956</string> <string>1CE0B1FE06471DED0097A5F4</string> - <string>2CD3B2400CDC7545001F1030</string> + <string>2CF3EE850CDE0AAA004F5956</string> <string>1CE0B20306471E060097A5F4</string> <string>1CE0B20506471E060097A5F4</string> </array> @@ -867,26 +787,25 @@ <integer>5</integer> <key>WindowOrderList</key> <array> - <string>2CD3B2610CDC7564001F1030</string> - <string>2CD3B2620CDC7564001F1030</string> - <string>2CDD4BFC0CB948FC00549FAC</string> <string>2CDD4B730CB935C700549FAC</string> - <string>2CD3B2500CDC7545001F1030</string> - <string>2CF5528D0CDA426600627463</string> + <string>1C530D57069F1CE1000CFCEE</string> + <string>2CF3EE990CDE0AAA004F5956</string> + <string>2CF3EE9A0CDE0AAA004F5956</string> + <string>2CDD4BFC0CB948FC00549FAC</string> + <string>2CF3EE950CDE0AAA004F5956</string> + <string>1C0AD2B3069F1EA900FABCE6</string> <string>2CF553750CDA575B00627463</string> <string>2CF553720CDA575B00627463</string> <string>2CF5536F0CDA575B00627463</string> <string>2CF552930CDA426600627463</string> <string>2CF552960CDA426600627463</string> - <string>2CF5536C0CDA575B00627463</string> - <string>2CF552990CDA426600627463</string> - <string>1C0AD2B3069F1EA900FABCE6</string> - <string>/Users/eddie/Projekte/UltraStarDX/trunk/Game/Code/MacOSX/UltraStarDX.xcodeproj</string> <string>2C0C2C180CDC7312004A651F</string> + <string>/Users/eddie/Projekte/UltraStarDX/trunk/Game/Code/MacOSX/UltraStarDX.xcodeproj</string> + <string>2CF3EF8A0CDE1898004F5956</string> <string>1CD10A99069EF8BA00B06720</string> </array> <key>WindowString</key> - <string>772 270 817 753 0 0 1680 1028 </string> + <string>767 271 817 753 0 0 1680 1028 </string> <key>WindowTools</key> <array> <dict> @@ -902,12 +821,14 @@ <key>Dock</key> <array> <dict> + <key>BecomeActive</key> + <true/> <key>ContentConfiguration</key> <dict> <key>PBXProjectModuleGUID</key> <string>1CD0528F0623707200166675</string> <key>PBXProjectModuleLabel</key> - <string></string> + <string>MacResources.pas</string> <key>StatusBarVisibility</key> <true/> </dict> @@ -963,7 +884,7 @@ <key>TableOfContents</key> <array> <string>2CDD4B730CB935C700549FAC</string> - <string>2CD3B25F0CDC7564001F1030</string> + <string>2CF3EEAC0CDE0C76004F5956</string> <string>1CD0528F0623707200166675</string> <string>XCMainBuildResultsModuleGUID</string> </array> @@ -1005,8 +926,8 @@ <string>yes</string> <key>sizes</key> <array> - <string>{{0, 0}, {347, 414}}</string> - <string>{{347, 0}, {617, 414}}</string> + <string>{{0, 0}, {341, 414}}</string> + <string>{{341, 0}, {623, 414}}</string> </array> </dict> <key>VerticalSplitView</key> @@ -1069,14 +990,14 @@ <key>TableOfContents</key> <array> <string>1CD10A99069EF8BA00B06720</string> - <string>2CD3B24A0CDC7545001F1030</string> + <string>2CF3EE8F0CDE0AAA004F5956</string> <string>1C162984064C10D400B95A72</string> - <string>2CD3B24B0CDC7545001F1030</string> - <string>2CD3B24C0CDC7545001F1030</string> - <string>2CD3B24D0CDC7545001F1030</string> - <string>2CD3B24E0CDC7545001F1030</string> - <string>2CD3B24F0CDC7545001F1030</string> - <string>2CD3B2500CDC7545001F1030</string> + <string>2CF3EE900CDE0AAA004F5956</string> + <string>2CF3EE910CDE0AAA004F5956</string> + <string>2CF3EE920CDE0AAA004F5956</string> + <string>2CF3EE930CDE0AAA004F5956</string> + <string>2CF3EE940CDE0AAA004F5956</string> + <string>2CF3EE950CDE0AAA004F5956</string> </array> <key>ToolbarConfiguration</key> <string>xcode.toolbar.config.debug</string> @@ -1108,7 +1029,7 @@ <key>PBXProjectModuleGUID</key> <string>1CDD528C0622207200134675</string> <key>PBXProjectModuleLabel</key> - <string>UCommon.pas</string> + <string>UAudio_bass.pas</string> <key>StatusBarVisibility</key> <true/> </dict> @@ -1117,7 +1038,7 @@ <key>Frame</key> <string>{{0, 0}, {790, 502}}</string> <key>RubberWindowFrame</key> - <string>688 118 790 888 0 0 1680 1028 </string> + <string>890 81 790 888 0 0 1680 1028 </string> </dict> <key>Module</key> <string>PBXNavigatorGroup</string> @@ -1143,7 +1064,7 @@ <key>Frame</key> <string>{{0, 507}, {790, 340}}</string> <key>RubberWindowFrame</key> - <string>688 118 790 888 0 0 1680 1028 </string> + <string>890 81 790 888 0 0 1680 1028 </string> </dict> <key>Module</key> <string>PBXProjectFindModule</string> @@ -1166,17 +1087,17 @@ <key>TableOfContents</key> <array> <string>1C530D57069F1CE1000CFCEE</string> - <string>2CF54F3B0CDA1AA600627463</string> - <string>2CF54F3C0CDA1AA600627463</string> + <string>2CF3EEA70CDE0C55004F5956</string> + <string>2CF3EEA80CDE0C55004F5956</string> <string>1CDD528C0622207200134675</string> <string>1CD0528E0623707200166675</string> </array> <key>WindowString</key> - <string>688 118 790 888 0 0 1680 1028 </string> + <string>890 81 790 888 0 0 1680 1028 </string> <key>WindowToolGUID</key> <string>1C530D57069F1CE1000CFCEE</string> <key>WindowToolIsVisible</key> - <true/> + <false/> </dict> <dict> <key>Identifier</key> @@ -1195,6 +1116,8 @@ <key>Dock</key> <array> <dict> + <key>BecomeActive</key> + <true/> <key>ContentConfiguration</key> <dict> <key>PBXProjectModuleGUID</key> @@ -1205,18 +1128,18 @@ <key>GeometryConfiguration</key> <dict> <key>Frame</key> - <string>{{0, 0}, {440, 358}}</string> + <string>{{0, 0}, {1248, 416}}</string> <key>RubberWindowFrame</key> - <string>80 556 440 400 0 0 1680 1028 </string> + <string>426 66 1248 457 0 0 1680 1028 </string> </dict> <key>Module</key> <string>PBXDebugCLIModule</string> <key>Proportion</key> - <string>358pt</string> + <string>416pt</string> </dict> </array> <key>Proportion</key> - <string>359pt</string> + <string>416pt</string> </dict> </array> <key>Name</key> @@ -1230,11 +1153,11 @@ <key>TableOfContents</key> <array> <string>2CDD4BFC0CB948FC00549FAC</string> - <string>2CD3B2600CDC7564001F1030</string> + <string>2CF3EE960CDE0AAA004F5956</string> <string>1C78EAAC065D492600B07095</string> </array> <key>WindowString</key> - <string>80 556 440 400 0 0 1680 1028 </string> + <string>426 66 1248 457 0 0 1680 1028 </string> <key>WindowToolGUID</key> <string>2CDD4BFC0CB948FC00549FAC</string> <key>WindowToolIsVisible</key> @@ -1300,18 +1223,18 @@ <key>GeometryConfiguration</key> <dict> <key>Frame</key> - <string>{{0, 0}, {966, 265}}</string> + <string>{{0, 0}, {1092, 660}}</string> <key>RubberWindowFrame</key> - <string>133 636 966 306 0 0 1680 1028 </string> + <string>133 241 1092 701 0 0 1680 1028 </string> </dict> <key>Module</key> <string>PBXRunSessionModule</string> <key>Proportion</key> - <string>265pt</string> + <string>660pt</string> </dict> </array> <key>Proportion</key> - <string>265pt</string> + <string>660pt</string> </dict> </array> <key>Name</key> @@ -1325,18 +1248,18 @@ <key>TableOfContents</key> <array> <string>1C0AD2B3069F1EA900FABCE6</string> - <string>2CD3B2510CDC7545001F1030</string> + <string>2CF3EE970CDE0AAA004F5956</string> <string>1CD0528B0623707200166675</string> - <string>2CD3B2520CDC7545001F1030</string> + <string>2CF3EE980CDE0AAA004F5956</string> </array> <key>ToolbarConfiguration</key> <string>xcode.toolbar.config.run</string> <key>WindowString</key> - <string>133 636 966 306 0 0 1680 1028 </string> + <string>133 241 1092 701 0 0 1680 1028 </string> <key>WindowToolGUID</key> <string>1C0AD2B3069F1EA900FABCE6</string> <key>WindowToolIsVisible</key> - <true/> + <false/> </dict> <dict> <key>FirstTimeWindowDisplayed</key> diff --git a/Game/Code/MacOSX/UltraStarDX.xcodeproj/eddie.pbxuser b/Game/Code/MacOSX/UltraStarDX.xcodeproj/eddie.pbxuser index af8b639d..0a358f1e 100644 --- a/Game/Code/MacOSX/UltraStarDX.xcodeproj/eddie.pbxuser +++ b/Game/Code/MacOSX/UltraStarDX.xcodeproj/eddie.pbxuser @@ -1,90 +1,10 @@ // !$*UTF8*$! { - 2C0C2C430CDC73BE004A651F /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 2C4D9C7B0CC9EC8C0031092D /* UMain.pas */; - name = "UMain.pas: 15"; - rLen = 0; - rLoc = 198; - rType = 0; - vrLen = 637; - vrLoc = 0; - }; - 2C0C2C450CDC73BE004A651F /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = DDC6851B09F57195004E4BFF /* UltraStarDX.pas */; - name = "UltraStarDX.pas: 6"; - rLen = 0; - rLoc = 117; - rType = 0; - vrLen = 131; - vrLoc = 0; - }; - 2C0C2C460CDC73BE004A651F /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 2C4D9C640CC9EC8C0031092D /* UAudio_FFMpeg.pas */; - name = "UAudio_FFMpeg.pas: 952"; - rLen = 0; - rLoc = 22697; - rType = 0; - vrLen = 1224; - vrLoc = 21473; - }; - 2C0C2C470CDC73BE004A651F /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 2C4D9C630CC9EC8C0031092D /* UAudio_bass.pas */; - name = "nux ... is t"; - rLen = 12; - rLoc = 3202; - rType = 0; - vrLen = 1266; - vrLoc = 15619; - }; - 2C0C2C480CDC73BE004A651F /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 2C4D9DEC0CC9EF0A0031092D /* sdl_image.pas */; - name = "sdl_image.pas: 130"; - rLen = 0; - rLoc = 8020; - rType = 0; - vrLen = 832; - vrLoc = 7978; - }; - 2C0C2C490CDC73BE004A651F /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 98B8BE5C0B1F974F00162019 /* sdl.pas */; - name = "sdl.pas: 250"; - rLen = 0; - rLoc = 16506; - rType = 0; - vrLen = 886; - vrLoc = 16376; - }; - 2C0C2C4A0CDC73BE004A651F /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 2C4D9C8B0CC9EC8C0031092D /* UTexture.pas */; - name = "ScaledTexture(TexSur"; - rLen = 20; - rLoc = 11816; - rType = 0; - vrLen = 1220; - vrLoc = 11189; - }; - 2C0C2C4B0CDC73BE004A651F /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 2C4D9E090CC9EF840031092D /* Windows.pas */; - name = "Windows.pas: 114"; - rLen = 0; - rLoc = 2832; - rType = 0; - vrLen = 1182; - vrLoc = 2090; - }; 2C4D9C620CC9EC8C0031092D /* TextGL.pas */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {758, 7742}}"; - sepNavSelRange = "{12201, 8}"; - sepNavVisRect = "{{0, 6061}, {758, 716}}"; + sepNavIntBoundsRect = "{{0, 0}, {923, 7798}}"; + sepNavSelRange = "{3311, 0}"; + sepNavVisRect = "{{0, 1726}, {923, 342}}"; sepNavWindowFrame = "{{38, 157}, {797, 845}}"; }; }; @@ -187,8 +107,8 @@ 2C4D9C6F0CC9EC8C0031092D /* UGraphic.pas */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {923, 10444}}"; - sepNavSelRange = "{15582, 0}"; - sepNavVisRect = "{{0, 6612}, {923, 342}}"; + sepNavSelRange = "{5900, 0}"; + sepNavVisRect = "{{0, 3588}, {923, 342}}"; sepNavWindowFrame = "{{38, 157}, {797, 845}}"; }; }; @@ -274,17 +194,17 @@ }; 2C4D9C7B0CC9EC8C0031092D /* UMain.pas */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {1013, 15456}}"; - sepNavSelRange = "{198, 0}"; - sepNavVisRect = "{{0, 0}, {1013, 614}}"; + sepNavIntBoundsRect = "{{0, 0}, {998, 15456}}"; + sepNavSelRange = "{7398, 0}"; + sepNavVisRect = "{{0, 3938}, {923, 342}}"; sepNavWindowFrame = "{{222, 91}, {1052, 743}}"; }; }; 2C4D9C7C0CC9EC8C0031092D /* UMedia_dummy.pas */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {758, 3864}}"; + sepNavIntBoundsRect = "{{0, 0}, {758, 3920}}"; sepNavSelRange = "{859, 0}"; - sepNavVisRect = "{{0, 0}, {758, 716}}"; + sepNavVisRect = "{{0, 3204}, {758, 716}}"; sepNavWindowFrame = "{{107, 94}, {797, 845}}"; }; }; @@ -298,9 +218,9 @@ }; 2C4D9C7E0CC9EC8C0031092D /* UMusic.pas */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {758, 4438}}"; - sepNavSelRange = "{44, 0}"; - sepNavVisRect = "{{0, 0}, {758, 716}}"; + sepNavIntBoundsRect = "{{0, 0}, {749, 4494}}"; + sepNavSelRange = "{5162, 12}"; + sepNavVisRect = "{{0, 2580}, {749, 470}}"; sepNavWindowFrame = "{{153, 52}, {797, 845}}"; }; }; @@ -338,9 +258,9 @@ }; 2C4D9C840CC9EC8C0031092D /* URecord.pas */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {1277, 4998}}"; - sepNavSelRange = "{159, 11}"; - sepNavVisRect = "{{0, 0}, {1277, 312}}"; + sepNavIntBoundsRect = "{{0, 0}, {749, 5054}}"; + sepNavSelRange = "{152, 4}"; + sepNavVisRect = "{{0, 0}, {749, 470}}"; sepNavWindowFrame = "{{130, 73}, {797, 845}}"; }; }; @@ -370,9 +290,9 @@ }; 2C4D9C880CC9EC8C0031092D /* USkins.pas */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {758, 2408}}"; - sepNavSelRange = "{25, 0}"; - sepNavVisRect = "{{0, 0}, {758, 716}}"; + sepNavIntBoundsRect = "{{0, 0}, {923, 2464}}"; + sepNavSelRange = "{1178, 0}"; + sepNavVisRect = "{{0, 550}, {923, 342}}"; sepNavWindowFrame = "{{61, 136}, {797, 845}}"; }; }; @@ -380,7 +300,7 @@ uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {950, 14686}}"; sepNavSelRange = "{503, 0}"; - sepNavVisRect = "{{0, 2095}, {758, 716}}"; + sepNavVisRect = "{{0, 2086}, {758, 716}}"; sepNavWindowFrame = "{{84, 115}, {797, 845}}"; }; }; @@ -394,17 +314,17 @@ }; 2C4D9C8B0CC9EC8C0031092D /* UTexture.pas */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {1730, 15960}}"; - sepNavSelRange = "{11816, 20}"; + sepNavIntBoundsRect = "{{0, 0}, {1730, 16002}}"; + sepNavSelRange = "{11873, 20}"; sepNavVisRect = "{{0, 4988}, {577, 612}}"; sepNavWindowFrame = "{{15, 282}, {616, 741}}"; }; }; 2C4D9C8C0CC9EC8C0031092D /* UThemes.pas */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {788, 30954}}"; - sepNavSelRange = "{44, 0}"; - sepNavVisRect = "{{0, 0}, {758, 716}}"; + sepNavIntBoundsRect = "{{0, 0}, {923, 31010}}"; + sepNavSelRange = "{21229, 0}"; + sepNavVisRect = "{{0, 19678}, {923, 342}}"; sepNavWindowFrame = "{{130, 73}, {797, 845}}"; }; }; @@ -545,9 +465,9 @@ }; 2C4D9E000CC9EF840031092D /* Graphics.pas */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {1277, 2674}}"; + sepNavIntBoundsRect = "{{0, 0}, {620, 2674}}"; sepNavSelRange = "{58, 56}"; - sepNavVisRect = "{{0, 0}, {1277, 312}}"; + sepNavVisRect = "{{0, 0}, {577, 612}}"; sepNavWindowFrame = "{{38, 261}, {616, 741}}"; }; }; @@ -570,119 +490,19 @@ 2C4D9E090CC9EF840031092D /* Windows.pas */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {577, 2352}}"; - sepNavSelRange = "{2832, 0}"; + sepNavSelRange = "{2345, 0}"; sepNavVisRect = "{{0, 1278}, {577, 612}}"; sepNavWindowFrame = "{{176, 135}, {616, 741}}"; }; }; 2C4D9E440CC9F0ED0031092D /* switches.inc */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {577, 616}}"; + sepNavIntBoundsRect = "{{0, 0}, {698, 644}}"; sepNavSelRange = "{312, 0}"; - sepNavVisRect = "{{0, 0}, {577, 612}}"; + sepNavVisRect = "{{0, 7}, {577, 612}}"; sepNavWindowFrame = "{{15, 282}, {616, 741}}"; }; }; - 2CD3B2550CDC7564001F1030 /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 2C4D9C890CC9EC8C0031092D /* USongs.pas */; - name = "USongs.pas: 39"; - rLen = 0; - rLoc = 503; - rType = 0; - vrLen = 753; - vrLoc = 0; - }; - 2CD3B28C0CDC76B6001F1030 /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 2C4D9C890CC9EC8C0031092D /* USongs.pas */; - name = "USongs.pas: 39"; - rLen = 0; - rLoc = 503; - rType = 0; - vrLen = 1403; - vrLoc = 4615; - }; - 2CD3B28D0CDC76B6001F1030 /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 2C4D9C7B0CC9EC8C0031092D /* UMain.pas */; - name = "UMain.pas: 15"; - rLen = 0; - rLoc = 198; - rType = 0; - vrLen = 637; - vrLoc = 0; - }; - 2CD3B28E0CDC76B6001F1030 /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = DDC6851B09F57195004E4BFF /* UltraStarDX.pas */; - name = "UltraStarDX.pas: 6"; - rLen = 0; - rLoc = 117; - rType = 0; - vrLen = 131; - vrLoc = 0; - }; - 2CD3B28F0CDC76B6001F1030 /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 2C4D9C640CC9EC8C0031092D /* UAudio_FFMpeg.pas */; - name = "UAudio_FFMpeg.pas: 952"; - rLen = 0; - rLoc = 22697; - rType = 0; - vrLen = 1224; - vrLoc = 21473; - }; - 2CD3B2900CDC76B6001F1030 /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 2C4D9C630CC9EC8C0031092D /* UAudio_bass.pas */; - name = "nux ... is t"; - rLen = 12; - rLoc = 3202; - rType = 0; - vrLen = 1266; - vrLoc = 15619; - }; - 2CD3B2910CDC76B6001F1030 /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 2C4D9DEC0CC9EF0A0031092D /* sdl_image.pas */; - name = "sdl_image.pas: 130"; - rLen = 0; - rLoc = 8020; - rType = 0; - vrLen = 832; - vrLoc = 7978; - }; - 2CD3B2920CDC76B6001F1030 /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 98B8BE5C0B1F974F00162019 /* sdl.pas */; - name = "sdl.pas: 250"; - rLen = 0; - rLoc = 16506; - rType = 0; - vrLen = 886; - vrLoc = 16376; - }; - 2CD3B2930CDC76B6001F1030 /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 2C4D9C8B0CC9EC8C0031092D /* UTexture.pas */; - name = "ScaledTexture(TexSur"; - rLen = 20; - rLoc = 11816; - rType = 0; - vrLen = 1220; - vrLoc = 11189; - }; - 2CD3B2940CDC76B6001F1030 /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 2C4D9E090CC9EF840031092D /* Windows.pas */; - name = "Windows.pas: 114"; - rLen = 0; - rLoc = 2832; - rType = 0; - vrLen = 1182; - vrLoc = 2090; - }; 2CDC716B0CDB9CB70018F966 /* StrUtils.pas */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {1013, 1022}}"; @@ -756,10 +576,165 @@ fileReference = 2CDD439C0CBBE92D00F364DE /* UMain.pas */; hitCount = 1; lineNumber = 293; - location = UltraStarDX; - modificationTime = 215774704.034014; + modificationTime = 215882409.953114; state = 1; }; + 2CE7D8F70CDCA55E0027F7CD /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 2C4D9C890CC9EC8C0031092D /* USongs.pas */; + name = "USongs.pas: 39"; + rLen = 0; + rLoc = 503; + rType = 0; + vrLen = 1403; + vrLoc = 4615; + }; + 2CE7D8F90CDCA55E0027F7CD /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 2C4D9C640CC9EC8C0031092D /* UAudio_FFMpeg.pas */; + name = "UAudio_FFMpeg.pas: 952"; + rLen = 0; + rLoc = 22697; + rType = 0; + vrLen = 1224; + vrLoc = 21473; + }; + 2CE7D8FA0CDCA55E0027F7CD /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 2C4D9C630CC9EC8C0031092D /* UAudio_bass.pas */; + name = "nux ... is t"; + rLen = 12; + rLoc = 3202; + rType = 0; + vrLen = 1266; + vrLoc = 15619; + }; + 2CE7D8FB0CDCA55E0027F7CD /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 2C4D9DEC0CC9EF0A0031092D /* sdl_image.pas */; + name = "sdl_image.pas: 130"; + rLen = 0; + rLoc = 8020; + rType = 0; + vrLen = 832; + vrLoc = 7978; + }; + 2CE7D8FC0CDCA55E0027F7CD /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 98B8BE5C0B1F974F00162019 /* sdl.pas */; + name = "sdl.pas: 250"; + rLen = 0; + rLoc = 16506; + rType = 0; + vrLen = 886; + vrLoc = 16376; + }; + 2CE7D8FD0CDCA55E0027F7CD /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 2C4D9C8B0CC9EC8C0031092D /* UTexture.pas */; + name = "ScaledTexture(TexSur"; + rLen = 20; + rLoc = 11873; + rType = 0; + vrLen = 1220; + vrLoc = 11189; + }; + 2CF3EF210CDE13A0004F5956 /* Messages.pas */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1013, 614}}"; + sepNavSelRange = "{0, 0}"; + sepNavVisRect = "{{0, 0}, {1013, 614}}"; + sepNavWindowFrame = "{{38, 259}, {1052, 743}}"; + }; + }; + 2CF3EF260CDE13BA004F5956 /* MacResources.pas */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1013, 1022}}"; + sepNavSelRange = "{1521, 0}"; + sepNavVisRect = "{{0, 310}, {1013, 614}}"; + sepNavWindowFrame = "{{515, 220}, {1052, 743}}"; + }; + }; + 2CF3EFA30CDE1A19004F5956 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 2CF3EF260CDE13BA004F5956 /* MacResources.pas */; + name = "MacResources.pas: 63"; + rLen = 0; + rLoc = 1896; + rType = 0; + vrLen = 1181; + vrLoc = 455; + }; + 2CF3EFEC0CDE1AB6004F5956 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 2CF3EF260CDE13BA004F5956 /* MacResources.pas */; + name = "MacResources.pas: 60"; + rLen = 0; + rLoc = 1521; + rType = 0; + vrLen = 1339; + vrLoc = 455; + }; + 2CF3EFED0CDE1AB6004F5956 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 2C4D9C890CC9EC8C0031092D /* USongs.pas */; + name = "USongs.pas: 39"; + rLen = 0; + rLoc = 503; + rType = 0; + vrLen = 1403; + vrLoc = 4615; + }; + 2CF3EFEE0CDE1AB6004F5956 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 2C4D9C640CC9EC8C0031092D /* UAudio_FFMpeg.pas */; + name = "UAudio_FFMpeg.pas: 952"; + rLen = 0; + rLoc = 22697; + rType = 0; + vrLen = 1224; + vrLoc = 21473; + }; + 2CF3EFEF0CDE1AB6004F5956 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 2C4D9C630CC9EC8C0031092D /* UAudio_bass.pas */; + name = "nux ... is t"; + rLen = 12; + rLoc = 3202; + rType = 0; + vrLen = 1266; + vrLoc = 15619; + }; + 2CF3EFF00CDE1AB6004F5956 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 2C4D9DEC0CC9EF0A0031092D /* sdl_image.pas */; + name = "sdl_image.pas: 130"; + rLen = 0; + rLoc = 8020; + rType = 0; + vrLen = 832; + vrLoc = 7978; + }; + 2CF3EFF10CDE1AB6004F5956 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 98B8BE5C0B1F974F00162019 /* sdl.pas */; + name = "sdl.pas: 250"; + rLen = 0; + rLoc = 16506; + rType = 0; + vrLen = 886; + vrLoc = 16376; + }; + 2CF3EFF20CDE1AB6004F5956 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 2C4D9C8B0CC9EC8C0031092D /* UTexture.pas */; + name = "ScaledTexture(TexSur"; + rLen = 20; + rLoc = 11873; + rType = 0; + vrLen = 1184; + vrLoc = 11218; + }; 2CF54F430CDA1B2B00627463 /* UScreenCredits.pas */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {1196, 19586}}"; @@ -1072,14 +1047,6 @@ sepNavWindowFrame = "{{107, 196}, {1052, 743}}"; }; }; - 2CF552660CDA404000627463 /* Messages.pas */ = { - uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {1013, 614}}"; - sepNavSelRange = "{65, 0}"; - sepNavVisRect = "{{0, 0}, {1013, 614}}"; - sepNavWindowFrame = "{{102, 176}, {1052, 743}}"; - }; - }; 2CF5529E0CDA42C900627463 /* avcodec.pas */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {1013, 28616}}"; @@ -1153,6 +1120,7 @@ activeTarget = DDC688C709F574E9004E4BFF /* UltraStarDX */; addToTargets = ( DDC688C709F574E9004E4BFF /* UltraStarDX */, + DDC688D409F57523004E4BFF /* Put all program sources also in this target */, ); breakpoints = ( 2CDEA8080CBD7D920096994C /* UMain.pas:293 */, @@ -1261,28 +1229,24 @@ PBXFileDataSource_Warnings_ColumnID, ); }; - PBXPerProjectTemplateStateSaveDate = 215774521; - PBXWorkspaceStateSaveDate = 215774521; + PBXPerProjectTemplateStateSaveDate = 215878288; + PBXWorkspaceStateSaveDate = 215878288; }; perUserProjectItems = { - 2C0C2C430CDC73BE004A651F /* PBXTextBookmark */ = 2C0C2C430CDC73BE004A651F /* PBXTextBookmark */; - 2C0C2C450CDC73BE004A651F /* PBXTextBookmark */ = 2C0C2C450CDC73BE004A651F /* PBXTextBookmark */; - 2C0C2C460CDC73BE004A651F /* PBXTextBookmark */ = 2C0C2C460CDC73BE004A651F /* PBXTextBookmark */; - 2C0C2C470CDC73BE004A651F /* PBXTextBookmark */ = 2C0C2C470CDC73BE004A651F /* PBXTextBookmark */; - 2C0C2C480CDC73BE004A651F /* PBXTextBookmark */ = 2C0C2C480CDC73BE004A651F /* PBXTextBookmark */; - 2C0C2C490CDC73BE004A651F /* PBXTextBookmark */ = 2C0C2C490CDC73BE004A651F /* PBXTextBookmark */; - 2C0C2C4A0CDC73BE004A651F /* PBXTextBookmark */ = 2C0C2C4A0CDC73BE004A651F /* PBXTextBookmark */; - 2C0C2C4B0CDC73BE004A651F /* PBXTextBookmark */ = 2C0C2C4B0CDC73BE004A651F /* PBXTextBookmark */; - 2CD3B2550CDC7564001F1030 /* PBXTextBookmark */ = 2CD3B2550CDC7564001F1030 /* PBXTextBookmark */; - 2CD3B28C0CDC76B6001F1030 /* PBXTextBookmark */ = 2CD3B28C0CDC76B6001F1030 /* PBXTextBookmark */; - 2CD3B28D0CDC76B6001F1030 /* PBXTextBookmark */ = 2CD3B28D0CDC76B6001F1030 /* PBXTextBookmark */; - 2CD3B28E0CDC76B6001F1030 /* PBXTextBookmark */ = 2CD3B28E0CDC76B6001F1030 /* PBXTextBookmark */; - 2CD3B28F0CDC76B6001F1030 /* PBXTextBookmark */ = 2CD3B28F0CDC76B6001F1030 /* PBXTextBookmark */; - 2CD3B2900CDC76B6001F1030 /* PBXTextBookmark */ = 2CD3B2900CDC76B6001F1030 /* PBXTextBookmark */; - 2CD3B2910CDC76B6001F1030 /* PBXTextBookmark */ = 2CD3B2910CDC76B6001F1030 /* PBXTextBookmark */; - 2CD3B2920CDC76B6001F1030 /* PBXTextBookmark */ = 2CD3B2920CDC76B6001F1030 /* PBXTextBookmark */; - 2CD3B2930CDC76B6001F1030 /* PBXTextBookmark */ = 2CD3B2930CDC76B6001F1030 /* PBXTextBookmark */; - 2CD3B2940CDC76B6001F1030 /* PBXTextBookmark */ = 2CD3B2940CDC76B6001F1030 /* PBXTextBookmark */; + 2CE7D8F70CDCA55E0027F7CD /* PBXTextBookmark */ = 2CE7D8F70CDCA55E0027F7CD /* PBXTextBookmark */; + 2CE7D8F90CDCA55E0027F7CD /* PBXTextBookmark */ = 2CE7D8F90CDCA55E0027F7CD /* PBXTextBookmark */; + 2CE7D8FA0CDCA55E0027F7CD /* PBXTextBookmark */ = 2CE7D8FA0CDCA55E0027F7CD /* PBXTextBookmark */; + 2CE7D8FB0CDCA55E0027F7CD /* PBXTextBookmark */ = 2CE7D8FB0CDCA55E0027F7CD /* PBXTextBookmark */; + 2CE7D8FC0CDCA55E0027F7CD /* PBXTextBookmark */ = 2CE7D8FC0CDCA55E0027F7CD /* PBXTextBookmark */; + 2CE7D8FD0CDCA55E0027F7CD /* PBXTextBookmark */ = 2CE7D8FD0CDCA55E0027F7CD /* PBXTextBookmark */; + 2CF3EFA30CDE1A19004F5956 /* PBXTextBookmark */ = 2CF3EFA30CDE1A19004F5956 /* PBXTextBookmark */; + 2CF3EFEC0CDE1AB6004F5956 /* PBXTextBookmark */ = 2CF3EFEC0CDE1AB6004F5956 /* PBXTextBookmark */; + 2CF3EFED0CDE1AB6004F5956 /* PBXTextBookmark */ = 2CF3EFED0CDE1AB6004F5956 /* PBXTextBookmark */; + 2CF3EFEE0CDE1AB6004F5956 /* PBXTextBookmark */ = 2CF3EFEE0CDE1AB6004F5956 /* PBXTextBookmark */; + 2CF3EFEF0CDE1AB6004F5956 /* PBXTextBookmark */ = 2CF3EFEF0CDE1AB6004F5956 /* PBXTextBookmark */; + 2CF3EFF00CDE1AB6004F5956 /* PBXTextBookmark */ = 2CF3EFF00CDE1AB6004F5956 /* PBXTextBookmark */; + 2CF3EFF10CDE1AB6004F5956 /* PBXTextBookmark */ = 2CF3EFF10CDE1AB6004F5956 /* PBXTextBookmark */; + 2CF3EFF20CDE1AB6004F5956 /* PBXTextBookmark */ = 2CF3EFF20CDE1AB6004F5956 /* PBXTextBookmark */; }; sourceControlManager = 2CDD4B690CB9357000549FAC /* Source Control */; userBuildSettings = { @@ -1290,9 +1254,9 @@ }; DDC6851B09F57195004E4BFF /* UltraStarDX.pas */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {948, 730}}"; + sepNavIntBoundsRect = "{{0, 0}, {923, 342}}"; sepNavSelRange = "{117, 0}"; - sepNavVisRect = "{{0, 0}, {948, 730}}"; + sepNavVisRect = "{{0, 0}, {923, 342}}"; sepNavWindowFrame = "{{189, 86}, {987, 859}}"; }; }; diff --git a/Game/Code/MacOSX/UltraStarDX.xcodeproj/project.pbxproj b/Game/Code/MacOSX/UltraStarDX.xcodeproj/project.pbxproj index f8cd06e7..6d8eb133 100644 --- a/Game/Code/MacOSX/UltraStarDX.xcodeproj/project.pbxproj +++ b/Game/Code/MacOSX/UltraStarDX.xcodeproj/project.pbxproj @@ -147,6 +147,10 @@ 2CDD4BE20CB947BE00549FAC /* UltraStarDX.pas in Sources */ = {isa = PBXBuildFile; fileRef = DDC6851B09F57195004E4BFF /* UltraStarDX.pas */; }; 2CDEA4F70CBD725B0096994C /* OpenGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2CDEA4F60CBD725B0096994C /* OpenGL.framework */; }; 2CDEC4960CC5264600FFA244 /* SDL.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 98B8BE570B1F972400162019 /* SDL.framework */; }; + 2CF3EF220CDE13A0004F5956 /* Messages.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CF3EF210CDE13A0004F5956 /* Messages.pas */; }; + 2CF3EF230CDE13A0004F5956 /* Messages.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CF3EF210CDE13A0004F5956 /* Messages.pas */; }; + 2CF3EF270CDE13BA004F5956 /* MacResources.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CF3EF260CDE13BA004F5956 /* MacResources.pas */; }; + 2CF3EF280CDE13BA004F5956 /* MacResources.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CF3EF260CDE13BA004F5956 /* MacResources.pas */; }; 2CF54F650CDA1B2B00627463 /* UScreenCredits.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CF54F430CDA1B2B00627463 /* UScreenCredits.pas */; }; 2CF54F660CDA1B2B00627463 /* UScreenEdit.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CF54F440CDA1B2B00627463 /* UScreenEdit.pas */; }; 2CF54F670CDA1B2B00627463 /* UScreenEditConvert.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CF54F450CDA1B2B00627463 /* UScreenEditConvert.pas */; }; @@ -224,8 +228,6 @@ 2CF5512D0CDA29C600627463 /* libsqlite3.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 2CF5512C0CDA29C600627463 /* libsqlite3.dylib */; }; 2CF552140CDA3D1400627463 /* UPluginDefs.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CF552110CDA3D1400627463 /* UPluginDefs.pas */; }; 2CF552170CDA3D1400627463 /* UPluginDefs.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CF552110CDA3D1400627463 /* UPluginDefs.pas */; }; - 2CF552670CDA404000627463 /* Messages.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CF552660CDA404000627463 /* Messages.pas */; }; - 2CF552680CDA404000627463 /* Messages.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CF552660CDA404000627463 /* Messages.pas */; }; 2CF552A70CDA42C900627463 /* avcodec.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CF5529E0CDA42C900627463 /* avcodec.pas */; }; 2CF552A80CDA42C900627463 /* avformat.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CF5529F0CDA42C900627463 /* avformat.pas */; }; 2CF552A90CDA42C900627463 /* avio.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CF552A00CDA42C900627463 /* avio.pas */; }; @@ -428,6 +430,8 @@ 2C4FA2A70CDBAD1E002CC3B0 /* ustar-icon_v01.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; name = "ustar-icon_v01.icns"; path = "../../Graphics/ustar-icon_v01.icns"; sourceTree = SOURCE_ROOT; }; 2CDC716B0CDB9CB70018F966 /* StrUtils.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = StrUtils.pas; path = ../../../Modis/SDK/StrUtils.pas; sourceTree = SOURCE_ROOT; }; 2CDEA4F60CBD725B0096994C /* OpenGL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGL.framework; path = /System/Library/Frameworks/OpenGL.framework; sourceTree = "<absolute>"; }; + 2CF3EF210CDE13A0004F5956 /* Messages.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = Messages.pas; path = Wrapper/Messages.pas; sourceTree = "<group>"; }; + 2CF3EF260CDE13BA004F5956 /* MacResources.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = MacResources.pas; path = Wrapper/MacResources.pas; sourceTree = "<group>"; }; 2CF54F430CDA1B2B00627463 /* UScreenCredits.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UScreenCredits.pas; path = ../Screens/UScreenCredits.pas; sourceTree = SOURCE_ROOT; }; 2CF54F440CDA1B2B00627463 /* UScreenEdit.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UScreenEdit.pas; path = ../Screens/UScreenEdit.pas; sourceTree = SOURCE_ROOT; }; 2CF54F450CDA1B2B00627463 /* UScreenEditConvert.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UScreenEditConvert.pas; path = ../Screens/UScreenEditConvert.pas; sourceTree = SOURCE_ROOT; }; @@ -468,7 +472,6 @@ 2CF5512C0CDA29C600627463 /* libsqlite3.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libsqlite3.dylib; path = ../lib/SQLite/libsqlite3.dylib; sourceTree = SOURCE_ROOT; }; 2CF551A70CDA356800627463 /* UltraStar.dpr */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text; name = UltraStar.dpr; path = ../UltraStar.dpr; sourceTree = SOURCE_ROOT; }; 2CF552110CDA3D1400627463 /* UPluginDefs.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UPluginDefs.pas; path = ../../../Modis/SDK/UPluginDefs.pas; sourceTree = SOURCE_ROOT; }; - 2CF552660CDA404000627463 /* Messages.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; path = Messages.pas; sourceTree = "<group>"; }; 2CF5529E0CDA42C900627463 /* avcodec.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = avcodec.pas; path = ../lib/ffmpeg/avcodec.pas; sourceTree = SOURCE_ROOT; }; 2CF5529F0CDA42C900627463 /* avformat.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = avformat.pas; path = ../lib/ffmpeg/avformat.pas; sourceTree = SOURCE_ROOT; }; 2CF552A00CDA42C900627463 /* avio.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = avio.pas; path = ../lib/ffmpeg/avio.pas; sourceTree = SOURCE_ROOT; }; @@ -539,11 +542,12 @@ 2C4D9DF50CC9EF3A0031092D /* Wrapper */ = { isa = PBXGroup; children = ( + 2CF3EF260CDE13BA004F5956 /* MacResources.pas */, + 2CF3EF210CDE13A0004F5956 /* Messages.pas */, 2C4D9E000CC9EF840031092D /* Graphics.pas */, 2C4D9E010CC9EF840031092D /* JPEG.pas */, 2C4D9E040CC9EF840031092D /* OpenGL12.pas */, 2C4D9E090CC9EF840031092D /* Windows.pas */, - 2CF552660CDA404000627463 /* Messages.pas */, ); name = Wrapper; sourceTree = "<group>"; @@ -1059,7 +1063,6 @@ 2CF551100CDA293700627463 /* SQLite3.pas in Sources */, 2CF551110CDA293700627463 /* SQLiteTable3.pas in Sources */, 2CF552140CDA3D1400627463 /* UPluginDefs.pas in Sources */, - 2CF552680CDA404000627463 /* Messages.pas in Sources */, 2CF552B00CDA42C900627463 /* avcodec.pas in Sources */, 2CF552B10CDA42C900627463 /* avformat.pas in Sources */, 2CF552B20CDA42C900627463 /* avio.pas in Sources */, @@ -1068,6 +1071,8 @@ 2CF552B70CDA42C900627463 /* rational.pas in Sources */, 2CF553080CDA51B500627463 /* sdlutils.pas in Sources */, 2CDC716C0CDB9CB70018F966 /* StrUtils.pas in Sources */, + 2CF3EF220CDE13A0004F5956 /* Messages.pas in Sources */, + 2CF3EF270CDE13BA004F5956 /* MacResources.pas in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1179,7 +1184,6 @@ 2CF551120CDA293700627463 /* SQLite3.pas in Sources */, 2CF551130CDA293700627463 /* SQLiteTable3.pas in Sources */, 2CF552170CDA3D1400627463 /* UPluginDefs.pas in Sources */, - 2CF552670CDA404000627463 /* Messages.pas in Sources */, 2CF552A70CDA42C900627463 /* avcodec.pas in Sources */, 2CF552A80CDA42C900627463 /* avformat.pas in Sources */, 2CF552A90CDA42C900627463 /* avio.pas in Sources */, @@ -1188,6 +1192,8 @@ 2CF552AE0CDA42C900627463 /* rational.pas in Sources */, 2CF553090CDA51B500627463 /* sdlutils.pas in Sources */, 2CDC716D0CDB9CB70018F966 /* StrUtils.pas in Sources */, + 2CF3EF230CDE13A0004F5956 /* Messages.pas in Sources */, + 2CF3EF280CDE13BA004F5956 /* MacResources.pas in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/Game/Code/MacOSX/Wrapper/MacClasses.pas b/Game/Code/MacOSX/Wrapper/MacClasses.pas deleted file mode 100755 index be41ac55..00000000 --- a/Game/Code/MacOSX/Wrapper/MacClasses.pas +++ /dev/null @@ -1,57 +0,0 @@ -unit MacClasses;
-
-{$I switches.inc}
-
-interface
-
-uses
- Classes, GlueWindows, SysUtils;
-
-type
-
- TMemoryStream = Classes.TMemoryStream;
-
- TResourceStream = class(TFileStream)
- private
- public
- constructor Create(Instance: THandle; const ResName: string; ResType: PChar);
- end;
-
-{$IFDEF MACOS}
- TWndMethod = procedure of object;
-{$ENDIF}
-
- function AllocateHWnd(Method: TWndMethod): HWND;
-
-implementation
-
-uses UPliki;
-
-{ TResourceStream }
-
-constructor TResourceStream.Create(Instance: THandle; const ResName: string; ResType: PChar);
-var
- sFileName : String;
-begin
- if ResType = 'FNT' then
- sFileName := GetResourcesPath + 'Fonts/' + ResName + '.dat'
- else
- sFileName := GetResourcesPath + 'Fonts/' + ResName + '.' + ResType;
-
- if FileExists(sFileName) then
- inherited Create( sFileName, fmOpenReadWrite)
- else
- inherited Create( sFileName, fmCreate);
-end;
-
-function AllocateHWnd(Method: TWndMethod): HWND;
-begin
-{$IFDEF MSWINDOWS}
- Result := Classes.AllocateHWnd(Method);
-{$ENDIF}
-{$IFDEF MACOS}
- Result := 0;
-{$ENDIF}
-end;
-
-end.
diff --git a/Game/Code/MacOSX/Wrapper/MacResources.pas b/Game/Code/MacOSX/Wrapper/MacResources.pas new file mode 100755 index 00000000..d408a432 --- /dev/null +++ b/Game/Code/MacOSX/Wrapper/MacResources.pas @@ -0,0 +1,72 @@ +unit MacResources; + +{$I switches.inc} + +interface + +uses + Classes, Windows, SysUtils; + +type + + TResourceStream = class(TFileStream) + private + public + constructor Create(Instance: THandle; const ResName: string; ResType: PChar); + end; + + Function FindResource( hInstance : THandle; pcIdentifier : PChar; pcResType : PChar) : THandle; + +implementation + +Function FindResource( hInstance : THandle; pcIdentifier : PChar; pcResType : PChar) : THandle; +begin + Result := 1; +end; + +Function GetResourcesPath : String; +var + x, + i : integer; +begin + Result := ExtractFilePath(ParamStr(0)); + for x := 0 to 2 do begin + i := Length(Result); + repeat + Delete( Result, i, 1); + i := Length(Result); + until (i = 0) or (Result[i] = '/'); + end; +end; + +{ TResourceStream } + +constructor TResourceStream.Create(Instance: THandle; const ResName: string; ResType: PChar); +var + sResNameLower : string; + sFileName : String; +begin + sResNameLower := LowerCase(string(ResName)); + + if sResNameLower = 'font' then + sFileName := GetResourcesPath + 'Fonts/Normal/Font Normal 16.png' + else if sResNameLower = 'fontb' then + sFileName := GetResourcesPath + 'Fonts/Bold/Font 1024 Bold 16.png' + else if sResNameLower = 'fonto' then + sFileName := GetResourcesPath + 'Fonts/Outline 1/Outline 1.png' + else if sResNameLower = 'outro_bg' then + sFileName := GetResourcesPath + 'Graphics/outro-bg.png' + else if sResNameLower = 'outro_esc' then + sFileName := GetResourcesPath + 'Graphics/outro-esc.png' + else if sResNameLower = 'outro_exd' then + sFileName := GetResourcesPath + 'Graphics/outro-exit-dark.png' + else if sResNameLower = 'fonto2' then + sFileName := GetResourcesPath + 'Fonts/Outline 2/Outline 2.png'; + + if FileExists(sFileName) then + inherited Create( sFileName, fmOpenReadWrite) + else + raise Exception.Create('MacResources.TResourceStream.Create: File "' + sFileName + '" not found.'); +end; + +end. |