mirror of
https://github.com/softdorothy/Glider4.git
synced 2024-06-01 12:41:29 +00:00
1 line
27 KiB
OpenEdge ABL
1 line
27 KiB
OpenEdge ABL
|
unit Drawing;
interface
uses
Palettes, Globals, Utilities;
procedure DrawRoomNum;
procedure PlotSICN (theRect: Rect; theSICN: SICNHand);
procedure LoadABackground (whichID: Integer);
procedure DrawAllObjects;
implementation
{=================================}
procedure DrawRoomNum;
var
tempStr: Str255;
begin
NumToString(roomAt, tempStr);
tempStr := CONCAT(thisRoom.roomName, ' [', tempStr, ']');
SetWTitle(mainWndo, tempStr);
end;
{=================================}
procedure PlotSICN;
var
state: SignedByte;
srcBits: BitMap;
begin
state := HGetState(Handle(theSICN));
HLock(Handle(theSICN));
{$PUSH}
srcBits.baseAddr := Ptr(@theSICN^^);
{$POP}
srcBits.rowBytes := 2;
SetRect(srcBits.bounds, 0, 0, 16, 16);
CopyBits(srcBits, GrafPtr(toolWndo)^.portBits, srcBits.bounds, theRect, srcCopy, nil);
HSetState(Handle(theSICN), state);
end;
{=================================}
procedure ArrangeTiles;
var
i, panel: Integer;
begin
for i := 0 to 7 do
begin
panel := thisRoom.tileOrder[i];
if (inColor) then
CopyBits(BitMapPtr(loadCPtr^.portPixMap^)^, BitMapPtr(virginCPtr^.portPixMap^)^, tileRects[panel], tileRects[i], srcCopy, nil)
else
CopyBits(offLoadMap, offVirginMap, tileRects[panel], tileRects[i], srcCopy, nil);
end;
end;
{=================================}
procedure LoadABackground;
var
refNumber: Integer;
tempByte: SignedByte;
thePict: PicHandle;
begin
if (inColor) then
SetPort(GrafPtr(loadCPtr))
else
SetPort(offLoadPort);
refNumber := OpenResFile(resourceName);
if (refNumber = -1) then
begin
CloseResFile(refNumber);
UseResFile(editorResNum);
GenericAlert(kErrGraphicsNotFound);
Exit(LoadABackground);
end;
thePict := GetPicture(whichID);
if (thePict <> nil) then
begin
tempByte := HGetState(Handle(thePict));
HLock(Handle(thePict));
DrawPicture(thePict, wholeArea);
HSetState(Handle(thePict), tempByte);
end
else
begin
case whichID of {try to substitute}
205:
thePict := GetPicture(201);
206:
thePict := GetPicture(204);
207:
thePict := GetPicture(200);
208:
thePict := GetPicture(203);
209:
thePict := GetPicture(200);
otherwise
begin
GenericAlert(kErrGraphicLoad);
Exit(LoadABackground);
end;
end;
if (thePict <> nil) then
begin
tempByte := HGetState(Handle(thePict));
HLock(Handle(thePict));
DrawPicture(thePict, wholeArea);
HSetState(Handle(thePict), tempByte);
end
else
begin
GenericAlert(kErrGraphicLoad);
Exit(LoadABackground);
end;
GenericAlert(kErrGraphicLoad);
end;
ReleaseResource(Handle(thePict));
CloseResFile(refNumber);
UseResFile(editorResNum);
if (toolWndo <> nil) then
SetPort(toolWndo);
ArrangeTiles;
if (inColor) then
begin
CopyBits(BitMapPtr(virginCPtr^.portPixMap^)^, BitMapPtr(loadCPtr^.portPixMap^)^, wholeArea, wholeArea, srcCopy, nil);
CopyBits(BitMapPtr(virginCPtr^.portPixMap^)^, GrafPtr(mainWndo)^.portBits, wholeArea, wholeArea, srcCopy, GrafPtr(mainWndo)^.visRgn)
end
else
begin
CopyBits(offVirginMap, offLoadMap, wholeArea, wholeArea, srcCopy, nil);
CopyBits(offVirginMap, mainWndo^.portBits, wholeArea, wholeArea, srcCopy, mainWndo^.visRgn);
end;
end;
{=================================}
procedure FillNFrame (theColor: RGBColor; theRect: Rect);
begin
RGBForeColor(theColor);
PaintRect(theRect);
RGBForeColor(rgbBlack);
FrameRect(theRect);
end;
{=================================}
procedure GrayNFrame (theRect: Rect);
begin
FillRect(theRect, gray);
FrameRect(theRect);
end;
{=================================}
procedure HiLiteARect (theColor: RGBColor; theRect: Rect);
begin
RGBForeColor(theColor);
MoveTo(theRect.left + 1, theRect.top + 1);
LineTo(theRect.right - 2, theRect.top + 1);
LineTo(theRect.right - 2, theRect.bottom - 2);
RGBForeColor(rgbBlack);
end;
{=================================}
procedure GrayLiteARect (theRect: Rect);
begin
PenPat(white);
MoveTo(theRect.left
|