GliderPRO/Sources/DebugUtilities.c

1 line
7.0 KiB
C
Raw Normal View History

/*============================================================*/ /*============================================================*/ /*== ==*/ /*== Debugging Utility Routines ==*/ /*== ==*/ /*============================================================*/ /*============================================================*/ #include <NumberFormatting.h> #include "Externs.h" short barGraphHori = 0; //============================================================== Functions //-------------------------------------------------------------- MonitorWait void MonitorWait (void) { GrafPtr wasPort, tempPort; Rect tempRect; GetPort(&wasPort); tempPort = (GrafPtr)NewPtrClear(sizeof(GrafPort)); OpenPort(tempPort); SetRect(&tempRect, 8, 28, 16, 36); InvertRect(&tempRect); ClosePort(tempPort); SetPort((GrafPtr)wasPort); } //-------------------------------------------------------------- DisplayRect void DisplayRect (Rect *theRect) { GrafPtr wasPort, tempPort; GetPort(&wasPort); tempPort = (GrafPtr)NewPtrClear(sizeof(GrafPort)); OpenPort(tempPort); InvertRect(theRect); ClosePort(tempPort); SetPort((GrafPtr)wasPort); } //-------------------------------------------------------------- FlashRect void FlashRect (Rect *theRect) { GrafPtr wasPort, tempPort; GetPort(&wasPort); tempPort = (GrafPtr)NewPtrClear(sizeof(GrafPort)); OpenPort(tempPort); InvertRect(theRect); InvertRect(theRect); InvertRect(theRect); InvertRect(theRect); ClosePort(tempPort); SetPort((GrafPtr)wasPort); } //-------------------------------------------------------------- CheckLegitRect void CheckLegitRect(Rect *srcRect, Rect *inRect) { Rect dummyRect; if ((srcRect->left > srcRect->right) || (srcRect->top > srcRect->bottom)) DebugStr("\pSource Rectangle not dimensional"); if (!SectRect(srcRect, inRect, &dummyRect)) DebugStr("\pSource Rectangle not Secting Target Rectangle"); } /*============================================================== DisplayLong */ void DisplayLong (long theValue) { GrafPtr wasPort, tempPort; Str255 tempStr; Rect tempRect; GetPort(&wasPort); tempPort = (GrafPtr)NewPtrClear(sizeof(GrafPort)); OpenPort(tempPort); NumToString(theValue, tempStr); MoveTo(20,40); SetRect(&tempRect, 18, 20, 122, 42); EraseRect(&tempRect); DrawString(tempStr); while (Button()) { } while (!Button()) { } ClosePort(tempPort); SetPort((GrafPtr)wasPort); } /*============================================================== DisplayShort */ void DisplayShort(short theValue) { GrafPtr wasPort, tempPort; Str255 tempStr; Rect tempRect; GetPort(&wasPort); tempPort = (GrafPtr)NewPtrClear(sizeof(GrafPort)); OpenPort(tempPort); NumToString((long)theValue, tempStr); MoveTo(20,40); SetRect(&tempRect, 18, 20, 122, 42); EraseRect(&tempRect); DrawString(tempStr); while (Button()) { } while (!Button()) { } ClosePort(tempPort); SetPort((GrafPtr)wasPort); } /*============================================================== FlashLong */ void FlashLong(long theValue) { GrafPtr wasPort, tempPort; Str255 tempStr; Rect tempRect; GetPort(&wasPort); tempPort = (GrafPtr)NewPtrClear(sizeof(GrafPort)); OpenPort(tempPort); NumToString(theValue, tempStr); MoveTo(20,40); SetRect(&tempRect, 18, 20, 122, 42); EraseRect(&tempRect); DrawString(tempStr); ClosePort(tempPort); SetPort((GrafPtr)wasPort); } /*============================================================== FlashShort */ void FlashShort (short theValue) { GrafPtr wasPort, tempPort; Str255 tempStr; Rect tempRect; GetPort(&wasPort); tempPort = (GrafPtr)NewPtrClear(sizeof(GrafPort)); OpenPort(tempPort); NumToString((long)theValue, tempStr); MoveTo(20,40); SetRect(&tempRect, 18, 20, 122, 42); EraseRect(&tempRect); DrawString(tempStr); ClosePort(tempPort); SetPort((GrafPtr)wasPort); } /*============================================================== DoBarGraph */ void DoBarGraph (short theValue, short