diff --git a/src/editor/f_main.pas b/src/editor/f_main.pas
index dfb9b75ef200377d2fbf27e5e7d780ac63f3acff..0c912cf20500d7b4250e7941ac44e1d46bfd32ff 100644 (file)
--- a/src/editor/f_main.pas
+++ b/src/editor/f_main.pas
procedure FormKeyUp(Sender: TObject; var Key: Word;
Shift: TShiftState);
private
+ LastDrawTime: UInt64;
procedure Draw();
procedure OnIdle(Sender: TObject; var Done: Boolean);
procedure RefillRecentMenu (menu: TMenuItem; start: Integer; fmt: AnsiString);
s: String;
begin
Randomize();
+ LastDrawTime := 0;
{$IFDEF DARWIN}
miApple.Enabled := True;
config := TConfig.CreateFile(CfgFileName);
+ gWADEditorLogLevel := config.ReadInt('WADEditor', 'LogLevel', DFWAD_LOG_DEFAULT);
+
if config.ReadInt('Editor', 'XPos', -1) = -1 then
Position := poDesktopCenter
else begin
ObjCount: Word;
aX, aY, aX2, aY2, XX, ScaleSz: Integer;
begin
+ LastDrawTime := GetTickCount64();
ID := 0;
PID := 0;
Width := 0;
else
a := 0;
+ glDisable(GL_TEXTURE_2D);
+ glColor3ub(GetRValue(DotColor), GetGValue(DotColor), GetBValue(DotColor));
+ glPointSize(DotSize);
+ glBegin(GL_POINTS);
x := MapOffset.X mod DotStep;
- y := MapOffset.Y mod DotStep;
-
while x < RenderPanel.Width do
begin
+ y := MapOffset.Y mod DotStep;
while y < RenderPanel.Height do
begin
- e_DrawPoint(DotSize, x + a, y + a,
- GetRValue(DotColor),
- GetGValue(DotColor),
- GetBValue(DotColor));
+ glVertex2i(x + a, y + a);
y += DotStep;
end;
x += DotStep;
- y := MapOffset.Y mod DotStep;
end;
+ glEnd();
+ glColor4ub(e_Colors.R, e_Colors.G, e_Colors.B, 255);
end;
// Превью текстуры:
begin
config := TConfig.CreateFile(CfgFileName);
+ config.WriteInt('WADEditor', 'LogLevel', gWADEditorLogLevel);
+
if WindowState <> wsMaximized then
begin
config.WriteInt('Editor', 'XPos', Left);
end;
procedure TMainForm.OnIdle(Sender: TObject; var Done: Boolean);
+ const MaxFPS = 60;
var f: AnsiString;
begin
+ // TODO: move refresh to user actions (ask to repaint only when something changed)
+ if GetTickCount64() - LastDrawTime >= 1000 div MaxFPS then
+ begin
+ PanelMap.Refresh;
+ end;
+
if StartMap <> '' then
begin
f := StartMap;