home *** CD-ROM | disk | FTP | other *** search
/ gondwana.ecr.mu.oz.au/pub/ / Graphics.tar / Graphics / VOGLE.ZIP / VOGLE / EXAMPLES / PJTEXT.P < prev    next >
Text File  |  2000-02-11  |  3KB  |  209 lines

  1. program pjtext;
  2.  
  3.  
  4. #include "Vogle.h"
  5.  
  6. var
  7.         dev: string_t;
  8.     dum: integer;
  9.  
  10. procedure drawstuff;
  11. begin
  12.     Color(BLACK);
  13.     PolyFill(true);    (* So rect clears a bit for us *)
  14.     Rect(0.1, 0.1, 0.9, 0.9);
  15.     Color(WHITE);
  16.     Move2(0.1, 0.5);
  17.     Draw2(0.9, 0.5);
  18.     Move2(0.5, 0.1);
  19.     Draw2(0.5, 0.9);
  20.  
  21.     Color(GREEN);
  22.     Move2(0.5, 0.5);
  23.     LeftJustify();
  24.     DrawStr('This is Left Justified text');
  25.  
  26.     dum := GetKey();
  27.  
  28.     Color(BLACK);
  29.     Rect(0.1, 0.1, 0.9, 0.9);
  30.     Color(WHITE);
  31.     Move2(0.1, 0.5);
  32.     Draw2(0.9, 0.5);
  33.     Move2(0.5, 0.1);
  34.     Draw2(0.5, 0.9);
  35.  
  36.     Color(YELLOW);
  37.     Move2(0.5, 0.5);
  38.     CenterText(true);
  39.     DrawStr('This is Centered text');
  40.     CenterText(false);
  41.  
  42.     dum := GetKey();
  43.  
  44.     Color(BLACK);
  45.     Rect(0.1, 0.1, 0.9, 0.9);
  46.     Color(WHITE);
  47.     Move2(0.1, 0.5);
  48.     Draw2(0.9, 0.5);
  49.     Move2(0.5, 0.1);
  50.     Draw2(0.5, 0.9);
  51.  
  52.     Color(MAGENTA);
  53.     Move2(0.5, 0.5);
  54.     RightJustify();
  55.     DrawStr('This is Right Justified text');
  56.     TextJustify(0);
  57.  
  58.     dum := GetKey()
  59. end;
  60.  
  61. procedure drawstuff2(ang : real);
  62. begin
  63.      Color(BLACK);
  64.     Rect(0.1, 0.1, 0.9, 0.9);
  65.     Color(WHITE);
  66.     Move2(0.1, 0.5);
  67.     Draw2(0.9, 0.5);
  68.     Move2(0.5, 0.1);
  69.     Draw2(0.5, 0.9);
  70.  
  71.     TextAng(ang);
  72.  
  73.     Color(GREEN);
  74.     Move2(0.5, 0.5);
  75.     LeftJustify();
  76.     DrawChar('B');
  77.  
  78.     TextAng(0.0);
  79.     TextJustify(0);
  80.     BoxText(0.1, 0.1, 0.4, 0.02, 'The ''B'' should be leftjustified');
  81.     
  82.     dum := GetKey();
  83.  
  84.     Color(BLACK);
  85.     Rect(0.1, 0.1, 0.9, 0.9);
  86.     Color(WHITE);
  87.     Move2(0.1, 0.5);
  88.     Draw2(0.9, 0.5);
  89.     Move2(0.5, 0.1);
  90.     Draw2(0.5, 0.9);
  91.  
  92.     TextAng(ang);
  93.     Color(YELLOW);
  94.     Move2(0.5, 0.5);
  95.     CenterText(true);
  96.     DrawChar('B');
  97.     CenterText(false);
  98.  
  99.     TextAng(0.0);
  100.     TextJustify(0);
  101.     BoxText(0.1, 0.1, 0.4, 0.02, 'The ''B'' should be centered');
  102.  
  103.     dum := GetKey();
  104.  
  105.     Color(BLACK);
  106.     Rect(0.1, 0.1, 0.9, 0.9);
  107.     Color(WHITE);
  108.     Move2(0.1, 0.5);
  109.     Draw2(0.9, 0.5);
  110.     Move2(0.5, 0.1);
  111.     Draw2(0.5, 0.9);
  112.  
  113.     TextAng(ang);
  114.     Color(MAGENTA);
  115.     Move2(0.5, 0.5);
  116.     RightJustify();
  117.     DrawChar('B');
  118.  
  119.     TextAng(0.0);
  120.     TextJustify(0);
  121.     BoxText(0.1, 0.1, 0.4, 0.02, 'The ''B'' should be rightjustified');
  122.  
  123.     dum := GetKey();
  124.  
  125.     Color(BLACK);
  126.     Rect(0.1, 0.1, 0.9, 0.9);
  127.     Color(WHITE);
  128.     Move2(0.1, 0.5);
  129.     Draw2(0.9, 0.5);
  130.     Move2(0.5, 0.1);
  131.     Draw2(0.5, 0.9);
  132.  
  133.     TextAng(ang);
  134.     Color(MAGENTA);
  135.     Move2(0.5, 0.5);
  136.     TopJustify();
  137.     DrawChar('B');
  138.  
  139.     TextAng(0.0);
  140.     TextJustify(0);
  141.     BoxText(0.1, 0.1, 0.4, 0.02, 'The ''B'' should be topjustified');
  142.  
  143.     dum := GetKey();
  144.  
  145.     Color(BLACK);
  146.     Rect(0.1, 0.1, 0.9, 0.9);
  147.     Color(WHITE);
  148.     Move2(0.1, 0.5);
  149.     Draw2(0.9, 0.5);
  150.     Move2(0.5, 0.1);
  151.     Draw2(0.5, 0.9);
  152.  
  153.     TextAng(ang);
  154.     Color(MAGENTA);
  155.     Move2(0.5, 0.5);
  156.     TopJustify();
  157.     RightJustify();
  158.     DrawChar('B');
  159.  
  160.     TextAng(0.0);
  161.     TextJustify(0);
  162.     BoxText(0.1, 0.1, 0.4, 0.02, 'The ''B'' should be right/topjustified');
  163.  
  164.     TextJustify(0);
  165.  
  166.     dum := GetKey()
  167. end;
  168.  
  169. begin
  170.     write('Enter device: ');
  171.     readln(dev);
  172.     Vinit(dev);
  173.  
  174.     TextSize(0.03, 0.04);
  175.  
  176.     Ortho2(0.0, 1.0, 0.0, 1.0);
  177.  
  178.     Color(RED);
  179.     Clear();
  180.  
  181.     drawstuff();
  182.  
  183.     (* Now do it all with the text rotated .... *)
  184.  
  185.     TextAng(45.0);
  186.     drawstuff();
  187.  
  188.     TextAng(160.0);
  189.     drawstuff();
  190.  
  191.     TextAng(270.0);
  192.     drawstuff();
  193.  
  194.     (* Now with a single character *)
  195.  
  196.     TextJustify(0);
  197.  
  198.     drawstuff2(0.0);
  199.  
  200.     drawstuff2(90.0);
  201.  
  202.     drawstuff2(160.0);
  203.  
  204.     drawstuff2(270.0);
  205.  
  206.     Vexit()
  207.  
  208. end.
  209.