graphic mouse
Having a mouse in the graphic mode under DOS was quite an achievement then.
Using the mouse
PROGRAM Graftest;
USES Graph,OPCrt,OPString,GInit,..,LMouse;
VAR tw:WORD;
ok:BOOLEAN;
MStat :WORD;
BStat :INTEGER;
NrOfButtons :WORD;
xm,ym :INTEGER;
BEGIN
Switchtograf;
InitMouse(MStat,NrOfButtons);
SetCursorPos(320,240);
DefineGraphicCursor(CrossCursor);
SetGraphicCursor(GCursor);
SetMickeysPerPixel(7,7);
MouseLow.ShowCursor;
...
REPEAT
GetPosBut(BStat,xm,ym);
IF (BStat<>0) THEN
BEGIN
M.LeftClick(xm,ym,ok,tw);
...
END;
UNTIL (BStat=4)or keypressed;
Switchtotext;
END.
intializing the graphic
{
GInit - initializes the graphic
Created : ..
Last Update : ..
Is updated version of : ..
}
{.$D-,L-}
UNIT GInit;
INTERFACE
TYPE BGIInitAs=(bgiDrv,bgiFnt,bgiDrvFnt);
PROCEDURE Error(s:STRING);
PROCEDURE Frame(x1,y1,x2,y2:INTEGER;Color:BYTE);
PROCEDURE SwitchToGraf(B:BGIInitAs);
PROCEDURE SwitchToText;
VAR
ScrMaxX,ScrMaxY:INTEGER; { resolution in graphic - set here at init }
IMPLEMENTATION
USES Graph,BGIDriv,BGIFont,BGIFont2,opcrt;
{----------------------------------------------------------------}
PROCEDURE Frame(x1,y1,x2,y2:INTEGER;Color:BYTE);
BEGIN
SetColor(color);
Line(x1,y1,x2,y1);
Line(x2,y1,x2,y2);
Line(x2,y2,x1,y2);
Line(x1,y2,x1,y1);
END;
{----------------------------------------------------------------}
PROCEDURE Error(s:STRING);
BEGIN
SetColor(15);
OutTextXY(0,470,s);
REPEAT UNTIL KeyPressed;
Halt;
END;
{----------------------------------------------------------------}
PROCEDURE SwitchToGraf(B:BGIInitAs);
VAR GraphDriver,GraphMode,ge:INTEGER;
VESA16 : Integer; { Driver number of 16 color driver }
type
VgaInfoBlock = record
VESASignature: array[0..3] of Byte;
VESAVersion: Word;
OEMStringPtr: Pointer;
Capabilities: array[0..3] of Byte;
VideoModePtr: Pointer;
end;