- Updated Vampyre Imaging Lib
- Added font rendering - Added height display in flat mode
This commit is contained in:
@@ -56,7 +56,7 @@
|
||||
<MinVersion Major="4" Minor="5" Release="1" Valid="True"/>
|
||||
</Item5>
|
||||
</RequiredPackages>
|
||||
<Units Count="35">
|
||||
<Units Count="36">
|
||||
<Unit0>
|
||||
<Filename Value="CentrED.lpr"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
@@ -273,6 +273,11 @@
|
||||
<IsPartOfProject Value="True"/>
|
||||
<UnitName Value="UTiledata"/>
|
||||
</Unit34>
|
||||
<Unit35>
|
||||
<Filename Value="UGLFont.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<UnitName Value="UGLFont"/>
|
||||
</Unit35>
|
||||
</Units>
|
||||
</ProjectOptions>
|
||||
<CompilerOptions>
|
||||
|
||||
@@ -40,7 +40,7 @@ uses
|
||||
UfrmLargeScaleCommand, UfrmVirtualLayer, UfrmFilter, UfrmTileInfo,
|
||||
UGUIPlatformUtils, UPlatformTypes, UfrmRegionControl, UPackets,
|
||||
UPacketHandlers, UAdminHandling, UGameResources, ULandscape, UfrmToolWindow,
|
||||
Logging, UMap, UWorldItem, UStatics, UTiledata;
|
||||
Logging, UMap, UWorldItem, UStatics, UTiledata, UGLFont;
|
||||
|
||||
{$IFDEF WINDOWS}{$R CentrED.rc}{$ENDIF}
|
||||
|
||||
|
||||
BIN
Client/GLFont/DejaVu.fnt
Normal file
BIN
Client/GLFont/DejaVu.fnt
Normal file
Binary file not shown.
BIN
Client/GLFont/DejaVu.png
Normal file
BIN
Client/GLFont/DejaVu.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 5.0 KiB |
@@ -1,3 +1,5 @@
|
||||
Overlay/LeftTopArrow.tga
|
||||
Overlay/TopArrow.tga
|
||||
Overlay/VirtualLayer.tga
|
||||
Overlay/LeftTopArrow.tga
|
||||
Overlay/TopArrow.tga
|
||||
Overlay/VirtualLayer.tga
|
||||
GLFont/DejaVu.png
|
||||
GLFont/DejaVu.fnt
|
||||
|
||||
205
Client/UGLFont.pas
Normal file
205
Client/UGLFont.pas
Normal file
@@ -0,0 +1,205 @@
|
||||
(*
|
||||
* 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 UGLFont;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, Math, ImagingClasses, ImagingTypes, ImagingOpenGL, GL;
|
||||
|
||||
type
|
||||
|
||||
TFontInfo = packed record
|
||||
Character: Char;
|
||||
LeftOffset: SmallInt;
|
||||
CharWidth: Word;
|
||||
Width: Word;
|
||||
Height: Word;
|
||||
X1: Single;
|
||||
Y1: Single;
|
||||
X2: Single;
|
||||
Y2: Single;
|
||||
end;
|
||||
|
||||
{ TGLFont }
|
||||
|
||||
TGLFont = class
|
||||
constructor Create;
|
||||
destructor Destroy; override;
|
||||
protected
|
||||
FFontImage: TSingleImage;
|
||||
FFontTexture: TGLuint;
|
||||
FSpaceWidth: Word;
|
||||
FFontInfo: array of TFontInfo;
|
||||
function FindCharInfo(AChar: Char): Integer;
|
||||
public
|
||||
function GetTextHeight(AText: String): Integer;
|
||||
function GetTextWidth(AText: String): Integer;
|
||||
procedure DrawText(AX, AY: Integer; AText: String);
|
||||
procedure LoadImage(AImage: TStream);
|
||||
procedure LoadFontInfo(AFontInfo: TStream);
|
||||
procedure UpdateTexture;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
Logging;
|
||||
|
||||
{ TGLFont }
|
||||
|
||||
|
||||
constructor TGLFont.Create;
|
||||
begin
|
||||
FFontTexture := 0;
|
||||
end;
|
||||
|
||||
destructor TGLFont.Destroy;
|
||||
begin
|
||||
FreeAndNil(FFontImage);
|
||||
if FFontTexture <> 0 then
|
||||
glDeleteTextures(1, @FFontTexture);
|
||||
inherited Destroy;
|
||||
end;
|
||||
|
||||
function TGLFont.FindCharInfo(AChar: Char): Integer;
|
||||
var
|
||||
i: Integer;
|
||||
begin
|
||||
Result := -1;
|
||||
i := 0;
|
||||
while (i < Length(FFontInfo)) and (Result = -1) do
|
||||
begin
|
||||
if FFontInfo[i].Character = AChar then
|
||||
Result := i
|
||||
else
|
||||
Inc(i);
|
||||
end;
|
||||
end;
|
||||
|
||||
function TGLFont.GetTextHeight(AText: String): Integer;
|
||||
var
|
||||
i, charInfo: Integer;
|
||||
begin
|
||||
Result := 0;
|
||||
for i := 1 to Length(AText) do
|
||||
begin
|
||||
if AText[i] <> ' ' then
|
||||
begin
|
||||
charInfo := FindCharInfo(AText[i]);
|
||||
if charInfo > -1 then
|
||||
Result := Max(Result, FFontInfo[charInfo].Height);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TGLFont.GetTextWidth(AText: String): Integer;
|
||||
var
|
||||
i, charInfo: Integer;
|
||||
begin
|
||||
Result := 0;
|
||||
for i := 1 to Length(AText) do
|
||||
begin
|
||||
if AText[i] = ' ' then
|
||||
Inc(Result, FSpaceWidth)
|
||||
else
|
||||
begin
|
||||
charInfo := FindCharInfo(AText[i]);
|
||||
if charInfo > -1 then
|
||||
Result := Result + FFontInfo[charInfo].LeftOffset +
|
||||
FFontInfo[charInfo].CharWidth;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TGLFont.DrawText(AX, AY: Integer; AText: String);
|
||||
var
|
||||
i, charInfo: Integer;
|
||||
curX: Integer;
|
||||
x1, y1, x2, y2: Single;
|
||||
begin
|
||||
if FFontTexture = 0 then UpdateTexture;
|
||||
glBindTexture(GL_TEXTURE_2D, FFontTexture);
|
||||
|
||||
curX := AX;
|
||||
for i := 1 to Length(AText) do
|
||||
begin
|
||||
if AText[i] = ' ' then
|
||||
Inc(curX, FSpaceWidth)
|
||||
else
|
||||
begin
|
||||
charInfo := FindCharInfo(AText[i]);
|
||||
if charInfo > -1 then
|
||||
begin
|
||||
x1 := FFontInfo[charInfo].X1;
|
||||
y1 := FFontInfo[charInfo].Y1;
|
||||
x2 := FFontInfo[charInfo].X2;
|
||||
y2 := FFontInfo[charInfo].Y2;
|
||||
|
||||
Inc(curX, FFontInfo[charInfo].LeftOffset);
|
||||
glBegin(GL_QUADS);
|
||||
glTexCoord2f(x1, y1); glVertex2i(curX, AY);
|
||||
glTexCoord2f(x2, y1); glVertex2i(curX + FFontInfo[charInfo].Width, AY);
|
||||
glTexCoord2f(x2, y2); glVertex2i(curX + FFontInfo[charInfo].Width,
|
||||
AY + FFontInfo[charInfo].Height);
|
||||
glTexCoord2f(x1, y2); glVertex2i(curX, AY + FFontInfo[charInfo].Height);
|
||||
glEnd;
|
||||
Inc(curX, FFontInfo[charInfo].CharWidth);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TGLFont.LoadImage(AImage: TStream);
|
||||
begin
|
||||
FFontImage := TSingleImage.CreateFromStream(AImage);
|
||||
end;
|
||||
|
||||
procedure TGLFont.LoadFontInfo(AFontInfo: TStream);
|
||||
begin
|
||||
AFontInfo.Read(FSpaceWidth, SizeOf(FSpaceWidth));
|
||||
SetLength(FFontInfo, (AFontInfo.Size - AFontInfo.Position) div
|
||||
SizeOf(TFontInfo));
|
||||
AFontInfo.Read(FFontInfo[0], Length(FFontInfo) * SizeOf(TFontInfo));
|
||||
end;
|
||||
|
||||
procedure TGLFont.UpdateTexture;
|
||||
begin
|
||||
Logger.Send('UpdateTexture');
|
||||
if FFontTexture <> 0 then glDeleteTextures(1, @FFontTexture);
|
||||
|
||||
FFontTexture := CreateGLTextureFromImage(FFontImage.ImageDataPointer^, 0, 0,
|
||||
True, ifUnknown);
|
||||
glBindTexture(GL_TEXTURE_2D, FFontTexture);
|
||||
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
|
||||
end;
|
||||
|
||||
end.
|
||||
|
||||
@@ -30,11 +30,11 @@ unit ULandscape;
|
||||
interface
|
||||
|
||||
uses
|
||||
SysUtils, Classes, math, LCLIntf, GL, GLU, ImagingOpenGL, Imaging,
|
||||
SysUtils, Classes, math, LCLIntf, GL, GLu, ImagingOpenGL, Imaging,
|
||||
ImagingClasses, ImagingTypes, ImagingUtility,
|
||||
UGenericIndex, UMap, UStatics, UArt, UTexture, UTiledata, UHue, UWorldItem,
|
||||
UMulBlock,
|
||||
UVector, UEnhancedMemoryStream,
|
||||
UVector, UEnhancedMemoryStream, UGLFont,
|
||||
UCacheManager;
|
||||
|
||||
type
|
||||
@@ -196,6 +196,19 @@ type
|
||||
procedure UpdateWriteMap(AStream: TEnhancedMemoryStream);
|
||||
end;
|
||||
|
||||
{ TGLText }
|
||||
|
||||
TGLText = class
|
||||
constructor Create(AFont: TGLFont; AText: String);
|
||||
protected
|
||||
FFont: TGLFont;
|
||||
FText: String;
|
||||
FWidth: Integer;
|
||||
FHeight: Integer;
|
||||
public
|
||||
procedure Render(AScreenRect: TRect);
|
||||
end;
|
||||
|
||||
TScreenState = (ssNormal, ssFiltered, ssGhost);
|
||||
|
||||
PBlockInfo = ^TBlockInfo;
|
||||
@@ -212,6 +225,7 @@ type
|
||||
HueOverride: Boolean;
|
||||
CheckRealQuad: Boolean;
|
||||
Translucent: Boolean;
|
||||
Text: TGLText;
|
||||
Next: PBlockInfo;
|
||||
end;
|
||||
|
||||
@@ -1213,6 +1227,7 @@ begin
|
||||
Result^.State := ssNormal;
|
||||
Result^.Highlighted := False;
|
||||
Result^.Translucent := False;
|
||||
Result^.Text := nil;
|
||||
Result^.Next := nil;
|
||||
|
||||
if FShortCuts[0] = nil then //First element
|
||||
@@ -1239,6 +1254,7 @@ begin
|
||||
current^.Item.Locked := False;
|
||||
current^.Item.OnDestroy.UnregisterEvent(@OnTileRemoved);
|
||||
if current^.Normals <> nil then Dispose(current^.Normals);
|
||||
current^.Text.Free;
|
||||
Dispose(current);
|
||||
current := next;
|
||||
end;
|
||||
@@ -1266,6 +1282,7 @@ begin
|
||||
if last <> nil then last^.Next := current^.Next;
|
||||
|
||||
if current^.Normals <> nil then Dispose(current^.Normals);
|
||||
current^.Text.Free;
|
||||
|
||||
Dispose(current);
|
||||
Dec(FCount);
|
||||
@@ -1356,6 +1373,7 @@ begin
|
||||
Result^.State := ssNormal;
|
||||
Result^.Highlighted := False;
|
||||
Result^.Translucent := False;
|
||||
Result^.Text := nil;
|
||||
|
||||
if (FShortCuts[0] = nil) or (CompareWorldItems(AItem, FShortCuts[0]^.Item) < 0) then
|
||||
begin
|
||||
@@ -1490,5 +1508,27 @@ begin
|
||||
Delete(TWorldItem(ATile));
|
||||
end;
|
||||
|
||||
{ TGLText }
|
||||
|
||||
constructor TGLText.Create(AFont: TGLFont; AText: String);
|
||||
var
|
||||
i: Integer;
|
||||
begin
|
||||
FFont := AFont;
|
||||
FText := AText;
|
||||
FWidth := FFont.GetTextWidth(AText);
|
||||
FHeight := FFont.GetTextHeight('A');
|
||||
end;
|
||||
|
||||
procedure TGLText.Render(AScreenRect: TRect);
|
||||
var
|
||||
x, y: Integer;
|
||||
i: Integer;
|
||||
begin
|
||||
y := AScreenRect.Top + (AScreenRect.Bottom - AScreenRect.Top - FHeight) div 2;
|
||||
x := AScreenRect.Left + (AScreenRect.Right - AScreenRect.Left - FWidth) div 2;
|
||||
FFont.DrawText(x, y, FText);
|
||||
end;
|
||||
|
||||
end.
|
||||
|
||||
|
||||
@@ -1,106 +1,105 @@
|
||||
(*
|
||||
* 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
|
||||
*)
|
||||
unit UResourceManager;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils;
|
||||
|
||||
type
|
||||
|
||||
{ TResourceManager }
|
||||
|
||||
TResourceManager = class(TObject)
|
||||
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
|
||||
if FFileStream <> nil then FreeAndNil(FFileStream);
|
||||
if FResourceStream <> nil then FreeAndNil(FResourceStream);
|
||||
inherited Destroy;
|
||||
end;
|
||||
|
||||
function TResourceManager.GetResource(AIndex: Integer): TStream;
|
||||
var
|
||||
size: Cardinal;
|
||||
begin
|
||||
if AIndex <> FCurrentResource then
|
||||
begin
|
||||
FFileStream.Position := FLookupTable[AIndex];
|
||||
if FResourceStream <> nil then
|
||||
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.
|
||||
|
||||
(*
|
||||
* 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(TObject)
|
||||
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.
|
||||
|
||||
|
||||
@@ -31,10 +31,10 @@ interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, Menus,
|
||||
ComCtrls, OpenGLContext, GL, GLU, UGameResources, ULandscape, ExtCtrls,
|
||||
ComCtrls, OpenGLContext, GL, GLu, UGameResources, ULandscape, ExtCtrls,
|
||||
StdCtrls, Spin, UEnums, VirtualTrees, Buttons, UMulBlock, UWorldItem, math,
|
||||
LCLIntf, UOverlayUI, UStatics, UEnhancedMemoryStream, ActnList, fgl,
|
||||
ImagingClasses, dateutils, UPlatformTypes, UMap, UPacket;
|
||||
ImagingClasses, dateutils, UPlatformTypes, UMap, UPacket, UGLFont;
|
||||
|
||||
type
|
||||
TAccessChangedListener = procedure(AAccessLevel: TAccessLevel) of object;
|
||||
@@ -269,6 +269,7 @@ type
|
||||
Node: PVirtualNode; Stream: TStream);
|
||||
protected
|
||||
{ Members }
|
||||
FAppDir: String;
|
||||
FX: Integer;
|
||||
FY: Integer;
|
||||
FDrawDistance: Integer;
|
||||
@@ -294,6 +295,7 @@ type
|
||||
FRepaintNeeded: Boolean;
|
||||
FSelection: TRect;
|
||||
FUndoList: TPacketList;
|
||||
FGLFont: TGLFont;
|
||||
{ Methods }
|
||||
procedure BuildTileList;
|
||||
function ConfirmAction: Boolean;
|
||||
@@ -784,6 +786,8 @@ var
|
||||
virtualLayerGraphic: TSingleImage;
|
||||
searchRec: TSearchRec;
|
||||
begin
|
||||
FAppDir := IncludeTrailingPathDelimiter(ExtractFilePath(Application.ExeName));
|
||||
|
||||
FLandscape := ResMan.Landscape;
|
||||
FLandscape.OnChange := @OnLandscapeChanged;
|
||||
FLandscape.OnMapChanged := @OnMapChanged;
|
||||
@@ -812,8 +816,7 @@ begin
|
||||
vstChat.NodeDataSize := SizeOf(TChatInfo);
|
||||
pnlChatHeader.AnchorSide[akBottom].Control := pnlBottom;
|
||||
|
||||
FLocationsFile := IncludeTrailingPathDelimiter(ExtractFilePath(
|
||||
Application.ExeName)) + 'Locations.dat';
|
||||
FLocationsFile := FAppDir + 'Locations.dat';
|
||||
vstLocations.NodeDataSize := SizeOf(TLocationInfo);
|
||||
if FileExists(FLocationsFile) then vstLocations.LoadFromFile(FLocationsFile);
|
||||
|
||||
@@ -824,11 +827,14 @@ begin
|
||||
virtualLayerGraphic.Height, virtualLayerGraphic);
|
||||
virtualLayerGraphic.Free;
|
||||
|
||||
FGLFont := TGLFont.Create;
|
||||
FGLFont.LoadImage(ResourceManager.GetResource(3));
|
||||
FGLFont.LoadFontInfo(ResourceManager.GetResource(4));
|
||||
|
||||
FVirtualTiles := TWorldItemList.Create(True);
|
||||
FUndoList := TPacketList.Create(True);
|
||||
|
||||
FRandomPresetLocation := IncludeTrailingPathDelimiter(ExtractFilePath(
|
||||
Application.ExeName)) + 'RandomPresets' + PathDelim;
|
||||
FRandomPresetLocation := FAppDir + 'RandomPresets' + PathDelim;
|
||||
if not DirectoryExists(FRandomPresetLocation) then
|
||||
CreateDir(FRandomPresetLocation);
|
||||
|
||||
@@ -1116,6 +1122,7 @@ begin
|
||||
FreeAndNil(FVLayerMaterial);
|
||||
FreeAndNil(FVirtualTiles);
|
||||
FreeAndNil(FUndoList);
|
||||
FreeAndNil(FGLFont);
|
||||
|
||||
RegisterPacketHandler($0C, nil);
|
||||
end;
|
||||
@@ -1783,9 +1790,11 @@ procedure TfrmMain.InitSize;
|
||||
begin
|
||||
glViewport(0, 0, oglGameWindow.Width, oglGameWindow.Height);
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glPushMatrix;
|
||||
glLoadIdentity;
|
||||
gluOrtho2D(0, oglGameWindow.Width, oglGameWindow.Height, 0);
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glPushMatrix;
|
||||
glLoadIdentity;
|
||||
end;
|
||||
|
||||
@@ -1923,6 +1932,10 @@ begin
|
||||
CheckRealQuad := True;
|
||||
end;
|
||||
end;
|
||||
end else
|
||||
begin
|
||||
ABlockInfo^.Text.Free;
|
||||
ABlockInfo^.Text := TGLText.Create(FGLFont, IntToStr(item.Z));
|
||||
end;
|
||||
|
||||
if not ABlockInfo^.CheckRealQuad then
|
||||
@@ -2082,6 +2095,9 @@ begin
|
||||
|
||||
if highlight then
|
||||
glDisable(GL_COLOR_LOGIC_OP);
|
||||
|
||||
if (blockInfo^.Text <> nil) then
|
||||
blockInfo^.Text.Render(blockInfo^.ScreenRect);
|
||||
end;
|
||||
|
||||
FOverlayUI.Draw(oglGameWindow);
|
||||
|
||||
Reference in New Issue
Block a user