home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
DP Tool Club 8
/
CDASC08.ISO
/
NEWS
/
554
/
JUILLET
/
MOVE_TXT.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1993-10-07
|
3KB
|
112 lines
{─ Fido Pascal Conference ────────────────────────────────────────────── PASCAL ─
Msg : 385 of 394
From : Michael Nicolai 2:2401/411.2 02 Jul 93 13:56
To : All 3:640/523.62
Subj : FAQ: Moving text in textmode
────────────────────────────────────────────────────────────────────────────────
Hi folks...hello everybody......
In the last couple of weeks i often read something like this:
"How can i move text around the screen WITHOUT distortions??? Oh, and it
only has to work in textmode."
So, i took some minutes off and wrote a little program to illustrate how
easy this task can be. :-)
I used Turbo-Pascal 6.0 but the program can be easily adopted to any Pascal
compiler (and to different machines as the PC).
If the text moves too fast or too slow on your screen, change the
"delay(40)"-command to an appropriate value.
If you do have any questions, feel free to write.
BTW, i must tell you there are some BIG troubles according the FIDO-Net
over here in germany. So, PLEASE, don't be upset if i don't answer. Just
re-post your message again and again and.... :-)))))))))
Ok, here is the code:
-----snip-----------------------------------------------------------------}
program move_txt;
uses CRT;
const
text : string = ' Michael Nicolai ';
clear : string = ' ';
Move1 : string = 'LLLLLLLLLLLLLLLDDDDDDDD';
Move2 : string = 'RRRRRRRRRRRRRRRUUUUUUU';
Move3 : string = 'RRRUULLLLLLLLLLLDDDDDDLLLLLLL';
Move4 : string = 'DDDDDRRRRRRRRRRRRRUUUUUUUUUU';
Move5 : string = 'LLLLLLLLLLLLLLLLLUUUUUU';
Move6 : string = 'RRRRRRRRRRRRDDDDDDRRRRRRRRRRRRRR';
Move7 : string = 'RRRRRRRLLLLLLLLLLLLL';
var
x, y : byte;
margin : byte;
Move : string;
i : integer;
procedure MoveDown;
begin
if (y < 25) then
begin
gotoxy(x, (y + 1));
write(text);
gotoxy(x, y);
write(clear);
y := y + 1;
end;
end;
procedure MoveUp;
begin
if (y > 1) then
begin
gotoxy(x, (y - 1));
write(text);
gotoxy(x, y);
write(clear);
y := y - 1;
end;
end;
begin
x := 32;
y := 12;
margin := 80 - ord(text[0]);
Move := Move1 + Move2 + Move3 + Move4 + Move5 + Move6 + Move7;
clrscr;
gotoxy(x, y);
write(text);
repeat
for i := 1 to ord(Move[0]) do
begin
case Move[i] of
'L' : begin
if (x > 1) then
x := x - 1;
gotoxy(x, y);
write(text);
end;
'R' : begin
if (x < margin) then
x := x + 1;
gotoxy(x, y);
write(text);
end;
'D' : MoveDown;
'U' : MoveUp;
end;
delay(40);
end;
until keypressed;
end.