* Migrated resources from custom resource manager to windows/lazarus resources (requires windres now!)

* Bumped version to 0.7
This commit is contained in:
Andreas Schneider 2015-05-10 18:20:40 +02:00
parent f3f5d12c2f
commit 484bd5523f
9 changed files with 43 additions and 199 deletions

Binary file not shown.

5
Client/Assets.rc Normal file
View File

@ -0,0 +1,5 @@
LEFTTOPARROW RCDATA "Overlay/LeftTopArrow.tga"
TOPARROW RCDATA "Overlay/TopArrow.tga"
VIRTUALLAYER RCDATA "Overlay/VirtualLayer.tga"
DEJAVU RCDATA "GLFont/DejaVu.png"
DEJAVUDAT RCDATA "GLFont/DejaVu.fnt"

View File

@ -16,10 +16,10 @@
<LazDoc Paths="../doc"/>
<VersionInfo>
<UseVersionInfo Value="True"/>
<MinorVersionNr Value="6"/>
<RevisionNr Value="4"/>
<BuildNr Value="245"/>
<StringTable CompanyName="AKS DataBasis" FileDescription="UO CentrED" InternalName="CentrED" LegalCopyright="(c) 2015 Andreas Schneider" OriginalFilename="CentrED.exe" ProductName="CentrED" ProductVersion="0.6.4"/>
<AutoIncrementBuild Value="True"/>
<MinorVersionNr Value="7"/>
<BuildNr Value="253"/>
<StringTable CompanyName="AKS DataBasis" FileDescription="UO CentrED" InternalName="CentrED" LegalCopyright="(c) 2015 Andreas Schneider and StaticZ" OriginalFilename="CentrED.exe" ProductName="CentrED" ProductVersion="0.7.0"/>
</VersionInfo>
<BuildModes Count="7">
<Item1 Name="default" Default="True"/>
@ -327,7 +327,6 @@
<ComponentName Value="frmMain"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="UfrmMain"/>
</Unit1>
<Unit2>
<Filename Value="UdmNetwork.pas"/>
@ -335,7 +334,6 @@
<ComponentName Value="dmNetwork"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="DataModule"/>
<UnitName Value="UdmNetwork"/>
</Unit2>
<Unit3>
<Filename Value="UfrmLogin.pas"/>
@ -455,12 +453,10 @@
<Unit23>
<Filename Value="UPacketHandlers.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="UPacketHandlers"/>
</Unit23>
<Unit24>
<Filename Value="UPackets.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="UPackets"/>
</Unit24>
<Unit25>
<Filename Value="ULandscape.pas"/>
@ -564,7 +560,6 @@
<ComponentName Value="frmChangePassword"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="UfrmChangePassword"/>
</Unit48>
</Units>
</ProjectOptions>

View File

@ -37,6 +37,7 @@ uses
Forms, UdmNetwork;
{$R CentrED.res}
{$R Assets.rc} // Beware: you need 'windres', which is part of mingw-binutils on *nix!
function GetApplicationName: String;
begin

View File

@ -1,5 +0,0 @@
Overlay/LeftTopArrow.tga
Overlay/TopArrow.tga
Overlay/VirtualLayer.tga
GLFont/DejaVu.png
GLFont/DejaVu.fnt

View File

@ -78,9 +78,6 @@ type
implementation
uses
UResourceManager;
{ TGLArrow }
constructor TGLArrow.Create(AGraphic: TSingleImage);
@ -172,12 +169,19 @@ constructor TOverlayUI.Create;
var
i: Integer;
arrow: TSingleImage;
resStream: TResourceStream;
begin
inherited Create;
FActiveArrow := -1;
FVisible := False;
arrow := TSingleImage.CreateFromStream(ResourceManager.GetResource(0));
resStream := TResourceStream.Create(HINSTANCE, 'LEFTTOPARROW', RT_RCDATA);
try
arrow := TSingleImage.CreateFromStream(resStream);
finally
resStream.Free;
end;
for i := 0 to 3 do
begin
FArrows[2*i] := TGLArrow.Create(arrow);
@ -186,7 +190,13 @@ begin
end;
arrow.Free;
arrow := TSingleImage.CreateFromStream(ResourceManager.GetResource(1));
resStream := TResourceStream.Create(HINSTANCE, 'TOPARROW', RT_RCDATA);
try
arrow := TSingleImage.CreateFromStream(resStream);
finally
resStream.Free;
end;
for i := 0 to 3 do
begin
FArrows[2*i+1] := TGLArrow.Create(arrow);

View File

