2
Ported to FPC by Nikolay Nikolov (nickysn@users.sourceforge.net)
6
Clear example for OpenPTC 1.0 C++ Implementation
7
Copyright (c) Glenn Fiedler (ptc@gaffer.org)
8
This source code is in the public domain
19
console : TPTCConsole;
21
surface : TPTCSurface;
22
width, height : Integer;
31
console := TPTCConsole.Create;
34
format := TPTCFormat.Create(32, $00FF0000, $0000FF00, $000000FF);
37
console.open('Clear example', format);
39
{ create surface matching console dimensions }
40
surface := TPTCSurface.Create(console.width, console.height, format);
42
{ loop until a key is pressed }
43
While Not console.KeyPressed Do
45
{ get surface dimensions }
46
width := surface.width;
47
height := surface.height;
49
{ get random position }
53
{ get random area size }
54
size := Random(width Div 8);
57
area := TPTCArea.Create(x-size, y-size, x+size, y+size);
59
{ create random color }
60
color := TPTCColor.Create(Random, Random, Random);
62
{ clear surface area with color }
63
surface.clear(color, area);
66
surface.copy(console);
77
On error : TPTCError Do