[fpc-pascal] Drawing window out line

mokashe.ram mokashe.ram at gmail.com
Thu May 22 09:00:32 CEST 2014


Hi ,

Could Any One help Me  to  writing Horizontal and vertical line to message
window in Free Pascal as i MEM and MEMW function not supported in free
pascal.

note : we can not use Video and CRT Unit both in single unit. i want to use
CRT unit only.

below is the my sample code

PROCEDURE draw_window_outline(top_left_x,
                              top_left_y,
                              width,
                              height,
                              style,
                              fore,
                              back      : BYTE);

VAR
   x,y    : BYTE;
   offset : INTEGER;


BEGIN
     IF (style<>255) AND (width>2) AND (height>2) THEN
     BEGIN
          offset:=(top_left_x-1)*2
                 +(top_left_y-1)*160;
          MEM[$B800:offset]:=top_left_corner[style];
          MEM[$B800:offset+1]:=back*16+fore;
          FOR x:=1 TO (width-2) DO
          BEGIN
               MEM[$B800:offset+x*2]:=horizontal[style];
               MEM[$B800:offset+x*2+1]:=back*16+fore;
          END;
          MEM[$B800:offset+(width-1)*2]:=top_right_corner[style];
          MEM[$B800:offset+(width-1)*2+1]:=back*16+fore;
          FOR y:=1 TO (height-2) DO
          BEGIN
               MEM[$B800:offset+y*160]:=vertical[style];
               MEM[$B800:offset+y*160+1]:=back*16+fore;
               MEM[$B800:offset+(width-1)*2+y*160]:=vertical[style];
               MEM[$B800:offset+(width-1)*2+y*160+1]:=back*16+fore;
          END;
          offset:=(top_left_x-1)*2
                 +(top_left_y+height-2)*160;
          MEM[$B800:offset]:=bottom_left_corner[style];
          MEM[$B800:offset+1]:=back*16+fore;
          FOR x:=1 TO (width-2) DO
          BEGIN
               MEM[$B800:offset+x*2]:=horizontal[style];
               MEM[$B800:offset+x*2+1]:=back*16+fore;
          END;
          MEMW[$B800:offset+(width-1)*2]:=bottom_right_corner[style];
          MEM[$B800:offset+(width-1)*2+1]:=back*16+fore;
     END;
END;

Thanks, 
Sudarshan



--
View this message in context: http://free-pascal-general.1045716.n5.nabble.com/Drawing-window-out-line-tp5719322.html
Sent from the Free Pascal - General mailing list archive at Nabble.com.



More information about the fpc-pascal mailing list