source: trunk/Forms/UFormMain.pas

Last change on this file was 3, checked in by chronos, 9 years ago
  • Added: Classes for decoding MAP, CPS, SHP and ENG file formats.
File size: 1.3 KB
Line 
1unit UFormMain;
2
3{$mode delphi}{$H+}
4
5interface
6
7uses
8 Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ExtCtrls,
9 LCLType, types;
10
11type
12
13 { TFormMain }
14
15 TFormMain = class(TForm)
16 PaintBox1: TPaintBox;
17 procedure FormActivate(Sender: TObject);
18 procedure FormKeyPress(Sender: TObject; var Key: char);
19 procedure PaintBox1Click(Sender: TObject);
20 procedure PaintBox1Paint(Sender: TObject);
21 private
22 Initialized: Boolean;
23 public
24 procedure EraseBackground(DC: HDC); override;
25 end;
26
27var
28 FormMain: TFormMain;
29
30implementation
31
32{$R *.lfm}
33
34uses
35 UCore;
36
37{ TFormMain }
38
39procedure TFormMain.PaintBox1Click(Sender: TObject);
40begin
41
42end;
43
44procedure TFormMain.PaintBox1Paint(Sender: TObject);
45begin
46 Core.Game.Paint(PaintBox1.Canvas);
47end;
48
49procedure TFormMain.FormActivate(Sender: TObject);
50begin
51 if not Initialized then begin
52 Initialized := True;
53 Core.Init;
54 end;
55end;
56
57procedure TFormMain.FormKeyPress(Sender: TObject; var Key: char);
58begin
59 Caption := IntToStr(Ord(Key));
60 if Key = #63 then begin
61 Inc(Core.Game.IW);
62 core.Game.LoadData;
63 PaintBox1.Repaint;
64 end;
65 if Key = #41 then begin
66 Dec(Core.Game.IW);
67 core.Game.LoadData;
68 PaintBox1.Repaint;
69 end;
70end;
71
72procedure TFormMain.EraseBackground(DC: HDC);
73begin
74 // Do not redraw background
75end;
76
77end.
78
Note: See TracBrowser for help on using the repository browser.