home *** CD-ROM | disk | FTP | other *** search
- /**************************************
- * displaying information on the screen
- * and updating it.
- **************************************/
- #include "SAT.h"
- #include "myPlatform.h"
-
- extern SpritePtr playerSp;
-
- #ifndef abs
- #define abs(x) (x>0?x:-x)
- #endif
-
-
- Str255 *aActionMsg[10];
- short lastActMsg = -1;
-
- void InitInformationArea(void)
- {
- StringHandle sh;
- short i=0;
- Rect r;
- SATPort tmpPort;
-
- do
- {
- sh = GetString(128+i);
- if (sh)
- aActionMsg[i] = (Str255*) sh[0];
- i++;
- }
- while ((i<ActionMsgNumber)&&(sh));
-
- SATGetPort(&tmpPort);
- DrawProgInfo(playerSp);
- SetRect(&r,0,0,gSAT.offSizeH,gSAT.offSizeV);
- SATBackChanged(&r); /*Let SAT show it on screen*/
- SATSetPort(&tmpPort);
- } //InitInformationArea
-
- void DrawProgInfo(SpritePtr me)
- {
- Str255 s;
- Rect r;
-
- SetPort(gSAT.backScreen.port);
- BackColor(blackColor);
-
- SetRect(&r, 0, 0, gSAT.bounds.right, 18);
-
- ForeColor(blueColor);
- EraseRect(&r);
- PenNormal();
-
- FrameRect(&r);
- SetRect(&r, 0, 0, gSAT.offSizeH, gSAT.offSizeV);
- FrameRect(&r);
-
- ForeColor(redColor);
- MoveTo(10, 13);
- DrawString("\pThis is a Demo for Scrolling and Platform Game.(made by Nissan Zafrir 1995)");
-
- SetRect(&r, 1, 350, gSAT.offSizeH-150, 366);
- EraseRect(&r);
- ForeColor(yellowColor);
-
- MoveTo(10, 362);
- DrawString("\pSpeed.V = ");
-
- /*** Displaying SpeedV info ***\
- NumToString(me->speed.v, s);
- MoveTo(100, 362);
- DrawString("\pSpeed.V = ");
- MoveTo(170, 362);
- DrawString(s);
- *******************************/
- MoveTo(110,362);
- DrawString("\pAction = ");
-
- MoveTo(700,362);
- DrawString("\pH = ");
-
- /*** Displaying PositionV info ***\
- MoveTo(350,362);
- DrawString("\pV = ");
- MoveTo(370,362);
- NumToString(me->position.v, s);
- DrawString(s);
- **********************************/
- ForeColor(blackColor);
- BackColor(whiteColor);
- } //DrawProgInfo
-
- void UpdateInfo(PlSpritePtr me)
- {
- Str255 s;
- StringHandle sh;
- Rect r;
-
- BackColor(blackColor);
- ForeColor(yellowColor);
-
- SetRect(&r, 80, 350, 110, 366);
- EraseRect(&r);
- NumToString(me->speed.v, s);
- MoveTo(80, 362);
- DrawString(s);
-
- if (me->action != lastActMsg) {
- SetRect(&r, 165, 350, 310, 366);
- EraseRect(&r);
- MoveTo(165,362);
- DrawString(*aActionMsg[ lastActMsg=me->action ]);
- }
- SetRect(&r, 720, 350, 750, 366);
- EraseRect(&r);
- MoveTo(720,362);
- NumToString(me->position.h, s);
- DrawString(s);
-
- ForeColor(blackColor);
- BackColor(whiteColor);
- } //UpdateInfo
-
- void DrawProgrammerInfo(void)
- {
- Str255 s;
- Rect r;
- SATPort tmpPort;
-
- SATGetPort(&tmpPort);
- SATSetPortScreen();
- UpdateInfo((void *)playerSp);
- SATSetPort(&tmpPort);
- } //DrawProgrammerInfo
-