- Changed TVirtualTile to inherit directly from TWorldItem
- Added FRepaintNeeded to minimize unnecessary repaints
This commit is contained in:
parent
0cee996fbc
commit
94d77d4a00
|
@ -614,11 +614,11 @@ object frmMain: TfrmMain
|
||||||
end
|
end
|
||||||
object tsClients: TTabSheet
|
object tsClients: TTabSheet
|
||||||
Caption = 'Clients'
|
Caption = 'Clients'
|
||||||
ClientHeight = 495
|
ClientHeight = 492
|
||||||
ClientWidth = 218
|
ClientWidth = 218
|
||||||
object lbClients: TListBox
|
object lbClients: TListBox
|
||||||
Left = 0
|
Left = 0
|
||||||
Height = 495
|
Height = 492
|
||||||
Top = 0
|
Top = 0
|
||||||
Width = 218
|
Width = 218
|
||||||
Align = alClient
|
Align = alClient
|
||||||
|
@ -632,7 +632,7 @@ object frmMain: TfrmMain
|
||||||
end
|
end
|
||||||
object tsLocations: TTabSheet
|
object tsLocations: TTabSheet
|
||||||
Caption = 'Locations'
|
Caption = 'Locations'
|
||||||
ClientHeight = 495
|
ClientHeight = 492
|
||||||
ClientWidth = 218
|
ClientWidth = 218
|
||||||
object btnClearLocations: TSpeedButton
|
object btnClearLocations: TSpeedButton
|
||||||
AnchorSideLeft.Control = btnDeleteLocation
|
AnchorSideLeft.Control = btnDeleteLocation
|
||||||
|
@ -641,7 +641,7 @@ object frmMain: TfrmMain
|
||||||
Left = 128
|
Left = 128
|
||||||
Height = 22
|
Height = 22
|
||||||
Hint = 'Clear'
|
Hint = 'Clear'
|
||||||
Top = 453
|
Top = 450
|
||||||
Width = 23
|
Width = 23
|
||||||
BorderSpacing.Left = 4
|
BorderSpacing.Left = 4
|
||||||
Color = clBtnFace
|
Color = clBtnFace
|
||||||
|
@ -694,7 +694,7 @@ object frmMain: TfrmMain
|
||||||
Left = 101
|
Left = 101
|
||||||
Height = 22
|
Height = 22
|
||||||
Hint = 'Delete'
|
Hint = 'Delete'
|
||||||
Top = 453
|
Top = 450
|
||||||
Width = 23
|
Width = 23
|
||||||
Anchors = [akLeft, akBottom]
|
Anchors = [akLeft, akBottom]
|
||||||
BorderSpacing.Bottom = 4
|
BorderSpacing.Bottom = 4
|
||||||
|
@ -746,7 +746,7 @@ object frmMain: TfrmMain
|
||||||
Left = 74
|
Left = 74
|
||||||
Height = 22
|
Height = 22
|
||||||
Hint = 'Add'
|
Hint = 'Add'
|
||||||
Top = 453
|
Top = 450
|
||||||
Width = 23
|
Width = 23
|
||||||
Anchors = [akTop, akRight]
|
Anchors = [akTop, akRight]
|
||||||
BorderSpacing.Right = 4
|
BorderSpacing.Right = 4
|
||||||
|
@ -800,7 +800,7 @@ object frmMain: TfrmMain
|
||||||
AnchorSideBottom.Control = btnDeleteLocation
|
AnchorSideBottom.Control = btnDeleteLocation
|
||||||
Cursor = 63
|
Cursor = 63
|
||||||
Left = 4
|
Left = 4
|
||||||
Height = 431
|
Height = 428
|
||||||
Top = 18
|
Top = 18
|
||||||
Width = 210
|
Width = 210
|
||||||
Anchors = [akTop, akLeft, akRight, akBottom]
|
Anchors = [akTop, akLeft, akRight, akBottom]
|
||||||
|
@ -2418,7 +2418,7 @@ object frmMain: TfrmMain
|
||||||
end
|
end
|
||||||
object pmClients: TPopupMenu
|
object pmClients: TPopupMenu
|
||||||
left = 184
|
left = 184
|
||||||
top = 168
|
top = 176
|
||||||
object mnuGoToClient: TMenuItem
|
object mnuGoToClient: TMenuItem
|
||||||
Caption = 'GoTo'
|
Caption = 'GoTo'
|
||||||
Default = True
|
Default = True
|
||||||
|
@ -2431,12 +2431,12 @@ object frmMain: TfrmMain
|
||||||
OnTimer = tmMovementTimer
|
OnTimer = tmMovementTimer
|
||||||
OnStartTimer = tmMovementTimer
|
OnStartTimer = tmMovementTimer
|
||||||
left = 232
|
left = 232
|
||||||
top = 64
|
top = 80
|
||||||
end
|
end
|
||||||
object ActionList1: TActionList
|
object ActionList1: TActionList
|
||||||
Images = ImageList1
|
Images = ImageList1
|
||||||
left = 264
|
left = 264
|
||||||
top = 64
|
top = 80
|
||||||
object acSelect: TAction
|
object acSelect: TAction
|
||||||
Category = 'Tools'
|
Category = 'Tools'
|
||||||
Caption = 'Select'
|
Caption = 'Select'
|
||||||
|
@ -2536,14 +2536,14 @@ object frmMain: TfrmMain
|
||||||
Enabled = False
|
Enabled = False
|
||||||
Interval = 250
|
Interval = 250
|
||||||
OnTimer = tmGrabTileInfoTimer
|
OnTimer = tmGrabTileInfoTimer
|
||||||
left = 367
|
left = 368
|
||||||
top = 64
|
top = 80
|
||||||
end
|
end
|
||||||
object tmTileHint: TTimer
|
object tmTileHint: TTimer
|
||||||
Enabled = False
|
Enabled = False
|
||||||
OnTimer = tmTileHintTimer
|
OnTimer = tmTileHintTimer
|
||||||
left = 185
|
left = 184
|
||||||
top = 200
|
top = 224
|
||||||
end
|
end
|
||||||
object pmGrabTileInfo: TPopupMenu
|
object pmGrabTileInfo: TPopupMenu
|
||||||
OnPopup = pmGrabTileInfoPopup
|
OnPopup = pmGrabTileInfoPopup
|
||||||
|
|
|
@ -38,7 +38,7 @@ uses
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
||||||
TVirtualTile = class(TStaticItem);
|
TVirtualTile = class(TWorldItem);
|
||||||
|
|
||||||
TAccessChangedListener = procedure(AAccessLevel: TAccessLevel) of object;
|
TAccessChangedListener = procedure(AAccessLevel: TAccessLevel) of object;
|
||||||
TScreenBufferState = (sbsValid, sbsIndexed, sbsFiltered);
|
TScreenBufferState = (sbsValid, sbsIndexed, sbsFiltered);
|
||||||
|
@ -288,6 +288,7 @@ type
|
||||||
FRandomPresetLocation: string;
|
FRandomPresetLocation: string;
|
||||||
FLastDraw: TDateTime;
|
FLastDraw: TDateTime;
|
||||||
FAccessChangedListeners: array of TAccessChangedListener;
|
FAccessChangedListeners: array of TAccessChangedListener;
|
||||||
|
FRepaintNeeded: Boolean;
|
||||||
{ Methods }
|
{ Methods }
|
||||||
procedure BuildTileList;
|
procedure BuildTileList;
|
||||||
function ConfirmAction: Boolean;
|
function ConfirmAction: Boolean;
|
||||||
|
@ -370,6 +371,9 @@ type
|
||||||
Name: string;
|
Name: string;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
const
|
||||||
|
CScreenBufferValid = [sbsValid, sbsIndexed, sbsFiltered];
|
||||||
|
|
||||||
{ TfrmMain }
|
{ TfrmMain }
|
||||||
|
|
||||||
procedure TfrmMain.mnuExitClick(Sender: TObject);
|
procedure TfrmMain.mnuExitClick(Sender: TObject);
|
||||||
|
@ -461,6 +465,8 @@ begin
|
||||||
|
|
||||||
if acSelect.Checked then //***** Selection Mode *****//
|
if acSelect.Checked then //***** Selection Mode *****//
|
||||||
tmGrabTileInfo.Enabled := True;
|
tmGrabTileInfo.Enabled := True;
|
||||||
|
|
||||||
|
FRepaintNeeded := True;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TfrmMain.oglGameWindowMouseEnter(Sender: TObject);
|
procedure TfrmMain.oglGameWindowMouseEnter(Sender: TObject);
|
||||||
|
@ -476,6 +482,8 @@ begin
|
||||||
frmFilter.Hide;
|
frmFilter.Hide;
|
||||||
frmFilter.Locked := False;
|
frmFilter.Locked := False;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
FRepaintNeeded := True;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TfrmMain.oglGameWindowMouseLeave(Sender: TObject);
|
procedure TfrmMain.oglGameWindowMouseLeave(Sender: TObject);
|
||||||
|
@ -488,6 +496,8 @@ begin
|
||||||
CurrentTile := nil;
|
CurrentTile := nil;
|
||||||
FOverlayUI.Visible := False;
|
FOverlayUI.Visible := False;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
FRepaintNeeded := True;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TfrmMain.oglGameWindowMouseMove(Sender: TObject; Shift: TShiftState;
|
procedure TfrmMain.oglGameWindowMouseMove(Sender: TObject; Shift: TShiftState;
|
||||||
|
@ -514,6 +524,8 @@ begin
|
||||||
CurrentTile := nil;
|
CurrentTile := nil;
|
||||||
|
|
||||||
UpdateCurrentTile(X, Y);
|
UpdateCurrentTile(X, Y);
|
||||||
|
|
||||||
|
FRepaintNeeded := True;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TfrmMain.oglGameWindowMouseUp(Sender: TObject; Button: TMouseButton;
|
procedure TfrmMain.oglGameWindowMouseUp(Sender: TObject; Button: TMouseButton;
|
||||||
|
@ -684,6 +696,7 @@ begin
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
SelectedTile := nil;
|
SelectedTile := nil;
|
||||||
|
FRepaintNeeded := True;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TfrmMain.oglGameWindowMouseWheel(Sender: TObject; Shift: TShiftState;
|
procedure TfrmMain.oglGameWindowMouseWheel(Sender: TObject; Shift: TShiftState;
|
||||||
|
@ -721,6 +734,8 @@ begin
|
||||||
SetCursorPos(Mouse.CursorPos.X, Mouse.CursorPos.Y - 4 * WheelDelta);
|
SetCursorPos(Mouse.CursorPos.X, Mouse.CursorPos.Y - 4 * WheelDelta);
|
||||||
UpdateCurrentTile(MousePos.X, MousePos.Y - 4 * WheelDelta);
|
UpdateCurrentTile(MousePos.X, MousePos.Y - 4 * WheelDelta);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
FRepaintNeeded := True;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TfrmMain.FormCreate(Sender: TObject);
|
procedure TfrmMain.FormCreate(Sender: TObject);
|
||||||
|
@ -852,10 +867,13 @@ end;
|
||||||
|
|
||||||
procedure TfrmMain.ApplicationProperties1Idle(Sender: TObject; var Done: Boolean);
|
procedure TfrmMain.ApplicationProperties1Idle(Sender: TObject; var Done: Boolean);
|
||||||
begin
|
begin
|
||||||
if MilliSecondsBetween(FLastDraw, Now) > 30 then
|
if (FScreenBufferState <> CScreenBufferValid) or
|
||||||
|
(FRepaintNeeded and (MilliSecondsBetween(Now, FLastDraw) > 50)) then
|
||||||
begin
|
begin
|
||||||
|
Logger.Send([lcClient, lcDebug], 'Repainting Game Window');
|
||||||
oglGameWindow.Repaint;
|
oglGameWindow.Repaint;
|
||||||
FLastDraw := Now;
|
FLastDraw := Now;
|
||||||
|
FRepaintNeeded := False;
|
||||||
end;
|
end;
|
||||||
Sleep(1);
|
Sleep(1);
|
||||||
Done := False;
|
Done := False;
|
||||||
|
@ -2291,7 +2309,7 @@ begin
|
||||||
virtualTile := TVirtualTile(FVirtualTiles[i]);
|
virtualTile := TVirtualTile(FVirtualTiles[i]);
|
||||||
end else
|
end else
|
||||||
begin
|
begin
|
||||||
virtualTile := TVirtualTile.Create(nil, nil, 0, 0);
|
virtualTile := TVirtualTile.Create(nil);
|
||||||
FVirtualTiles.Add(virtualTile);
|
FVirtualTiles.Add(virtualTile);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue