source: Console test/UConsoleApp.pas

Last change on this file was 2, checked in by george, 15 years ago
  • Přidáno: Prvotní načtení tříd.
File size: 927 bytes
Line 
1unit UConsoleApp;
2
3interface
4
5uses
6 UConsole, UFileSystem, UTextScreen, UKeyboard;
7
8type
9 TConsoleApp = class
10 private
11 public
12 Console: TConsole;
13 Screen: TTextScreen;
14 Keyboard: TKeyboard;
15 function GetCurrentDirectory: TDirectory;
16 procedure Execute; virtual; abstract;
17 constructor Create;
18 destructor Destroy; override;
19 procedure KeyboardShowKey(Key: Char);
20 end;
21
22implementation
23
24{ TConsoleApp }
25
26constructor TConsoleApp.Create;
27begin
28 Console := TConsole.Create;
29 Screen := TTextScreen.Create;
30 Keyboard := TKeyboard.Create;
31 Keyboard.OnShowKey := KeyboardShowKey;
32end;
33
34destructor TConsoleApp.Destroy;
35begin
36 Keyboard.Free;
37 Screen.Free;
38 Console.Destroy;
39 inherited;
40end;
41
42function TConsoleApp.GetCurrentDirectory: TDirectory;
43begin
44
45end;
46
47procedure TConsoleApp.KeyboardShowKey(Key: Char);
48begin
49 Screen.Write(Key);
50end;
51
52end.
Note: See TracBrowser for help on using the repository browser.