source: trunk/Packages/bgracontrols/testbgracontrols/uanim.pas

Last change on this file was 2, checked in by chronos, 5 years ago
File size: 2.0 KB
Line 
1unit uanim;
2
3{$mode objfpc}{$H+}
4
5interface
6
7uses
8 Classes, Controls, Dialogs, FileUtil, Forms, Graphics, StdCtrls, SysUtils,
9 BGRASpriteAnimation, BGRABitmap, BGRABitmapTypes;
10
11type
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
36var
37 frmAnimation: TfrmAnimation;
38
39implementation
40
41{$R *.lfm}
42
43procedure TfrmAnimation.testLapChanged(Sender: TObject);
44begin
45 Label1.Caption := 'Lap ' + IntToStr(test.AnimRepeatLap);
46end;
47
48procedure TfrmAnimation.FormShow(Sender: TObject);
49begin
50 test1.AnimStatic := False;
51 test.AnimStatic := False;
52end;
53
54procedure TfrmAnimation.test1LapChanged(Sender: TObject);
55begin
56 case test1.SpriteFillOpacity of
57 0: n := +5;
58 255: n := -5;
59 end;
60
61 test1.SpriteFillOpacity := test1.SpriteFillOpacity + n;
62end;
63
64procedure TfrmAnimation.FormClose(Sender: TObject; var CloseAction: TCloseAction
65 );
66begin
67 test1.AnimStatic := True;
68 test.AnimStatic := True;
69end;
70
71procedure TfrmAnimation.FormCreate(Sender: TObject);
72begin
73
74end;
75
76procedure TfrmAnimation.testPositionChanged(Sender: TObject);
77begin
78 Label2.Caption := 'Pos ' + IntToStr(test.AnimPosition);
79end;
80
81procedure TfrmAnimation.testRedrawAfter(Sender: TObject; Bitmap: TBGRABitmap);
82begin
83 Bitmap.FontHeight := 10;
84 Bitmap.TextOut(0, 0, IntToStr(test.AnimRepeatLap), BGRABlack, taLeftJustify);
85 Bitmap.TextOut(0, 12, IntToStr(test.AnimPosition), BGRABlack, taLeftJustify);
86end;
87
88{ TfrmAnimation }
89
90end.
Note: See TracBrowser for help on using the repository browser.