[comp.lang.pascal] Your Name

icsu8249@khan.cs.montana.edu (Emmett) (12/10/90)

So, has anyone else out there got a better way to do this?
For now all it does is simulate two strings of chaser lights moving away
from the center of the 'lights.'  I'd like to set this whole thing up so
that with a simple procedure call like:
 
Box(X1,Y1,X2,Y2,Clockwise);

I can create a chasing border around a window, and indicate things like:
direction of chase (clockwise,counter-clockwise,edges-to-center,etc.),
speed of chase, and possibly a set of characters for the border itself.

Sounds to me like something somebody else has probably already written, 
so before I do anything else with this, can anybody point me to what I'm
looking for?

------------------------------------------------------
program MarqueeLights;
uses crt;
var
  h,i,j,k:integer;

begin
  clrscr;
  k:=0;
  gotoxy(26,10);
  i:=1;
  repeat
     gotoxy(10,10);
     for j:=1 to 16 do
        case ((((j+k) mod 8)+1) mod 4) of
           0 : write(#176);
           1 : write(#177);
           2 : write(#178);
           3 : write(#219);
        end;

     gotoxy(26,10);
     for j:=1 to 16 do
        case (((abs(j-k) mod 8)+1) mod 4) of
           0 : write(#176);
           1 : write(#177);
           2 : write(#178);
           3 : write(#219);
        end;
     inc(k);
     Delay(100);
  until KeyPressed;
end.
--
*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
| Larry Emmett                     * 'Computers are a lot like the God of the |
* icsu8249@caesar.cs.montana.edu   |   Old Testament.  A whole lot of rules   *
| Software Consulting, Exorcisms   *    and no mercy.'  -- Joseph Campbell    |

nlarson@isis.cs.du.edu (Neil Larson) (12/13/90)

program freechase;
{   For all those netters interested in yet another drawbox proram, here it is.

    This program demonstrates a marquee type box that can be put on a screen
    and left there. Once displayed, the box takes no more processor time, so
    your program can go and do something else. I also included the ability to
    change fore and background colors but this is not tested since I have a
    mono system only. If you use other colors, they should be 0-7 in value.

    This source code was formatted by Pascal Beautifier 2.0 available from :
    Central Computer Products 330 Central Ave Fillmore CA 93015 (805)-524-4026.
    Advertisement was included as a part of the demonstration code to show a
    possible use for a marquee style box.

    This program freechase released into the public domain, Neil Larson, 1990 }

uses
   Crt;



procedure DrawDottedBox(ulx,		    { upperleftx }
			uly,		    { upperlefty }
			lrx,		    { lowerrightx }
			lry,		    { lowerrighty }
			modval : Integer    { 1 or 0 only });
{ This procedure draws a box from ulx,uly to lrx,lry that alternates between
  the light character, and a space. }

const
   LIGHT = #219;   { change this if you want another character }

var
   x,
   y : Integer;

begin
modval := modval mod 2;
for x := ulx to lrx do
   if((x + uly) mod 2 = modval) then
      begin
      GoToXY(x, uly);
      Write(LIGHT)
      end;

for y := uly + 1 to lry - 1 do
   begin
   if((ulx + y) mod 2 = modval) then
      begin
      GoToXY(ulx, y);
      Write(LIGHT)
      end;
   if((lrx + y) mod 2 = modval) then
      begin
      GoToXY(lrx, y);
      Write(LIGHT)
      end
   end;

for x := ulx to lrx do
   if((x + lry) mod 2 = modval) then
      begin
      GoToXY(x, lry);
      Write(LIGHT)
      end
end;



procedure drawmarquee(ulx,		{ upperleftx }
		      uly,		{ upperlefty }
		      lrx,		{ lowerrightx }
		      lry,		{ lowerrighty }
		      fore,		{ foreground color }
		      back : Integer	{ background color });
{ This procedure draws a box with moving marquee lights from (ulx,uly) to
  (lrx,lry). Motion of the lights is done by using the blink attribute.
  Since the motion is part of the video hardware, the processor is free to
  do other tasks, and a marquee box will persist after program termination.
  The direction of motion is an optical illusion, and therefore clockwise
  or counter clockwise. No error checking on input parameters is performed. }

var
   x,
   y : Integer;

begin
if((((2 * (lrx - ulx)) - (2 * (lry - uly)) - 4) mod 2) <> 0) then
   WriteLn('shouldnt happen, since 4 sided box has even number side units')
else
   begin
   textcolor(fore or blink);
   TextBackground(back);
   DrawDottedBox(ulx, uly, lrx, lry, 0);
   textcolor(back or blink);
   TextBackground(fore);
   DrawDottedBox(ulx, uly, lrx, lry, 1);
   textcolor(fore);
   TextBackground(back)
   end
end;



procedure printadd;
{ This procedure displays an ad for Pascal Beautifier, a program I created to
  quickly format Turbo Pascal source code into an adjustable style. It is
  placed here for demonstation of the drawmarquee procedure only. PB was
  written mostly in C, but I do still crank out quick stuff in Pascal. Besides,
  TANSTAAFL! }

begin
Window(10, 7, 78, 17);
WriteLn('Pascal Beautifier 2.0 quickly formats Turbo source code');
WriteLn('into the style you choose. Saves time and frustration');
WriteLn('by indenting, capitalization, condensing, and aligning');
WriteLn('comments. For more information or a product catalog,');
WriteLn('write or call :');
WriteLn;
HighVideo;
WriteLn('Central Computer Products');
WriteLn('330 Central Ave, Fillmore CA 93015');
WriteLn('(805) - 524 - 4026');
WriteLn;
NormVideo;
Write('                  Hit any key to exit!');
while not KeyPressed do
 ;						{ wait until a key is pressed }
Window(1, 1, 80, 25);
ClrScr
end;



begin
ClrScr;
drawmarquee(1, 1, 79, 24, lightgray, black);		  { draws marquee box }
printadd 				{ prints an add for Pascal Beautifier }
end.