diff options
author | nickysn <nickysn@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2011-11-12 18:28:40 +0000 |
---|---|---|
committer | nickysn <nickysn@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2011-11-12 18:28:40 +0000 |
commit | 047030ec57544fbc422ff0a0021a6bc18a0d7bc0 (patch) | |
tree | c44afd779b740a1221d6727d7b019ccd16b8cfdd /packages/ptc/examples/lights.pp | |
parent | e87d12808bc501110fb3ef3b5a6d8caa5e6db579 (diff) | |
download | fpc-047030ec57544fbc422ff0a0021a6bc18a0d7bc0.tar.gz |
* Updated PTCPas to version 0.99.12
git-svn-id: http://svn.freepascal.org/svn/fpc/trunk@19633 3ad0048d-3df7-0310-abae-a5850022a9f2
Diffstat (limited to 'packages/ptc/examples/lights.pp')
-rw-r--r-- | packages/ptc/examples/lights.pp | 27 |
1 files changed, 12 insertions, 15 deletions
diff --git a/packages/ptc/examples/lights.pp b/packages/ptc/examples/lights.pp index b938ae8fbd..2df96f07b1 100644 --- a/packages/ptc/examples/lights.pp +++ b/packages/ptc/examples/lights.pp @@ -28,10 +28,10 @@ begin end; var - console: TPTCConsole = nil; - surface: TPTCSurface = nil; - format: TPTCFormat = nil; - palette: TPTCPalette = nil; + console: IPTCConsole; + surface: IPTCSurface; + format: IPTCFormat; + palette: IPTCPalette; dx, dy: Integer; divisor: Single; data: PUint32; @@ -54,15 +54,15 @@ begin try try { create console } - console := TPTCConsole.Create; + console := TPTCConsoleFactory.CreateNew; - format := TPTCFormat.Create(8); + format := TPTCFormatFactory.CreateNew(8); { open console } console.open('Lights demo', 320, 200, format); { create surface } - surface := TPTCSurface.Create(320, 200, format); + surface := TPTCSurfaceFactory.CreateNew(320, 200, format); { setup intensity table } for dy := 0 to 199 do @@ -75,15 +75,15 @@ begin end; { create palette } - palette := TPTCPalette.Create; + palette := TPTCPaletteFactory.CreateNew; { generate greyscale palette } - data := palette.lock; + data := palette.Lock; try for i := 0 to 255 do data[i] := (i shl 16) or (i shl 8) or i; finally - palette.unlock; + palette.Unlock; end; { set console palette } @@ -271,11 +271,8 @@ begin console.update; end; finally - console.close; - surface.Free; - console.Free; - palette.Free; - format.Free; + if Assigned(console) then + console.close; end; except on error: TPTCError do |