home *** CD-ROM | disk | FTP | other *** search
- PROGRAM qprodent;
-
- { Demo program to show how to define a mouse graphics cursor.
-
- Written in Microsoft QuickPascal version 1.0.
-
- Hardware req'ts : CGA, EGA, or VGA
- Microsoft-compatible mouse}
-
- USES MSGraph, Mouse;
-
- { Define an hourglass-shaped mouse graphics cursor }
- TYPE MCursorType = ARRAY[0..31] OF Word;
- CONST MCursor : MCursorType =
-
- { Screen mask }
-
- ($0001, { 0000000000000001 }
- $0001, { 0000000000000001 }
- $8003, { 1000000000000011 }
- $C7C7, { 1100011111000111 }
- $E38F, { 1110001110001111 }
- $F11F, { 1111000100011111 }
- $F83F, { 1111100000111111 }
- $FC7F, { 1111110001111111 }
- $F83F, { 1111100000111111 }
- $F11F, { 1111000100011111 }
- $E38F, { 1110001110001111 }
- $C7C7, { 1100011111000111 }
- $8003, { 1000000000000011 }
- $0001, { 0000000000000001 }
- $0001, { 0000000000000001 }
- $0000, { 0000000000000000 }
-
- { Cursor mask }
-
- $0000, { 0000000000000000 }
- $7FFC, { 0111111111111100 }
- $2008, { 0010000000001000 }
- $1010, { 0001000000010000 }
- $0820, { 0000100000100000 }
- $0440, { 0000010001000000 }
- $0280, { 0000001010000000 }
- $0100, { 0000000100000000 }
- $0280, { 0000001010000000 }
- $0440, { 0000010001000000 }
- $0820, { 0000100000100000 }
- $1010, { 0001000000010000 }
- $2008, { 0010000000001000 }
- $7FFC, { 0111111111111100 }
- $0000, { 0000000000000000 }
- $0000); { 0000000000000000 }
-
- VAR
- Buttons, { Number of mouse buttons }
- MouseX, MouseY, MouseButton, { Mouse cursor loc and button info }
- rightbutton, { Where to print mouse right button }
- GrStat : Integer; { Return status from _SetVideoMode }
-
- GotMouse : Boolean;
-
- PROCEDURE ShowButton(Loc, Condition : Integer);
- BEGIN
- _SetTextPosition(2, Loc);
- IF (Condition = 0) THEN
- write(' ')
- ELSE
- write('███');
- END;
-
- BEGIN {main}
- GrStat := _SetVideoMode(_HResBW);
- IF (GrStat = 0) THEN
- BEGIN
- Writeln('This program requires a CGA or other color adapter.');
- Halt(1);
- END;
- GotMouse := ms_init(buttons); { Initialize mouse and get # of buttons }
- IF NOT GotMouse THEN
- BEGIN
- GrStat := _SetVideoMode(_DefaultMode);
- Writeln('No mouse detected.');
- Halt(1);
- END;
-
- IF (Buttons = 3) THEN
- RightButton := 42
- ELSE
- RightButton := 35;
- Writeln('╔════╗ ┌───┐ ┌───┐');
- Writeln('║Quit║ x = xxx y = yyy │ │ │ │');
- Writeln('╚════╝ └───┘ └───┘');
- IF (Buttons = 3) THEN
- BEGIN
- _SetTextPosition(1, RightButton - 1);
- Write('┌───┐');
- _SetTextPosition(2, RightButton - 1);
- Write('│ │');
- _SetTextPosition(3, RightButton - 1);
- Write('└───┘');
- END;
-
- ms_set_graphPointer(7, 7, @MCursor);
- ms_show;
-
- { Main program loop }
- REPEAT
- ms_read(MouseX, MouseY, MouseButton);
- _SetTextPosition(2, 13);
- write(MouseX:3);
- _SetTextPosition(2, 22);
- write(MouseY:3);
- ShowButton(28, MouseButton AND 1);
- ShowButton(RightButton, MouseButton AND 2);
- IF (Buttons = 3) THEN
- ShowButton(35, MouseButton AND 4);
- UNTIL ((MouseButton = 1) AND (MouseX < 48) AND (MouseY < 24));
-
- ms_hide;
- GrStat := _SetVideoMode(_DefaultMode);
- END.
-