home *** CD-ROM | disk | FTP | other *** search
/ Turbo Toolbox / Turbo_Toolbox.iso / dtx9302 / pastrick / drehtest.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1993-02-23  |  2.4 KB  |  89 lines

  1. (* ****************************************************** *)
  2. (*                      DREHTEST.PAS                      *)
  3. (*              Demonstration der Unit DrehFont           *)
  4. (* ****************************************************** *)
  5. PROGRAM DrehTest;
  6.  
  7. USES Objects, Drivers, Graph, DrehFont;
  8.  
  9. CONST BgiPath = '\tp\bgi\';
  10.       PiHalb  : Real = pi / 2;
  11.  
  12.   PROCEDURE grInitVideo;
  13.   VAR
  14.     GraphMode, GraphDriver : INTEGER;
  15.     xAsp, yAsp             : WORD;
  16.   BEGIN
  17.     StartupMode := ScreenMode;
  18.     GraphDriver := Detect;
  19.     InitGraph(GraphDriver, GraphMode, BgiPath);
  20.     IF GraphResult <> grOk THEN Halt(1);
  21.     ScreenMode := GraphMode;
  22.     InitDrehen;
  23.     GetAspectRatio(xAsp, yAsp);
  24.     xyRatio := xAsp/yAsp;
  25.   END;
  26.  
  27.   PROCEDURE grDoneVideo;
  28.   BEGIN
  29.     CloseGraph;
  30.     SetVideoMode(StartupMode);
  31.   END;
  32.  
  33. VAR
  34.   Font, Radius, i  : INTEGER;
  35.   Aktwinkel, dRad  : REAL;
  36.   Punkt, Mitte     : tPoint;
  37.   Temp             : STRING;
  38.   RegZeiger        : Pointer;
  39.   f                : File;
  40.  
  41.   PROCEDURE GetPunkt(VAR Punkt : tPoint);
  42.   BEGIN
  43.     Punkt.x := Mitte.x + Round(Radius *
  44.                                Cos(AktWinkel + piHalb));
  45.     Punkt.y := Mitte.y - Round(Radius *
  46.                Sin(AktWinkel + piHalb)* xyRatio);
  47.   END;
  48.  
  49. BEGIN
  50.   Assign(f, BgiPath + 'TRIP.CHR');
  51.   Reset(f, 1);
  52.   GetMem(RegZeiger, FileSize(f));
  53.   BlockRead(f, RegZeiger^, FileSize(f));
  54.   Close(f);
  55.   Font := RegisterBGIFont(RegZeiger);
  56.   IF Font < 0 THEN RunError;
  57.   grInitVideo;
  58.   Mitte.x   := GetMaxX DIV 2;
  59.   Mitte.y   := GetMaxY DIV 2;
  60.   Radius    := Mitte.x DIV 2;
  61.   Aktwinkel := PiHalb;
  62.   SetTextJustify(LeftText, BottomText);
  63.   Temp := 'Hallo.Welt!';
  64.   SetTextStyle(Font, 0, 9);
  65.   FOR i := 1 TO Length(Temp) DO BEGIN
  66.     dRad := TextWidth(Temp[i]) / Radius;
  67.     SetDirection(AktWinkel - dRad/2);
  68.     GetPunkt(Punkt);
  69.     MoveTo(Punkt.x, Punkt.y);
  70.     SetColor(i);
  71.     OutText(Temp[i]);
  72.     AktWinkel := AktWinkel - dRad;
  73.   END;
  74.   SetTextStyle(Font + 3, 0, 7);
  75.   SetKursiv(20); SetGrad(0);
  76.   MoveTo(Mitte.x, Mitte.y);
  77.   SetTextJustify(CenterText, BottomText);
  78.   Temp := 'Schräge'; OutText(Temp);
  79.   SetColor(GetColor + 1);
  80.   SetTextStyle(Font + 2, 0, 6);
  81.   MoveRel(0, Round(TextHeight(Temp) * xyRatio));
  82.   SetGrad(200); SetKursiv(-90);
  83.   Temp := 'Typen'; OutText(Temp);
  84.   ReadLn;
  85.   grDoneVideo;
  86. END.
  87. (* ****************************************************** *)
  88. (*               Ende von DREHTEST.PAS                    *)
  89.