[fpc-pascal]The Video unit

Sergey Ulanov sulanov at euro.ru
Sat Jan 13 16:39:52 CET 2001


I want to draw box on the screen. Why does following code work well on
linux console, but does not work in xterm ?

{$mode objfpc}
uses
  video;

procedure DrawChar(x,y:integer;c:char);
begin
  VideoBuf^[x+y*ScreenWidth] := $0700 + byte(c);
end;

procedure DrawBox(x,y,w,h:integer);
var
  i,j:integer;
begin
    DrawChar(x,y,#130);
    DrawChar(x+w-1,y,#131);
    DrawChar(x,y+h-1,#132);
    DrawChar(x+w-1,y+h-1,#133);
    for i:=1 to w-2 do begin
      DrawChar(x+i,y,#128);
      DrawChar(x+i,y+h-1,#128);
    end;
    for i:=1 to h-2 do begin  
      DrawChar(x,y+i,#129);
      DrawChar(x+w-1,y+i,#129);
    end;
end;


begin
  InitVideo;
  
  DrawBox(5,5,20,10);    
  UpdateScreen(true);
  
  readln;
  DoneVideo;
end.






More information about the fpc-pascal mailing list