|
Last change
on this file was 1, checked in by chronos, 5 years ago |
- Added: "Clovece nezlob se" game with adjustable board for different player count.
|
|
File size:
775 bytes
|
| Line | |
|---|
| 1 | unit UControls;
|
|---|
| 2 |
|
|---|
| 3 | {$mode delphi}
|
|---|
| 4 |
|
|---|
| 5 | interface
|
|---|
| 6 |
|
|---|
| 7 | uses
|
|---|
| 8 | Classes, SysUtils, UGraphics;
|
|---|
| 9 |
|
|---|
| 10 | type
|
|---|
| 11 |
|
|---|
| 12 | { TControl }
|
|---|
| 13 |
|
|---|
| 14 | TControl = class
|
|---|
| 15 | Canvas: TCanvas;
|
|---|
| 16 | Position: TPoint;
|
|---|
| 17 | Size: TPoint;
|
|---|
| 18 | Text: string;
|
|---|
| 19 | procedure Paint; virtual;
|
|---|
| 20 | constructor Create;
|
|---|
| 21 | destructor Destroy; override;
|
|---|
| 22 | end;
|
|---|
| 23 |
|
|---|
| 24 | { TButton }
|
|---|
| 25 |
|
|---|
| 26 | TButton = class(TControl)
|
|---|
| 27 | procedure Paint; override;
|
|---|
| 28 | end;
|
|---|
| 29 |
|
|---|
| 30 | implementation
|
|---|
| 31 |
|
|---|
| 32 | { TButton }
|
|---|
| 33 |
|
|---|
| 34 | procedure TButton.Paint;
|
|---|
| 35 | begin
|
|---|
| 36 | with Canvas do begin
|
|---|
| 37 | Rectangle(Rect(0, 0, Size.Width, Size.Height));
|
|---|
| 38 | TextOut(Point(Position.X, Position.Y), Text);
|
|---|
| 39 | end;
|
|---|
| 40 | end;
|
|---|
| 41 |
|
|---|
| 42 | { TControl }
|
|---|
| 43 |
|
|---|
| 44 | procedure TControl.Paint;
|
|---|
| 45 | begin
|
|---|
| 46 |
|
|---|
| 47 | end;
|
|---|
| 48 |
|
|---|
| 49 | constructor TControl.Create;
|
|---|
| 50 | begin
|
|---|
| 51 | Canvas := TCanvas.Create;
|
|---|
| 52 | end;
|
|---|
| 53 |
|
|---|
| 54 | destructor TControl.Destroy;
|
|---|
| 55 | begin
|
|---|
| 56 | Canvas.Free;
|
|---|
| 57 | inherited;
|
|---|
| 58 | end;
|
|---|
| 59 |
|
|---|
| 60 | end.
|
|---|
| 61 |
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.