📄 openglmain.pas
字号:
unit OpenGLMain;
interface
{ The Fuchsia borders around some of the trees, are a fault in the map,
not a fault in the OpenGLIsoEngine (I don't know why DirectX doesn't
displays them different) }
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
{CgWindows is part of CgLib which can be obtained from www.gamedeveloper.org}
CgWindow,
OpenGLIsoEngine;
type
TForm1 = class(TCGForm)
procedure FormResize(Sender: TObject);
private
{ Private declarations }
FIsoMap: TOpenGLIsoMap;
procedure Flip(Sender: TObject);
procedure AppIdle(Sender: TObject; var Done: Boolean);
public
{ Public declarations }
constructor Create(AOwner: TComponent); override;
property IsoMap: TOpenGLIsoMap read FIsoMap;
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
{ TForm1 }
procedure TForm1.AppIdle(Sender: TObject; var Done: Boolean);
begin
IsoMap.DrawIsoMap;
Done := True;
end;
constructor TForm1.Create(AOwner: TComponent);
begin
inherited;
InitGL;
FIsoMap := TOpenGLIsoMap.Create(Self);
IsoMap.OnFlip := Flip;
IsoMap.Width := ClientWidth;
IsoMap.Height := ClientHeight;
Application.OnIdle := AppIdle;
IsoMap.LoadFromFile('campground.dxm');
end;
procedure TForm1.Flip(Sender: TObject);
begin
SwapBuffers(DC);
end;
procedure TForm1.FormResize(Sender: TObject);
begin
IsoMap.Height := ClientHeight;
IsoMap.Width := ClientWidth;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -