mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-10 03:28:40 +02:00
+ Initial implementation
This commit is contained in:
parent
5910806f36
commit
e62631e6cb
46
docs/gpmex/gpmex.pp
Normal file
46
docs/gpmex/gpmex.pp
Normal file
@ -0,0 +1,46 @@
|
||||
program gpmex;
|
||||
|
||||
{
|
||||
Example program to demonstrate the use of the gpm unit.
|
||||
}
|
||||
|
||||
uses gpm;
|
||||
|
||||
var
|
||||
connect : TGPMConnect;
|
||||
event : tgpmevent;
|
||||
|
||||
begin
|
||||
connect.EventMask:=GPM_MOVE or GPM_DRAG or GPM_DOWN or GPM_UP;
|
||||
connect.DefaultMask:=0;
|
||||
connect.MinMod:=0;
|
||||
connect.MaxMod:=0;
|
||||
if Gpm_Open(connect,0)=-1 then
|
||||
begin
|
||||
Writeln('No mouse handler present.');
|
||||
Halt(1);
|
||||
end;
|
||||
Writeln('Click right button to end.');
|
||||
Repeat
|
||||
gpm_getevent(Event);
|
||||
With Event do
|
||||
begin
|
||||
Write('Pos = (',X,',',Y,') Buttons : (');
|
||||
if (buttons and Gpm_b_left)<>0 then
|
||||
write('left ');
|
||||
if (buttons and Gpm_b_right)<>0 then
|
||||
write('right ');
|
||||
if (buttons and Gpm_b_middle)<>0 then
|
||||
Write('middle ');
|
||||
Write(') Event : ');
|
||||
Case EventType and $F of
|
||||
GPM_MOVE: write('Move');
|
||||
GPM_DRAG: write('Drag');
|
||||
GPM_DOWN: write('Down');
|
||||
GPM_UP: write('Up');
|
||||
end;
|
||||
Writeln;
|
||||
end;
|
||||
Until (Event.Buttons and gpm_b_right)<>0;
|
||||
gpm_close;
|
||||
end.
|
Loading…
Reference in New Issue
Block a user