2
Ported to FPC by Nikolay Nikolov (nickysn@users.sourceforge.net)
6
HiColor example for OpenPTC 1.0 C++ Implementation
7
Copyright (c) Glenn Fiedler (ptc@gaffer.org)
8
This source code is in the public domain
11
Program HiColorExample;
19
console : TPTCConsole;
20
surface : TPTCSurface;
23
width, height : Integer;
25
x, y, r, g, b : Integer;
34
console := TPTCConsole.Create;
37
format := TPTCFormat.Create(16, $F800, $07E0, $001F);
40
console.open('HiColor example', format);
42
{ create surface matching console dimensions }
43
surface := TPTCSurface.Create(console.width, console.height, format);
45
{ loop until a key is pressed }
46
While Not console.KeyPressed Do
49
pixels := surface.lock;
51
{ get surface dimensions }
52
width := surface.width;
53
height := surface.height;
55
{ draw random pixels }
58
{ get random position }
67
{ draw color [r,g,b] at position [x,y] }
68
pixels[x + y * width] := ((r And $00F8) Shl 8) Or
69
((g And $00FC) Shl 3) Or
70
((b And $00F8) Shr 3);
78
surface.copy(console);
90
On error : TPTCError Do