@ -1,105 +0,0 @@
(*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at
* http://www.opensource.org/licenses/cddl1.php.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at
* http://www.opensource.org/licenses/cddl1.php. If applicable,
* add the following below this CDDL HEADER, with the fields enclosed
* by brackets "[]" replaced with your own identifying * information:
* Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*
*
* Portions Copyright 2009 Andreas Schneider
*)
unit UResourceManager;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils;
type
{ TResourceManager }
TResourceManager = class
constructor Create(AFileName: string);
destructor Destroy; override;
protected
FFileStream: TFileStream;
FCount: Integer;
FLookupTable: array of Cardinal;
FCurrentResource: Integer;
FResourceStream: TMemoryStream;
public
function GetResource(AIndex: Integer): TStream;
end;
var
ResourceManager: TResourceManager;
implementation
{ TResourceManager }
constructor TResourceManager.Create(AFileName: string);
begin
inherited Create;
FFileStream := TFileStream.Create(AFileName, fmOpenRead or fmShareDenyWrite);
FFileStream.Position := 0;
FFileStream.Read(FCount, SizeOf(Integer));
SetLength(FLookupTable, FCount);
FFileStream.Read(FLookupTable[0], FCount * SizeOf(Cardinal));
FCurrentResource := -1;
end;
destructor TResourceManager.Destroy;
begin
FreeAndNil(FFileStream);
FreeAndNil(FResourceStream);
inherited Destroy;
end;
function TResourceManager.GetResource(AIndex: Integer): TStream;
var
size: Cardinal;
begin
if AIndex <> FCurrentResource then
begin
FFileStream.Position := FLookupTable[AIndex];
FResourceStream.Free;
FResourceStream := TMemoryStream.Create;
FFileStream.Read(size, SizeOf(Cardinal));
FResourceStream.CopyFrom(FFileStream, size);
FCurrentResource := AIndex;
end;
FResourceStream.Position := 0;
Result := FResourceStream;
end;
initialization
begin
ResourceManager := TResourceManager.Create(ChangeFileExt(ParamStr(0), '.dat'));
end;
finalization
begin
if ResourceManager <> nil then FreeAndNil(ResourceManager);
end;
end.

View File

@ -408,7 +408,7 @@ uses
UfrmAccountControl, UGraphicHelper, ImagingComponents, UfrmDrawSettings,
UfrmBoundaries, UfrmElevateSettings, UfrmConfirmation, UfrmMoveSettings,
UfrmAbout, UPacketHandlers, UfrmHueSettings, UfrmRadar, UfrmLargeScaleCommand,
UfrmLogin, UResourceManager, UfrmVirtualLayer, UfrmFilter, UfrmRegionControl,
UfrmLogin, UfrmVirtualLayer, UfrmFilter, UfrmRegionControl,
Logging, LConvEncoding, LCLType, UfrmLightlevel, UfrmChangePassword;
type
@ -889,6 +889,8 @@ begin
end;
procedure TfrmMain.FormCreate(Sender: TObject);
var
resStream: TResourceStream;
begin
FAppDir := IncludeTrailingPathDelimiter(ExtractFilePath(Application.ExeName));
FConfigDir := GetAppConfigDir(False);
@ -940,11 +942,21 @@ begin
RegisterPacketHandler($0C, TPacketHandler.Create(0, @OnClientHandlingPacket));
FVLayerImage := TSingleImage.CreateFromStream(ResourceManager.GetResource(2));
resStream := nil;
try
resStream := TResourceStream.Create(HINSTANCE, 'VIRTUALLAYER', RT_RCDATA);
FVLayerImage := TSingleImage.CreateFromStream(resStream);
FreeAndNil(resStream);
FGLFont := TGLFont.Create;
FGLFont.LoadImage(ResourceManager.GetResource(3));
FGLFont.LoadFontInfo(ResourceManager.GetResource(4));
FGLFont := TGLFont.Create;
resStream := TResourceStream.Create(HINSTANCE, 'DEJAVU', RT_RCDATA);
FGLFont.LoadImage(resStream);
FreeAndNil(resStream);
resStream := TResourceStream.Create(HINSTANCE, 'DEJAVUDAT', RT_RCDATA);
FGLFont.LoadFontInfo(resStream);
finally
FreeAndNil(resStream);
end;
FVirtualTiles := TWorldItemList.Create(True);
FUndoList := TPacketList.Create(True);

View File

@ -1,69 +0,0 @@
(*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at
* http://www.opensource.org/licenses/cddl1.php.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at
* http://www.opensource.org/licenses/cddl1.php. If applicable,
* add the following below this CDDL HEADER, with the fields enclosed
* by brackets "[]" replaced with your own identifying * information:
* Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*
*
* Portions Copyright 2007 Andreas Schneider
*)
program ResourceBuilder;
{$mode objfpc}{$H+}
uses
SysUtils, Classes;
var
fileList: TStringList;
infile, outfile: TFileStream;
i, count: Integer;
size: Cardinal;
lookupTable: array of Cardinal;
begin
if ParamCount <> 2 then
begin
writeln('Usage: ResourceBuilder <FileList> <ResourceFile>');
halt;
end;
fileList := TStringList.Create;
fileList.LoadFromFile(ParamStr(1));
outfile := TFileStream.Create(ParamStr(2), fmCreate);
count := fileList.Count;
outfile.Write(count, SizeOf(Integer));
SetLength(lookupTable, count);
outfile.Write(lookupTable[0], count * SizeOf(Cardinal));
for i := 0 to count - 1 do
begin
lookupTable[i] := outfile.Position;
writeln(i, ': ', fileList.Strings[i]);
infile := TFileStream.Create(fileList.Strings[i], fmOpenRead);
infile.Position := 0;
size := infile.Size;
outfile.Write(size, SizeOf(Cardinal));
outfile.CopyFrom(infile, infile.Size);
infile.Free;
end;
outfile.Position := SizeOf(Integer);
outfile.Write(lookupTable[0], count * SizeOf(Cardinal));
outfile.Free;
fileList.Free;
end.