home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Hack-Phreak Scene Programs
/
cleanhpvac.zip
/
cleanhpvac
/
FNTPAK32.ZIP
/
PASCAL.EXE
/
DEMO_GMS.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1995-08-16
|
4KB
|
131 lines
{**********************************************************************
Demo_GMS.Pas Copyright 1994, Rob W. Smetana
Demonstrate how to:
1. Select GRAPHICS-mode mouse cursor shapes from Font Pak's library.
2. Determine how many mouse shapes there are.
Requires:
a. EGAVGA.BGI Borland support BGI
NOTE::: Search for PathToDrivers := 'd:\tp\bgi'
below and edit the path as needed.
1. Mouse.Obj (which contains mouse functions)
2. LdGFXCsr.OBJ (graphics-mode mouse shapes)
Notes:
It is CRITICAL that you be in GRAPHICS-mode when you call the
graphics-mode procedures. A crash awaits you if you're not.
*************************************************************************}
Uses Graph, CRT,
Font_Pak; { The Font_Pak unit declares/links procedures }
(* We'll demonstrate these. They're declared in unit Font Pak.
procedure rsLoadGFXCursor (WhichShape, HotSpotX, HotSpotY : Integer);
function NumGFXShapes : Integer;
*)
Procedure OpenGraphics;Assembler; {use EGA graphics for on either EGA or VGA}
ASM
Mov Ah, 00h;
Mov Al, 10h; {0E = 640x200 EGA/VGA; 12 = 640x480 VGA}
Int $10;
End;
Procedure CloseGraphics; Assembler; {Back to text mode}
ASM
Mov Ah, 00h;
Mov Al, 03h;
Int $10;
End;
var
GraphDriver, GraphMode, ErrorCode, n, Row, Col, Button, GFXorText : Integer;
NumShapes, WhichShape, HotSpotX, HotSpotY : Integer;
PathToDrivers : String;
Begin
TextAttr:=27; ClrScr;
fpInitialize; ClrScr; { useful for shareware versions only }
n := rsThereIsAMouse; {Is there a mouse? If so, initialize.}
If n = 0 then {0 = no mouse, -1 = there is a mouse }
Begin
WriteLn ('Sorry. This demo requires a mouse/mouse driver. I found none.');
ReadKey;
Halt;
End;
GraphDriver := Detect; { use autodetection }
PathToDrivers := 'd:\tp\bgi'; { !! EDIT THIS as appropriate !! }
InitGraph(GraphDriver, GraphMode, PathToDrivers);
ErrorCode := GraphResult; { preserve error return }
if ErrorCode <> grOK then { error? }
begin
Writeln('Graphics error: ', GraphErrorMsg(ErrorCode));
ReadLn;
Halt;
end;
OpenGraphics; { BE SURE you're in graphics mode }
{ BEFORE calling gfx-mode functions}
DirectVideo := False; { DirectVideo may interfere! }
NumShapes := NumGFXShapes;
Writeln(' Demonstrate how to select one of ',NumShapes, ' GRAPHICS-mode mouse cursor shapes.');
WriteLn('');
Write('Here''s the normal (default) mouse shape. Click a mouse button to try a new one.');
rsShowCursor; { turn ON the mouse cursor }
HotSpotX := 1; HotSpotY := 1; { use 1,1 to keep demo simple }
GFXorText := -1;
{ Loop until you click a mouse button. Then change mouse cursor shapes. }
For WhichShape := 0 to NumShapes do
Begin
{ scrub any remaining button clicks }
Repeat
Button := rsButtonPressed (Row, Col, GFXorText);
Until Button=0;
{ now wait for a button click }
Button := 0;
Repeat
Button := rsButtonPressed (Row, Col, GFXorText);
Until Button>0;
{ load the next cursor shape }
rsHideCursor;
rsLoadGFXCursor (WhichShape + 1, HotSpotX, HotSpotY);
rsShowCursor;
gotoxy (30,6); write('This is cursor # ', WhichShape+1);
end;
CloseGraphics;
ClrScr;
Write('That''s all . . .');
End.