1 | unit uanim;
|
---|
2 |
|
---|
3 | {$mode objfpc}{$H+}
|
---|
4 |
|
---|
5 | interface
|
---|
6 |
|
---|
7 | uses
|
---|
8 | Classes, Controls, Dialogs, FileUtil, Forms, Graphics, StdCtrls, SysUtils,
|
---|
9 | BGRASpriteAnimation, BGRABitmap, BGRABitmapTypes;
|
---|
10 |
|
---|
11 | type
|
---|
12 |
|
---|
13 | { TfrmAnimation }
|
---|
14 |
|
---|
15 | TfrmAnimation = class(TForm)
|
---|
16 | Label1: TLabel;
|
---|
17 | Label2: TLabel;
|
---|
18 | test: TBGRASpriteAnimation;
|
---|
19 | lbLap: TLabel;
|
---|
20 | lbPos: TLabel;
|
---|
21 | test1: TBGRASpriteAnimation;
|
---|
22 | procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
|
---|
23 | procedure FormCreate(Sender: TObject);
|
---|
24 | procedure FormShow(Sender: TObject);
|
---|
25 | procedure test1LapChanged(Sender: TObject);
|
---|
26 | procedure testLapChanged(Sender: TObject);
|
---|
27 | procedure testPositionChanged(Sender: TObject);
|
---|
28 | procedure testRedrawAfter(Sender: TObject; Bitmap: TBGRABitmap);
|
---|
29 | private
|
---|
30 | { private declarations }
|
---|
31 | public
|
---|
32 | { public declarations }
|
---|
33 | n: integer;
|
---|
34 | end;
|
---|
35 |
|
---|
36 | var
|
---|
37 | frmAnimation: TfrmAnimation;
|
---|
38 |
|
---|
39 | implementation
|
---|
40 |
|
---|
41 | {$R *.lfm}
|
---|
42 |
|
---|
43 | procedure TfrmAnimation.testLapChanged(Sender: TObject);
|
---|
44 | begin
|
---|
45 | Label1.Caption := 'Lap ' + IntToStr(test.AnimRepeatLap);
|
---|
46 | end;
|
---|
47 |
|
---|
48 | procedure TfrmAnimation.FormShow(Sender: TObject);
|
---|
49 | begin
|
---|
50 | test1.AnimStatic := False;
|
---|
51 | test.AnimStatic := False;
|
---|
52 | end;
|
---|
53 |
|
---|
54 | procedure TfrmAnimation.test1LapChanged(Sender: TObject);
|
---|
55 | begin
|
---|
56 | case test1.SpriteFillOpacity of
|
---|
57 | 0: n := +5;
|
---|
58 | 255: n := -5;
|
---|
59 | end;
|
---|
60 |
|
---|
61 | test1.SpriteFillOpacity := test1.SpriteFillOpacity + n;
|
---|
62 | end;
|
---|
63 |
|
---|
64 | procedure TfrmAnimation.FormClose(Sender: TObject; var CloseAction: TCloseAction
|
---|
65 | );
|
---|
66 | begin
|
---|
67 | test1.AnimStatic := True;
|
---|
68 | test.AnimStatic := True;
|
---|
69 | end;
|
---|
70 |
|
---|
71 | procedure TfrmAnimation.FormCreate(Sender: TObject);
|
---|
72 | begin
|
---|
73 |
|
---|
74 | end;
|
---|
75 |
|
---|
76 | procedure TfrmAnimation.testPositionChanged(Sender: TObject);
|
---|
77 | begin
|
---|
78 | Label2.Caption := 'Pos ' + IntToStr(test.AnimPosition);
|
---|
79 | end;
|
---|
80 |
|
---|
81 | procedure TfrmAnimation.testRedrawAfter(Sender: TObject; Bitmap: TBGRABitmap);
|
---|
82 | begin
|
---|
83 | Bitmap.FontHeight := 10;
|
---|
84 | Bitmap.TextOut(0, 0, IntToStr(test.AnimRepeatLap), BGRABlack, taLeftJustify);
|
---|
85 | Bitmap.TextOut(0, 12, IntToStr(test.AnimPosition), BGRABlack, taLeftJustify);
|
---|
86 | end;
|
---|
87 |
|
---|
88 | { TfrmAnimation }
|
---|
89 |
|
---|
90 | end.
|
---|